summaryrefslogtreecommitdiff
path: root/storage/class/classpnp/src/utils.c
diff options
context:
space:
mode:
authorDave Wilson <[email protected]>2015-04-29 09:48:49 -0700
committerDave Wilson <[email protected]>2015-04-29 10:47:29 -0700
commitd40232638faaab19de557e70a3ee938da7a35295 (patch)
tree14e61c973745949af186b7940e3a53d25322f5de /storage/class/classpnp/src/utils.c
parent02e5b090a6131a7cc1b90f4a9373117c9e3c7088 (diff)
samples update for //build
Diffstat (limited to 'storage/class/classpnp/src/utils.c')
-rw-r--r--storage/class/classpnp/src/utils.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/storage/class/classpnp/src/utils.c b/storage/class/classpnp/src/utils.c
index f8236c68..b503f890 100644
--- a/storage/class/classpnp/src/utils.c
+++ b/storage/class/classpnp/src/utils.c
@@ -8128,8 +8128,6 @@ retry:
if ((firmwareInfo->Version < sizeof(STORAGE_HW_FIRMWARE_INFO)) ||
(firmwareInfo->Size < sizeof(STORAGE_HW_FIRMWARE_INFO)) ||
(firmwareInfo->SlotCount == 0) ||
- (firmwareInfo->ActiveSlot >= firmwareInfo->SlotCount) ||
- ((firmwareInfo->PendingActivateSlot >= firmwareInfo->SlotCount) && (firmwareInfo->PendingActivateSlot != STORAGE_HW_FIRMWARE_INVALID_SLOT)) ||
(firmwareInfo->ImagePayloadMaxSize > fdoExtension->AdapterDescriptor->MaximumTransferLength)) {
oldState = InterlockedCompareExchange((PLONG)(&fdoExtension->FunctionSupportInfo->HwFirmwareGetInfoSupport), (LONG)NotSupported, (ULONG)SupportUnknown);
@@ -8493,7 +8491,8 @@ ClassDeviceHwFirmwareDownloadProcess(
//
// Validate the device support
//
- if (fdoExtension->FunctionSupportInfo->HwFirmwareInfo->SupportUpgrade == FALSE) {
+ if ((fdoExtension->FunctionSupportInfo->HwFirmwareInfo->SupportUpgrade == FALSE) ||
+ (fdoExtension->FunctionSupportInfo->HwFirmwareInfo->ImagePayloadAlignment == 0)) {
status = STATUS_NOT_SUPPORTED;
goto Exit_Firmware_Download;
}
@@ -8538,9 +8537,9 @@ ClassDeviceHwFirmwareDownloadProcess(
//
if (((ULONG_PTR)firmwareDownload->ImageBuffer % fdoExtension->FunctionSupportInfo->HwFirmwareInfo->ImagePayloadAlignment) != 0) {
//
- // Allocate buffer aligns to PAGE_SIZE to accommodate any alignment requirement.
+ // Allocate buffer aligns to ImagePayloadAlignment to accommodate the alignment requirement.
//
- bufferSize = ALIGN_UP_BY(firmwareDownload->BufferSize, PAGE_SIZE);
+ bufferSize = ALIGN_UP_BY(firmwareDownload->BufferSize, fdoExtension->FunctionSupportInfo->HwFirmwareInfo->ImagePayloadAlignment);
#pragma prefast(suppress:6014, "The allocated memory that firmwareImageBuffer points to will be freed in ClassHwFirmwareDownloadComplete().")
firmwareImageBuffer = ExAllocatePoolWithTag(NonPagedPoolNx, bufferSize, CLASSPNP_POOL_TAG_FIRMWARE);
@@ -8631,9 +8630,9 @@ ClassDeviceHwFirmwareDownloadProcess(
cdb->WRITE_BUFFER.BufferOffset[1] = *((PCHAR)&firmwareDownload->Offset + 1);
cdb->WRITE_BUFFER.BufferOffset[2] = *((PCHAR)&firmwareDownload->Offset);
- cdb->WRITE_BUFFER.ParameterListLength[0] = *((PCHAR)&firmwareDownload->BufferSize + 2);
- cdb->WRITE_BUFFER.ParameterListLength[1] = *((PCHAR)&firmwareDownload->BufferSize + 1);
- cdb->WRITE_BUFFER.ParameterListLength[2] = *((PCHAR)&firmwareDownload->BufferSize);
+ cdb->WRITE_BUFFER.ParameterListLength[0] = *((PCHAR)&bufferSize + 2);
+ cdb->WRITE_BUFFER.ParameterListLength[1] = *((PCHAR)&bufferSize + 1);
+ cdb->WRITE_BUFFER.ParameterListLength[2] = *((PCHAR)&bufferSize);
//
// Send as a tagged command.
@@ -8902,5 +8901,3 @@ Exit_Firmware_Activate:
FREE_POOL(Srb);
return status;
}
-
-