https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cc95d3ece3dd1f94bfe80…
commit cc95d3ece3dd1f94bfe804ec025fec85648388f5
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Oct 21 23:58:42 2017 +0200
[STORPORT] Implement StorPortNotification() / EnablePassiveInitialization and call the
passive initialization routine.
CORE-13866
---
drivers/storage/port/storport/fdo.c | 11 ++++++++
drivers/storage/port/storport/precomp.h | 2 +-
drivers/storage/port/storport/storport.c | 48 +++++++++++++++++++++++++++++++-
3 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/drivers/storage/port/storport/fdo.c b/drivers/storage/port/storport/fdo.c
index 70b6a30dd3..9072971a91 100644
--- a/drivers/storage/port/storport/fdo.c
+++ b/drivers/storage/port/storport/fdo.c
@@ -63,6 +63,17 @@ PortFdoStartMiniport(
return Status;
}
+ /* Call the HwPassiveInitRoutine function, if available */
+ if (DeviceExtension->HwPassiveInitRoutine != NULL)
+ {
+ DPRINT1("Calling HwPassiveInitRoutine()\n");
+ if
(!DeviceExtension->HwPassiveInitRoutine(&DeviceExtension->Miniport.MiniportExtension->HwDeviceExtension))
+ {
+ DPRINT1("HwPassiveInitRoutine() failed\n");
+ return STATUS_UNSUCCESSFUL;
+ }
+ }
+
return STATUS_SUCCESS;
}
diff --git a/drivers/storage/port/storport/precomp.h
b/drivers/storage/port/storport/precomp.h
index bd2bc91daf..168c318544 100644
--- a/drivers/storage/port/storport/precomp.h
+++ b/drivers/storage/port/storport/precomp.h
@@ -100,7 +100,7 @@ typedef struct _FDO_DEVICE_EXTENSION
PVOID UncachedExtensionVirtualBase;
PHYSICAL_ADDRESS UncachedExtensionPhysicalBase;
ULONG UncachedExtensionSize;
-
+ PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine;
} FDO_DEVICE_EXTENSION, *PFDO_DEVICE_EXTENSION;
diff --git a/drivers/storage/port/storport/storport.c
b/drivers/storage/port/storport/storport.c
index b105722c09..39c6564c59 100644
--- a/drivers/storage/port/storport/storport.c
+++ b/drivers/storage/port/storport/storport.c
@@ -992,7 +992,53 @@ StorPortNotification(
_In_ PVOID HwDeviceExtension,
...)
{
- DPRINT1("StorPortNotification()\n");
+ PMINIPORT_DEVICE_EXTENSION MiniportExtension = NULL;
+ PFDO_DEVICE_EXTENSION DeviceExtension = NULL;
+ PHW_PASSIVE_INITIALIZE_ROUTINE HwPassiveInitRoutine;
+ PBOOLEAN Result;
+ va_list ap;
+
+ DPRINT1("StorPortNotification(%x %p)\n",
+ NotificationType, HwDeviceExtension);
+
+ /* Get the miniport extension */
+ if (HwDeviceExtension != NULL)
+ {
+ MiniportExtension = CONTAINING_RECORD(HwDeviceExtension,
+ MINIPORT_DEVICE_EXTENSION,
+ HwDeviceExtension);
+ DPRINT1("HwDeviceExtension %p MiniportExtension %p\n",
+ HwDeviceExtension, MiniportExtension);
+
+ DeviceExtension = MiniportExtension->Miniport->DeviceExtension;
+ }
+
+ va_start(ap, HwDeviceExtension);
+
+ switch (NotificationType)
+ {
+ case EnablePassiveInitialization:
+ DPRINT1("EnablePassiveInitialization\n");
+ HwPassiveInitRoutine = (PHW_PASSIVE_INITIALIZE_ROUTINE)va_arg(ap,
PHW_PASSIVE_INITIALIZE_ROUTINE);
+ DPRINT1("HwPassiveInitRoutine %p\n", HwPassiveInitRoutine);
+ Result = (PBOOLEAN)va_arg(ap, PBOOLEAN);
+
+ *Result = FALSE;
+
+ if ((DeviceExtension != NULL) &&
+ (DeviceExtension->HwPassiveInitRoutine == NULL))
+ {
+ DeviceExtension->HwPassiveInitRoutine = HwPassiveInitRoutine;
+ *Result = TRUE;
+ }
+ break;
+
+ default:
+ DPRINT1("Unsupported Notification %lx\n", NotificationType);
+ break;
+ }
+
+ va_end(ap);
}