https://git.reactos.org/?p=reactos.git;a=commitdiff;h=45cc5c0e37ff6033c80b7…
commit 45cc5c0e37ff6033c80b767529c05576451718f3
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Oct 21 17:55:35 2017 +0200
[STORPORT] Implement StorPortGetUncachedExtension().
CORE-13866
---
boot/bootdata/txtsetup.sif | 4 ++--
drivers/storage/port/storport/precomp.h | 4 ++++
drivers/storage/port/storport/storport.c | 40 ++++++++++++++++++++++++++++----
3 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/boot/bootdata/txtsetup.sif b/boot/bootdata/txtsetup.sif
index 3ea62974b5..0600c098a8 100644
--- a/boot/bootdata/txtsetup.sif
+++ b/boot/bootdata/txtsetup.sif
@@ -87,8 +87,8 @@ PCI\VEN_104B&CC_0100 = buslogic
PCI\CC_0101 = pciide
PCI\CC_0104 = uniata
PCI\CC_0105 = uniata
-PCI\CC_0106 = uniata
-;PCI\CC_0106 = storahci
+;PCI\CC_0106 = uniata
+PCI\CC_0106 = storahci
*PNP0600 = uniata
;USB\CLASS_09 = usbhub
USB\ROOT_HUB = usbhub
diff --git a/drivers/storage/port/storport/precomp.h
b/drivers/storage/port/storport/precomp.h
index 30ca7fe78d..b64190d114 100644
--- a/drivers/storage/port/storport/precomp.h
+++ b/drivers/storage/port/storport/precomp.h
@@ -97,6 +97,10 @@ typedef struct _FDO_DEVICE_EXTENSION
BUS_INTERFACE_STANDARD BusInterface;
BOOLEAN BusInitialized;
PMAPPED_ADDRESS MappedAddressList;
+
+ PVOID UncachedExtensionBase;
+ ULONG UncachedExtensionSize;
+
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
diff --git a/drivers/storage/port/storport/storport.c
b/drivers/storage/port/storport/storport.c
index d25064bba1..7ee36051bf 100644
--- a/drivers/storage/port/storport/storport.c
+++ b/drivers/storage/port/storport/storport.c
@@ -607,7 +607,6 @@ StorPortGetDeviceBase(
_In_ BOOLEAN InIoSpace)
{
PMINIPORT_DEVICE_EXTENSION MiniportExtension;
-
PHYSICAL_ADDRESS TranslatedAddress;
PVOID MappedAddress;
NTSTATUS Status;
@@ -743,7 +742,7 @@ StorPortGetSrb(
/*
- * @unimplemented
+ * @implemented
*/
STORPORT_API
PVOID
@@ -753,10 +752,43 @@ StorPortGetUncachedExtension(
_In_ PPORT_CONFIGURATION_INFORMATION ConfigInfo,
_In_ ULONG NumberOfBytes)
{
+ PMINIPORT_DEVICE_EXTENSION MiniportExtension;
+ PFDO_DEVICE_EXTENSION DeviceExtension;
+ PHYSICAL_ADDRESS LowestAddress, HighestAddress, Alignment;
+
DPRINT1("StorPortGetUncachedExtension(%p %p %lu)\n",
HwDeviceExtension, ConfigInfo, NumberOfBytes);
- UNIMPLEMENTED;
- return NULL;
+
+ /* Get the miniport extension */
+ MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
+ MINIPORT_DEVICE_EXTENSION,
+ HwDeviceExtension);
+ DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
+ HwDeviceExtension, MiniportExtension);
+
+ DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
+
+ /* Return the uncached extension base address if we already have one */
+ if (DeviceExtension->UncachedExtensionBase != NULL)
+ return DeviceExtension->UncachedExtensionBase;
+
+ // FIXME: Set DMA stuff here?
+
+ /* Allocate the uncached extension */
+ Alignment.QuadPart = 0;
+ LowestAddress.QuadPart = 0;
+ HighestAddress.QuadPart = 0x00000000FFFFFFFF;
+ DeviceExtension->UncachedExtensionBase =
MmAllocateContiguousMemorySpecifyCache(NumberOfBytes,
+
LowestAddress,
+
HighestAddress,
+
Alignment,
+
MmCached);
+ if (DeviceExtension->UncachedExtensionBase == NULL)
+ return NULL;
+
+ DeviceExtension->UncachedExtensionSize = NumberOfBytes;
+
+ return DeviceExtension->UncachedExtensionBase;
}