diff --git a/drivers/storage/port/storport/fdo.c b/drivers/storage/port/storport/fdo.c index 70b6a30dd37..9072971a91e 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 bd2bc91daff..168c3185441 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 b105722c09d..39c6564c59e 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); }