mirror of
https://github.com/reactos/reactos.git
synced 2024-10-01 06:57:08 +00:00
[HAL]: First use of bus handler support: HalGetBusDataByOffset now uses bus handlers. Please report any problems.
svn path=/trunk/; revision=47670
This commit is contained in:
parent
e8040d911e
commit
cc500cbf5c
|
@ -262,7 +262,7 @@ HaliRegisterBusHandler(IN INTERFACE_TYPE InterfaceType,
|
|||
ConfigBusNumberArray = HalpAllocateArray(BusNumber);
|
||||
|
||||
/* Only proceed if all allocations succeeded */
|
||||
if (InterfaceArray && InterfaceBusNumberArray && ConfigArray && ConfigBusNumberArray)
|
||||
if ((InterfaceArray) && (InterfaceBusNumberArray) && (ConfigArray) && (ConfigBusNumberArray))
|
||||
{
|
||||
/* Find the parent handler if any */
|
||||
ParentHandler = HaliReferenceHandlerForBus(ParentBusType, ParentBusNumber);
|
||||
|
|
|
@ -82,7 +82,6 @@ HalpRegisterInternalBusHandlers(VOID)
|
|||
InterfaceTypeUndefined,
|
||||
0,
|
||||
0);
|
||||
DPRINT1("Registering Internal Bus: %p\n", Bus);
|
||||
if (Bus)
|
||||
{
|
||||
/* Set it up */
|
||||
|
@ -97,7 +96,6 @@ HalpRegisterInternalBusHandlers(VOID)
|
|||
InterfaceTypeUndefined,
|
||||
0,
|
||||
0);
|
||||
DPRINT1("Registering CMOS Bus: %p\n", Bus);
|
||||
if (Bus)
|
||||
{
|
||||
/* Set it up */
|
||||
|
@ -112,7 +110,6 @@ HalpRegisterInternalBusHandlers(VOID)
|
|||
InterfaceTypeUndefined,
|
||||
0,
|
||||
0);
|
||||
DPRINT1("Registering CMOS Bus: %p\n", Bus);
|
||||
if (Bus)
|
||||
{
|
||||
/* Set it up */
|
||||
|
@ -127,7 +124,6 @@ HalpRegisterInternalBusHandlers(VOID)
|
|||
Internal,
|
||||
0,
|
||||
0);
|
||||
DPRINT1("Registering ISA Bus: %p\n", Bus);
|
||||
if (Bus)
|
||||
{
|
||||
/* Set it up */
|
||||
|
@ -1286,38 +1282,24 @@ HalGetBusDataByOffset(IN BUS_DATA_TYPE BusDataType,
|
|||
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;
|
||||
PBUS_HANDLER Handler;
|
||||
ULONG Status;
|
||||
|
||||
/* Find the handler */
|
||||
Handler = HaliReferenceHandlerForConfigSpace(BusDataType, BusNumber);
|
||||
if (!Handler) return 0;
|
||||
|
||||
/* Do the assignment */
|
||||
Status = Handler->GetBusData(Handler,
|
||||
Handler,
|
||||
SlotNumber,
|
||||
Buffer,
|
||||
Offset,
|
||||
Length);
|
||||
|
||||
/* Dereference the handler and return */
|
||||
HalDereferenceBusHandler(Handler);
|
||||
return Status;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -449,6 +449,13 @@ HalpInitBusHandler(
|
|||
VOID
|
||||
);
|
||||
|
||||
PBUS_HANDLER
|
||||
FASTCALL
|
||||
HaliReferenceHandlerForConfigSpace(
|
||||
IN BUS_DATA_TYPE ConfigType,
|
||||
IN ULONG BusNumber
|
||||
);
|
||||
|
||||
ULONG
|
||||
NTAPI
|
||||
HalpNoBusData(
|
||||
|
|
Loading…
Reference in a new issue