Author: hpoussin
Date: Thu Dec 13 18:34:02 2007
New Revision: 31194
URL:
http://svn.reactos.org/svn/reactos?rev=31194&view=rev
Log:
Use PBUS_HANDLER->Get/SetBusData function pointers to call PCI bus handler
Update Xbox PCI bus management after HAL changes
Fix typo
Modified:
trunk/reactos/hal/halx86/generic/bus.c
trunk/reactos/hal/halx86/generic/pci.c
trunk/reactos/hal/halx86/include/bus.h
trunk/reactos/hal/halx86/include/halp.h
trunk/reactos/hal/halx86/xbox/halinit_xbox.c
trunk/reactos/hal/halx86/xbox/halxbox.h
trunk/reactos/hal/halx86/xbox/pci_xbox.c
Modified: trunk/reactos/hal/halx86/generic/bus.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/bus.c?r…
==============================================================================
--- trunk/reactos/hal/halx86/generic/bus.c (original)
+++ trunk/reactos/hal/halx86/generic/bus.c Thu Dec 13 18:34:02 2007
@@ -233,12 +233,12 @@
BusHandler.BusNumber = BusNumber;
/* Call PCI function */
- return HalpGetPCIData(&BusHandler,
- &BusHandler,
- *(PPCI_SLOT_NUMBER)&SlotNumber,
- Buffer,
- Offset,
- Length);
+ return HalpFakePciBusHandler.GetBusData(&BusHandler,
+ &BusHandler,
+ *(PPCI_SLOT_NUMBER)&SlotNumber,
+ Buffer,
+ Offset,
+ Length);
}
/* Invalid bus */
@@ -312,12 +312,12 @@
BusHandler.BusNumber = BusNumber;
/* Call PCI function */
- return HalpSetPCIData(&BusHandler,
- &BusHandler,
- *(PPCI_SLOT_NUMBER)&SlotNumber,
- Buffer,
- Offset,
- Length);
+ return HalpFakePciBusHandler.SetBusData(&BusHandler,
+ &BusHandler,
+ *(PPCI_SLOT_NUMBER)&SlotNumber,
+ Buffer,
+ Offset,
+ Length);
}
/* Invalid bus */
Modified: trunk/reactos/hal/halx86/generic/pci.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/pci.c?r…
==============================================================================
--- trunk/reactos/hal/halx86/generic/pci.c (original)
+++ trunk/reactos/hal/halx86/generic/pci.c Thu Dec 13 18:34:02 2007
@@ -55,7 +55,7 @@
{
/* Synchronization */
(FncSync)HalpPCISynchronizeType2,
- (FncReleaseSync)HalpPCIReleaseSynchronzationType2,
+ (FncReleaseSync)HalpPCIReleaseSynchronizationType2,
/* Read */
{
@@ -187,8 +187,8 @@
VOID
NTAPI
-HalpPCIReleaseSynchronzationType2(IN PBUS_HANDLER BusHandler,
- IN KIRQL Irql)
+HalpPCIReleaseSynchronizationType2(IN PBUS_HANDLER BusHandler,
+ IN KIRQL Irql)
{
PCI_TYPE2_CSE_BITS PciCfg2Cse;
PPCIPBUSDATA BusData = (PPCIPBUSDATA)BusHandler->BusData;
@@ -893,6 +893,9 @@
NTAPI
HalpInitializePciBus(VOID)
{
+ /* Initialize the hooks */
+ if (HalpHooks.InitPciBus) HalpHooks.InitPciBus(&HalpFakePciBusHandler);
+
/* Initialize the stubs */
HalpInitializePciStubs();
Modified: trunk/reactos/hal/halx86/include/bus.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/bus.h?r…
==============================================================================
--- trunk/reactos/hal/halx86/include/bus.h (original)
+++ trunk/reactos/hal/halx86/include/bus.h Thu Dec 13 18:34:02 2007
@@ -170,7 +170,7 @@
VOID
NTAPI
-HalpPCIReleaseSynchronzationType2(
+HalpPCIReleaseSynchronizationType2(
IN PBUS_HANDLER BusHandler,
IN KIRQL Irql
);
Modified: trunk/reactos/hal/halx86/include/halp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/halp.h?…
==============================================================================
--- trunk/reactos/hal/halx86/include/halp.h (original)
+++ trunk/reactos/hal/halx86/include/halp.h Thu Dec 13 18:34:02 2007
@@ -117,7 +117,7 @@
typedef struct tagHALP_HOOKS
{
- void (*InitPciBus)(ULONG BusNumber, PBUS_HANDLER BusHandler);
+ void (*InitPciBus)(PBUS_HANDLER BusHandler);
} HALP_HOOKS, *PHALP_HOOKS;
extern HALP_HOOKS HalpHooks;
Modified: trunk/reactos/hal/halx86/xbox/halinit_xbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/xbox/halinit_xb…
==============================================================================
--- trunk/reactos/hal/halx86/xbox/halinit_xbox.c (original)
+++ trunk/reactos/hal/halx86/xbox/halinit_xbox.c Thu Dec 13 18:34:02 2007
@@ -21,25 +21,14 @@
VOID
HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
{
- HalpHooks.InitPciBus = HalpXboxInitPciBus;
+ HalpHooks.InitPciBus = HalpXboxInitPciBus;
- HalpInitPICs();
-
- /* Setup busy waiting */
- //HalpCalibrateStallExecution();
-
- HalpXboxInitPartIo();
+ HalpXboxInitPartIo();
}
VOID
HalpInitPhase1(VOID)
{
- /* Enable the clock interrupt */
- ((PKIPCR)KeGetPcr())->IDT[0x30].ExtendedOffset =
- (USHORT)(((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF);
- ((PKIPCR)KeGetPcr())->IDT[0x30].Offset =
- (USHORT)HalpClockInterrupt;
- HalEnableSystemInterrupt(0x30, CLOCK2_LEVEL, Latched);
}
/* EOF */
Modified: trunk/reactos/hal/halx86/xbox/halxbox.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/xbox/halxbox.h?…
==============================================================================
--- trunk/reactos/hal/halx86/xbox/halxbox.h (original)
+++ trunk/reactos/hal/halx86/xbox/halxbox.h Thu Dec 13 18:34:02 2007
@@ -18,8 +18,8 @@
extern UCHAR XboxFont8x16[256 * 16];
-void HalpXboxInitPciBus(ULONG BusNumber, PBUS_HANDLER BusHandler);
-void HalpXboxInitPartIo(void);
+VOID HalpXboxInitPciBus(PBUS_HANDLER BusHandler);
+VOID HalpXboxInitPartIo(VOID);
#endif /* HALXBOX_H_INCLUDED */
Modified: trunk/reactos/hal/halx86/xbox/pci_xbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/xbox/pci_xbox.c…
==============================================================================
--- trunk/reactos/hal/halx86/xbox/pci_xbox.c (original)
+++ trunk/reactos/hal/halx86/xbox/pci_xbox.c Thu Dec 13 18:34:02 2007
@@ -23,18 +23,8 @@
/* VARIABLES ***************************************************************/
-static ULONG (NTAPI *GenericGetPciData)(IN PBUS_HANDLER BusHandler,
- IN PBUS_HANDLER RootHandler,
- IN PCI_SLOT_NUMBER SlotNumber,
- OUT PUCHAR Buffer,
- IN ULONG Offset,
- IN ULONG Length);
-static ULONG (NTAPI *GenericSetPciData)(IN PBUS_HANDLER BusHandler,
- IN PBUS_HANDLER RootHandler,
- IN PCI_SLOT_NUMBER SlotNumber,
- IN PUCHAR Buffer,
- IN ULONG Offset,
- IN ULONG Length);
+static pGetSetBusData GenericGetPciData;
+static pGetSetBusData GenericSetPciData;
/* FUNCTIONS ***************************************************************/
@@ -46,28 +36,28 @@
IN ULONG Offset,
IN ULONG Length)
{
- ULONG BusNumber = BusHandler->BusNumber;
+ ULONG BusNumber = BusHandler->BusNumber;
- 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);
+ 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 && 0 == SlotNumber.u.bits.DeviceNumber &&
- (1 == SlotNumber.u.bits.FunctionNumber || 2 == SlotNumber.u.bits.FunctionNumber))
||
- (1 == BusNumber && 0 != SlotNumber.u.bits.DeviceNumber))
+ if ((0 == BusNumber && 0 == SlotNumber.u.bits.DeviceNumber &&
+ (1 == SlotNumber.u.bits.FunctionNumber || 2 ==
SlotNumber.u.bits.FunctionNumber)) ||
+ (1 == BusNumber && 0 != SlotNumber.u.bits.DeviceNumber))
{
- DPRINT("Blacklisted PCI slot\n");
- if (0 == Offset && 2 <= Length)
+ DPRINT("Blacklisted PCI slot\n");
+ if (0 == Offset && 2 <= Length)
{
- *(PUSHORT)Buffer = PCI_INVALID_VENDORID;
- return 2;
+ *(PUSHORT)Buffer = PCI_INVALID_VENDORID;
+ return 2;
}
- return 0;
+ return 0;
}
- return GenericGetPciData(BusHandler, RootHandler, SlotNumber, Buffer, Offset, Length);
+ return GenericGetPciData(BusHandler, RootHandler, SlotNumber, Buffer, Offset,
Length);
}
static ULONG NTAPI
@@ -78,35 +68,33 @@
IN ULONG Offset,
IN ULONG Length)
{
- ULONG BusNumber = BusHandler->BusNumber;
+ ULONG BusNumber = BusHandler->BusNumber;
- DPRINT("HalpXboxSetPciData() called.\n");
- DPRINT(" BusNumber %lu\n", BusNumber);
- DPRINT(" SlotNumber %lu\n", SlotNumber);
- DPRINT(" Offset 0x%lx\n", Offset);
- DPRINT(" Length 0x%lx\n", Length);
+ DPRINT("HalpXboxSetPciData() 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 && 0 == SlotNumber.u.bits.DeviceNumber &&
- (1 == SlotNumber.u.bits.FunctionNumber || 2 == SlotNumber.u.bits.FunctionNumber))
||
- (1 == BusNumber && 0 != SlotNumber.u.bits.DeviceNumber))
+ if ((0 == BusNumber && 0 == SlotNumber.u.bits.DeviceNumber &&
+ (1 == SlotNumber.u.bits.FunctionNumber || 2 ==
SlotNumber.u.bits.FunctionNumber)) ||
+ (1 == BusNumber && 0 != SlotNumber.u.bits.DeviceNumber))
{
- DPRINT1("Trying to set data on blacklisted PCI slot\n");
- return 0;
+ DPRINT1("Trying to set data on blacklisted PCI slot\n");
+ return 0;
}
- return GenericSetPciData(BusHandler, RootHandler, SlotNumber, Buffer, Offset, Length);
+ return GenericSetPciData(BusHandler, RootHandler, SlotNumber, Buffer, Offset,
Length);
}
-void
-HalpXboxInitPciBus(ULONG BusNumber, PBUS_HANDLER BusHandler)
+VOID
+HalpXboxInitPciBus(PBUS_HANDLER BusHandler)
{
- if (0 == BusNumber || 1 == BusNumber)
- {
- GenericGetPciData = BusHandler->GetBusData;
- BusHandler->GetBusData = HalpXboxGetPciData;
- GenericSetPciData = BusHandler->SetBusData;
- BusHandler->SetBusData = HalpXboxSetPciData;
- }
+ /* Use our own handlers to prevent a freeze */
+ GenericGetPciData = BusHandler->GetBusData;
+ BusHandler->GetBusData = HalpXboxGetPciData;
+ GenericSetPciData = BusHandler->SetBusData;
+ BusHandler->SetBusData = HalpXboxSetPciData;
}
/* EOF */