ReactOS  0.4.15-dev-425-gc40b086
machxbox.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for machxbox.c:

Go to the source code of this file.

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 (PCONFIGURATION_COMPONENT_DATA BusKey, GET_SERIAL_PORT MachGetSerialPort, 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 (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
static UCHAR XboxGetFloppyCount (VOID)
 
PCONFIGURATION_COMPONENT_DATA XboxHwDetect (VOID)
 
VOID XboxHwIdle (VOID)
 
VOID MachInit (const char *CmdLine)
 
VOID XboxPrepareForReactOS (VOID)
 

Variables

PVOID FrameBuffer
 
ULONG FrameBufferSize
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectDisplayController()

static VOID DetectDisplayController ( PCONFIGURATION_COMPONENT_DATA  BusKey)
static

Definition at line 166 of file machxbox.c.

167 {
168  CHAR Buffer[80];
169  PCONFIGURATION_COMPONENT_DATA ControllerKey;
170  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
171  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
172  ULONG Size;
173 
174  if (FrameBufferSize == 0)
175  return;
176 
177  strcpy(Buffer, "NV2A Framebuffer");
178 
179  Size = sizeof(CM_PARTIAL_RESOURCE_LIST);
180  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
181  if (PartialResourceList == NULL)
182  {
183  ERR("Failed to allocate resource descriptor\n");
184  return;
185  }
186  memset(PartialResourceList, 0, Size);
187 
188  /* Initialize resource descriptor */
189  PartialResourceList->Version = 1;
190  PartialResourceList->Revision = 1;
191  PartialResourceList->Count = 1;
192 
193  /* Set Memory */
194  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
195  PartialDescriptor->Type = CmResourceTypeMemory;
197  PartialDescriptor->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
198  PartialDescriptor->u.Memory.Start.LowPart = (ULONG_PTR)FrameBuffer & 0x0FFFFFFF;
199  PartialDescriptor->u.Memory.Length = FrameBufferSize;
200 
201  FldrCreateComponentKey(BusKey,
203  DisplayController,
204  0x0,
205  0x0,
206  0xFFFFFFFF,
207  Buffer,
208  PartialResourceList,
209  Size,
210  &ControllerKey);
211 
212  TRACE("Created key: DisplayController\\0\n");
213 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@384 Memory
GLint x0
Definition: linetemp.h:95
char CHAR
Definition: xmlstorage.h:175
#define CM_RESOURCE_MEMORY_READ_WRITE
Definition: cmtypes.h:120
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
PVOID FrameBuffer
Definition: xboxvideo.c:27
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379 u
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID NTAPI 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 PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:110
ULONG FrameBufferSize
Definition: xboxvideo.c:28
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
unsigned int ULONG
Definition: retypes.h:1
#define ULONG_PTR
Definition: config.h:101
#define CmResourceTypeMemory
Definition: hwresource.cpp:125
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectIsaBios().

◆ DetectIsaBios()

static VOID DetectIsaBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 217 of file machxbox.c.

218 {
219  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
221  ULONG Size;
222 
223  /* Set 'Configuration Data' value */
224  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
226  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
227  if (PartialResourceList == NULL)
228  {
229  TRACE("Failed to allocate resource descriptor\n");
230  return;
231  }
232 
233  /* Initialize resource descriptor */
234  memset(PartialResourceList, 0, Size);
235  PartialResourceList->Version = 1;
236  PartialResourceList->Revision = 1;
237  PartialResourceList->Count = 0;
238 
239  /* Create new bus key */
240  FldrCreateComponentKey(SystemKey,
241  AdapterClass,
242  MultiFunctionAdapter,
243  0x0,
244  0x0,
245  0xFFFFFFFF,
246  "ISA",
247  PartialResourceList,
248  Size,
249  &BusKey);
250 
251  /* Increment bus number */
252  (*BusNumber)++;
253 
254  /* Detect ISA/BIOS devices */
255  DetectBiosDisks(SystemKey, BusKey);
257  DetectDisplayController(BusKey);
258 
259  /* FIXME: Detect more ISA devices */
260 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
VOID DetectSerialPorts(PCONFIGURATION_COMPONENT_DATA BusKey, GET_SERIAL_PORT MachGetSerialPort, ULONG Count)
Definition: machpc.c:659
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: pchw.c:344
GLint x0
Definition: linetemp.h:95
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machxbox.c:166
#define MAX_XBOX_COM_PORTS
Definition: machxbox.h:25
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
static ULONG XboxGetSerialPort(ULONG Index, PULONG Irq)
Definition: machxbox.c:45
VOID NTAPI 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 PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by XboxHwDetect().

◆ DetectSerialPointerPeripheral()

VOID DetectSerialPointerPeripheral ( PCONFIGURATION_COMPONENT_DATA  ControllerKey,
PUCHAR  Base 
)

◆ DetectSerialPorts()

VOID DetectSerialPorts ( PCONFIGURATION_COMPONENT_DATA  BusKey,
GET_SERIAL_PORT  MachGetSerialPort,
ULONG  Count 
)

Definition at line 659 of file machpc.c.

660 {
661  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
662  PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
663  PCM_SERIAL_DEVICE_DATA SerialDeviceData;
664  ULONG Irq;
665  ULONG Base;
666  CHAR Buffer[80];
667  ULONG ControllerNumber = 0;
668  PCONFIGURATION_COMPONENT_DATA ControllerKey;
669  ULONG i;
670  ULONG Size;
671 
672  TRACE("DetectSerialPorts()\n");
673 
674  for (i = 0; i < Count; i++)
675  {
676  Base = MachGetSerialPort(i, &Irq);
677  if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
678  continue;
679 
680  TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
681 
682  /* Set 'Identifier' value */
683  sprintf(Buffer, "COM%ld", i + 1);
684 
685  /* Build full device descriptor */
686  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
687  2 * sizeof(CM_PARTIAL_RESOURCE_DESCRIPTOR) +
688  sizeof(CM_SERIAL_DEVICE_DATA);
689  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
690  if (PartialResourceList == NULL)
691  {
692  ERR("Failed to allocate resource descriptor\n");
693  continue;
694  }
695  memset(PartialResourceList, 0, Size);
696 
697  /* Initialize resource descriptor */
698  PartialResourceList->Version = 1;
699  PartialResourceList->Revision = 1;
700  PartialResourceList->Count = 3;
701 
702  /* Set IO Port */
703  PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
704  PartialDescriptor->Type = CmResourceTypePort;
706  PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
707  PartialDescriptor->u.Port.Start.LowPart = Base;
708  PartialDescriptor->u.Port.Start.HighPart = 0x0;
709  PartialDescriptor->u.Port.Length = 8;
710 
711  /* Set Interrupt */
712  PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
713  PartialDescriptor->Type = CmResourceTypeInterrupt;
714  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
715  PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
716  PartialDescriptor->u.Interrupt.Level = Irq;
717  PartialDescriptor->u.Interrupt.Vector = Irq;
718  PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
719 
720  /* Set serial data (device specific) */
721  PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
722  PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
723  PartialDescriptor->ShareDisposition = CmResourceShareUndetermined;
724  PartialDescriptor->Flags = 0;
725  PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
726 
727  SerialDeviceData =
728  (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
729  SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
730 
731  /* Create controller key */
732  FldrCreateComponentKey(BusKey,
734  SerialController,
736  ControllerNumber,
737  0xFFFFFFFF,
738  Buffer,
739  PartialResourceList,
740  Size,
741  &ControllerKey);
742 
744  {
745  /* Detect serial mouse */
747  }
748 
749  ControllerNumber++;
750  }
751 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@381 Port
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
Definition: arc.h:82
char CHAR
Definition: xmlstorage.h:175
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@382 Interrupt
struct _CM_SERIAL_DEVICE_DATA CM_SERIAL_DEVICE_DATA
_In_opt_ ULONG Base
Definition: rtlfuncs.h:2373
Definition: arc.h:84
_Inout_ __drv_aliasesMem PSLIST_ENTRY _Inout_ PSLIST_ENTRY _In_ ULONG Count
Definition: exfuncs.h:1015
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:483
BOOLEAN Rs232PortInUse(PUCHAR Base)
Definition: rs232.c:140
#define CmResourceTypePort
Definition: hwresource.cpp:123
#define sprintf(buf, format,...)
Definition: sprintf.c:55
BOOLEAN NTAPI CpDoesPortExist(IN PUCHAR Address)
Definition: cport.c:227
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
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
#define UlongToPtr(u)
Definition: config.h:106
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
#define TRACE(s)
Definition: solgame.cpp:4
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@388 DeviceSpecificData
struct _CM_SERIAL_DEVICE_DATA * PCM_SERIAL_DEVICE_DATA
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
Definition: arc.h:85
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379 u
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
VOID NTAPI 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 PCHAR IdentifierString, IN PCM_PARTIAL_RESOURCE_LIST ResourceList, IN ULONG Size, OUT PCONFIGURATION_COMPONENT_DATA *ComponentKey)
Definition: archwsup.c:147
#define ERR(fmt,...)
Definition: debug.h:110
#define CM_RESOURCE_PORT_IO
Definition: cmtypes.h:109
Definition: arc.h:83
#define CmResourceTypeInterrupt
Definition: hwresource.cpp:124
#define CM_RESOURCE_INTERRUPT_LATCHED
Definition: cmtypes.h:144
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26

Referenced by DetectIsaBios().

◆ MachInit()

VOID MachInit ( const char CmdLine)

Definition at line 310 of file machxbox.c.

311 {
312  ULONG PciId;
313 
314  memset(&MachVtbl, 0, sizeof(MACHVTBL));
315 
316  /* Check for Xbox by identifying device at PCI 0:0:0, if it's
317  * 0x10DE/0x02A5 then we're running on an Xbox */
318  WRITE_PORT_ULONG((PULONG)0xCF8, CONFIG_CMD(0, 0, 0));
319  PciId = READ_PORT_ULONG((PULONG)0xCFC);
320  if (PciId != 0x02A510DE)
321  {
322  ERR("This is not original Xbox!\n");
323 
324  /* Disable and halt the CPU */
325  _disable();
326  __halt();
327 
328  while (TRUE);
329  }
330 
331  /* Set LEDs to red before anything is initialized */
332  XboxSetLED("rrrr");
333 
334  /* Setup vtbl */
351  MachVtbl.Beep = PcBeep;
363 
364  /* Initialize our stuff */
365  XboxMemInit();
366  XboxVideoInit();
367 
368  /* Set LEDs to orange after init */
369  XboxSetLED("oooo");
370 
372 }
BOOLEAN XboxConsKbHit(VOID)
Definition: xboxcons.c:69
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID)
Definition: machxbox.c:279
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
#define TRUE
Definition: types.h:120
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1595
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:77
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
ULONG NTAPI READ_PORT_ULONG(IN PULONG Port)
Definition: portio.c:70
static UCHAR XboxGetFloppyCount(VOID)
Definition: machxbox.c:264
VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: xboxvideo.c:272
VOID XboxVideoClearScreen(UCHAR Attr)
Definition: xboxvideo.c:123
VOID XboxConsPutChar(int c)
Definition: xboxcons.c:26
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
VOID XboxMemInit(VOID)
Definition: xboxmem.c:57
VOID XboxVideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: xboxvideo.c:260
VOID NTAPI WRITE_PORT_ULONG(IN PULONG Port, IN ULONG Value)
Definition: portio.c:123
BOOLEAN XboxDiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: xboxdisk.c:84
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:470
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
int XboxConsGetCh(void)
Definition: xboxcons.c:76
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
ULONG XboxVideoGetBufferSize(VOID)
Definition: xboxvideo.c:248
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
VOID XboxVideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: xboxvideo.c:254
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
BOOLEAN XboxVideoIsPaletteFixed(VOID)
Definition: xboxvideo.c:288
PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: xboxmem.c:157
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:240
VOID XboxPrepareForReactOS(VOID)
Definition: machxbox.c:375
VOID XboxHwIdle(VOID)
Definition: machxbox.c:301
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID XboxVideoSync(VOID)
Definition: xboxvideo.c:306
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
VOID XboxVideoInit(VOID)
Definition: xboxvideo.c:193
void XboxSetLED(PCSTR pattern)
Definition: xboxi2c.c:198
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:133
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:266
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
int(* ConsGetCh)(VOID)
Definition: machine.h:43
#define ERR(fmt,...)
Definition: debug.h:110
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: xboxdisk.c:103
MACHVTBL MachVtbl
Definition: arcemul.c:21
VOID PcBeep(VOID)
Definition: pcbeep.c:34
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
unsigned int * PULONG
Definition: retypes.h:1
#define CONFIG_CMD(bus, dev_fn, where)
Definition: hardware.h:23
VOID(* VideoSync)(VOID)
Definition: machine.h:57
void __cdecl _disable(void)
Definition: intrin_arm.h:365
VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: xboxvideo.c:294
unsigned int ULONG
Definition: retypes.h:1
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: xboxvideo.c:300
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
VOID XboxGetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machxbox.c:87
VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
Definition: xboxvideo.c:233
VOID(* Beep)(VOID)
Definition: machine.h:58
#define memset(x, y, z)
Definition: compat.h:39
TIMEINFO * XboxGetTime(VOID)
Definition: xboxrtc.c:40
ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: xboxdisk.c:122
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51

◆ XboxFindPciBios()

BOOLEAN XboxFindPciBios ( PPCI_REGISTRY_INFO  BusData)

Definition at line 28 of file machxbox.c.

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

Referenced by XboxHwDetect().

◆ XboxGetExtendedBIOSData()

VOID XboxGetExtendedBIOSData ( PULONG  ExtendedBIOSDataArea,
PULONG  ExtendedBIOSDataSize 
)

Definition at line 87 of file machxbox.c.

88 {
89  TRACE("XboxGetExtendedBIOSData(): UNIMPLEMENTED\n");
92 }
#define ExtendedBIOSDataSize
Definition: winldr.c:421
#define ExtendedBIOSDataArea
Definition: winldr.c:420
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by MachInit().

◆ XboxGetFloppyCount()

static UCHAR XboxGetFloppyCount ( VOID  )
static

Definition at line 264 of file machxbox.c.

265 {
266  /* On a PC we use CMOS/RTC I/O ports 0x70 and 0x71 to detect floppies.
267  * However an Xbox CMOS memory range [0x10, 0x70) and [0x80, 0x100)
268  * is filled with 0x55 0xAA 0x55 0xAA ... byte pattern which is used
269  * to validate the date/time settings by Xbox OS.
270  *
271  * Technically it's possible to connect a floppy drive to Xbox, but
272  * CMOS detection method should not be used here. */
273 
274  WARN("XboxGetFloppyCount() is UNIMPLEMENTED, returning 0\n");
275  return 0;
276 }
#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 98 of file machxbox.c.

99 {
100  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
101  PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
102  //EXTENDED_GEOMETRY ExtGeometry;
103  GEOMETRY Geometry;
104  ULONG Size;
105 
106  //
107  // Initialize returned size
108  //
109  *pSize = 0;
110 
111  /* Set 'Configuration Data' value */
112  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
114  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
115  if (PartialResourceList == NULL)
116  {
117  ERR("Failed to allocate a full resource descriptor\n");
118  return NULL;
119  }
120 
121  memset(PartialResourceList, 0, Size);
122  PartialResourceList->Version = 1;
123  PartialResourceList->Revision = 1;
124  PartialResourceList->Count = 1;
125  PartialResourceList->PartialDescriptors[0].Type =
127 // PartialResourceList->PartialDescriptors[0].ShareDisposition =
128 // PartialResourceList->PartialDescriptors[0].Flags =
129  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
131 
132  /* Get pointer to geometry data */
133  DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
134 
135  /* Get the disk geometry */
136  //ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
137 
138  if (XboxDiskGetDriveGeometry(DriveNumber, &Geometry))
139  {
140  DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
141  DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
142  DiskGeometry->SectorsPerTrack = Geometry.Sectors;
143  DiskGeometry->NumberOfHeads = Geometry.Heads;
144  }
145  else
146  {
147  ERR("Reading disk geometry failed\n");
148  FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
149  return NULL;
150  }
151  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
152  DriveNumber,
153  DiskGeometry->NumberOfCylinders,
154  DiskGeometry->NumberOfHeads,
155  DiskGeometry->SectorsPerTrack,
156  DiskGeometry->BytesPerSector);
157 
158  //
159  // Return configuration data
160  //
161  *pSize = Size;
162  return PartialResourceList;
163 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
#define CmResourceTypeDeviceSpecific
Definition: hwresource.cpp:127
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:170
ULONG Cylinders
Definition: disk.h:26
uint32_t ULONG_PTR
Definition: typedefs.h:64
smooth NULL
Definition: ftsmooth.c:416
void * PVOID
Definition: retypes.h:9
ULONG Sectors
Definition: disk.h:28
#define TRACE(s)
Definition: solgame.cpp:4
FORCEINLINE PVOID FrLdrHeapAlloc(SIZE_T MemorySize, ULONG Tag)
Definition: mm.h:163
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379::@388 DeviceSpecificData
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@379 u
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
#define ERR(fmt,...)
Definition: debug.h:110
BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: xboxdisk.c:103
ULONG BytesPerSector
Definition: disk.h:29
Definition: disk.h:24
unsigned int ULONG
Definition: retypes.h:1
#define memset(x, y, z)
Definition: compat.h:39
struct _CM_DISK_GEOMETRY_DEVICE_DATA CM_DISK_GEOMETRY_DEVICE_DATA
#define TAG_HW_RESOURCE_LIST
Definition: hardware.h:26
ULONG Heads
Definition: disk.h:27

Referenced by XboxHwDetect().

◆ XboxGetSerialPort()

static ULONG XboxGetSerialPort ( ULONG  Index,
PULONG  Irq 
)
static

Definition at line 45 of file machxbox.c.

46 {
47  /*
48  * Xbox may have maximum two Serial COM ports
49  * if the Super I/O chip is connected via LPC
50  */
52  ULONG ComBase = 0;
53 
54  // Enter Configuration
56 
57  // Select serial device
60 
61  // Check if selected device is active
63  if (READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1)) == 1)
64  {
65  // Read LSB
67  ComBase = READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1));
68  // Read MSB
70  ComBase |= (READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1)) << 8);
71  // Read IRQ
73  *Irq = READ_PORT_UCHAR((PUCHAR)(LPC_IO_BASE + 1));
74  }
75 
76  // Exit Configuration
78 
79  return ComBase;
80 }
_In_ PIRP _In_ PDEVICE_OBJECT Device
Definition: fatprocs.h:2029
#define LPC_CONFIG_DEVICE_BASE_ADDRESS_LOW
Definition: machxbox.h:37
unsigned char * PUCHAR
Definition: retypes.h:3
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
#define MAX_XBOX_COM_PORTS
Definition: machxbox.h:25
#define LPC_CONFIG_DEVICE_NUMBER
Definition: machxbox.h:34
#define LPC_IO_BASE
Definition: machxbox.h:27
#define LPC_ENTER_CONFIG_KEY
Definition: machxbox.h:28
static const UCHAR Index[8]
Definition: usbohci.c:18
#define LPC_CONFIG_DEVICE_ACTIVATE
Definition: machxbox.h:35
unsigned char UCHAR
Definition: xmlstorage.h:181
#define LPC_DEVICE_SERIAL_PORT_1
Definition: machxbox.h:31
#define LPC_EXIT_CONFIG_KEY
Definition: machxbox.h:29
#define LPC_DEVICE_SERIAL_PORT_2
Definition: machxbox.h:32
#define LPC_CONFIG_DEVICE_BASE_ADDRESS_HIGH
Definition: machxbox.h:36
unsigned int ULONG
Definition: retypes.h:1
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532
#define LPC_CONFIG_DEVICE_INTERRUPT
Definition: machxbox.h:38

Referenced by DetectIsaBios().

◆ XboxHwDetect()

PCONFIGURATION_COMPONENT_DATA XboxHwDetect ( VOID  )

Definition at line 279 of file machxbox.c.

280 {
282  ULONG BusNumber = 0;
283 
284  TRACE("DetectHardware()\n");
285 
286  /* Create the 'System' key */
287  FldrCreateSystemKey(&SystemKey);
288  FldrSetIdentifier(SystemKey, "Original Xbox (PC/AT like)");
289 
292 
293  /* TODO: Build actual xbox's hardware configuration tree */
294  DetectPciBios(SystemKey, &BusNumber);
295  DetectIsaBios(SystemKey, &BusNumber);
296 
297  TRACE("DetectHardware() Done\n");
298  return SystemKey;
299 }
VOID NTAPI FldrSetIdentifier(IN PCONFIGURATION_COMPONENT_DATA ComponentData, IN PCHAR IdentifierString)
Definition: archwsup.c:56
BOOLEAN XboxFindPciBios(PPCI_REGISTRY_INFO BusData)
Definition: machxbox.c:28
FIND_PCI_BIOS FindPciBios
Definition: hwpci.c:26
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:156
#define TRACE(s)
Definition: solgame.cpp:4
VOID DetectPciBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: hwpci.c:176
unsigned int ULONG
Definition: retypes.h:1
VOID NTAPI FldrCreateSystemKey(OUT PCONFIGURATION_COMPONENT_DATA *SystemNode)
Definition: archwsup.c:89
static VOID DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
Definition: machxbox.c:217
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machxbox.c:98

Referenced by MachInit().

◆ XboxHwIdle()

VOID XboxHwIdle ( VOID  )

Definition at line 301 of file machxbox.c.

302 {
303  /* UNIMPLEMENTED */
304 }

Referenced by MachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( VOID  )

Definition at line 375 of file machxbox.c.

376 {
377  /* On Xbox, prepare video and disk support */
381 
382  /* Turn off debug messages to screen */
383  DebugDisableScreenPort();
384 }
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1244
VOID XboxVideoPrepareForReactOS(VOID)
Definition: xboxvideo.c:312
VOID XboxDiskInit(BOOLEAN Init)
Definition: xboxdisk.c:26

Referenced by MachInit().

Variable Documentation

◆ FrameBuffer

◆ FrameBufferSize

ULONG FrameBufferSize