Author: sir_richard
Date: Mon Jun 7 22:10:53 2010
New Revision: 47670
URL:
http://svn.reactos.org/svn/reactos?rev=47670&view=rev
Log:
[HAL]: First use of bus handler support: HalGetBusDataByOffset now uses bus handlers.
Please report any problems.
Modified:
trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c
trunk/reactos/hal/halx86/generic/legacy/bussupp.c
trunk/reactos/hal/halx86/include/bus.h
Modified: trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bus/bushndlr.c [iso-8859-1] Mon Jun 7
22:10:53 2010
@@ -262,7 +262,7 @@
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);
Modified: trunk/reactos/hal/halx86/generic/legacy/bussupp.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/generic/legacy/…
==============================================================================
--- trunk/reactos/hal/halx86/generic/legacy/bussupp.c [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/generic/legacy/bussupp.c [iso-8859-1] Mon Jun 7 22:10:53
2010
@@ -82,7 +82,6 @@
InterfaceTypeUndefined,
0,
0);
- DPRINT1("Registering Internal Bus: %p\n", Bus);
if (Bus)
{
/* Set it up */
@@ -97,7 +96,6 @@
InterfaceTypeUndefined,
0,
0);
- DPRINT1("Registering CMOS Bus: %p\n", Bus);
if (Bus)
{
/* Set it up */
@@ -112,7 +110,6 @@
InterfaceTypeUndefined,
0,
0);
- DPRINT1("Registering CMOS Bus: %p\n", Bus);
if (Bus)
{
/* Set it up */
@@ -127,7 +124,6 @@
Internal,
0,
0);
- DPRINT1("Registering ISA Bus: %p\n", Bus);
if (Bus)
{
/* Set it up */
@@ -1286,38 +1282,24 @@
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;
}
/*
Modified: trunk/reactos/hal/halx86/include/bus.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/hal/halx86/include/bus.h?r…
==============================================================================
--- trunk/reactos/hal/halx86/include/bus.h [iso-8859-1] (original)
+++ trunk/reactos/hal/halx86/include/bus.h [iso-8859-1] Mon Jun 7 22:10:53 2010
@@ -449,6 +449,13 @@
VOID
);
+PBUS_HANDLER
+FASTCALL
+HaliReferenceHandlerForConfigSpace(
+ IN BUS_DATA_TYPE ConfigType,
+ IN ULONG BusNumber
+);
+
ULONG
NTAPI
HalpNoBusData(