Skip to content

Commit 415c737

Browse files
committed
[FREELDR] Add display controller detection for Xbox
Also add system identifier here. [BOOTDATA] Fix some typos CORE-16216
1 parent 9f6442f commit 415c737

File tree

2 files changed

+56
-2
lines changed

2 files changed

+56
-2
lines changed

boot/bootdata/txtsetup.sif

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ ntoskrnl.exe = 1,,,,,,,2,,,,1,2
266266
hal.dll = 1,,,,,,,2,,,,1,2
267267

268268
[Display]
269-
;<id> = <user friendly name>,<spare>,<service key name>,<height>,<width>,<bpp>
269+
;<id> = <user friendly name>,<spare>,<service key name>,<width>,<height>,<bpp>
270270
vga = "VGA Display (640x480x4)",,Vga,640,480,4
271271
vbe_640x480x8 = "VESA Display (640x480x8)",,VBE,640,480,8
272272
vbe_640x480x16 = "VESA Display (640x480x16)",,VBE,640,480,16
@@ -298,7 +298,7 @@ xbox = "Original Xbox NV2A Framebuffer (640x480x32)",,XboxVmp,640,48
298298
;<id> = <pnp id string>
299299
vga = "VGA Display"
300300
vbe = "VBE Display"
301-
xboxvmp = "NV2A Framebuffer"
301+
xbox = "NV2A Framebuffer"
302302

303303
[Keyboard]
304304
Default = "XT-, AT- or extended keyboard (83-105 keys)"

boot/freeldr/freeldr/arch/i386/xbox/machxbox.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
#include <debug.h>
2222
DBG_DEFAULT_CHANNEL(HWDETECT);
2323

24+
extern PVOID FrameBuffer;
25+
extern ULONG FrameBufferSize;
2426

2527
BOOLEAN
2628
XboxFindPciBios(PPCI_REGISTRY_INFO BusData)
@@ -160,6 +162,56 @@ XboxGetHarddiskConfigurationData(UCHAR DriveNumber, ULONG* pSize)
160162
return PartialResourceList;
161163
}
162164

165+
static VOID
166+
DetectDisplayController(PCONFIGURATION_COMPONENT_DATA BusKey)
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;
196+
PartialDescriptor->ShareDisposition = CmResourceShareDeviceExclusive;
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,
202+
ControllerClass,
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+
}
214+
163215
static
164216
VOID
165217
DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
@@ -202,6 +254,7 @@ DetectIsaBios(PCONFIGURATION_COMPONENT_DATA SystemKey, ULONG *BusNumber)
202254
/* Detect ISA/BIOS devices */
203255
DetectBiosDisks(SystemKey, BusKey);
204256
DetectSerialPorts(BusKey, XboxGetSerialPort, MAX_XBOX_COM_PORTS);
257+
DetectDisplayController(BusKey);
205258

206259
/* FIXME: Detect more ISA devices */
207260
}
@@ -232,6 +285,7 @@ XboxHwDetect(VOID)
232285

233286
/* Create the 'System' key */
234287
FldrCreateSystemKey(&SystemKey);
288+
FldrSetIdentifier(SystemKey, "Original Xbox (PC/AT like)");
235289

236290
GetHarddiskConfigurationData = XboxGetHarddiskConfigurationData;
237291
FindPciBios = XboxFindPciBios;

0 commit comments

Comments
 (0)