mirror of https://github.com/lianthony/NT4.0
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
111 lines
2.7 KiB
111 lines
2.7 KiB
/*++
|
|
|
|
|
|
Copyright (c) 1989 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
pxsysbus.c
|
|
|
|
Abstract:
|
|
|
|
Author:
|
|
|
|
Environment:
|
|
|
|
Revision History:
|
|
Jim Wooldridge - ported to PowerPC
|
|
|
|
|
|
--*/
|
|
|
|
#include "halp.h"
|
|
|
|
#include "eisa.h"
|
|
#include "pxmemctl.h"
|
|
|
|
ULONG HalpDefaultInterruptAffinity;
|
|
|
|
BOOLEAN
|
|
HalpTranslateSystemBusAddress(
|
|
IN PBUS_HANDLER BusHandler,
|
|
IN PBUS_HANDLER RootHandler,
|
|
IN PHYSICAL_ADDRESS BusAddress,
|
|
IN OUT PULONG AddressSpace,
|
|
OUT PPHYSICAL_ADDRESS TranslatedAddress
|
|
)
|
|
|
|
/*++
|
|
|
|
Routine Description:
|
|
|
|
This function translates a bus-relative address space and address into
|
|
a system physical address.
|
|
|
|
Arguments:
|
|
|
|
BusAddress - Supplies the bus-relative address
|
|
|
|
AddressSpace - Supplies the address space number.
|
|
Returns the host address space number.
|
|
|
|
AddressSpace == 0 => memory space
|
|
AddressSpace == 1 => I/O space
|
|
|
|
TranslatedAddress - Supplies a pointer to return the translated address
|
|
|
|
Return Value:
|
|
|
|
A return value of TRUE indicates that a system physical address
|
|
corresponding to the supplied bus relative address and bus address
|
|
number has been returned in TranslatedAddress.
|
|
|
|
A return value of FALSE occurs if the translation for the address was
|
|
not possible
|
|
|
|
--*/
|
|
|
|
{
|
|
PSUPPORTED_RANGE pRange;
|
|
|
|
pRange = NULL;
|
|
switch (*AddressSpace) {
|
|
case 0:
|
|
// verify memory address is within buses memory limits
|
|
for (pRange = &BusHandler->BusAddresses->PrefetchMemory; pRange; pRange = pRange->Next) {
|
|
if (BusAddress.QuadPart >= pRange->Base &&
|
|
BusAddress.QuadPart <= pRange->Limit) {
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!pRange) {
|
|
for (pRange = &BusHandler->BusAddresses->Memory; pRange; pRange = pRange->Next) {
|
|
if (BusAddress.QuadPart >= pRange->Base &&
|
|
BusAddress.QuadPart <= pRange->Limit) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
break;
|
|
|
|
case 1:
|
|
// verify IO address is within buses IO limits
|
|
for (pRange = &BusHandler->BusAddresses->IO; pRange; pRange = pRange->Next) {
|
|
if (BusAddress.QuadPart >= pRange->Base &&
|
|
BusAddress.QuadPart <= pRange->Limit) {
|
|
break;
|
|
}
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (pRange) {
|
|
TranslatedAddress->QuadPart = BusAddress.QuadPart + pRange->SystemBase;
|
|
*AddressSpace = pRange->SystemAddressSpace;
|
|
return TRUE;
|
|
}
|
|
|
|
return FALSE;
|
|
}
|
|
|