mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +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;
|
||||
BOOLEAN BusInitialized;
|
||||
PMAPPED_ADDRESS MappedAddressList;
|
||||
|
||||
PVOID UncachedExtensionBase;
|
||||
PVOID UncachedExtensionVirtualBase;
|
||||
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase;
|
||||
ULONG UncachedExtensionSize;
|
||||
|
||||
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
|
||||
|
|
|
@ -683,7 +683,7 @@ StorPortGetLogicalUnit(
|
|||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
* @implemented
|
||||
*/
|
||||
STORPORT_API
|
||||
STOR_PHYSICAL_ADDRESS
|
||||
|
@ -694,10 +694,37 @@ StorPortGetPhysicalAddress(
|
|||
_In_ PVOID VirtualAddress,
|
||||
_Out_ ULONG *Length)
|
||||
{
|
||||
PMINIPORT_DEVICE_EXTENSION MiniportExtension;
|
||||
PFDO_DEVICE_EXTENSION DeviceExtension;
|
||||
STOR_PHYSICAL_ADDRESS PhysicalAddress;
|
||||
ULONG_PTR Offset;
|
||||
|
||||
DPRINT1("StorPortGetPhysicalAddress(%p %p %p %p)\n",
|
||||
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;
|
||||
|
||||
*Length = 0;
|
||||
|
@ -769,8 +796,8 @@ StorPortGetUncachedExtension(
|
|||
DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
|
||||
|
||||
/* Return the uncached extension base address if we already have one */
|
||||
if (DeviceExtension->UncachedExtensionBase != NULL)
|
||||
return DeviceExtension->UncachedExtensionBase;
|
||||
if (DeviceExtension->UncachedExtensionVirtualBase != NULL)
|
||||
return DeviceExtension->UncachedExtensionVirtualBase;
|
||||
|
||||
// FIXME: Set DMA stuff here?
|
||||
|
||||
|
@ -778,17 +805,18 @@ StorPortGetUncachedExtension(
|
|||
Alignment.QuadPart = 0;
|
||||
LowestAddress.QuadPart = 0;
|
||||
HighestAddress.QuadPart = 0x00000000FFFFFFFF;
|
||||
DeviceExtension->UncachedExtensionBase = MmAllocateContiguousMemorySpecifyCache(NumberOfBytes,
|
||||
LowestAddress,
|
||||
HighestAddress,
|
||||
Alignment,
|
||||
MmCached);
|
||||
if (DeviceExtension->UncachedExtensionBase == NULL)
|
||||
DeviceExtension->UncachedExtensionVirtualBase = MmAllocateContiguousMemorySpecifyCache(NumberOfBytes,
|
||||
LowestAddress,
|
||||
HighestAddress,
|
||||
Alignment,
|
||||
MmCached);
|
||||
if (DeviceExtension->UncachedExtensionVirtualBase == NULL)
|
||||
return NULL;
|
||||
|
||||
DeviceExtension->UncachedExtensionPhysicalBase = MmGetPhysicalAddress(DeviceExtension->UncachedExtensionVirtualBase);
|
||||
DeviceExtension->UncachedExtensionSize = NumberOfBytes;
|
||||
|
||||
return DeviceExtension->UncachedExtensionBase;
|
||||
return DeviceExtension->UncachedExtensionVirtualBase;
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue