mirror of
https://github.com/reactos/reactos.git
synced 2025-04-27 17:10:22 +00:00
- Implement the generic bus handler support and initialization.
- Add missing hack flags for ACPI hacks. - Add the hack flags to the registry. svn path=/trunk/; revision=44061
This commit is contained in:
parent
652e881f54
commit
a9f0dd5a8d
7 changed files with 256 additions and 18 deletions
|
@ -45,6 +45,24 @@ HKLM,"SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName","ComputerName"
|
||||||
; Device classes key
|
; Device classes key
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\DeviceClasses",,0x00000012
|
HKLM,"SYSTEM\CurrentControlSet\Control\DeviceClasses",,0x00000012
|
||||||
|
|
||||||
|
; HAL Chipset Hacks
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","10390530",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","10390620",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","10B90533",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","10B91533",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","11060596",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","11060686",0x00010001,0x5
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","1166004F",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","11660050",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","11660200",0x00010001,0x1
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","80862410",0x00010001,0x8
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","80862420",0x00010001,0x8
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","80862440",0x00010001,0x8
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","8086244C",0x00010001,0x8
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","80862480",0x00010001,0x8
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","8086248C",0x00010001,0x8
|
||||||
|
HKLM,"SYSTEM\CurrentControlSet\Control\HAL","80867110",0x00010001,0x1
|
||||||
|
|
||||||
; Hardware profile settings
|
; Hardware profile settings
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB",,0x00000012
|
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB",,0x00000012
|
||||||
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB","CurrentConfig",0x00010001,0x00000000
|
HKLM,"SYSTEM\CurrentControlSet\Control\IDConfigDB","CurrentConfig",0x00010001,0x00000000
|
||||||
|
|
|
@ -2,6 +2,185 @@
|
||||||
* PROJECT: ReactOS HAL
|
* PROJECT: ReactOS HAL
|
||||||
* LICENSE: GPL - See COPYING in the top level directory
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* FILE: hal/halx86/generic/bus/bushndlr.c
|
* FILE: hal/halx86/generic/bus/bushndlr.c
|
||||||
* PURPOSE:
|
* PURPOSE: Generic HAL Bus Handler Support
|
||||||
* PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
|
* 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 == -1) 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;
|
||||||
|
}
|
||||||
|
|
|
@ -115,16 +115,6 @@ HalpFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
|
||||||
NTAPI
|
|
||||||
HalpInitNonBusHandler(VOID)
|
|
||||||
{
|
|
||||||
/* These should be written by the PCI driver later, but we give defaults */
|
|
||||||
HalPciTranslateBusAddress = HalpTranslateBusAddress;
|
|
||||||
HalPciAssignSlotResources = HalpAssignSlotResources;
|
|
||||||
HalFindBusAddressTranslation = HalpFindBusAddressTranslation;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* PUBLIC FUNCTIONS **********************************************************/
|
/* PUBLIC FUNCTIONS **********************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -139,8 +139,8 @@ HalInitSystem(IN ULONG BootPhase,
|
||||||
}
|
}
|
||||||
else if (BootPhase == 1)
|
else if (BootPhase == 1)
|
||||||
{
|
{
|
||||||
/* Initialize the default HAL stubs for bus handling functions */
|
/* Initialize bus handlers */
|
||||||
HalpInitNonBusHandler();
|
HalpInitBusHandler();
|
||||||
|
|
||||||
/* Enable IRQ 0 */
|
/* Enable IRQ 0 */
|
||||||
HalpEnableInterruptHandler(IDT_DEVICE,
|
HalpEnableInterruptHandler(IDT_DEVICE,
|
||||||
|
|
|
@ -157,6 +157,19 @@ typedef struct _PCI_REGISTRY_INFO_INTERNAL
|
||||||
PCI_CARD_DESCRIPTOR CardList[ANYSIZE_ARRAY];
|
PCI_CARD_DESCRIPTOR CardList[ANYSIZE_ARRAY];
|
||||||
} PCI_REGISTRY_INFO_INTERNAL, *PPCI_REGISTRY_INFO_INTERNAL;
|
} PCI_REGISTRY_INFO_INTERNAL, *PPCI_REGISTRY_INFO_INTERNAL;
|
||||||
|
|
||||||
|
typedef struct _ARRAY
|
||||||
|
{
|
||||||
|
ULONG ArraySize;
|
||||||
|
PVOID Element[ANYSIZE_ARRAY];
|
||||||
|
} ARRAY, *PARRAY;
|
||||||
|
|
||||||
|
typedef struct _HAL_BUS_HANDLER
|
||||||
|
{
|
||||||
|
LIST_ENTRY AllHandlers;
|
||||||
|
ULONG ReferenceCount;
|
||||||
|
BUS_HANDLER Handler;
|
||||||
|
} HAL_BUS_HANDLER, *PHAL_BUS_HANDLER;
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -306,6 +319,45 @@ HalpInitializePciStubs(
|
||||||
VOID
|
VOID
|
||||||
);
|
);
|
||||||
|
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
HalpInitBusHandler(
|
||||||
|
VOID
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
HalpTranslateBusAddress(
|
||||||
|
IN INTERFACE_TYPE InterfaceType,
|
||||||
|
IN ULONG BusNumber,
|
||||||
|
IN PHYSICAL_ADDRESS BusAddress,
|
||||||
|
IN OUT PULONG AddressSpace,
|
||||||
|
OUT PPHYSICAL_ADDRESS TranslatedAddress
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
|
HalpFindBusAddressTranslation(
|
||||||
|
IN PHYSICAL_ADDRESS BusAddress,
|
||||||
|
IN OUT PULONG AddressSpace,
|
||||||
|
OUT PPHYSICAL_ADDRESS TranslatedAddress,
|
||||||
|
IN OUT PULONG_PTR Context,
|
||||||
|
IN BOOLEAN NextBus
|
||||||
|
);
|
||||||
|
|
||||||
extern ULONG HalpBusType;
|
extern ULONG HalpBusType;
|
||||||
extern BOOLEAN HalpPCIConfigInitialized;
|
extern BOOLEAN HalpPCIConfigInitialized;
|
||||||
extern BUS_HANDLER HalpFakePciBusHandler;
|
extern BUS_HANDLER HalpFakePciBusHandler;
|
||||||
|
|
|
@ -61,9 +61,6 @@ typedef struct _HalAddressUsage
|
||||||
/* adapter.c */
|
/* adapter.c */
|
||||||
PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx(ULONG NumberOfMapRegisters,BOOLEAN IsMaster, BOOLEAN Dma32BitAddresses);
|
PADAPTER_OBJECT NTAPI HalpAllocateAdapterEx(ULONG NumberOfMapRegisters,BOOLEAN IsMaster, BOOLEAN Dma32BitAddresses);
|
||||||
|
|
||||||
/* bus.c */
|
|
||||||
VOID NTAPI HalpInitNonBusHandler (VOID);
|
|
||||||
|
|
||||||
/* sysinfo.c */
|
/* sysinfo.c */
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -249,8 +249,10 @@ typedef struct _BUS_HANDLER
|
||||||
//
|
//
|
||||||
// HAL Chip Hacks
|
// HAL Chip Hacks
|
||||||
//
|
//
|
||||||
#define HAL_PCI_CHIP_HACK_DISABLE_HIBERNATE 0x02
|
#define HAL_PCI_CHIP_HACK_BROKEN_ACPI_TIMER 0x01
|
||||||
#define HAL_PCI_CHIP_HACK_USB_SMI_DISABLE 0x08
|
#define HAL_PCI_CHIP_HACK_DISABLE_HIBERNATE 0x02
|
||||||
|
#define HAL_PCI_CHIP_HACK_DISABLE_ACPI_IRQ_ROUTING 0x04
|
||||||
|
#define HAL_PCI_CHIP_HACK_USB_SMI_DISABLE 0x08
|
||||||
|
|
||||||
//
|
//
|
||||||
// Kernel Exports
|
// Kernel Exports
|
||||||
|
|
Loading…
Reference in a new issue