mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Use PBUS_HANDLER->Get/SetBusData function pointers to call PCI bus handler
Update Xbox PCI bus management after HAL changes Fix typo svn path=/trunk/; revision=31194
This commit is contained in:
parent
adf80d74b3
commit
82ae7dcf03
7 changed files with 60 additions and 80 deletions
|
@ -233,12 +233,12 @@ HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
|
|||
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 @@ HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
|
|||
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 */
|
||||
|
|
|
@ -55,7 +55,7 @@ PCI_CONFIG_HANDLER PCIConfigHandlerType2 =
|
|||
{
|
||||
/* Synchronization */
|
||||
(FncSync)HalpPCISynchronizeType2,
|
||||
(FncReleaseSync)HalpPCIReleaseSynchronzationType2,
|
||||
(FncReleaseSync)HalpPCIReleaseSynchronizationType2,
|
||||
|
||||
/* Read */
|
||||
{
|
||||
|
@ -187,8 +187,8 @@ HalpPCISynchronizeType2(IN PBUS_HANDLER BusHandler,
|
|||
|
||||
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 @@ VOID
|
|||
NTAPI
|
||||
HalpInitializePciBus(VOID)
|
||||
{
|
||||
/* Initialize the hooks */
|
||||
if (HalpHooks.InitPciBus) HalpHooks.InitPciBus(&HalpFakePciBusHandler);
|
||||
|
||||
/* Initialize the stubs */
|
||||
HalpInitializePciStubs();
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ HalpPCISynchronizeType2(
|
|||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpPCIReleaseSynchronzationType2(
|
||||
HalpPCIReleaseSynchronizationType2(
|
||||
IN PBUS_HANDLER BusHandler,
|
||||
IN KIRQL Irql
|
||||
);
|
||||
|
|
|
@ -117,7 +117,7 @@ HaliSetSystemInformation(
|
|||
|
||||
typedef struct tagHALP_HOOKS
|
||||
{
|
||||
void (*InitPciBus)(ULONG BusNumber, PBUS_HANDLER BusHandler);
|
||||
void (*InitPciBus)(PBUS_HANDLER BusHandler);
|
||||
} HALP_HOOKS, *PHALP_HOOKS;
|
||||
|
||||
extern HALP_HOOKS HalpHooks;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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 @@ HalpXboxGetPciData(IN PBUS_HANDLER BusHandler,
|
|||
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 @@ HalpXboxSetPciData(IN PBUS_HANDLER BusHandler,
|
|||
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 */
|
||||
|
|
Loading…
Reference in a new issue