ReactOS  0.4.13-dev-257-gfabbd7c
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)
 
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData (UCHAR DriveNumber, ULONG *pSize)
 
static VOID DetectIsaBios (PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
 
PCONFIGURATION_COMPONENT_DATA XboxHwDetect (VOID)
 
VOID XboxHwIdle (VOID)
 
VOID XboxMachInit (const char *CmdLine)
 
VOID XboxPrepareForReactOS (IN BOOLEAN Setup)
 

Function Documentation

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ DetectIsaBios()

static VOID DetectIsaBios ( PCONFIGURATION_COMPONENT_DATA  SystemKey,
ULONG BusNumber 
)
static

Definition at line 99 of file machxbox.c.

100 {
101  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
103  ULONG Size;
104 
105  /* Set 'Configuration Data' value */
106  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) -
108  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
109  if (PartialResourceList == NULL)
110  {
111  TRACE("Failed to allocate resource descriptor\n");
112  return;
113  }
114 
115  /* Initialize resource descriptor */
116  memset(PartialResourceList, 0, Size);
117  PartialResourceList->Version = 1;
118  PartialResourceList->Revision = 1;
119  PartialResourceList->Count = 0;
120 
121  /* Create new bus key */
122  FldrCreateComponentKey(SystemKey,
123  AdapterClass,
124  MultiFunctionAdapter,
125  0x0,
126  0x0,
127  0xFFFFFFFF,
128  "ISA",
129  PartialResourceList,
130  Size,
131  &BusKey);
132 
133  /* Increment bus number */
134  (*BusNumber)++;
135 
136  /* Detect ISA/BIOS devices */
137  DetectBiosDisks(SystemKey, BusKey);
138 
139  /* FIXME: Detect more ISA devices */
140 }
struct _CM_PARTIAL_RESOURCE_LIST CM_PARTIAL_RESOURCE_LIST
GLint x0
Definition: linetemp.h:95
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
VOID DetectBiosDisks(PCONFIGURATION_COMPONENT_DATA SystemKey, PCONFIGURATION_COMPONENT_DATA BusKey)
Definition: hardware.c:353
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
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().

◆ XboxGetHarddiskConfigurationData()

static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData ( UCHAR  DriveNumber,
ULONG pSize 
)
static

Definition at line 30 of file machxbox.c.

31 {
32  PCM_PARTIAL_RESOURCE_LIST PartialResourceList;
33  PCM_DISK_GEOMETRY_DEVICE_DATA DiskGeometry;
34  //EXTENDED_GEOMETRY ExtGeometry;
35  GEOMETRY Geometry;
36  ULONG Size;
37 
38  //
39  // Initialize returned size
40  //
41  *pSize = 0;
42 
43  /* Set 'Configuration Data' value */
44  Size = sizeof(CM_PARTIAL_RESOURCE_LIST) +
46  PartialResourceList = FrLdrHeapAlloc(Size, TAG_HW_RESOURCE_LIST);
47  if (PartialResourceList == NULL)
48  {
49  ERR("Failed to allocate a full resource descriptor\n");
50  return NULL;
51  }
52 
53  memset(PartialResourceList, 0, Size);
54  PartialResourceList->Version = 1;
55  PartialResourceList->Revision = 1;
56  PartialResourceList->Count = 1;
57  PartialResourceList->PartialDescriptors[0].Type =
59 // PartialResourceList->PartialDescriptors[0].ShareDisposition =
60 // PartialResourceList->PartialDescriptors[0].Flags =
61  PartialResourceList->PartialDescriptors[0].u.DeviceSpecificData.DataSize =
63 
64  /* Get pointer to geometry data */
65  DiskGeometry = (PVOID)(((ULONG_PTR)PartialResourceList) + sizeof(CM_PARTIAL_RESOURCE_LIST));
66 
67  /* Get the disk geometry */
68  //ExtGeometry.Size = sizeof(EXTENDED_GEOMETRY);
69 
70  if (MachDiskGetDriveGeometry(DriveNumber, &Geometry))
71  {
72  DiskGeometry->BytesPerSector = Geometry.BytesPerSector;
73  DiskGeometry->NumberOfCylinders = Geometry.Cylinders;
74  DiskGeometry->SectorsPerTrack = Geometry.Sectors;
75  DiskGeometry->NumberOfHeads = Geometry.Heads;
76  }
77  else
78  {
79  ERR("Reading disk geometry failed\n");
80  FrLdrHeapFree(PartialResourceList, TAG_HW_RESOURCE_LIST);
81  return NULL;
82  }
83  TRACE("Disk %x: %u Cylinders %u Heads %u Sectors %u Bytes\n",
84  DriveNumber,
85  DiskGeometry->NumberOfCylinders,
86  DiskGeometry->NumberOfHeads,
87  DiskGeometry->SectorsPerTrack,
88  DiskGeometry->BytesPerSector);
89 
90  //
91  // Return configuration data
92  //
93  *pSize = Size;
94  return PartialResourceList;
95 }
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
union _CM_PARTIAL_RESOURCE_DESCRIPTOR::@369 u
uint32_t ULONG_PTR
Definition: typedefs.h:63
smooth NULL
Definition: ftsmooth.c:416
struct _CM_PARTIAL_RESOURCE_DESCRIPTOR::@369::@378 DeviceSpecificData
void * PVOID
Definition: retypes.h:9
#define MachDiskGetDriveGeometry(Drive, Geom)
Definition: machine.h:122
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
CM_PARTIAL_RESOURCE_DESCRIPTOR PartialDescriptors[1]
Definition: hwresource.cpp:119
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define ERR(fmt,...)
Definition: debug.h:109
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().

◆ XboxHwDetect()

PCONFIGURATION_COMPONENT_DATA XboxHwDetect ( VOID  )

Definition at line 143 of file machxbox.c.

144 {
146  ULONG BusNumber = 0;
147 
148  TRACE("DetectHardware()\n");
149 
150  /* Create the 'System' key */
151  FldrCreateSystemKey(&SystemKey);
152 
154 
155  /* TODO: Build actual xbox's hardware configuration tree */
156  DetectIsaBios(SystemKey, &BusNumber);
157 
158  TRACE("DetectHardware() Done\n");
159  return SystemKey;
160 }
GET_HARDDISK_CONFIG_DATA GetHarddiskConfigurationData
Definition: hardware.c:42
_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
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:99
static PCM_PARTIAL_RESOURCE_LIST XboxGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG *pSize)
Definition: machxbox.c:30

Referenced by XboxMachInit().

◆ XboxHwIdle()

VOID XboxHwIdle ( VOID  )

Definition at line 162 of file machxbox.c.

163 {
164  /* UNIMPLEMENTED */
165 }

Referenced by XboxMachInit().

◆ XboxMachInit()

VOID XboxMachInit ( const char CmdLine)

Definition at line 171 of file machxbox.c.

172 {
173  /* Set LEDs to red before anything is initialized */
174  XboxSetLED("rrrr");
175 
176  /* Initialize our stuff */
177  XboxMemInit();
178  XboxVideoInit();
179 
180  /* Setup vtbl */
195  MachVtbl.Beep = PcBeep;
206 
208 
209  /* Set LEDs to orange after init */
210  XboxSetLED("oooo");
211 }
BOOLEAN XboxConsKbHit(VOID)
Definition: xboxcons.c:59
PCONFIGURATION_COMPONENT_DATA XboxHwDetect(VOID)
Definition: machxbox.c:143
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:62
DISK_GET_PARTITION_ENTRY DiskGetPartitionEntry
Definition: partition.c:33
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:75
BOOLEAN(* DiskGetBootPath)(PCHAR BootPath, ULONG Size)
Definition: machine.h:64
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
VOID XboxVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: xboxvideo.c:196
VOID XboxVideoClearScreen(UCHAR Attr)
Definition: xboxvideo.c:102
VOID XboxConsPutChar(int c)
Definition: xboxcons.c:26
BOOLEAN XboxDiskGetPartitionEntry(UCHAR DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
Definition: xboxdisk.c:474
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:53
VOID XboxMemInit(VOID)
Definition: xboxmem.c:32
BOOLEAN PcInitializeBootDevices(VOID)
Definition: hwdisk.c:349
int XboxConsGetCh(void)
Definition: xboxcons.c:66
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:66
ULONG XboxVideoGetBufferSize(VOID)
Definition: xboxvideo.c:178
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:70
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:74
BOOLEAN XboxDiskReadLogicalSectors(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: xboxdisk.c:431
BOOLEAN DiskGetBootPath(OUT PCHAR BootPath, IN ULONG Size)
Definition: disk.c:102
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:55
BOOLEAN XboxVideoIsPaletteFixed(VOID)
Definition: xboxvideo.c:212
PFREELDR_MEMORY_DESCRIPTOR XboxMemGetMemoryMap(ULONG *MemoryMapSize)
Definition: xboxmem.c:80
VOID XboxVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: xboxvideo.c:170
VOID XboxHwIdle(VOID)
Definition: machxbox.c:162
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:65
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID XboxVideoSync(VOID)
Definition: xboxvideo.c:230
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:51
VOID XboxVideoInit(VOID)
Definition: xboxvideo.c:122
void XboxSetLED(PCSTR pattern)
Definition: xboxi2c.c:198
VOID XboxVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: xboxvideo.c:112
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:54
VOID PcBeep(VOID)
Definition: i386rtl.c:25
VOID XboxVideoHideShowTextCursor(BOOLEAN Show)
Definition: xboxvideo.c:190
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
int(* ConsGetCh)(VOID)
Definition: machine.h:43
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:67
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
BOOLEAN XboxDiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: xboxdisk.c:500
VOID(* HwIdle)(VOID)
Definition: machine.h:76
VOID(* VideoSync)(VOID)
Definition: machine.h:56
VOID XboxVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: xboxvideo.c:218
VOID XboxVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: xboxvideo.c:224
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:52
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
VIDEODISPLAYMODE XboxVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
Definition: xboxvideo.c:163
MACHVTBL MachVtbl
Definition: machine.c:21
VOID(* Beep)(VOID)
Definition: machine.h:57
TIMEINFO * XboxGetTime(VOID)
Definition: xboxrtc.c:40
VOID XboxPrepareForReactOS(IN BOOLEAN Setup)
Definition: machxbox.c:214
ULONG XboxDiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: xboxdisk.c:560
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:50
VOID(* PrepareForReactOS)(IN BOOLEAN Setup)
Definition: machine.h:58

Referenced by MachInit().

◆ XboxPrepareForReactOS()

VOID XboxPrepareForReactOS ( IN BOOLEAN  Setup)

Definition at line 214 of file machxbox.c.

215 {
216  /* On XBOX, prepare video and turn off the floppy motor */
219 }
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE ACPI_HANDLE ACPI_HANDLE *OutHandle ACPI_HANDLE *OutHandle void *Context void *Context ACPI_EVENT_HANDLER Handler UINT32 UINT32 ACPI_GPE_HANDLER void *Context UINT32 ACPI_NOTIFY_HANDLER void *Context ACPI_ADR_SPACE_TYPE ACPI_ADR_SPACE_HANDLER ACPI_ADR_SPACE_SETUP Setup
Definition: acpixf.h:816
VOID XboxVideoPrepareForReactOS(IN BOOLEAN Setup)
Definition: xboxvideo.c:243
VOID DiskStopFloppyMotor(VOID)
Definition: macharm.c:62

Referenced by XboxMachInit().