+ //\r
+ // ScatterGatherList is only referenced if the capsules are defined to persist across\r
+ // system reset. Set its value into NV storage to let pre-boot driver to pick it up \r
+ // after coming through a system reset.\r
+ //\r
+ Status = gRT->SetVariable (\r
+ EFI_CAPSULE_VARIABLE_NAME,\r
+ &gEfiCapsuleVendorGuid,\r
+ EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
+ sizeof (UINTN),\r
+ (VOID *) &ScatterGatherList\r
+ );\r
+ if (!EFI_ERROR (Status) && InitiateReset) {\r
+ //\r
+ // Firmware that encounters a capsule which has the CAPSULE_FLAGS_INITIATE_RESET Flag set in its header\r
+ // will initiate a reset of the platform which is compatible with the passed-in capsule request and will \r
+ // not return back to the caller.\r
+ //\r
+ gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);\r
+ }\r
+ return Status;\r