diff --git a/reactos/hal/halx86/generic/halinit.c b/reactos/hal/halx86/generic/halinit.c index ba203a39415..c41f1084a6a 100644 --- a/reactos/hal/halx86/generic/halinit.c +++ b/reactos/hal/halx86/generic/halinit.c @@ -1,4 +1,4 @@ -/* $Id: halinit.c,v 1.2 2004/12/04 21:40:55 gvg Exp $ +/* $Id: halinit.c,v 1.3 2004/12/04 22:52:59 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -20,6 +20,7 @@ /* GLOBALS *****************************************************************/ PVOID HalpZeroPageMapping = NULL; +HALP_HOOKS HalpHooks; /* FUNCTIONS ***************************************************************/ @@ -38,6 +39,7 @@ HalInitSystem (ULONG BootPhase, { if (BootPhase == 0) { + RtlZeroMemory(&HalpHooks, sizeof(HALP_HOOKS)); HalpInitPhase0(); } else if (BootPhase == 1) diff --git a/reactos/hal/halx86/generic/pci.c b/reactos/hal/halx86/generic/pci.c index 79d58aa562f..99b1ba8cc58 100644 --- a/reactos/hal/halx86/generic/pci.c +++ b/reactos/hal/halx86/generic/pci.c @@ -1,4 +1,4 @@ -/* $Id: pci.c,v 1.1 2004/12/03 20:10:43 gvg Exp $ +/* $Id: pci.c,v 1.2 2004/12/04 22:52:59 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -21,6 +21,7 @@ #include #include #include +#include #define NDEBUG #include @@ -764,6 +765,10 @@ HalpInitPciBus(VOID) // (pGetSetBusData)HalpAdjustPciResourceList; BusHandler->AssignSlotResources = (pAssignSlotResources)HalpAssignPciSlotResources; + if (NULL != HalpHooks.InitPciBus) + { + HalpHooks.InitPciBus(0, BusHandler); + } /* agp bus (bus 1) handler */ @@ -780,6 +785,10 @@ HalpInitPciBus(VOID) // (pGetSetBusData)HalpAdjustPciResourceList; BusHandler->AssignSlotResources = (pAssignSlotResources)HalpAssignPciSlotResources; + if (NULL != HalpHooks.InitPciBus) + { + HalpHooks.InitPciBus(1, BusHandler); + } /* PCI bus (bus 2) handler */ @@ -796,6 +805,10 @@ HalpInitPciBus(VOID) // (pGetSetBusData)HalpAdjustPciResourceList; BusHandler->AssignSlotResources = (pAssignSlotResources)HalpAssignPciSlotResources; + if (NULL != HalpHooks.InitPciBus) + { + HalpHooks.InitPciBus(2, BusHandler); + } DPRINT("HalpInitPciBus() finished.\n"); } diff --git a/reactos/hal/halx86/include/hal.h b/reactos/hal/halx86/include/hal.h index 9388831f5c6..395bdc27df0 100644 --- a/reactos/hal/halx86/include/hal.h +++ b/reactos/hal/halx86/include/hal.h @@ -433,8 +433,11 @@ static inline VOID Ki386WriteFsByte(ULONG offset, BYTE value) #error Unknown compiler for inline assembler #endif +typedef struct tagHALP_HOOKS +{ + void (*InitPciBus)(ULONG BusNumber, PBUS_HANDLER BusHandler); +} HALP_HOOKS, *PHALP_HOOKS; - - +extern HALP_HOOKS HalpHooks; #endif /* __INTERNAL_HAL_HAL_H */ diff --git a/reactos/hal/halx86/xbox/Makefile b/reactos/hal/halx86/xbox/Makefile index 17c122737fe..36c16349c3f 100644 --- a/reactos/hal/halx86/xbox/Makefile +++ b/reactos/hal/halx86/xbox/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 2004/12/04 21:43:37 gvg Exp $ +# $Id: Makefile,v 1.2 2004/12/04 22:52:59 gvg Exp $ PATH_TO_TOP = ../../.. @@ -64,7 +64,8 @@ XBOX_OBJECTS = \ flashleds.o \ display_xbox.o \ font.o \ - halinit_xbox.o + halinit_xbox.o \ + pci_xbox.o HAL_OBJECTS = $(GENERIC_OBJECTS) $(XBOX_OBJECTS) diff --git a/reactos/hal/halx86/xbox/halinit_xbox.c b/reactos/hal/halx86/xbox/halinit_xbox.c index 909683eb203..9bca0948cc7 100644 --- a/reactos/hal/halx86/xbox/halinit_xbox.c +++ b/reactos/hal/halx86/xbox/halinit_xbox.c @@ -1,4 +1,4 @@ -/* $Id: halinit_xbox.c,v 1.1 2004/12/04 21:43:37 gvg Exp $ +/* $Id: halinit_xbox.c,v 1.2 2004/12/04 22:52:59 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -13,6 +13,7 @@ #include #include +#include "halxbox.h" #define NDEBUG #include @@ -22,6 +23,8 @@ VOID HalpInitPhase0(VOID) { + HalpHooks.InitPciBus = HalpXboxInitPciBus; + HalpInitPICs(); /* Setup busy waiting */ diff --git a/reactos/hal/halx86/xbox/halxbox.h b/reactos/hal/halx86/xbox/halxbox.h index baf6424f31f..823054c90cc 100644 --- a/reactos/hal/halx86/xbox/halxbox.h +++ b/reactos/hal/halx86/xbox/halxbox.h @@ -1,4 +1,4 @@ -/* $Id: halxbox.h,v 1.1 2004/12/04 21:43:37 gvg Exp $ +/* $Id: halxbox.h,v 1.2 2004/12/04 22:52:59 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: Xbox HAL @@ -14,6 +14,8 @@ extern BYTE XboxFont8x16[256 * 16]; +void HalpXboxInitPciBus(ULONG BusNumber, PBUS_HANDLER BusHandler); + #endif /* HALXBOX_H_INCLUDED */ /* EOF */ diff --git a/reactos/hal/halx86/xbox/pci_xbox.c b/reactos/hal/halx86/xbox/pci_xbox.c new file mode 100644 index 00000000000..3a520a1dfb1 --- /dev/null +++ b/reactos/hal/halx86/xbox/pci_xbox.c @@ -0,0 +1,71 @@ +/* $Id: pci_xbox.c,v 1.1 2004/12/04 22:52:59 gvg Exp $ + * + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: hal/halx86/xbox/pci_xbox.c + * PURPOSE: Xbox specific handling of PCI cards + * PROGRAMMER: Ge van Geldorp (gvg@reactos.com) + * UPDATE HISTORY: + * 2004/12/04: Created + */ + +/* INCLUDES *****************************************************************/ + +#include +#include +#include +#include "halxbox.h" + +#define NDEBUG +#include + +/* VARIABLES ***************************************************************/ + +static ULONG (* STDCALL GenericGetPciData)(PBUS_HANDLER BusHandler, + ULONG BusNumber, + ULONG SlotNumber, + PVOID Buffer, + ULONG Offset, + ULONG Length); + +/* FUNCTIONS ***************************************************************/ + +static ULONG STDCALL +HalpXboxGetPciData(PBUS_HANDLER BusHandler, + ULONG BusNumber, + ULONG SlotNumber, + PVOID Buffer, + ULONG Offset, + ULONG Length) +{ + DPRINT("HalpXboxGetPciData() called.\n"); + DPRINT(" BusNumber %lu\n", BusNumber); + DPRINT(" SlotNumber %lu\n", SlotNumber); + DPRINT(" Offset 0x%lx\n", Offset); + DPRINT(" Length 0x%lx\n", Length); + + if (0 == BusNumber && (1 == ((SlotNumber >> 5) & 0x07) || 2 == ((SlotNumber >> 5) & 0x07))) + { + DPRINT("Blacklisted PCI slot\n"); + if (0 == Offset && 2 <= Length) + { + *(PUSHORT)Buffer = PCI_INVALID_VENDORID; + return 2; + } + return 0; + } + + return GenericGetPciData(BusHandler, BusNumber, SlotNumber, Buffer, Offset, Length); +} + +void +HalpXboxInitPciBus(ULONG BusNumber, PBUS_HANDLER BusHandler) +{ + if (0 == BusNumber) + { + GenericGetPciData = BusHandler->GetBusData; + BusHandler->GetBusData = HalpXboxGetPciData; + } +} + +/* EOF */