ReactOS 0.4.16-dev-297-gc569aee
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 155 of file machxbox.c.

156{
157 PCONFIGURATION_COMPONENT_DATA ControllerKey;
158 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
159 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
160 ULONG Size;
161
162 if (FrameBufferSize == 0)
163 return;
164
166 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
167 if (PartialResourceList == NULL)
168 {
169 ERR("Failed to allocate resource descriptor\n");
170 return;
171 }
172
173 /* Initialize resource descriptor */
174 RtlZeroMemory(PartialResourceList, Size);
175 PartialResourceList->Version = 1;
176 PartialResourceList->Revision = 1;
177 PartialResourceList->Count = 1;
178
179 /* Set Memory */
180 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
181 PartialDescriptor->Type = CmResourceTypeMemory;
183 PartialDescriptor->Flags = CM_RESOURCE_MEMORY_READ_WRITE;
184 PartialDescriptor->u.Memory.Start.LowPart = (ULONG_PTR)FrameBuffer & 0x0FFFFFFF;
185 PartialDescriptor->u.Memory.Length = FrameBufferSize;
186
191 0,
192 0xFFFFFFFF,
193 "NV2A Framebuffer",
194 PartialResourceList,
195 Size,
196 &ControllerKey);
197}
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: precomp.h:57
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
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@396 Memory
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391 u
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 201 of file machxbox.c.

205{
206 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
208 ULONG Size;
209
210 /* Set 'Configuration Data' value */
213 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
214 if (PartialResourceList == NULL)
215 {
216 ERR("Failed to allocate resource descriptor\n");
217 return;
218 }
219
220 /* Initialize resource descriptor */
221 RtlZeroMemory(PartialResourceList, Size);
222 PartialResourceList->Version = 1;
223 PartialResourceList->Revision = 1;
224 PartialResourceList->Count = 0;
225
226 /* Create new bus key */
227 FldrCreateComponentKey(SystemKey,
230 0,
231 0,
232 0xFFFFFFFF,
233 "ISA",
234 PartialResourceList,
235 Size,
236 &BusKey);
237
238 /* Increment bus number */
239 (*BusNumber)++;
240
241 /* Detect ISA/BIOS devices */
242 DetectBiosDisks(SystemKey, BusKey);
245
246 /* FIXME: Detect more ISA devices */
247}
#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:766
static VOID DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: machxbox.c:155
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 766 of file machpc.c.

771{
772 PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
773 PCM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptor;
774 PCM_SERIAL_DEVICE_DATA SerialDeviceData;
775 ULONG Irq;
776 ULONG Base;
777 CHAR Identifier[80];
778 ULONG ControllerNumber = 0;
779 PCONFIGURATION_COMPONENT_DATA ControllerKey;
780 ULONG i;
781 ULONG Size;
782 ULONG PortBitmap;
783
784 TRACE("DetectSerialPorts()\n");
785
787
788 for (i = 0; i < Count; i++)
789 {
790 Base = MachGetSerialPort(i, &Irq);
791 if ((Base == 0) || !CpDoesPortExist(UlongToPtr(Base)))
792 continue;
793
794 TRACE("Found COM%u port at 0x%x\n", i + 1, Base);
795
796 /* Set 'Identifier' value */
797 RtlStringCbPrintfA(Identifier, sizeof(Identifier), "COM%ld", i + 1);
798
799 /* Build full device descriptor */
802 sizeof(CM_SERIAL_DEVICE_DATA);
803 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
804 if (PartialResourceList == NULL)
805 {
806 ERR("Failed to allocate resource descriptor! Ignoring remaining serial ports. (i = %lu, Count = %lu)\n",
807 i, Count);
808 break;
809 }
810
811 /* Initialize resource descriptor */
812 RtlZeroMemory(PartialResourceList, Size);
813 PartialResourceList->Version = 1;
814 PartialResourceList->Revision = 1;
815 PartialResourceList->Count = 3;
816
817 /* Set IO Port */
818 PartialDescriptor = &PartialResourceList->PartialDescriptors[0];
819 PartialDescriptor->Type = CmResourceTypePort;
821 PartialDescriptor->Flags = CM_RESOURCE_PORT_IO;
822 PartialDescriptor->u.Port.Start.LowPart = Base;
823 PartialDescriptor->u.Port.Start.HighPart = 0x0;
824 PartialDescriptor->u.Port.Length = 8;
825
826 /* Set Interrupt */
827 PartialDescriptor = &PartialResourceList->PartialDescriptors[1];
828 PartialDescriptor->Type = CmResourceTypeInterrupt;
830 PartialDescriptor->Flags = CM_RESOURCE_INTERRUPT_LATCHED;
831 PartialDescriptor->u.Interrupt.Level = Irq;
832 PartialDescriptor->u.Interrupt.Vector = Irq;
833 PartialDescriptor->u.Interrupt.Affinity = 0xFFFFFFFF;
834
835 /* Set serial data (device specific) */
836 PartialDescriptor = &PartialResourceList->PartialDescriptors[2];
837 PartialDescriptor->Type = CmResourceTypeDeviceSpecific;
839 PartialDescriptor->Flags = 0;
840 PartialDescriptor->u.DeviceSpecificData.DataSize = sizeof(CM_SERIAL_DEVICE_DATA);
841
842 SerialDeviceData =
843 (PCM_SERIAL_DEVICE_DATA)&PartialResourceList->PartialDescriptors[3];
844 SerialDeviceData->BaudClock = 1843200; /* UART Clock frequency (Hertz) */
845
846 /* Create controller key */
851 ControllerNumber,
852 0xFFFFFFFF,
854 PartialResourceList,
855 Size,
856 &ControllerKey);
857
858 if (!(PortBitmap & (1 << i)) && !Rs232PortInUse(UlongToPtr(Base)))
859 {
860 /* Detect serial mouse */
862 }
863
864 ControllerNumber++;
865 }
866}
@ 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:726
static VOID DetectSerialPointerPeripheral(PCONFIGURATION_COMPONENT_DATA ControllerKey, PUCHAR Base)
Definition: machpc.c:542
#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:2451
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::@391::@393 Port
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@400 DeviceSpecificData
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@391::@394 Interrupt
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 297 of file machxbox.c.

298{
299 PCI_TYPE1_CFG_BITS PciCfg1;
300 ULONG PciId;
301
302 /* Check for Xbox by identifying device at PCI 0:0:0, if it's
303 * 0x10DE/0x02A5 then we're running on an Xbox */
304
305 /* Select Host to PCI bridge */
306 PciCfg1.u.bits.Enable = 1;
307 PciCfg1.u.bits.BusNumber = 0;
308 PciCfg1.u.bits.DeviceNumber = 0;
309 PciCfg1.u.bits.FunctionNumber = 0;
310 /* Select register VendorID & DeviceID */
311 PciCfg1.u.bits.RegisterNumber = 0x00;
312 PciCfg1.u.bits.Reserved = 0;
313
316 if (PciId != 0x02A510DE)
317 {
318 ERR("This is not an original Xbox!\n");
319
320 /* Disable and halt the CPU */
321 _disable();
322 __halt();
323
324 while (TRUE)
325 NOTHING;
326 }
327
328 /* Set LEDs to red before anything is initialized */
329 XboxSetLED("rrrr");
330
331 /* Setup vtbl */
361
362 /* Initialize our stuff */
363 XboxMemInit();
365
366 /* Set LEDs to orange after init */
367 XboxSetLED("oooo");
368
370}
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:288
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(_In_opt_ PCSTR Options)
Definition: machxbox.c:266
static UCHAR XboxGetFloppyCount(VOID)
Definition: machxbox.c:251
VOID XboxPrepareForReactOS(VOID)
Definition: machxbox.c:373
VOID PcBeep(VOID)
Definition: pcbeep.c:34
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
struct _PCI_TYPE1_CFG_BITS::@157::@158 bits
union _PCI_TYPE1_CFG_BITS::@157 u
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:123
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 251 of file machxbox.c.

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

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 GEOMETRY Geometry;
99 ULONG Size;
100
101 /* Initialize returned size */
102 *pSize = 0;
103
104 /* Set 'Configuration Data' value */
107 PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
108 if (PartialResourceList == NULL)
109 {
110 ERR("Failed to allocate resource descriptor\n");
111 return NULL;
112 }
113
114 RtlZeroMemory(PartialResourceList, Size);
115 PartialResourceList->Version = 1;
116 PartialResourceList->Revision = 1;
117 PartialResourceList->Count = 1;
118 PartialResourceList->PartialDescriptors[0].Type =
120// PartialResourceList->PartialDescriptors[0].ShareDisposition =
121// PartialResourceList->PartialDescriptors[0].Flags =
122 PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
124
125 /* Get pointer to geometry data */
126 DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
127
128 /* Get the disk geometry */
129 if (XboxDiskGetDriveGeometry(DriveNumber, &Geometry))
130 {
131 DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
132 DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
133 DiskGeometry->SectorsPerTrack = Geometry.SectorsPerTrack;
134 DiskGeometry->NumberOfHeads = Geometry.Heads;
135 }
136 else
137 {
138 ERR("Reading disk geometry failed\n");
139 FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
140 return NULL;
141 }
142 TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
143 DriveNumber,
144 DiskGeometry->NumberOfCylinders,
145 DiskGeometry->NumberOfHeads,
146 DiskGeometry->SectorsPerTrack,
147 DiskGeometry->BytesPerSector);
148
149 /* Return configuration data */
150 *pSize = Size;
151 return PartialResourceList;
152}
FORCEINLINE VOID FrLdrHeapFree(PVOID MemoryPointer, ULONG Tag)
Definition: mm.h:181
Definition: disk.h:26
ULONG BytesPerSector
Number of bytes per sector.
Definition: disk.h:30
ULONG Cylinders
Number of cylinders on the disk.
Definition: disk.h:27
ULONG SectorsPerTrack
Number of sectors per track.
Definition: disk.h:29
ULONG Heads
Number of heads on the disk.
Definition: disk.h:28
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 266 of file machxbox.c.

268{
270 ULONG BusNumber = 0;
271
272 TRACE("DetectHardware()\n");
273
274 /* Create the 'System' key */
275 FldrCreateSystemKey(&SystemKey, "Original Xbox (PC/AT like)");
276
279
280 /* TODO: Build actual xbox's hardware configuration tree */
281 DetectPciBios(SystemKey, &BusNumber);
282 DetectIsaBios(Options, SystemKey, &BusNumber);
283
284 TRACE("DetectHardware() Done\n");
285 return SystemKey;
286}
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:201
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 288 of file machxbox.c.

289{
290 /* UNIMPLEMENTED */
291}

Referenced by MachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( VOID  )

Definition at line 373 of file machxbox.c.

374{
375 /* On Xbox, prepare video and disk support */
379
380 /* Turn off debug messages to screen */
382}
#define DebugDisableScreenPort()
Definition: debug.h:123
#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