Author: cgutman
Date: Sun May 3 06:48:02 2009
New Revision: 40776
URL:
http://svn.reactos.org/svn/reactos?rev=40776&view=rev
Log:
- Translate the raw address before attempting to map it
Modified:
trunk/reactos/drivers/network/ndis/ndis/io.c
Modified: trunk/reactos/drivers/network/ndis/ndis/io.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/network/ndis/ndis/…
==============================================================================
--- trunk/reactos/drivers/network/ndis/ndis/io.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/network/ndis/ndis/io.c [iso-8859-1] Sun May 3 06:48:02 2009
@@ -613,18 +613,25 @@
* NDIS_STATUS_FAILURE: a general failure has occured
* NOTES:
* - Must be called at IRQL = PASSIVE_LEVEL
- * BUGS:
- * - Only supports things that MmMapIoSpace internally supports - what
- * about considering bus type, etc?
- * - doesn't track resources allocated...
- */
-{
+ */
+{
+ PLOGICAL_ADAPTER Adapter = MiniportAdapterHandle;
+ ULONG AddressSpace = 0; /* Memory Space */
+ NDIS_PHYSICAL_ADDRESS TranslatedAddress;
+
PAGED_CODE();
ASSERT(VirtualAddress && MiniportAdapterHandle);
NDIS_DbgPrint(MAX_TRACE, ("Called\n"));
- *VirtualAddress = MmMapIoSpace(PhysicalAddress, Length, MmNonCached);
+ if(!HalTranslateBusAddress(Adapter->NdisMiniportBlock.BusType,
Adapter->NdisMiniportBlock.BusNumber,
+ PhysicalAddress, &AddressSpace,
&TranslatedAddress))
+ {
+ NDIS_DbgPrint(MIN_TRACE, ("Unable to translate address\n"));
+ return NDIS_STATUS_RESOURCES;
+ }
+
+ *VirtualAddress = MmMapIoSpace(TranslatedAddress, Length, MmNonCached);
if(!*VirtualAddress) {
NDIS_DbgPrint(MIN_TRACE, ("MmMapIoSpace failed\n"));