As a result, none of the Hal*Bus HALDISPATCH routines were implemented, which bus drivers expect to find when they're not on ACPI systems (ReactOS today). eVb's new PCI driver was crashing, for example.
Furthermore, legacy systems suffer, because the ACPI HAL Bus routines (that we currently have) expect perfect ACPI-style-compliant systems, not the legacy crap from the early 90ies. This works fine in VMs and new hardware, but old hardware is left behind.
This patch basically corrects the first part of the problem, by making the bus handling support separate between ACPI and non-ACPI HALs. For now, the code remains 100% the same in functionality between both.
However, I have started adding the first few elements:
[HAL]: Implement HalRegisterBusHandler HALDISPATCH routine.
[HAL]: On legacy HALs, register the CMOS, ISA, SYSTEM handlers.
[HAL]: Add cmosbus.c. Stub all bus-specific bus handler routines in the xxxbus.c files.
No real functionality change occurs with this patch, yet.
svn path=/trunk/; revision=47649
/*
* PROJECT: ReactOS HAL
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: hal/halx86/generic/bus/halbus.c
- * PURPOSE: Bus Support Routines
- * PROGRAMMERS: Alex Ionescu (alex.ionescu@reactos.org)
+ * LICENSE: BSD - See COPYING.ARM in the top level directory
+ * FILE: hal/halx86/generic/acpi/busemul.c
+ * PURPOSE: ACPI HAL Bus Handler Emulation Code
+ * PROGRAMMERS: ReactOS Portable Systems Group
*/
-/* INCLUDES ******************************************************************/
+/* INCLUDES *******************************************************************/
#include <hal.h>
#define NDEBUG
#include <debug.h>
-/* GLOBALS *******************************************************************/
+/* GLOBALS ********************************************************************/
-ULONG HalpBusType;
-
-/* PRIVATE FUNCTIONS *********************************************************/
+/* PRIVATE FUNCTIONS **********************************************************/
VOID
NTAPI
ULONG
NTAPI
-HalpGetSystemInterruptVector(IN ULONG BusNumber,
- IN ULONG BusInterruptLevel,
- IN ULONG BusInterruptVector,
- OUT PKIRQL Irql,
- OUT PKAFFINITY Affinity)
+HalpGetSystemInterruptVector_Acpi(IN ULONG BusNumber,
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity)
{
ULONG Vector = IRQ2VECTOR(BusInterruptLevel);
*Irql = (KIRQL)VECTOR2IRQL(Vector);
OUT PKAFFINITY Affinity)
{
/* Call the system bus translator */
- return HalpGetSystemInterruptVector(BusNumber,
- BusInterruptLevel,
- BusInterruptVector,
- Irql,
- Affinity);
+ return HalpGetSystemInterruptVector_Acpi(BusNumber,
+ BusInterruptLevel,
+ BusInterruptVector,
+ Irql,
+ Affinity);
}
/*
HalpGetNMICrashFlag();
}
+VOID
+NTAPI
+HalpInitNonBusHandler(VOID)
+{
+ /* These should be written by the PCI driver later, but we give defaults */
+ HalPciTranslateBusAddress = HalpTranslateBusAddress;
+ HalPciAssignSlotResources = HalpAssignSlotResources;
+ HalFindBusAddressTranslation = HalpFindBusAddressTranslation;
+}
+
+VOID
+NTAPI
+HalpInitBusHandlers(VOID)
+{
+ /* On ACPI, we only have a fake PCI bus to worry about */
+ HalpInitNonBusHandler();
+}
+
VOID
NTAPI
HalpBuildAddressMap(VOID)
+++ /dev/null
-/*
- * PROJECT: ReactOS HAL
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: hal/halx86/generic/bus/bushndlr.c
- * PURPOSE: Generic HAL Bus Handler Support
- * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
- */
-
-/* INCLUDES *******************************************************************/
-
-#include <hal.h>
-#define NDEBUG
-#include <debug.h>
-
-/* GLOBALS ********************************************************************/
-
-KSPIN_LOCK HalpBusDatabaseSpinLock;
-KEVENT HalpBusDatabaseEvent;
-LIST_ENTRY HalpAllBusHandlers;
-PARRAY HalpBusTable;
-PARRAY HalpConfigTable;
-
-/* PRIVATE FUNCTIONS **********************************************************/
-
-PARRAY
-NTAPI
-HalpAllocateArray(IN ULONG ArraySize)
-{
- PARRAY Array;
- ULONG Size;
-
- /* Compute array size */
- if (ArraySize == MAXULONG) ArraySize = 0;
- Size = ArraySize * sizeof(PARRAY) + sizeof(ARRAY);
-
- /* Allocate the array */
- Array = ExAllocatePoolWithTag(NonPagedPool,
- Size,
- 'BusH');
- if (!Array) KeBugCheckEx(HAL_MEMORY_ALLOCATION, Size, 0, (ULONG_PTR)__FILE__, __LINE__);
-
- /* Initialize it */
- Array->ArraySize = ArraySize;
- RtlZeroMemory(Array->Element, sizeof(PVOID) * (ArraySize + 1));
- return Array;
-}
-
-VOID
-NTAPI
-HalpGrowArray(IN PARRAY *CurrentArray,
- IN PARRAY *NewArray)
-{
- PVOID Tmp;
-
- /* Check if the current array doesn't exist yet, or if it's smaller than the new one */
- if (!(*CurrentArray) || ((*NewArray)->ArraySize > (*CurrentArray)->ArraySize))
- {
- /* Does it exist (and can it fit?) */
- if (*CurrentArray)
- {
- /* Copy the current array into the new one */
- RtlCopyMemory(&(*NewArray)->Element,
- &(*CurrentArray)->Element,
- sizeof(PVOID) * ((*CurrentArray)->ArraySize + 1));
- }
-
- /* Swap the pointers (XOR swap would be more l33t) */
- Tmp = *CurrentArray;
- *CurrentArray = *NewArray;
- *NewArray = Tmp;
- }
-}
-
-PBUS_HANDLER
-FASTCALL
-HalpLookupHandler(IN PARRAY Array,
- IN ULONG Type,
- IN ULONG Number,
- IN BOOLEAN AddReference)
-{
- PHAL_BUS_HANDLER Bus;
- PBUS_HANDLER Handler = NULL;
-
- /* Make sure the entry exists */
- if (Array->ArraySize >= Type)
- {
- /* Retrieve it */
- Array = Array->Element[Type];
-
- /* Make sure the entry array exists */
- if ((Array) && (Array->ArraySize >= Number))
- {
- /* Retrieve the bus and its handler */
- Bus = Array->Element[Number];
- Handler = &Bus->Handler;
-
- /* Reference the handler if needed */
- if (AddReference) Bus->ReferenceCount++;
- }
- }
-
- /* Return the handler */
- return Handler;
-}
-
-VOID
-FASTCALL
-HaliReferenceBusHandler(IN PBUS_HANDLER Handler)
-{
- PHAL_BUS_HANDLER Bus;
-
- /* Find and reference the bus handler */
- Bus = CONTAINING_RECORD(Handler, HAL_BUS_HANDLER, Handler);
- Bus->ReferenceCount++;
-}
-
-VOID
-FASTCALL
-HaliDereferenceBusHandler(IN PBUS_HANDLER Handler)
-{
- PHAL_BUS_HANDLER Bus;
-
- /* Find and dereference the bus handler */
- Bus = CONTAINING_RECORD(Handler, HAL_BUS_HANDLER, Handler);
- Bus->ReferenceCount--;
- ASSERT(Bus->ReferenceCount != 0);
-}
-
-PBUS_HANDLER
-FASTCALL
-HaliHandlerForBus(IN INTERFACE_TYPE InterfaceType,
- IN ULONG BusNumber)
-{
- /* Lookup the interface in the bus table */
- return HalpLookupHandler(HalpBusTable, InterfaceType, BusNumber, FALSE);
-}
-
-PBUS_HANDLER
-FASTCALL
-HaliHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType,
- IN ULONG BusNumber)
-{
- /* Lookup the configuration in the configuration table */
- return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, FALSE);
-}
-
-PBUS_HANDLER
-FASTCALL
-HaliReferenceHandlerForBus(IN INTERFACE_TYPE InterfaceType,
- IN ULONG BusNumber)
-{
- /* Lookup the interface in the bus table, and reference the handler */
- return HalpLookupHandler(HalpBusTable, InterfaceType, BusNumber, TRUE);
-}
-
-PBUS_HANDLER
-FASTCALL
-HaliReferenceHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType,
- IN ULONG BusNumber)
-{
- /* Lookup the configuration in the configuration table and add a reference */
- return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, TRUE);
-}
-
-VOID
-NTAPI
-HalpInitBusHandler(VOID)
-{
- /* Setup the bus lock */
- KeInitializeSpinLock(&HalpBusDatabaseSpinLock);
-
- /* Setup the bus event */
- KeInitializeEvent(&HalpBusDatabaseEvent, SynchronizationEvent, TRUE);
-
- /* Setup the bus configuration and bus table */
- HalpBusTable = HalpAllocateArray(0);
- HalpConfigTable = HalpAllocateArray(0);
-
- /* Setup the bus list */
- InitializeListHead(&HalpAllBusHandlers);
-
- /* These should be written by the PCI driver later, but we give defaults */
- HalPciTranslateBusAddress = HalpTranslateBusAddress;
- HalPciAssignSlotResources = HalpAssignSlotResources;
- HalFindBusAddressTranslation = HalpFindBusAddressTranslation;
-}
+++ /dev/null
-/*
- * PROJECT: ReactOS HAL
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: hal/halx86/generic/bus/isabus.c
- * PURPOSE:
- * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
- */
+++ /dev/null
-/*
- * PROJECT: ReactOS HAL
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: hal/halx86/generic/bus/sysbus.c
- * PURPOSE:
- * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
- */
else if (BootPhase == 1)
{
/* Initialize bus handlers */
- HalpInitBusHandler();
+ HalpInitBusHandlers();
#ifndef _MINIHAL_
/* Enable IRQ 0 */
--- /dev/null
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: hal/halx86/generic/bus/bushndlr.c
+ * PURPOSE: Generic HAL Bus Handler Support
+ * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+KSPIN_LOCK HalpBusDatabaseSpinLock;
+KEVENT HalpBusDatabaseEvent;
+LIST_ENTRY HalpAllBusHandlers;
+PARRAY HalpBusTable;
+PARRAY HalpConfigTable;
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+PARRAY
+NTAPI
+HalpAllocateArray(IN ULONG ArraySize)
+{
+ PARRAY Array;
+ ULONG Size;
+
+ /* Compute array size */
+ if (ArraySize == MAXULONG) ArraySize = 0;
+ Size = ArraySize * sizeof(PARRAY) + sizeof(ARRAY);
+
+ /* Allocate the array */
+ Array = ExAllocatePoolWithTag(NonPagedPool,
+ Size,
+ 'BusH');
+ if (!Array) KeBugCheckEx(HAL_MEMORY_ALLOCATION, Size, 0, (ULONG_PTR)__FILE__, __LINE__);
+
+ /* Initialize it */
+ Array->ArraySize = ArraySize;
+ RtlZeroMemory(Array->Element, sizeof(PVOID) * (ArraySize + 1));
+ return Array;
+}
+
+VOID
+NTAPI
+HalpGrowArray(IN PARRAY *CurrentArray,
+ IN PARRAY *NewArray)
+{
+ PVOID Tmp;
+
+ /* Check if the current array doesn't exist yet, or if it's smaller than the new one */
+ if (!(*CurrentArray) || ((*NewArray)->ArraySize > (*CurrentArray)->ArraySize))
+ {
+ /* Does it exist (and can it fit?) */
+ if (*CurrentArray)
+ {
+ /* Copy the current array into the new one */
+ RtlCopyMemory(&(*NewArray)->Element,
+ &(*CurrentArray)->Element,
+ sizeof(PVOID) * ((*CurrentArray)->ArraySize + 1));
+ }
+
+ /* Swap the pointers (XOR swap would be more l33t) */
+ Tmp = *CurrentArray;
+ *CurrentArray = *NewArray;
+ *NewArray = Tmp;
+ }
+}
+
+PBUS_HANDLER
+FASTCALL
+HalpLookupHandler(IN PARRAY Array,
+ IN ULONG Type,
+ IN ULONG Number,
+ IN BOOLEAN AddReference)
+{
+ PHAL_BUS_HANDLER Bus;
+ PBUS_HANDLER Handler = NULL;
+
+ /* Make sure the entry exists */
+ if (Array->ArraySize >= Type)
+ {
+ /* Retrieve it */
+ Array = Array->Element[Type];
+
+ /* Make sure the entry array exists */
+ if ((Array) && (Array->ArraySize >= Number))
+ {
+ /* Retrieve the bus and its handler */
+ Bus = Array->Element[Number];
+ Handler = &Bus->Handler;
+
+ /* Reference the handler if needed */
+ if (AddReference) Bus->ReferenceCount++;
+ }
+ }
+
+ /* Return the handler */
+ return Handler;
+}
+
+ULONG
+NTAPI
+HalpNoBusData(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length)
+{
+ /* Not implemented */
+ DPRINT1("STUB GetSetBusData\n");
+ return 0;
+}
+
+NTSTATUS
+NTAPI
+HalpNoAdjustResourceList(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN OUT PIO_RESOURCE_REQUIREMENTS_LIST *pResourceList)
+{
+ DPRINT1("STUB Adjustment\n");
+ return STATUS_UNSUCCESSFUL;
+}
+
+NTSTATUS
+NTAPI
+HalpNoAssignSlotResources(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN PUNICODE_STRING RegistryPath,
+ IN PUNICODE_STRING DriverClassName OPTIONAL,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT DeviceObject OPTIONAL,
+ IN ULONG SlotNumber,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources)
+{
+ DPRINT1("STUB Assignment\n");
+ return STATUS_NOT_SUPPORTED;
+}
+
+VOID
+FASTCALL
+HaliReferenceBusHandler(IN PBUS_HANDLER Handler)
+{
+ PHAL_BUS_HANDLER Bus;
+
+ /* Find and reference the bus handler */
+ Bus = CONTAINING_RECORD(Handler, HAL_BUS_HANDLER, Handler);
+ Bus->ReferenceCount++;
+}
+
+VOID
+FASTCALL
+HaliDereferenceBusHandler(IN PBUS_HANDLER Handler)
+{
+ PHAL_BUS_HANDLER Bus;
+
+ /* Find and dereference the bus handler */
+ Bus = CONTAINING_RECORD(Handler, HAL_BUS_HANDLER, Handler);
+ Bus->ReferenceCount--;
+ ASSERT(Bus->ReferenceCount != 0);
+}
+
+PBUS_HANDLER
+FASTCALL
+HaliHandlerForBus(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber)
+{
+ /* Lookup the interface in the bus table */
+ return HalpLookupHandler(HalpBusTable, InterfaceType, BusNumber, FALSE);
+}
+
+PBUS_HANDLER
+FASTCALL
+HaliHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType,
+ IN ULONG BusNumber)
+{
+ /* Lookup the configuration in the configuration table */
+ return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, FALSE);
+}
+
+PBUS_HANDLER
+FASTCALL
+HaliReferenceHandlerForBus(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber)
+{
+ /* Lookup the interface in the bus table, and reference the handler */
+ return HalpLookupHandler(HalpBusTable, InterfaceType, BusNumber, TRUE);
+}
+
+PBUS_HANDLER
+FASTCALL
+HaliReferenceHandlerForConfigSpace(IN BUS_DATA_TYPE ConfigType,
+ IN ULONG BusNumber)
+{
+ /* Lookup the configuration in the configuration table and add a reference */
+ return HalpLookupHandler(HalpConfigTable, ConfigType, BusNumber, TRUE);
+}
+
+#ifndef _MINIHAL_
+NTSTATUS
+NTAPI
+HaliRegisterBusHandler(IN INTERFACE_TYPE InterfaceType,
+ IN BUS_DATA_TYPE ConfigType,
+ IN ULONG BusNumber,
+ IN INTERFACE_TYPE ParentBusType,
+ IN ULONG ParentBusNumber,
+ IN ULONG ExtraData,
+ IN PINSTALL_BUS_HANDLER InstallCallback,
+ OUT PBUS_HANDLER *ReturnedBusHandler)
+{
+ PHAL_BUS_HANDLER Bus, OldHandler = NULL;
+ PHAL_BUS_HANDLER* BusEntry;
+ PVOID CodeHandle;
+ PARRAY InterfaceArray, InterfaceBusNumberArray, ConfigArray, ConfigBusNumberArray;
+ PBUS_HANDLER ParentHandler;
+ KIRQL OldIrql;
+ NTSTATUS Status;
+ DPRINT1("HAL BUS REGISTRATION: %d.%d on bus %d with parent %d on bus %d\n",
+ InterfaceType, ConfigType, BusNumber, ParentBusType, ParentBusNumber);
+
+ /* Make sure we have a valid handler */
+ ASSERT((InterfaceType != InterfaceTypeUndefined) ||
+ (ConfigType != ConfigurationSpaceUndefined));
+
+ /* Allocate the bus handler */
+ Bus = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(HAL_BUS_HANDLER) + ExtraData,
+ 'HsuB');
+ if (!Bus) return STATUS_INSUFFICIENT_RESOURCES;
+
+ /* Return the handler */
+ *ReturnedBusHandler = &Bus->Handler;
+
+ /* Don't page us out */
+ CodeHandle = MmLockPagableDataSection(&HaliRegisterBusHandler);
+
+ /* Synchronize with anyone else */
+ KeWaitForSingleObject(&HalpBusDatabaseEvent,
+ WrExecutive,
+ KernelMode,
+ FALSE,
+ NULL);
+
+ /* Check for unknown/root bus */
+ if (BusNumber == -1)
+ {
+ /* We must have an interface */
+ ASSERT(InterfaceType != InterfaceTypeUndefined);
+
+ /* Find the right bus */
+ BusNumber = 0;
+ while (HaliHandlerForBus(InterfaceType, BusNumber)) BusNumber++;
+ }
+
+ /* Allocate arrays for the handler */
+ InterfaceArray = HalpAllocateArray(InterfaceType);
+ InterfaceBusNumberArray = HalpAllocateArray(BusNumber);
+ ConfigArray = HalpAllocateArray(ConfigType);
+ ConfigBusNumberArray = HalpAllocateArray(BusNumber);
+
+ /* Only proceed if all allocations succeeded */
+ if (InterfaceArray && InterfaceBusNumberArray && ConfigArray && ConfigBusNumberArray)
+ {
+ /* Find the parent handler if any */
+ ParentHandler = HaliReferenceHandlerForBus(ParentBusType, ParentBusNumber);
+
+ /* Initialize the handler */
+ RtlZeroMemory(Bus, sizeof(HAL_BUS_HANDLER) + ExtraData);
+ Bus->ReferenceCount = 1;
+
+ /* Fill out bus data */
+ Bus->Handler.BusNumber = BusNumber;
+ Bus->Handler.InterfaceType = InterfaceType;
+ Bus->Handler.ConfigurationType = ConfigType;
+ Bus->Handler.ParentHandler = ParentHandler;
+
+ /* Fill out dummy handlers */
+ Bus->Handler.GetBusData = HalpNoBusData;
+ Bus->Handler.SetBusData = HalpNoBusData;
+ Bus->Handler.AdjustResourceList = HalpNoAdjustResourceList;
+ Bus->Handler.AssignSlotResources = HalpNoAssignSlotResources;
+
+ /* Make space for extra data */
+ if (ExtraData) Bus->Handler.BusData = Bus + 1;
+
+ /* Check for a parent handler */
+ if (ParentHandler)
+ {
+ /* Inherit the parent routines */
+ Bus->Handler.GetBusData = ParentHandler->GetBusData;
+ Bus->Handler.SetBusData = ParentHandler->SetBusData;
+ Bus->Handler.AdjustResourceList = ParentHandler->AdjustResourceList;
+ Bus->Handler.AssignSlotResources = ParentHandler->AssignSlotResources;
+ Bus->Handler.TranslateBusAddress = ParentHandler->TranslateBusAddress;
+ Bus->Handler.GetInterruptVector = ParentHandler->GetInterruptVector;
+ }
+
+ /* We don't support this yet */
+ ASSERT(!InstallCallback);
+
+ /* Lock the buses */
+ KeAcquireSpinLock(&HalpBusDatabaseSpinLock, &OldIrql);
+
+ /* Make space for the interface */
+ HalpGrowArray(&HalpBusTable, &InterfaceArray);
+
+ /* Check if we really have an interface */
+ if (InterfaceType != InterfaceTypeUndefined)
+ {
+ /* Make space for the association */
+ HalpGrowArray((PARRAY*)&HalpBusTable->Element[InterfaceType],
+ &InterfaceBusNumberArray);
+
+ /* Get the bus handler pointer */
+ BusEntry = (PHAL_BUS_HANDLER*)&((PARRAY)HalpBusTable->Element[InterfaceType])->Element[BusNumber];
+
+ /* Check if there was already a handler there, and set the new one */
+ if (*BusEntry) OldHandler = *BusEntry;
+ *BusEntry = Bus;
+ }
+
+ /* Now add a space for the configuration space */
+ HalpGrowArray(&HalpConfigTable, &ConfigArray);
+
+ /* Check if we really have one */
+ if (ConfigType != ConfigurationSpaceUndefined)
+ {
+ /* Make space for this association */
+ HalpGrowArray((PARRAY*)&HalpConfigTable->Element[ConfigType],
+ &ConfigBusNumberArray);
+
+ /* Get the bus handler pointer */
+ BusEntry = (PHAL_BUS_HANDLER*)&((PARRAY)HalpConfigTable->Element[ConfigType])->Element[BusNumber];
+ if (*BusEntry)
+ {
+ /* Get the old entry, but make sure it's the same we had before */
+ ASSERT((OldHandler == NULL) || (OldHandler == *BusEntry));
+ OldHandler = *BusEntry;
+ }
+
+ /* Set the new entry */
+ *BusEntry = Bus;
+ }
+
+ /* Link the adapter */
+ InsertTailList(&HalpAllBusHandlers, &Bus->AllHandlers);
+
+ /* Remove the old linkage */
+ Bus = OldHandler;
+ if (Bus) RemoveEntryList(&Bus->AllHandlers);
+
+ /* Release the lock */
+ KeReleaseSpinLock(&HalpBusDatabaseSpinLock, OldIrql);
+ Status = STATUS_SUCCESS;
+ }
+ else
+ {
+ /* Fail */
+ Status = STATUS_INSUFFICIENT_RESOURCES;
+ }
+
+ /* Signal the event */
+ KeSetEvent(&HalpBusDatabaseEvent, 0, FALSE);
+
+ /* Re-page the function */
+ MmUnlockPagableImageSection(CodeHandle);
+
+ /* Free all allocations */
+ if (Bus) ExFreePool(Bus);
+ if (InterfaceArray) ExFreePool(InterfaceArray);
+ if (InterfaceBusNumberArray) ExFreePool(InterfaceBusNumberArray);
+ if (ConfigArray) ExFreePool(ConfigArray);
+ if (ConfigBusNumberArray) ExFreePool(ConfigBusNumberArray);
+
+ /* And we're done */
+ DPRINT1("Bus handler has been registered: %p\n", *ReturnedBusHandler);
+ return Status;
+}
+#endif
+
+VOID
+NTAPI
+HalpInitBusHandler(VOID)
+{
+ /* Setup the bus lock */
+ KeInitializeSpinLock(&HalpBusDatabaseSpinLock);
+
+ /* Setup the bus event */
+ KeInitializeEvent(&HalpBusDatabaseEvent, SynchronizationEvent, TRUE);
+
+ /* Setup the bus configuration and bus table */
+ HalpBusTable = HalpAllocateArray(0);
+ HalpConfigTable = HalpAllocateArray(0);
+
+ /* Setup the bus list */
+ InitializeListHead(&HalpAllBusHandlers);
+
+ /* Setup the HAL Dispatch routines */
+#ifndef _MINIHAL_
+ HalRegisterBusHandler = HaliRegisterBusHandler;
+ HalHandlerForBus = HaliHandlerForBus;
+ HalHandlerForConfigSpace = HaliHandlerForConfigSpace;
+ HalReferenceHandlerForBus = HaliReferenceHandlerForBus;
+ HalReferenceBusHandler = HaliReferenceBusHandler;
+ HalDereferenceBusHandler = HaliDereferenceBusHandler;
+#endif
+ HalPciAssignSlotResources = HalpAssignSlotResources;
+ /* FIXME: Fix later */
+#if 0
+ HalPciTranslateBusAddress = HaliTranslateBusAddress;
+ if (!HalFindBusAddressTranslation) HalFindBusAddressTranslation = HaliFindBusAddressTranslation;
+#else
+ /* These should be written by the PCI driver later, but we give defaults */
+ HalPciTranslateBusAddress = HalpTranslateBusAddress;
+ HalFindBusAddressTranslation = HalpFindBusAddressTranslation;
+#endif
+}
+
+/* EOF */
--- /dev/null
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: hal/halx86/generic/bus/sysbus.c
+ * PURPOSE:
+ * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+ULONG
+NTAPI
+HalpcGetCmosData(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length)
+{
+ DPRINT1("CMOS GetData\n");
+ while (TRUE);
+ return 0;
+}
+
+ULONG
+NTAPI
+HalpcSetCmosData(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length)
+{
+ DPRINT1("CMOS SetData\n");
+ while (TRUE);
+ return 0;
+}
+
+/* EOF */
--- /dev/null
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: hal/halx86/generic/bus/isabus.c
+ * PURPOSE:
+ * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+BOOLEAN
+NTAPI
+HalpTranslateIsaBusAddress(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress)
+{
+ DPRINT1("ISA Translate\n");
+ while (TRUE);
+ return FALSE;
+}
+
+/* EOF */
/* GLOBALS *******************************************************************/
+ULONG HalpBusType;
+
PCI_TYPE1_CFG_CYCLE_BITS HalpPciDebuggingDevice[2] = {{{{0}}}};
BOOLEAN HalpPCIConfigInitialized;
--- /dev/null
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: hal/halx86/generic/bus/sysbus.c
+ * PURPOSE:
+ * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+BOOLEAN
+NTAPI
+HalpTranslateSystemBusAddress(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress)
+{
+ DPRINT1("SYSTEM Translate\n");
+ while (TRUE);
+ return FALSE;
+}
+
+ULONG
+NTAPI
+HalpGetSystemInterruptVector(IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity)
+{
+ /* Get the root vector */
+ DPRINT1("SYSTEM GetVector\n");
+ while (TRUE);
+ return 0;
+}
+
+/* EOF */
--- /dev/null
+/*
+ * PROJECT: ReactOS HAL
+ * LICENSE: BSD - See COPYING.ARM in the top level directory
+ * FILE: hal/halx86/generic/legacy/bussupp.c
+ * PURPOSE: HAL Legacy Bus Support Code
+ * PROGRAMMERS: ReactOS Portable Systems Group
+ */
+
+/* INCLUDES *******************************************************************/
+
+#include <hal.h>
+#define NDEBUG
+#include <debug.h>
+
+/* GLOBALS ********************************************************************/
+
+/* PRIVATE FUNCTIONS **********************************************************/
+
+PBUS_HANDLER
+NTAPI
+HalpAllocateBusHandler(IN INTERFACE_TYPE InterfaceType,
+ IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN INTERFACE_TYPE ParentBusInterfaceType,
+ IN ULONG ParentBusNumber,
+ IN ULONG BusSpecificData)
+{
+ PBUS_HANDLER Bus;
+
+ /* Register the bus handler */
+ HalRegisterBusHandler(InterfaceType,
+ BusDataType,
+ BusNumber,
+ ParentBusInterfaceType,
+ ParentBusNumber,
+ BusSpecificData,
+ NULL,
+ &Bus);
+ if (!Bus) return NULL;
+
+ /* Check for a valid interface */
+ if (InterfaceType != InterfaceTypeUndefined)
+ {
+ /* Allocate address ranges and zero them out */
+ Bus->BusAddresses = ExAllocatePoolWithTag(NonPagedPool,
+ sizeof(SUPPORTED_RANGES),
+ ' laH');
+ RtlZeroMemory(Bus->BusAddresses, sizeof(SUPPORTED_RANGES));
+
+ /* Build the data structure */
+ Bus->BusAddresses->Version = HAL_SUPPORTED_RANGE_VERSION;
+ Bus->BusAddresses->Dma.Limit = 7;
+ Bus->BusAddresses->Memory.Limit = 0xFFFFFFFF;
+ Bus->BusAddresses->IO.Limit = 0xFFFF;
+ Bus->BusAddresses->IO.SystemAddressSpace = 1;
+ Bus->BusAddresses->PrefetchMemory.Base = 1;
+ }
+
+ /* Return the bus address */
+ return Bus;
+}
+
+VOID
+NTAPI
+HalpRegisterInternalBusHandlers(VOID)
+{
+ PBUS_HANDLER Bus;
+
+ /* Only do processor 1 */
+ if (KeGetCurrentPrcb()->Number) return;
+
+ /* Register root support */
+ HalpInitBusHandler();
+
+ /* Allocate the system bus */
+ Bus = HalpAllocateBusHandler(Internal,
+ ConfigurationSpaceUndefined,
+ 0,
+ InterfaceTypeUndefined,
+ 0,
+ 0);
+ DPRINT1("Registering Internal Bus: %p\n", Bus);
+ if (Bus)
+ {
+ /* Set it up */
+ Bus->GetInterruptVector = HalpGetSystemInterruptVector;
+ Bus->TranslateBusAddress = HalpTranslateSystemBusAddress;
+ }
+
+ /* Allocate the CMOS bus */
+ Bus = HalpAllocateBusHandler(InterfaceTypeUndefined,
+ Cmos,
+ 0,
+ InterfaceTypeUndefined,
+ 0,
+ 0);
+ DPRINT1("Registering CMOS Bus: %p\n", Bus);
+ if (Bus)
+ {
+ /* Set it up */
+ Bus->GetBusData = HalpcGetCmosData;
+ Bus->SetBusData = HalpcSetCmosData;
+ }
+
+ /* Allocate the CMOS bus */
+ Bus = HalpAllocateBusHandler(InterfaceTypeUndefined,
+ Cmos,
+ 1,
+ InterfaceTypeUndefined,
+ 0,
+ 0);
+ DPRINT1("Registering CMOS Bus: %p\n", Bus);
+ if (Bus)
+ {
+ /* Set it up */
+ Bus->GetBusData = HalpcGetCmosData;
+ Bus->SetBusData = HalpcSetCmosData;
+ }
+
+ /* Allocate ISA bus */
+ Bus = HalpAllocateBusHandler(Isa,
+ ConfigurationSpaceUndefined,
+ 0,
+ Internal,
+ 0,
+ 0);
+ DPRINT1("Registering ISA Bus: %p\n", Bus);
+ if (Bus)
+ {
+ /* Set it up */
+ Bus->GetBusData = HalpNoBusData;
+ Bus->BusAddresses->Memory.Limit = 0xFFFFFF;
+ Bus->TranslateBusAddress = HalpTranslateIsaBusAddress;
+ }
+
+ /* No support for EISA or MCA */
+ ASSERT(HalpBusType == MACHINE_TYPE_ISA);
+}
+
+VOID
+NTAPI
+HalpInitializePciBus(VOID)
+{
+ /* FIXME: Should do legacy PCI bus detection */
+
+ /* FIXME: Should detect chipset hacks */
+
+ /* FIXME: Should detect broken PCI hardware and apply hacks */
+
+ /* FIXME: Should build resource ranges */
+}
+
+VOID
+NTAPI
+HalpInitBusHandlers(VOID)
+{
+ /* Register the HAL Bus Handler support */
+ HalpRegisterInternalBusHandlers();
+}
+
+VOID
+NTAPI
+HalpRegisterKdSupportFunctions(VOID)
+{
+ /* Register PCI Device Functions */
+ KdSetupPciDeviceForDebugging = HalpSetupPciDeviceForDebugging;
+ KdReleasePciDeviceforDebugging = HalpReleasePciDeviceForDebugging;
+
+ /* Register memory functions */
+#ifndef _MINIHAL_
+ KdMapPhysicalMemory64 = HalpMapPhysicalMemory64;
+ KdUnmapVirtualAddress = HalpUnmapVirtualAddress;
+#endif
+
+ /* Register ACPI stub */
+ KdCheckPowerButton = HalpCheckPowerButton;
+}
+
+NTSTATUS
+NTAPI
+HalpAssignSlotResources(IN PUNICODE_STRING RegistryPath,
+ IN PUNICODE_STRING DriverClassName,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources)
+{
+ BUS_HANDLER BusHandler;
+ PAGED_CODE();
+
+ /* Only PCI is supported */
+ if (BusType != PCIBus) return STATUS_NOT_IMPLEMENTED;
+
+ /* Setup fake PCI Bus handler */
+ RtlCopyMemory(&BusHandler, &HalpFakePciBusHandler, sizeof(BUS_HANDLER));
+ BusHandler.BusNumber = BusNumber;
+
+ /* Call the PCI function */
+ return HalpAssignPCISlotResources(&BusHandler,
+ &BusHandler,
+ RegistryPath,
+ DriverClassName,
+ DriverObject,
+ DeviceObject,
+ SlotNumber,
+ AllocatedResources);
+}
+
+BOOLEAN
+NTAPI
+HalpTranslateBusAddress(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress)
+{
+ /* Translation is easy */
+ TranslatedAddress->QuadPart = BusAddress.QuadPart;
+ return TRUE;
+}
+
+ULONG
+NTAPI
+HalpGetSystemInterruptVector_Acpi(IN ULONG BusNumber,
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity)
+{
+ ULONG Vector = IRQ2VECTOR(BusInterruptLevel);
+ *Irql = (KIRQL)VECTOR2IRQL(Vector);
+ *Affinity = 0xFFFFFFFF;
+ return Vector;
+}
+
+BOOLEAN
+NTAPI
+HalpFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress,
+ IN OUT PULONG_PTR Context,
+ IN BOOLEAN NextBus)
+{
+ /* Make sure we have a context */
+ if (!Context) return FALSE;
+
+ /* If we have data in the context, then this shouldn't be a new lookup */
+ if ((*Context) && (NextBus == TRUE)) return FALSE;
+
+ /* Return bus data */
+ TranslatedAddress->QuadPart = BusAddress.QuadPart;
+
+ /* Set context value and return success */
+ *Context = 1;
+ return TRUE;
+}
+
+/* PUBLIC FUNCTIONS **********************************************************/
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+HalAdjustResourceList(IN PCM_RESOURCE_LIST Resources)
+{
+ /* Deprecated, return success */
+ return STATUS_SUCCESS;
+}
+
+/*
+ * @implemented
+ */
+NTSTATUS
+NTAPI
+HalAssignSlotResources(IN PUNICODE_STRING RegistryPath,
+ IN PUNICODE_STRING DriverClassName,
+ IN PDRIVER_OBJECT DriverObject,
+ IN PDEVICE_OBJECT DeviceObject,
+ IN INTERFACE_TYPE BusType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN OUT PCM_RESOURCE_LIST *AllocatedResources)
+{
+ /* Check the bus type */
+ if (BusType != PCIBus)
+ {
+ /* Call our internal handler */
+ return HalpAssignSlotResources(RegistryPath,
+ DriverClassName,
+ DriverObject,
+ DeviceObject,
+ BusType,
+ BusNumber,
+ SlotNumber,
+ AllocatedResources);
+ }
+ else
+ {
+ /* Call the PCI registered function */
+ return HalPciAssignSlotResources(RegistryPath,
+ DriverClassName,
+ DriverObject,
+ DeviceObject,
+ PCIBus,
+ BusNumber,
+ SlotNumber,
+ AllocatedResources);
+ }
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+HalGetBusData(IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length)
+{
+ /* Call the extended function */
+ return HalGetBusDataByOffset(BusDataType,
+ BusNumber,
+ SlotNumber,
+ Buffer,
+ 0,
+ Length);
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length)
+{
+ BUS_HANDLER BusHandler;
+
+ /* Look as the bus type */
+ if (BusDataType == Cmos)
+ {
+ /* Call CMOS Function */
+ return HalpGetCmosData(0, SlotNumber, Buffer, Length);
+ }
+ else if (BusDataType == EisaConfiguration)
+ {
+ /* FIXME: TODO */
+ ASSERT(FALSE);
+ }
+ else if ((BusDataType == PCIConfiguration) &&
+ (HalpPCIConfigInitialized) &&
+ ((BusNumber >= HalpMinPciBus) && (BusNumber <= HalpMaxPciBus)))
+ {
+ /* Setup fake PCI Bus handler */
+ RtlCopyMemory(&BusHandler, &HalpFakePciBusHandler, sizeof(BUS_HANDLER));
+ BusHandler.BusNumber = BusNumber;
+
+ /* Call PCI function */
+ return HalpGetPCIData(&BusHandler,
+ &BusHandler,
+ *(PPCI_SLOT_NUMBER)&SlotNumber,
+ Buffer,
+ Offset,
+ Length);
+ }
+
+ /* Invalid bus */
+ return 0;
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+HalGetInterruptVector(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity)
+{
+ /* Call the system bus translator */
+ return HalpGetSystemInterruptVector_Acpi(BusNumber,
+ BusInterruptLevel,
+ BusInterruptVector,
+ Irql,
+ Affinity);
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+HalSetBusData(IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length)
+{
+ /* Call the extended function */
+ return HalSetBusDataByOffset(BusDataType,
+ BusNumber,
+ SlotNumber,
+ Buffer,
+ 0,
+ Length);
+}
+
+/*
+ * @implemented
+ */
+ULONG
+NTAPI
+HalSetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length)
+{
+ BUS_HANDLER BusHandler;
+
+ /* Look as the bus type */
+ if (BusDataType == Cmos)
+ {
+ /* Call CMOS Function */
+ return HalpSetCmosData(0, SlotNumber, Buffer, Length);
+ }
+ else if ((BusDataType == PCIConfiguration) && (HalpPCIConfigInitialized))
+ {
+ /* Setup fake PCI Bus handler */
+ RtlCopyMemory(&BusHandler, &HalpFakePciBusHandler, sizeof(BUS_HANDLER));
+ BusHandler.BusNumber = BusNumber;
+
+ /* Call PCI function */
+ return HalpSetPCIData(&BusHandler,
+ &BusHandler,
+ *(PPCI_SLOT_NUMBER)&SlotNumber,
+ Buffer,
+ Offset,
+ Length);
+ }
+
+ /* Invalid bus */
+ return 0;
+}
+
+/*
+ * @implemented
+ */
+BOOLEAN
+NTAPI
+HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress)
+{
+ /* Look as the bus type */
+ if (InterfaceType == PCIBus)
+ {
+ /* Call the PCI registered function */
+ return HalPciTranslateBusAddress(PCIBus,
+ BusNumber,
+ BusAddress,
+ AddressSpace,
+ TranslatedAddress);
+ }
+ else
+ {
+ /* Translation is easy */
+ TranslatedAddress->QuadPart = BusAddress.QuadPart;
+ return TRUE;
+ }
+}
+
+/* EOF */
/*
* PROJECT: ReactOS HAL
* LICENSE: BSD - See COPYING.ARM in the top level directory
- * FILE: hal/halx86/generic/acpi/halpcat.c
+ * FILE: hal/halx86/generic/legacy/halpcat.c
* PURPOSE: HAL Legacy Support Code
* PROGRAMMERS: ReactOS Portable Systems Group
*/
return STATUS_NO_SUCH_DEVICE;
}
-VOID
-NTAPI
-HalpInitializePciBus(VOID)
-{
- /* FIXME: Should do legacy PCI bus detection */
-
- /* FIXME: Should detect chipset hacks */
-
- /* FIXME: Should detect broken PCI hardware and apply hacks */
-
- /* FIXME: Should build resource ranges */
-}
-
VOID
NTAPI
HalpBuildAddressMap(VOID)
<define name="_NTHALDLL_" />
<define name="_NTHAL_" />
<directory name="generic">
- <directory name="bus">
- <file>bushndlr.c</file>
- <file>isabus.c</file>
- <file>halbus.c</file>
- <file>pcibus.c</file>
- <file>pcidata.c</file>
- <file>sysbus.c</file>
- </directory>
<file>beep.c</file>
<file>cmos.c</file>
<file>display.c</file>
<directory name="acpi">
<file>halacpi.c</file>
<file>halpnpdd.c</file>
+ <file>busemul.c</file>
</directory>
+ <directory name="legacy">
+ <directory name="bus">
+ <file>pcibus.c</file>
+ </directory>
+ </directory>
</directory>
</module>
</group>
<define name="_NTHAL_" />
<directory name="generic">
<directory name="legacy">
+ <directory name="bus">
+ <file>bushndlr.c</file>
+ <file>cmosbus.c</file>
+ <file>isabus.c</file>
+ <file>pcibus.c</file>
+ <file>pcidata.c</file>
+ <file>sysbus.c</file>
+ </directory>
+ <file>bussupp.c</file>
<file>halpcat.c</file>
</directory>
</directory>
<define name="_BLDR_" />
<define name="_MINIHAL_" />
<directory name="generic">
- <directory name="bus">
- <file>bushndlr.c</file>
- <file>isabus.c</file>
- <file>halbus.c</file>
- <file>pcibus.c</file>
- <file>pcidata.c</file>
- <file>sysbus.c</file>
+ <directory name="legacy">
+ <directory name="bus">
+ <file>bushndlr.c</file>
+ <file>cmosbus.c</file>
+ <file>isabus.c</file>
+ <file>pcibus.c</file>
+ <file>pcidata.c</file>
+ <file>sysbus.c</file>
+ </directory>
+ <file>bussupp.c</file>
</directory>
<file>beep.c</file>
<file>bios.c</file>
/* FUNCTIONS *****************************************************************/
+/* SHARED (Fake PCI-BUS HANDLER) */
+
VOID
NTAPI
HalpPCISynchronizeType1(
IN ULONG Length
);
-ULONG
-NTAPI
-HalpGetSystemInterruptVector(
- ULONG BusNumber,
- ULONG BusInterruptLevel,
- ULONG BusInterruptVector,
- PKIRQL Irql,
- PKAFFINITY Affinity
-);
-
-ULONG
-NTAPI
-HalpGetCmosData(
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN PVOID Buffer,
- IN ULONG Length
-);
-
-ULONG
-NTAPI
-HalpSetCmosData(
- IN ULONG BusNumber,
- IN ULONG SlotNumber,
- IN PVOID Buffer,
- IN ULONG Length
-);
-
ULONG
NTAPI
HalpGetPCIData(
IN OUT PCM_RESOURCE_LIST *pAllocatedResources
);
-VOID
+/* NON-LEGACY */
+
+ULONG
NTAPI
-HalpInitializePciBus(
- VOID
+HalpGetSystemInterruptVector_Acpi(
+ ULONG BusNumber,
+ ULONG BusInterruptLevel,
+ ULONG BusInterruptVector,
+ PKIRQL Irql,
+ PKAFFINITY Affinity
+);
+
+ULONG
+NTAPI
+HalpGetCmosData(
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length
+);
+
+ULONG
+NTAPI
+HalpSetCmosData(
+ IN ULONG BusNumber,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Length
);
VOID
NTAPI
-HalpInitializePciStubs(
+HalpInitializePciBus(
VOID
);
VOID
NTAPI
-HalpInitBusHandler(
+HalpInitializePciStubs(
VOID
);
VOID
);
+/* LEGACY */
+
+VOID
+NTAPI
+HalpInitBusHandler(
+ VOID
+);
+
+ULONG
+NTAPI
+HalpNoBusData(
+ IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length
+);
+
+ULONG
+NTAPI
+HalpcGetCmosData(
+ IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length
+);
+
+ULONG
+NTAPI
+HalpcSetCmosData(
+ IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG SlotNumber,
+ IN PVOID Buffer,
+ IN ULONG Offset,
+ IN ULONG Length
+);
+
+BOOLEAN
+NTAPI
+HalpTranslateSystemBusAddress(
+ IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress
+);
+
+BOOLEAN
+NTAPI
+HalpTranslateIsaBusAddress(
+ IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress
+);
+
+ULONG
+NTAPI
+HalpGetSystemInterruptVector(
+ IN PBUS_HANDLER BusHandler,
+ IN PBUS_HANDLER RootHandler,
+ IN ULONG BusInterruptLevel,
+ IN ULONG BusInterruptVector,
+ OUT PKIRQL Irql,
+ OUT PKAFFINITY Affinity
+);
+
extern ULONG HalpBusType;
extern BOOLEAN HalpPCIConfigInitialized;
extern BUS_HANDLER HalpFakePciBusHandler;
IN KIRQL OldIrql
);
+VOID
+NTAPI
+HalpInitBusHandlers(
+ VOID
+);
+
#ifdef _M_AMD64
#define KfLowerIrql KeLowerIrql
#ifndef CONFIG_SMP