mirror of
https://github.com/reactos/reactos.git
synced 2025-08-02 05:55:42 +00:00
[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. svn path=/trunk/; revision=47679
This commit is contained in:
parent
0ae7a75158
commit
28bde112e1
3 changed files with 39 additions and 6 deletions
|
@ -407,13 +407,12 @@ HalpInitBusHandler(VOID)
|
|||
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
|
||||
}
|
||||
|
|
|
@ -1196,6 +1196,37 @@ HalpFindBusAddressTranslation(IN PHYSICAL_ADDRESS BusAddress,
|
|||
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 @@ HalTranslateBusAddress(IN INTERFACE_TYPE InterfaceType,
|
|||
}
|
||||
else
|
||||
{
|
||||
/* Translation is easy */
|
||||
TranslatedAddress->QuadPart = BusAddress.QuadPart;
|
||||
return TRUE;
|
||||
/* Call the bus handler */
|
||||
return HaliTranslateBusAddress(InterfaceType,
|
||||
BusNumber,
|
||||
BusAddress,
|
||||
AddressSpace,
|
||||
TranslatedAddress);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -368,7 +368,7 @@ HalpInitializePciStubs(
|
|||
|
||||
BOOLEAN
|
||||
NTAPI
|
||||
HalpTranslateBusAddress(
|
||||
HaliTranslateBusAddress(
|
||||
IN INTERFACE_TYPE InterfaceType,
|
||||
IN ULONG BusNumber,
|
||||
IN PHYSICAL_ADDRESS BusAddress,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue