mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
[STORPORT] Implement parts of StorPortGetPhysicalAddress() that handle the uncached extension.
CORE-13866
This commit is contained in:
parent
ec4fe62118
commit
f9f21574ba
2 changed files with 40 additions and 12 deletions
|
@ -97,8 +97,8 @@ typedef struct _FDO_DEVICE_EXTENSION
|
||||||
BUS_INTERFACE_STANDARD BusInterface;
|
BUS_INTERFACE_STANDARD BusInterface;
|
||||||
BOOLEAN BusInitialized;
|
BOOLEAN BusInitialized;
|
||||||
PMAPPED_ADDRESS MappedAddressList;
|
PMAPPED_ADDRESS MappedAddressList;
|
||||||
|
PVOID UncachedExtensionVirtualBase;
|
||||||
PVOID UncachedExtensionBase;
|
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase;
|
||||||
ULONG UncachedExtensionSize;
|
ULONG UncachedExtensionSize;
|
||||||
|
|
||||||
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||||
|
|
|
@ -683,7 +683,7 @@ StorPortGetLogicalUnit(
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @unimplemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
STORPORT_API
|
STORPORT_API
|
||||||
STOR_PHYSICAL_ADDRESS
|
STOR_PHYSICAL_ADDRESS
|
||||||
|
@ -694,10 +694,37 @@ StorPortGetPhysicalAddress(
|
||||||
_In_ PVOID VirtualAddress,
|
_In_ PVOID VirtualAddress,
|
||||||
_Out_ ULONG *Length)
|
_Out_ ULONG *Length)
|
||||||
{
|
{
|
||||||
|
PMINIPORT_DEVICE_EXTENSION MiniportExtension;
|
||||||
|
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||||
STOR_PHYSICAL_ADDRESS PhysicalAddress;
|
STOR_PHYSICAL_ADDRESS PhysicalAddress;
|
||||||
|
ULONG_PTR Offset;
|
||||||
|
|
||||||
DPRINT1("StorPortGetPhysicalAddress(%p %p %p %p)\n",
|
DPRINT1("StorPortGetPhysicalAddress(%p %p %p %p)\n",
|
||||||
HwDeviceExtension, Srb, VirtualAddress, Length);
|
HwDeviceExtension, Srb, VirtualAddress, Length);
|
||||||
|
|
||||||
|
/* Get the miniport extension */
|
||||||
|
MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
|
||||||
|
MINIPORT_DEVICE_EXTENSION,
|
||||||
|
HwDeviceExtension);
|
||||||
|
DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
|
||||||
|
HwDeviceExtension, MiniportExtension);
|
||||||
|
|
||||||
|
DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
|
||||||
|
|
||||||
|
/* Inside of the uncached extension? */
|
||||||
|
if (((ULONG_PTR)VirtualAddress >= (ULONG_PTR)DeviceExtension->UncachedExtensionVirtualBase) &&
|
||||||
|
((ULONG_PTR)VirtualAddress <= (ULONG_PTR)DeviceExtension->UncachedExtensionVirtualBase + DeviceExtension->UncachedExtensionSize))
|
||||||
|
{
|
||||||
|
Offset = (ULONG_PTR)VirtualAddress - (ULONG_PTR)DeviceExtension->UncachedExtensionVirtualBase;
|
||||||
|
|
||||||
|
PhysicalAddress.QuadPart = DeviceExtension->UncachedExtensionPhysicalBase.QuadPart + Offset;
|
||||||
|
*Length = DeviceExtension->UncachedExtensionSize - Offset;
|
||||||
|
|
||||||
|
return PhysicalAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME
|
||||||
|
|
||||||
UNIMPLEMENTED;
|
UNIMPLEMENTED;
|
||||||
|
|
||||||
*Length = 0;
|
*Length = 0;
|
||||||
|
@ -769,8 +796,8 @@ StorPortGetUncachedExtension(
|
||||||
DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
|
DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
|
||||||
|
|
||||||
/* Return the uncached extension base address if we already have one */
|
/* Return the uncached extension base address if we already have one */
|
||||||
if (DeviceExtension->UncachedExtensionBase != NULL)
|
if (DeviceExtension->UncachedExtensionVirtualBase != NULL)
|
||||||
return DeviceExtension->UncachedExtensionBase;
|
return DeviceExtension->UncachedExtensionVirtualBase;
|
||||||
|
|
||||||
// FIXME: Set DMA stuff here?
|
// FIXME: Set DMA stuff here?
|
||||||
|
|
||||||
|
@ -778,17 +805,18 @@ StorPortGetUncachedExtension(
|
||||||
Alignment.QuadPart = 0;
|
Alignment.QuadPart = 0;
|
||||||
LowestAddress.QuadPart = 0;
|
LowestAddress.QuadPart = 0;
|
||||||
HighestAddress.QuadPart = 0x00000000FFFFFFFF;
|
HighestAddress.QuadPart = 0x00000000FFFFFFFF;
|
||||||
DeviceExtension->UncachedExtensionBase = MmAllocateContiguousMemorySpecifyCache(NumberOfBytes,
|
DeviceExtension->UncachedExtensionVirtualBase = MmAllocateContiguousMemorySpecifyCache(NumberOfBytes,
|
||||||
LowestAddress,
|
LowestAddress,
|
||||||
HighestAddress,
|
HighestAddress,
|
||||||
Alignment,
|
Alignment,
|
||||||
MmCached);
|
MmCached);
|
||||||
if (DeviceExtension->UncachedExtensionBase == NULL)
|
if (DeviceExtension->UncachedExtensionVirtualBase == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
DeviceExtension->UncachedExtensionPhysicalBase = MmGetPhysicalAddress(DeviceExtension->UncachedExtensionVirtualBase);
|
||||||
DeviceExtension->UncachedExtensionSize = NumberOfBytes;
|
DeviceExtension->UncachedExtensionSize = NumberOfBytes;
|
||||||
|
|
||||||
return DeviceExtension->UncachedExtensionBase;
|
return DeviceExtension->UncachedExtensionVirtualBase;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue