mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 15:05:54 +00:00
Remove HALP_HOOKS structure
Revert r31198 and part of r31194, and replace them by compile-time define in pci.c Don't use one rbuild file per hal, but merge them into one Share halinit.c between UP and MP versions svn path=/trunk/; revision=31207
This commit is contained in:
parent
9cae851aec
commit
c77f80bc75
14 changed files with 133 additions and 358 deletions
|
@ -4,13 +4,66 @@
|
|||
<directory name="generic">
|
||||
<xi:include href="generic/generic.rbuild" />
|
||||
</directory>
|
||||
<directory name="up">
|
||||
<xi:include href="up/halup.rbuild" />
|
||||
</directory>
|
||||
<directory name="mp">
|
||||
<xi:include href="mp/halmp.rbuild" />
|
||||
</directory>
|
||||
<directory name="xbox">
|
||||
<xi:include href="xbox/halxbox.rbuild" />
|
||||
</directory>
|
||||
|
||||
<module name="halup" type="kernelmodedll" entrypoint="0">
|
||||
<importlibrary definition="../hal/hal.def" />
|
||||
<bootstrap installbase="$(CDOUTPUT)" nameoncd="hal.dll" />
|
||||
<include>include</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_NTHAL_" />
|
||||
<library>hal_generic</library>
|
||||
<library>hal_generic_up</library>
|
||||
<library>hal_generic_pc</library>
|
||||
<library>ntoskrnl</library>
|
||||
<directory name="up">
|
||||
<file>halinit_up.c</file>
|
||||
<file>halup.rc</file>
|
||||
</directory>
|
||||
</module>
|
||||
<module name="halmp" type="kernelmodedll" entrypoint="0">
|
||||
<importlibrary definition="../hal/hal.def" />
|
||||
<bootstrap installbase="$(CDOUTPUT)" />
|
||||
<include>include</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="CONFIG_SMP" />
|
||||
<define name="_NTHAL_" />
|
||||
<library>hal_generic</library>
|
||||
<library>hal_generic_pc</library>
|
||||
<library>ntoskrnl</library>
|
||||
<directory name="mp">
|
||||
<file>apic.c</file>
|
||||
<file>halinit_mp.c</file>
|
||||
<file>ioapic.c</file>
|
||||
<file>ipi_mp.c</file>
|
||||
<file>mpconfig.c</file>
|
||||
<file>mps.S</file>
|
||||
<file>mpsboot.asm</file>
|
||||
<file>mpsirql.c</file>
|
||||
<file>processor_mp.c</file>
|
||||
<file>spinlock.c</file>
|
||||
<file>halmp.rc</file>
|
||||
</directory>
|
||||
</module>
|
||||
<module name="halxbox" type="kernelmodedll" entrypoint="0" allowwarnings="true">
|
||||
<importlibrary definition="../hal/hal.def" />
|
||||
<include>include</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_NTHAL_" />
|
||||
<define name="SARCH_XBOX" />
|
||||
<library>hal_generic</library>
|
||||
<library>hal_generic_up</library>
|
||||
<library>ntoskrnl</library>
|
||||
<directory name="generic">
|
||||
<file>pci.c</file>
|
||||
</directory>
|
||||
<directory name="xbox">
|
||||
<file>halinit_xbox.c</file>
|
||||
<file>part_xbox.c</file>
|
||||
<file>halxbox.rc</file>
|
||||
<pch>halxbox.h</pch>
|
||||
</directory>
|
||||
</module>
|
||||
</group>
|
||||
|
|
|
@ -56,14 +56,14 @@ HalpAssignSlotResources(IN PUNICODE_STRING RegistryPath,
|
|||
BusHandler.BusNumber = BusNumber;
|
||||
|
||||
/* Call the PCI function */
|
||||
return BusHandler.AssignSlotResources(&BusHandler,
|
||||
&BusHandler,
|
||||
RegistryPath,
|
||||
DriverClassName,
|
||||
DriverObject,
|
||||
DeviceObject,
|
||||
SlotNumber,
|
||||
AllocatedResources);
|
||||
return HalpAssignPCISlotResources(&BusHandler,
|
||||
&BusHandler,
|
||||
RegistryPath,
|
||||
DriverClassName,
|
||||
DriverObject,
|
||||
DeviceObject,
|
||||
SlotNumber,
|
||||
AllocatedResources);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
|
@ -233,12 +233,12 @@ HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
|
|||
BusHandler.BusNumber = BusNumber;
|
||||
|
||||
/* Call PCI function */
|
||||
return BusHandler.GetBusData(&BusHandler,
|
||||
&BusHandler,
|
||||
*(PPCI_SLOT_NUMBER)&SlotNumber,
|
||||
Buffer,
|
||||
Offset,
|
||||
Length);
|
||||
return HalpGetPCIData(&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 BusHandler.SetBusData(&BusHandler,
|
||||
&BusHandler,
|
||||
*(PPCI_SLOT_NUMBER)&SlotNumber,
|
||||
Buffer,
|
||||
Offset,
|
||||
Length);
|
||||
return HalpSetPCIData(&BusHandler,
|
||||
&BusHandler,
|
||||
*(PPCI_SLOT_NUMBER)&SlotNumber,
|
||||
Buffer,
|
||||
Offset,
|
||||
Length);
|
||||
}
|
||||
|
||||
/* Invalid bus */
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<file>dma.c</file>
|
||||
<file>drive.c</file>
|
||||
<file>display.c</file>
|
||||
<file>halinit.c</file>
|
||||
<file>misc.c</file>
|
||||
<file>pci.c</file>
|
||||
<file>portio.c</file>
|
||||
<file>profil.c</file>
|
||||
<file>reboot.c</file>
|
||||
|
@ -28,8 +28,14 @@
|
|||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_NTHAL_" />
|
||||
<file>irq.S</file>
|
||||
<file>halinit.c</file>
|
||||
<file>processor.c</file>
|
||||
<file>spinlock.c</file>
|
||||
</module>
|
||||
<module name="hal_generic_pc" type="objectlibrary">
|
||||
<include base="hal_generic_pc">../include</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_NTHAL_" />
|
||||
<file>pci.c</file>
|
||||
</module>
|
||||
</group>
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
HALP_HOOKS HalpHooks;
|
||||
BOOLEAN HalpPciLockSettings;
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
|
|
@ -346,6 +346,26 @@ HalpGetPCIData(IN PBUS_HANDLER BusHandler,
|
|||
PPCI_COMMON_CONFIG PciConfig = (PPCI_COMMON_CONFIG)PciBuffer;
|
||||
ULONG Len = 0;
|
||||
|
||||
#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 ((0 == BusHandler->BusNumber && 0 == Slot.u.bits.DeviceNumber &&
|
||||
(1 == Slot.u.bits.FunctionNumber || 2 == Slot.u.bits.FunctionNumber)) ||
|
||||
(1 == BusHandler->BusNumber && 0 != Slot.u.bits.DeviceNumber))
|
||||
{
|
||||
DPRINT("Blacklisted PCI slot\n");
|
||||
if (0 == Offset && 2 <= Length)
|
||||
{
|
||||
*(PUSHORT)Buffer = PCI_INVALID_VENDORID;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Normalize the length */
|
||||
if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG);
|
||||
|
||||
|
@ -417,6 +437,21 @@ HalpSetPCIData(IN PBUS_HANDLER BusHandler,
|
|||
PPCI_COMMON_CONFIG PciConfig = (PPCI_COMMON_CONFIG)PciBuffer;
|
||||
ULONG Len = 0;
|
||||
|
||||
#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 ((0 == BusHandler->BusNumber && 0 == Slot.u.bits.DeviceNumber &&
|
||||
(1 == Slot.u.bits.FunctionNumber || 2 == Slot.u.bits.FunctionNumber)) ||
|
||||
(1 == BusHandler->BusNumber && 0 != Slot.u.bits.DeviceNumber))
|
||||
{
|
||||
DPRINT1("Trying to set data on blacklisted PCI slot\n");
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Normalize the length */
|
||||
if (Length > sizeof(PCI_COMMON_CONFIG)) Length = sizeof(PCI_COMMON_CONFIG);
|
||||
|
||||
|
@ -893,9 +928,6 @@ VOID
|
|||
NTAPI
|
||||
HalpInitializePciBus(VOID)
|
||||
{
|
||||
/* Initialize the hooks */
|
||||
if (HalpHooks.InitPciBus) HalpHooks.InitPciBus(&HalpFakePciBusHandler);
|
||||
|
||||
/* Initialize the stubs */
|
||||
HalpInitializePciStubs();
|
||||
|
||||
|
|
|
@ -115,12 +115,6 @@ HaliSetSystemInformation(
|
|||
IN OUT PVOID Buffer
|
||||
);
|
||||
|
||||
typedef struct tagHALP_HOOKS
|
||||
{
|
||||
void (*InitPciBus)(PBUS_HANDLER BusHandler);
|
||||
} HALP_HOOKS, *PHALP_HOOKS;
|
||||
|
||||
extern HALP_HOOKS HalpHooks;
|
||||
extern KSPIN_LOCK HalpSystemHardwareLock;
|
||||
|
||||
#endif /* __INTERNAL_HAL_HAL_H */
|
||||
|
|
|
@ -1,153 +0,0 @@
|
|||
/*
|
||||
* PROJECT: ReactOS HAL
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: hal/halx86/generic/halinit.c
|
||||
* PURPOSE: HAL Entrypoint and Initialization
|
||||
* PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
|
||||
*/
|
||||
|
||||
/* INCLUDES ******************************************************************/
|
||||
|
||||
#include <hal.h>
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* GLOBALS *******************************************************************/
|
||||
|
||||
HALP_HOOKS HalpHooks;
|
||||
BOOLEAN HalpPciLockSettings;
|
||||
|
||||
/* PRIVATE FUNCTIONS *********************************************************/
|
||||
|
||||
VOID
|
||||
NTAPI
|
||||
HalpGetParameters(IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
PCHAR CommandLine;
|
||||
|
||||
/* Make sure we have a loader block and command line */
|
||||
if ((LoaderBlock) && (LoaderBlock->LoadOptions))
|
||||
{
|
||||
/* Read the command line */
|
||||
CommandLine = LoaderBlock->LoadOptions;
|
||||
|
||||
/* Check if PCI is locked */
|
||||
if (strstr(CommandLine, "PCILOCK")) HalpPciLockSettings = TRUE;
|
||||
|
||||
/* Check for initial breakpoint */
|
||||
if (strstr(CommandLine, "BREAK")) DbgBreakPoint();
|
||||
}
|
||||
}
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
HalInitSystem(IN ULONG BootPhase,
|
||||
IN PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
PKPRCB Prcb = KeGetCurrentPrcb();
|
||||
|
||||
/* Check the boot phase */
|
||||
if (!BootPhase)
|
||||
{
|
||||
/* Phase 0... save bus type */
|
||||
HalpBusType = LoaderBlock->u.I386.MachineType & 0xFF;
|
||||
|
||||
/* Get command-line parameters */
|
||||
HalpGetParameters(LoaderBlock);
|
||||
|
||||
/* Checked HAL requires checked kernel */
|
||||
#if DBG
|
||||
if (!(Prcb->BuildType & PRCB_BUILD_DEBUG))
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 1, 0);
|
||||
}
|
||||
#else
|
||||
/* Release build requires release HAL */
|
||||
if (Prcb->BuildType & PRCB_BUILD_DEBUG)
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_SMP
|
||||
/* SMP HAL requires SMP kernel */
|
||||
if (Prcb->BuildType & PRCB_BUILD_UNIPROCESSOR)
|
||||
{
|
||||
/* No match, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 2, Prcb->BuildType, 0, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Validate the PRCB */
|
||||
if (Prcb->MajorVersion != PRCB_MAJOR_VERSION)
|
||||
{
|
||||
/* Validation failed, bugcheck */
|
||||
KeBugCheckEx(MISMATCHED_HAL, 1, Prcb->MajorVersion, 1, 0);
|
||||
}
|
||||
|
||||
/* Initialize the PICs */
|
||||
//HalpInitPICs();
|
||||
|
||||
/* Force initial PIC state */
|
||||
KfRaiseIrql(KeGetCurrentIrql());
|
||||
|
||||
/* Initialize the clock */
|
||||
HalpInitializeClock();
|
||||
|
||||
/* Setup busy waiting */
|
||||
//HalpCalibrateStallExecution();
|
||||
|
||||
/* Fill out the dispatch tables */
|
||||
HalQuerySystemInformation = HaliQuerySystemInformation;
|
||||
HalSetSystemInformation = HaliSetSystemInformation;
|
||||
HalInitPnpDriver = NULL; // FIXME: TODO
|
||||
HalGetDmaAdapter = HalpGetDmaAdapter;
|
||||
HalGetInterruptTranslator = NULL; // FIXME: TODO
|
||||
|
||||
/* Initialize the hardware lock (CMOS) */
|
||||
KeInitializeSpinLock(&HalpSystemHardwareLock);
|
||||
}
|
||||
else if (BootPhase == 1)
|
||||
{
|
||||
/* Initialize the default HAL stubs for bus handling functions */
|
||||
HalpInitNonBusHandler();
|
||||
|
||||
/* Enable the clock interrupt */
|
||||
((PKIPCR)KeGetPcr())->IDT[0x30].ExtendedOffset =
|
||||
(USHORT)(((ULONG_PTR)HalpClockInterrupt >> 16) & 0xFFFF);
|
||||
((PKIPCR)KeGetPcr())->IDT[0x30].Offset =
|
||||
(ULONG_PTR)HalpClockInterrupt;
|
||||
HalEnableSystemInterrupt(0x30, CLOCK2_LEVEL, Latched);
|
||||
|
||||
/* Initialize DMA. NT does this in Phase 0 */
|
||||
HalpInitDma();
|
||||
}
|
||||
|
||||
/* All done, return */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
VOID
|
||||
NTAPI
|
||||
HalReportResourceUsage(VOID)
|
||||
{
|
||||
/* Initialize PCI bus. */
|
||||
HalpInitializePciBus();
|
||||
|
||||
/* FIXME: This is done in ReactOS MP HAL only*/
|
||||
//HaliReconfigurePciInterrupts();
|
||||
|
||||
/* FIXME: Report HAL Usage to kernel */
|
||||
}
|
||||
|
||||
/* EOF */
|
|
@ -21,6 +21,12 @@ extern BOOLEAN HaliFindSmpConfig(VOID);
|
|||
ULONG_PTR KernelBase;
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
VOID NTAPI HalpInitPICs(VOID)
|
||||
{
|
||||
UNIMPLEMENTED;
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="halmp" type="kernelmodedll" entrypoint="0">
|
||||
<importlibrary definition="../../hal/hal.def" />
|
||||
<bootstrap installbase="$(CDOUTPUT)" />
|
||||
<include base="hal_generic">../include</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="CONFIG_SMP" />
|
||||
<define name="_NTHAL_" />
|
||||
<library>hal_generic</library>
|
||||
<library>ntoskrnl</library>
|
||||
<file>apic.c</file>
|
||||
<file>halinit.c</file>
|
||||
<file>halinit_mp.c</file>
|
||||
<file>ioapic.c</file>
|
||||
<file>ipi_mp.c</file>
|
||||
<file>mpconfig.c</file>
|
||||
<file>mps.S</file>
|
||||
<file>mpsboot.asm</file>
|
||||
<file>mpsirql.c</file>
|
||||
<file>processor_mp.c</file>
|
||||
<file>spinlock.c</file>
|
||||
<file>halmp.rc</file>
|
||||
</module>
|
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="halup" type="kernelmodedll" entrypoint="0">
|
||||
<importlibrary definition="../../hal/hal.def" />
|
||||
<bootstrap installbase="$(CDOUTPUT)" nameoncd="hal.dll" />
|
||||
<include base="hal_generic">../include</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="_NTHAL_" />
|
||||
<linkerflag>-enable-stdcall-fixup</linkerflag>
|
||||
<library>hal_generic</library>
|
||||
<library>hal_generic_up</library>
|
||||
<library>ntoskrnl</library>
|
||||
<file>halinit_up.c</file>
|
||||
<file>halup.rc</file>
|
||||
</module>
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <halxbox.h>
|
||||
#include "halxbox.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
@ -21,8 +21,6 @@
|
|||
VOID
|
||||
HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
|
||||
{
|
||||
HalpHooks.InitPciBus = HalpXboxInitPciBus;
|
||||
|
||||
HalpXboxInitPartIo();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module SYSTEM "../../../tools/rbuild/project.dtd">
|
||||
<module name="halxbox" type="kernelmodedll" entrypoint="0" allowwarnings="true">
|
||||
<importlibrary definition="../../hal/hal.def" />
|
||||
<include base="hal_generic">../include</include>
|
||||
<include base="halxbox">.</include>
|
||||
<include base="ntoskrnl">include</include>
|
||||
<define name="_DISABLE_TIDENTS" />
|
||||
<define name="UP" />
|
||||
<define name="_NTHAL_" />
|
||||
<library>hal_generic</library>
|
||||
<library>hal_generic_up</library>
|
||||
<library>ntoskrnl</library>
|
||||
<file>halinit_xbox.c</file>
|
||||
<file>part_xbox.c</file>
|
||||
<file>pci_xbox.c</file>
|
||||
<file>halxbox.rc</file>
|
||||
<pch>halxbox.h</pch>
|
||||
</module>
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <halxbox.h>
|
||||
#include "halxbox.h"
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* 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
|
||||
*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <halxbox.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
/* VARIABLES ***************************************************************/
|
||||
|
||||
static pGetSetBusData GenericGetPciData;
|
||||
static pGetSetBusData GenericSetPciData;
|
||||
|
||||
/* FUNCTIONS ***************************************************************/
|
||||
|
||||
static ULONG NTAPI
|
||||
HalpXboxGetPciData(IN PBUS_HANDLER BusHandler,
|
||||
IN PBUS_HANDLER RootHandler,
|
||||
IN PCI_SLOT_NUMBER SlotNumber,
|
||||
OUT PUCHAR Buffer,
|
||||
IN ULONG Offset,
|
||||
IN ULONG Length)
|
||||
{
|
||||
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);
|
||||
|
||||
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)
|
||||
{
|
||||
*(PUSHORT)Buffer = PCI_INVALID_VENDORID;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GenericGetPciData(BusHandler, RootHandler, SlotNumber, Buffer, Offset, Length);
|
||||
}
|
||||
|
||||
static ULONG NTAPI
|
||||
HalpXboxSetPciData(IN PBUS_HANDLER BusHandler,
|
||||
IN PBUS_HANDLER RootHandler,
|
||||
IN PCI_SLOT_NUMBER SlotNumber,
|
||||
IN PUCHAR Buffer,
|
||||
IN ULONG Offset,
|
||||
IN ULONG Length)
|
||||
{
|
||||
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);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return GenericSetPciData(BusHandler, RootHandler, SlotNumber, Buffer, Offset, Length);
|
||||
}
|
||||
|
||||
VOID
|
||||
HalpXboxInitPciBus(PBUS_HANDLER BusHandler)
|
||||
{
|
||||
/* Use our own handlers to prevent a freeze */
|
||||
GenericGetPciData = BusHandler->GetBusData;
|
||||
BusHandler->GetBusData = HalpXboxGetPciData;
|
||||
GenericSetPciData = BusHandler->SetBusData;
|
||||
BusHandler->SetBusData = HalpXboxSetPciData;
|
||||
}
|
||||
|
||||
/* EOF */
|
Loading…
Add table
Add a link
Reference in a new issue