ReactOS 0.4.15-dev-7958-gcd0bb1a
machxbox.c File Reference
#include <freeldr.h>
#include <drivers/xbox/superio.h>
#include <debug.h>
Include dependency graph for machxbox.c:

Go to the source code of this file.

Macros

#define MAX_XBOX_COM_PORTS   2
 

Functions

 DBG_DEFAULT_CHANNEL (HWDETECT)
 
BOOLEAN XboxFindPciBios (PPCI_REGISTRY_INFO BusData)
 
VOID DetectSerialPointerPeripheral (PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
 
static ULONG XboxGetSerialPort (ULONG Index, PULONG Irq)
 
VOID DetectSerialPorts (_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA BusKey, _In_ GET_SERIAL_PORT MachGetSerialPort, _In_ ULONG Count)
 
VOID XboxGetExtendedBIOSData (PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
 
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData (UCHAR DriveNumber, ULONG *pSize)
 
static VOID DetectDisplayController (PCONFIGURATION_COMPONENT_DATA BusKey)
 
static VOID DetectIsaBios (_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA SystemKey, _Out_ ULONG *BusNumber)
 
static UCHAR XboxGetFloppyCount (VOID)
 
PCONFIGURATION_COMPONENT_DATA XboxHwDetect (_In_opt_ PCSTR Options)
 
VOID XboxHwIdle (VOID)
 
VOID MachInit (const char *CmdLine)
 
VOID XboxPrepareForReactOS (VOID)
 

Variables

PVOID FrameBuffer
 
ULONG FrameBufferSize
 

Macro Definition Documentation

◆ MAX_XBOX_COM_PORTS

#define MAX_XBOX_COM_PORTS   2

Definition at line 25 of file machxbox.c.

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectDisplayController()

static VOID DetectDisplayController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 162 of file machxbox.c.

163{
164 PCONFIGURATION_COMPONENT_DATA ControllerKey;
165 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
166 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
167 ULONG Size;
168
169 if (FrameBufferSize == 0)
170 return;
171
173 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
174 if (PartialResourceList == NULL)
175 {
176 ERR("Failed to allocate resource descriptor\n");
177 return;
178 }
179
180 /* Initialize resource descriptor */
181 RtlZeroMemory(PartialResourceList, Size);
182 PartialResourceList->Version = 1;
183 PartialResourceList->Revision = 1;
184 PartialResourceList->Count = 1;
185
186 /* Set Memory */
187 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
188 PartialDescriptor->Type = CmResourceTypeMemory;
190 PartialDescriptor->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
191 PartialDescriptor->u.Memory.Start.LowPart = (ULONG_PTR)FrameBuffer & 0x0FFFFFFF;
192 PartialDescriptor->u.Memory.Length = FrameBufferSize;
193
198 0,
199 0xFFFFFFFF,
200 "NV2A Framebuffer",
201 PartialResourceList,
202 Size,
203 &ControllerKey);
204}
VOID FldrCreateComponentKey(_In_ PCONFIGURATION_COMPONENT_DATA SystemNode, _In_ CONFIGURATION_CLASS Class, _In_ CONFIGURATION_TYPE Type, _In_ IDENTIFIER_FLAG Flags, _In_ ULONG Key, _In_ ULONG Affinity, _In_ PCSTR IdentifierString, _In_ PCM_PARTIAL_RESOURCE_LIST ResourceList, _In_ ULONG Size, _Out_ PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:198
#define ERR(fmt,...)
Definition: debug.h:110
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:174
#define NULL
Definition: types.h:112
#define ULONG_PTR
Definition: config.h:101
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
ULONG FrameBufferSize
Definition: xboxvideo.c:29
PVOID FrameBuffer
Definition: xboxvideo.c:28
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
@ ControllerClass
Definition: arc.h:94
@ DisplayController
Definition: arc.h:123
@ ConsoleOut
Definition: arc.h:83
@ Output
Definition: arc.h:85
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393 u
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393::@398 Memory
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
uint32_t ULONG
Definition: typedefs.h:59
#define TAG_HW_RESOURCE_LIST
Definition: uefidisk.c:15
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
@ CmResourceShareDeviceExclusive
Definition: cmtypes.h:241

Referenced by DetectIsaBios().

◆ DetectIsaBios()

static VOID DetectIsaBios ( _In_opt_ PCSTR  Options,
_Inout_ PCONFIGURATION_COMPONENT_DATA  SystemKey,
_Out_ ULONG BusNumber 
)
static

Definition at line 208 of file machxbox.c.

212{
213 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
215 ULONG Size;
216
217 /* Set 'Configuration Data' value */
220 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
221 if (PartialResourceList == NULL)
222 {
223 ERR("Failed to allocate resource descriptor\n");
224 return;
225 }
226
227 /* Initialize resource descriptor */
228 RtlZeroMemory(PartialResourceList, Size);
229 PartialResourceList->Version = 1;
230 PartialResourceList->Revision = 1;
231 PartialResourceList->Count = 0;
232
233 /* Create new bus key */
234 FldrCreateComponentKey(SystemKey,
237 0,
238 0,
239 0xFFFFFFFF,
240 "ISA",
241 PartialResourceList,
242 Size,
243 &BusKey);
244
245 /* Increment bus number */
246 (*BusNumber)++;
247
248 /* Detect ISA/BIOS devices */
249 DetectBiosDisks(SystemKey, BusKey);
252
253 /* FIXME: Detect more ISA devices */
254}
#define MAX_XBOX_COM_PORTS
Definition: machxbox.c:25
static ULONG XboxGetSerialPort(ULONG Index, PULONG Irq)
Definition: machxbox.c:48
VOID DetectSerialPorts(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA BusKey, _In_ GET_SERIAL_PORT MachGetSerialPort, _In_ ULONG Count)
Definition: machpc.c:782
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machxbox.c:162
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pchw.c:344
@ AdapterClass
Definition: arc.h:93
@ MultiFunctionAdapter
Definition: arc.h:116
_In_ PWDFDEVICE_INIT _In_ PWDF_REMOVE_LOCK_OPTIONS Options
Definition: wdfdevice.h:3534

Referenced by XboxHwDetect().

◆ DetectSerialPointerPeripheral()

VOID DetectSerialPointerPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey,
PUCHAR  Base 
)

◆ DetectSerialPorts()

VOID DetectSerialPorts ( _In_opt_ PCSTR  Options,
_Inout_ PCONFIGURATION_COMPONENT_DATA  BusKey,
_In_ GET_SERIAL_PORT  MachGetSerialPort,
_In_ ULONG  Count 
)

Definition at line 782 of file machpc.c.

787{
788 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
789 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
790 PCM_SERIAL_DEVICE_DATA SerialDeviceData;
791 ULONG Irq;
792 ULONG Base;
793 CHAR Identifier[80];
794 ULONG ControllerNumber = 0;
795 PCONFIGURATION_COMPONENT_DATA ControllerKey;
796 ULONG i;
797 ULONG Size;
798 ULONG PortBitmap;
799
800 TRACE("DetectSerialPorts()\n");
801
803
804 for (i = 0; i < Count; i++)
805 {
806 Base = MachGetSerialPort(i, &Irq);
807 if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
808 continue;
809
810 TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
811
812 /* Set 'Identifier' value */
813 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%ld", i + 1);
814
815 /* Build full device descriptor */
818 sizeof(CM_SERIAL_DEVICE_DATA);
819 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
820 if (PartialResourceList == NULL)
821 {
822 ERR("Failed to allocate resource descriptor! Ignoring remaining serial ports. (i = %lu, Count = %lu)\n",
823 i, Count);
824 break;
825 }
826
827 /* Initialize resource descriptor */
828 RtlZeroMemory(PartialResourceList, Size);
829 PartialResourceList->Version = 1;
830 PartialResourceList->Revision = 1;
831 PartialResourceList->Count = 3;
832
833 /* Set IO Port */
834 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
835 PartialDescriptor->Type = CmResourceTypePort;
837 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
838 PartialDescriptor->u.Port.Start.LowPart = Base;
839 PartialDescriptor->u.Port.Start.HighPart = 0x0;
840 PartialDescriptor->u.Port.Length = 8;
841
842 /* Set Interrupt */
843 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
844 PartialDescriptor->Type = CmResourceTypeInterrupt;
846 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
847 PartialDescriptor->u.Interrupt.Level = Irq;
848 PartialDescriptor->u.Interrupt.Vector = Irq;
849 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
850
851 /* Set serial data (device specific) */
852 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
853 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
855 PartialDescriptor->Flags = 0;
856 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
857
858 SerialDeviceData =
859 (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
860 SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
861
862 /* Create controller key */
867 ControllerNumber,
868 0xFFFFFFFF,
870 PartialResourceList,
871 Size,
872 &ControllerKey);
873
874 if (!(PortBitmap & (1 << i)) && !Rs232PortInUse(UlongToPtr(Base)))
875 {
876 /* Detect serial mouse */
878 }
879
880 ControllerNumber++;
881 }
882}
@ Identifier
Definition: asmpp.cpp:95
BOOLEAN Rs232PortInUse(PUCHAR Base)
Definition: rs232.c:140
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:224
#define UlongToPtr(u)
Definition: config.h:106
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
static ULONG GetSerialMouseDetectionBitmap(_In_opt_ PCSTR Options)
Definition: machpc.c:742
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:558
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2439
int Count
Definition: noreturn.cpp:7
NTSTRSAFEVAPI RtlStringCbPrintfA(_Out_writes_bytes_(cbDest) _Always_(_Post_z_) NTSTRSAFE_PSTR pszDest, _In_ size_t cbDest, _In_ _Printf_format_string_ NTSTRSAFE_PCSTR pszFormat,...)
Definition: ntstrsafe.h:1148
@ SerialController
Definition: arc.h:121
@ ConsoleIn
Definition: arc.h:82
@ Input
Definition: arc.h:84
#define TRACE(s)
Definition: solgame.cpp:4
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393::@396 Interrupt
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393::@402 DeviceSpecificData
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@393::@395 Port
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
struct _CM_SERIAL_DEVICE_DATA CM_SERIAL_DEVICE_DATA
@ CmResourceShareUndetermined
Definition: cmtypes.h:240
char CHAR
Definition: xmlstorage.h:175

Referenced by DetectIsaBios().

◆ MachInit()

VOID MachInit ( const char CmdLine)

Definition at line 304 of file machxbox.c.

305{
306 PCI_TYPE1_CFG_BITS PciCfg1;
307 ULONG PciId;
308
309 /* Check for Xbox by identifying device at PCI 0:0:0, if it's
310 * 0x10DE/0x02A5 then we're running on an Xbox */
311
312 /* Select Host to PCI bridge */
313 PciCfg1.u.bits.Enable = 1;
314 PciCfg1.u.bits.BusNumber = 0;
315 PciCfg1.u.bits.DeviceNumber = 0;
316 PciCfg1.u.bits.FunctionNumber = 0;
317 /* Select register VendorID & DeviceID */
318 PciCfg1.u.bits.RegisterNumber = 0x00;
319 PciCfg1.u.bits.Reserved = 0;
320
323 if (PciId != 0x02A510DE)
324 {
325 ERR("This is not an original Xbox!\n");
326
327 /* Disable and halt the CPU */
328 _disable();
329 __halt();
330
331 while (TRUE)
332 NOTHING;
333 }
334
335 /* Set LEDs to red before anything is initialized */
336 XboxSetLED("rrrr");
337
338 /* Setup vtbl */
368
369 /* Initialize our stuff */
370 XboxMemInit();
372
373 /* Set LEDs to orange after init */
374 XboxSetLED("oooo");
375
377}
MACHVTBL MachVtbl
Definition: arcemul.c:21
#define PCI_TYPE1_DATA_PORT
Definition: hardware.h:34
#define PCI_TYPE1_ADDRESS_PORT
Definition: hardware.h:33
#define TRUE
Definition: types.h:120
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
Definition: portio.c:70
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:473
#define NOTHING
Definition: input_list.c:10
void __cdecl _disable(void)
Definition: intrin_arm.h:365
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714
VOID XboxGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machxbox.c:83
VOID XboxHwIdle(VOID)
Definition: machxbox.c:295
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(_In_opt_ PCSTR Options)
Definition: machxbox.c:273
static UCHAR XboxGetFloppyCount(VOID)
Definition: machxbox.c:258
VOID XboxPrepareForReactOS(VOID)
Definition: machxbox.c:380
VOID PcBeep(VOID)
Definition: pcbeep.c:34
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
union _PCI_TYPE1_CFG_BITS::@163 u
struct _PCI_TYPE1_CFG_BITS::@163::@164 bits
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
int(* ConsGetCh)(VOID)
Definition: machine.h:43
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
VOID(* Beep)(VOID)
Definition: machine.h:58
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID(* VideoSync)(VOID)
Definition: machine.h:57
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(_In_opt_ PCSTR Options)
Definition: machine.h:77
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
uint32_t * PULONG
Definition: typedefs.h:59
BOOLEAN XboxConsKbHit(VOID)
Definition: xboxcons.c:69
VOID XboxConsPutChar(int c)
Definition: xboxcons.c:26
int XboxConsGetCh(void)
Definition: xboxcons.c:76
BOOLEAN XboxDiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: xboxdisk.c:84
ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: xboxdisk.c:122
BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: xboxdisk.c:103
void XboxSetLED(PCSTR pattern)
Definition: xboxi2c.c:198
PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: xboxmem.c:228
VOID XboxMemInit(VOID)
Definition: xboxmem.c:117
TIMEINFO * XboxGetTime(VOID)
Definition: xboxrtc.c:40
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: xboxvideo.c:303
VOID XboxVideoInit(VOID)
Definition: xboxvideo.c:196
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:136
VOID XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: xboxvideo.c:263
VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: xboxvideo.c:297
VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: xboxvideo.c:275
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:243
ULONG XboxVideoGetBufferSize(VOID)
Definition: xboxvideo.c:251
VOID XboxVideoSync(VOID)
Definition: xboxvideo.c:309
VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
Definition: xboxvideo.c:236
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:269
BOOLEAN XboxVideoIsPaletteFixed(VOID)
Definition: xboxvideo.c:291
VOID XboxVideoClearScreen(UCHAR Attr)
Definition: xboxvideo.c:126
VOID XboxVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: xboxvideo.c:257

◆ XboxFindPciBios()

BOOLEAN XboxFindPciBios ( PPCI_REGISTRY_INFO  BusData)

Definition at line 31 of file machxbox.c.

32{
33 /* We emulate PCI BIOS here, there are 2 known working PCI buses on an original Xbox */
34
35 BusData->NoBuses = 2;
36 BusData->MajorRevision = 1;
37 BusData->MinorRevision = 0;
38 BusData->HardwareMechanism = 1;
39 return TRUE;
40}
UCHAR MajorRevision
Definition: pci.h:107
UCHAR NoBuses
Definition: pci.h:109
UCHAR HardwareMechanism
Definition: pci.h:110
UCHAR MinorRevision
Definition: pci.h:108

Referenced by XboxHwDetect().

◆ XboxGetExtendedBIOSData()

VOID XboxGetExtendedBIOSData ( PULONG  ExtendedBIOSDataArea,
PULONG  ExtendedBIOSDataSize 
)

Definition at line 83 of file machxbox.c.

84{
85 TRACE("XboxGetExtendedBIOSData(): UNIMPLEMENTED\n");
88}
#define ExtendedBIOSDataArea
Definition: winldr.c:346
#define ExtendedBIOSDataSize
Definition: winldr.c:347

Referenced by MachInit().

◆ XboxGetFloppyCount()

static UCHAR XboxGetFloppyCount ( VOID  )
static

Definition at line 258 of file machxbox.c.

259{
260 /* On a PC we use CMOS/RTC I/O ports 0x70 and 0x71 to detect floppies.
261 * However an Xbox CMOS memory range [0x10, 0x70) and [0x80, 0x100)
262 * is filled with 0x55 0xAA 0x55 0xAA ... byte pattern which is used
263 * to validate the date/time settings by Xbox OS.
264 *
265 * Technically it's possible to connect a floppy drive to Xbox, but
266 * CMOS detection method should not be used here. */
267
268 WARN("XboxGetFloppyCount() is UNIMPLEMENTED, returning 0\n");
269 return 0;
270}
#define WARN(fmt,...)
Definition: debug.h:112

Referenced by MachInit().

◆ XboxGetHarddiskConfigurationData()

static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData ( UCHAR  DriveNumber,
ULONG pSize 
)
static

Definition at line 94 of file machxbox.c.

95{
96 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
98 //EXTENDED_GEOMETRY ExtGeometry;
99 GEOMETRY Geometry;
100 ULONG Size;
101
102 //
103 // Initialize returned size
104 //
105 *pSize = 0;
106
107 /* Set 'Configuration Data' value */
110 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
111 if (PartialResourceList == NULL)
112 {
113 ERR("Failed to allocate resource descriptor\n");
114 return NULL;
115 }
116
117 RtlZeroMemory(PartialResourceList, Size);
118 PartialResourceList->Version = 1;
119 PartialResourceList->Revision = 1;
120 PartialResourceList->Count = 1;
121 PartialResourceList->PartialDescriptors[0].Type =
123// PartialResourceList->PartialDescriptors[0].ShareDisposition =
124// PartialResourceList->PartialDescriptors[0].Flags =
125 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
127
128 /* Get pointer to geometry data */
129 DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
130
131 /* Get the disk geometry */
132 //ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
133
134 if (XboxDiskGetDriveGeometry(DriveNumber, &Geometry))
135 {
136 DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
137 DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
138 DiskGeometry->SectorsPerTrack = Geometry.Sectors;
139 DiskGeometry->NumberOfHeads = Geometry.Heads;
140 }
141 else
142 {
143 ERR("Reading disk geometry failed\n");
144 FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
145 return NULL;
146 }
147 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
148 DriveNumber,
149 DiskGeometry->NumberOfCylinders,
150 DiskGeometry->NumberOfHeads,
151 DiskGeometry->SectorsPerTrack,
152 DiskGeometry->BytesPerSector);
153
154 //
155 // Return configuration data
156 //
157 *pSize = Size;
158 return PartialResourceList;
159}
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
Definition: disk.h:25
ULONG BytesPerSector
Definition: disk.h:29
ULONG Sectors
Definition: disk.h:28
ULONG Cylinders
Definition: disk.h:26
ULONG Heads
Definition: disk.h:27
void * PVOID
Definition: typedefs.h:50
uint32_t ULONG_PTR
Definition: typedefs.h:65
struct _CM_DISK_GEOMETRY_DEVICE_DATA CM_DISK_GEOMETRY_DEVICE_DATA

Referenced by XboxHwDetect().

◆ XboxGetSerialPort()

static ULONG XboxGetSerialPort ( ULONG  Index,
PULONG  Irq 
)
static

Definition at line 48 of file machxbox.c.

49{
50 /*
51 * Xbox may have maximum two Serial COM ports
52 * if the Super I/O chip is connected via LPC
53 */
55 ULONG ComBase = 0;
56
58
59 // Select serial device
61
62 // Check if selected device is active
64 {
65 ComBase = LpcGetIoBase();
66 *Irq = LpcGetIrqPrimary();
67 }
68
70
71 return ComBase;
72}
#define LPC_CONFIG_DEVICE_NUMBER
Definition: superio.h:30
#define LPC_CONFIG_DEVICE_ACTIVATE
Definition: superio.h:31
FORCEINLINE ULONG LpcGetIoBase(VOID)
Definition: superio.h:96
#define LPC_DEVICE_SERIAL_PORT_2
Definition: superio.h:24
FORCEINLINE ULONG LpcGetIrqPrimary(VOID)
Definition: superio.h:126
FORCEINLINE UCHAR LpcReadRegister(UCHAR Register)
Definition: superio.h:59
#define LPC_DEVICE_SERIAL_PORT_1
Definition: superio.h:23
FORCEINLINE VOID LpcWriteRegister(UCHAR Register, UCHAR Value)
Definition: superio.h:67
FORCEINLINE VOID LpcExitConfig(VOID)
Definition: superio.h:51
FORCEINLINE VOID LpcEnterConfig(VOID)
Definition: superio.h:43
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_In_ WDFCOLLECTION _In_ ULONG Index
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by DetectIsaBios().

◆ XboxHwDetect()

PCONFIGURATION_COMPONENT_DATA XboxHwDetect ( _In_opt_ PCSTR  Options)

Definition at line 273 of file machxbox.c.

275{
277 ULONG BusNumber = 0;
278
279 TRACE("DetectHardware()\n");
280
281 /* Create the 'System' key */
282 FldrCreateSystemKey(&SystemKey, "Original Xbox (PC/AT like)");
283
286
287 /* TODO: Build actual xbox's hardware configuration tree */
288 DetectPciBios(SystemKey, &BusNumber);
289 DetectIsaBios(Options, SystemKey, &BusNumber);
290
291 TRACE("DetectHardware() Done\n");
292 return SystemKey;
293}
VOID FldrCreateSystemKey(_Out_ PCONFIGURATION_COMPONENT_DATA *SystemNode, _In_ PCSTR IdentifierString)
Definition: archwsup.c:135
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machxbox.c:94
static VOID DetectIsaBios(_In_opt_ PCSTR Options, _Inout_ PCONFIGURATION_COMPONENT_DATA SystemKey, _Out_ ULONG *BusNumber)
Definition: machxbox.c:208
BOOLEAN XboxFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: machxbox.c:31
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: pchw.c:45
_In_opt_ PUNICODE_STRING _In_ PDRIVER_OBJECT _In_ PDEVICE_OBJECT _In_ INTERFACE_TYPE _In_ ULONG BusNumber
Definition: halfuncs.h:160

Referenced by MachInit().

◆ XboxHwIdle()

VOID XboxHwIdle ( VOID  )

Definition at line 295 of file machxbox.c.

296{
297 /* UNIMPLEMENTED */
298}

Referenced by MachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( VOID  )

Definition at line 380 of file machxbox.c.

381{
382 /* On Xbox, prepare video and disk support */
386
387 /* Turn off debug messages to screen */
389}
#define DebugDisableScreenPort()
Definition: debug.h:120
#define FALSE
Definition: types.h:117
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1235
VOID XboxDiskInit(BOOLEAN Init)
Definition: xboxdisk.c:26
VOID XboxVideoPrepareForReactOS(VOID)
Definition: xboxvideo.c:315

Referenced by MachInit().

Variable Documentation

◆ FrameBuffer

◆ FrameBufferSize

ULONG FrameBufferSize
extern