Author: sir_richard
Date: Mon Jun 7 23:01:53 2010
New Revision: 47679
URL:
http://svn.reactos.org/svn/reactos?rev=47679&view=rev
Log:
[HAL]: Implement HalTranslateBusAddress using Bus Handler support. The old HAL would just
return whatever the caller gave (no translation was done). For example, with the new HAL,
this now results in the translation of 0xCF800 in I/O space to fail (not sure which driver
requests this), because this is not a valid I/O address on PC/AT systems (highest is
0xFFFF).
This change also allows for the PCI driver to override the translation mechanism
(which will piggy-back to the system bus translator) with its own. Please test.
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
23:01:53 2010
@@ -407,13 +407,12 @@
HalDereferenceBusHandler = HaliDereferenceBusHandler;
#endif
HalPciAssignSlotResources = HalpAssignSlotResources;
+ HalPciTranslateBusAddress = HaliTranslateBusAddress; /* PCI Driver can override */
/* 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
}
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 23:01:53
2010
@@ -1196,6 +1196,37 @@
return TRUE;
}
+BOOLEAN
+NTAPI
+HaliTranslateBusAddress(IN INTERFACE_TYPE InterfaceType,
+ IN ULONG BusNumber,
+ IN PHYSICAL_ADDRESS BusAddress,
+ IN OUT PULONG AddressSpace,
+ OUT PPHYSICAL_ADDRESS TranslatedAddress)
+{
+ PBUS_HANDLER Handler;
+ BOOLEAN Status;
+
+ /* Find the handler */
+ Handler = HalReferenceHandlerForBus(InterfaceType, BusNumber);
+ if (!(Handler) || !(Handler->TranslateBusAddress))
+ {
+ DPRINT1("No translator!\n");
+ return FALSE;
+ }
+
+ /* Do the assignment */
+ Status = Handler->TranslateBusAddress(Handler,
+ Handler,
+ BusAddress,
+ AddressSpace,
+ TranslatedAddress);
+
+ /* Dereference the handler and return */
+ HalDereferenceBusHandler(Handler);
+ return Status;
+}
+
/* PUBLIC FUNCTIONS **********************************************************/
/*
@@ -1423,9 +1454,12 @@
}
else
{
- /* Translation is easy */
- TranslatedAddress->QuadPart = BusAddress.QuadPart;
- return TRUE;
+ /* Call the bus handler */
+ return HaliTranslateBusAddress(InterfaceType,
+ BusNumber,
+ BusAddress,
+ AddressSpace,
+ TranslatedAddress);
}
}
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 23:01:53 2010
@@ -368,7 +368,7 @@
BOOLEAN
NTAPI
-HalpTranslateBusAddress(
+HaliTranslateBusAddress(
IN INTERFACE_TYPE InterfaceType,
IN ULONG BusNumber,
IN PHYSICAL_ADDRESS BusAddress,