[STORPORT] Implement StorPortGetUncachedExtension().
authorEric Kohl <eric.kohl@reactos.org>
Sat, 21 Oct 2017 15:55:35 +0000 (17:55 +0200)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 21 Oct 2017 15:56:06 +0000 (17:56 +0200)
CORE-13866

boot/bootdata/txtsetup.sif
drivers/storage/port/storport/precomp.h
drivers/storage/port/storport/storport.c

index 3ea6297..0600c09 100644 (file)
@@ -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
index 30ca7fe..b64190d 100644 (file)
@@ -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;
 
 
index d25064b..7ee3605 100644 (file)
@@ -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;
 }