/** @file\r
- Capsule Runtime Drivers produces two UEFI capsule runtime services.\r
+ Capsule Runtime Driver produces two UEFI capsule runtime services.\r
(UpdateCapsule, QueryCapsuleCapabilities)\r
+ It installs the Capsule Architectural Protocol defined in PI1.0a to signify \r
+ the capsule runtime services are ready.\r
\r
Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
All rights reserved. This program and the accompanying materials\r
\r
**/\r
\r
-#include "CapsuleService.h"\r
+#include <Uefi.h>\r
+\r
+#include <Protocol/Capsule.h>\r
+#include <Guid/CapsuleVendor.h>\r
+\r
+#include <Library/DebugLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/CapsuleLib.h>\r
+#include <Library/UefiDriverEntryPoint.h>\r
+#include <Library/UefiBootServicesTableLib.h>\r
+#include <Library/UefiRuntimeServicesTableLib.h>\r
+#include <Library/UefiRuntimeLib.h>\r
\r
/**\r
Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended\r
//\r
// Check if the platform supports update capsule across a system reset\r
//\r
- if (!FeaturePcdGet(PcdSupportUpdateCapsuleRest)) {\r
+ if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) {\r
return EFI_UNSUPPORTED;\r
}\r
//\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 = EfiSetVariable (\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
+ 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 (Status != EFI_SUCCESS) {\r
return Status;\r
}\r
//\r
//Check if the platform supports update capsule across a system reset\r
//\r
- if (!FeaturePcdGet(PcdSupportUpdateCapsuleRest)) {\r
+ if (!FeaturePcdGet(PcdSupportUpdateCapsuleReset)) {\r
return EFI_UNSUPPORTED;\r
}\r
- *ResetType = EfiResetWarm;\r
- *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule);\r
+ *ResetType = EfiResetWarm; \r
} else {\r
//\r
// For non-reset capsule image.\r
//\r
*ResetType = EfiResetCold;\r
+ }\r
+ \r
+ //\r
+ // The support max capsule image size\r
+ //\r
+ if ((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) != 0) {\r
+ *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule);\r
+ } else {\r
*MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizeNonPopulateCapsule);\r
}\r
+\r
return EFI_SUCCESS;\r
}\r
\r
\r
/**\r
\r
- This code is to install UEFI capsule runtime service.\r
+ This code installs UEFI capsule runtime service.\r
\r
@param ImageHandle The firmware allocated handle for the EFI image. \r
@param SystemTable A pointer to the EFI System Table.\r
//\r
// Install capsule runtime services into UEFI runtime service tables.\r
//\r
- SystemTable->RuntimeServices->UpdateCapsule = UpdateCapsule;\r
- SystemTable->RuntimeServices->QueryCapsuleCapabilities = QueryCapsuleCapabilities;\r
+ gRT->UpdateCapsule = UpdateCapsule;\r
+ gRT->QueryCapsuleCapabilities = QueryCapsuleCapabilities;\r
\r
//\r
// Install the Capsule Architectural Protocol on a new handle\r