Author: hpoussin
Date: Fri Dec 14 11:53:56 2007
New Revision: 31207
URL:
http://svn.reactos.org/svn/reactos?rev=31207&view=rev
Log:
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
Removed:
trunk/reactos/hal/halx86/mp/halinit.c
trunk/reactos/hal/halx86/mp/halmp.rbuild
trunk/reactos/hal/halx86/up/halup.rbuild
trunk/reactos/hal/halx86/xbox/halxbox.rbuild
trunk/reactos/hal/halx86/xbox/pci_xbox.c
Modified:
trunk/reactos/hal/halx86/directory.rbuild
trunk/reactos/hal/halx86/generic/bus.c
trunk/reactos/hal/halx86/generic/generic.rbuild
trunk/reactos/hal/halx86/generic/halinit.c
trunk/reactos/hal/halx86/generic/pci.c
trunk/reactos/hal/halx86/include/halp.h
trunk/reactos/hal/halx86/mp/halinit_mp.c
trunk/reactos/hal/halx86/xbox/halinit_xbox.c
trunk/reactos/hal/halx86/xbox/part_xbox.c
Modified: trunk/reactos/hal/halx86/directory.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/directory.rbuil…
==============================================================================
--- trunk/reactos/hal/halx86/directory.rbuild (original)
+++ trunk/reactos/hal/halx86/directory.rbuild Fri Dec 14 11:53:56 2007
@@ -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>
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 Fri Dec 14 11:53:56 2007
@@ -56,14 +56,14 @@
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 @@
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 @@
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 */
Modified: trunk/reactos/hal/halx86/generic/generic.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/generic…
==============================================================================
--- trunk/reactos/hal/halx86/generic/generic.rbuild (original)
+++ trunk/reactos/hal/halx86/generic/generic.rbuild Fri Dec 14 11:53:56 2007
@@ -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>
Modified: trunk/reactos/hal/halx86/generic/halinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/halinit…
==============================================================================
--- trunk/reactos/hal/halx86/generic/halinit.c (original)
+++ trunk/reactos/hal/halx86/generic/halinit.c Fri Dec 14 11:53:56 2007
@@ -14,7 +14,6 @@
/* GLOBALS *******************************************************************/
-HALP_HOOKS HalpHooks;
BOOLEAN HalpPciLockSettings;
/* PRIVATE FUNCTIONS *********************************************************/
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 Fri Dec 14 11:53:56 2007
@@ -346,6 +346,26 @@
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);
@@ -416,6 +436,21 @@
UCHAR PciBuffer[PCI_COMMON_HDR_LENGTH];
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 @@
NTAPI
HalpInitializePciBus(VOID)
{
- /* Initialize the hooks */
- if (HalpHooks.InitPciBus) HalpHooks.InitPciBus(&HalpFakePciBusHandler);
-
/* Initialize the stubs */
HalpInitializePciStubs();
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 Fri Dec 14 11:53:56 2007
@@ -115,12 +115,6 @@
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 */
Removed: trunk/reactos/hal/halx86/mp/halinit.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/halinit.c?re…
==============================================================================
--- trunk/reactos/hal/halx86/mp/halinit.c (original)
+++ trunk/reactos/hal/halx86/mp/halinit.c (removed)
@@ -1,153 +1,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(a)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 */
Modified: trunk/reactos/hal/halx86/mp/halinit_mp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/halinit_mp.c…
==============================================================================
--- trunk/reactos/hal/halx86/mp/halinit_mp.c (original)
+++ trunk/reactos/hal/halx86/mp/halinit_mp.c Fri Dec 14 11:53:56 2007
@@ -21,6 +21,12 @@
ULONG_PTR KernelBase;
/***************************************************************************/
+
+VOID NTAPI HalpInitPICs(VOID)
+{
+ UNIMPLEMENTED;
+}
+
VOID
HalpInitPhase0(PLOADER_PARAMETER_BLOCK LoaderBlock)
Removed: trunk/reactos/hal/halx86/mp/halmp.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/mp/halmp.rbuild…
==============================================================================
--- trunk/reactos/hal/halx86/mp/halmp.rbuild (original)
+++ trunk/reactos/hal/halx86/mp/halmp.rbuild (removed)
@@ -1,25 +1,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>
Removed: trunk/reactos/hal/halx86/up/halup.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/up/halup.rbuild…
==============================================================================
--- trunk/reactos/hal/halx86/up/halup.rbuild (original)
+++ trunk/reactos/hal/halx86/up/halup.rbuild (removed)
@@ -1,16 +1,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>
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 Fri Dec 14 11:53:56 2007
@@ -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();
}
Removed: trunk/reactos/hal/halx86/xbox/halxbox.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/xbox/halxbox.rb…
==============================================================================
--- trunk/reactos/hal/halx86/xbox/halxbox.rbuild (original)
+++ trunk/reactos/hal/halx86/xbox/halxbox.rbuild (removed)
@@ -1,19 +1,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>
Modified: trunk/reactos/hal/halx86/xbox/part_xbox.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/xbox/part_xbox.…
==============================================================================
--- trunk/reactos/hal/halx86/xbox/part_xbox.c (original)
+++ trunk/reactos/hal/halx86/xbox/part_xbox.c Fri Dec 14 11:53:56 2007
@@ -11,7 +11,7 @@
/* INCLUDES *****************************************************************/
-#include <halxbox.h>
+#include "halxbox.h"
#define NDEBUG
#include <debug.h>
Removed: 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 (removed)
@@ -1,100 +1,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(a)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 */