From 251bf491270ce95e4bb62e21ce1f976d1a75b0b5 Mon Sep 17 00:00:00 2001 From: Stanislav Motylkov Date: Sat, 17 Aug 2019 20:03:39 +0300 Subject: [PATCH] [HAL] Xbox needs more PCI blacklisting! CORE-16216 --- hal/halx86/legacy/bus/pcibus.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hal/halx86/legacy/bus/pcibus.c b/hal/halx86/legacy/bus/pcibus.c index 93ed9cb5ca1..a0aff2c70da 100644 --- a/hal/halx86/legacy/bus/pcibus.c +++ b/hal/halx86/legacy/bus/pcibus.c @@ -325,6 +325,21 @@ HalpValidPCISlot(IN PBUS_HANDLER BusHandler, if (Slot.u.bits.Reserved) return FALSE; if (Slot.u.bits.DeviceNumber >= BusData->MaxDevice) return FALSE; +#ifdef SARCH_XBOX + /* Trying to get PCI config data from devices 0:0:1 and 0:0:2 will completely + * hang the Xbox. Also, the device number doesn't seem to be decoded for the + * video card, so it appears to be present on 1:0:0 - 1:31:0. + * We hack around these problems by indicating "device not present" for devices + * 0:0:1, 0:0:2, 1:1:0, 1:2:0, 1:3:0, ...., 1:31:0 */ + if ((BusHandler->BusNumber == 0 && Slot.u.bits.DeviceNumber == 0 && + (Slot.u.bits.FunctionNumber == 1 || Slot.u.bits.FunctionNumber == 2)) || + (BusHandler->BusNumber == 1 && Slot.u.bits.DeviceNumber != 0)) + { + DPRINT("HalpValidPCISlot(): Blacklisted PCI slot (%d:%d:%d)\n", BusHandler->BusNumber, Slot.u.bits.DeviceNumber, Slot.u.bits.FunctionNumber); + return FALSE; + } +#endif + /* Function 0 doesn't need checking */ if (!Slot.u.bits.FunctionNumber) return TRUE; -- 2.17.1