]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Code scrub for the Capsule, SecurityStub, and Crc32 library instance.
authorlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 9 Jul 2008 13:33:20 +0000 (13:33 +0000)
committerlgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 9 Jul 2008 13:33:20 +0000 (13:33 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5441 6f19259b-4bc3-4df7-8a09-765794883524

MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.c
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.c
MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.c
MdeModulePkg/Library/PeiRecoveryLibNull/PeiRecoveryLibNull.inf
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.c
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleService.h
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.c
MdeModulePkg/Universal/SecurityStubDxe/SecurityStub.h
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf

index 1b88b3a61283f8379f7ba4bfcf3936cde2665537..66546f12f8bcde68e52eafef8bca63d4ca4cd994 100644 (file)
@@ -1,7 +1,7 @@
-/**@file\r
-  Capsule Library Null instance. \r
+/** @file\r
+  Null Dxe Capsule Library instance.\r
 \r
-Copyright (c) 2007 Intel Corporation\r
+Copyright (c) 2007 - 2008 Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -15,11 +15,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/CapsuleLib.h>\r
 \r
 /**\r
-  Those capsules supported by the firmwares.\r
+  Check those capsules are supported by the firmwares.\r
   \r
   @param  CapsuleHeader    Point to the UEFI capsule image to be checked.\r
   \r
-  @retval EFI_SUCESS       Input capsule is supported by firmware.\r
   @retval EFI_UNSUPPORTED  Input capsule is not supported by the firmware.\r
 **/\r
 EFI_STATUS\r
@@ -36,7 +35,6 @@ SupportCapsuleImage (
   \r
   @param  CapsuleHeader    Point to the UEFI capsule image to be processed. \r
    \r
-  @retval EFI_SUCESS       Process Capsule Image successfully. \r
   @retval EFI_UNSUPPORTED  Capsule image is not supported by the firmware.\r
 **/\r
 EFI_STATUS\r
index 167f2813653b29a7e426bf6915ad1a0479445592..99f728510853c82dbc46d650a69cb7be7da16c3d 100644 (file)
@@ -27,6 +27,21 @@ typedef struct {
   UINT32                    CRC32Checksum;\r
 } CRC32_SECTION_HEADER;\r
 \r
+/**\r
+\r
+  The implementation of Crc32 guided section GetInfo() to get \r
+  size and attribute of the guided section.\r
+\r
+  @param InputSection       Buffer containing the input GUIDed section to be processed.\r
+  @param OutputBufferSize   The size of OutputBuffer.\r
+  @param ScratchBufferSize  The size of ScratchBuffer.\r
+  @param SectionAttribute   The attribute of the input guided section.\r
+\r
+  @retval EFI_SUCCESS            The size of destination buffer, the size of scratch buffer and \r
+                                 the attribute of the input section are successull retrieved.\r
+  @retval EFI_INVALID_PARAMETER  The GUID in InputSection does not match this instance guid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Crc32GuidedSectionGetInfo (\r
@@ -35,26 +50,10 @@ Crc32GuidedSectionGetInfo (
   OUT UINT32      *ScratchBufferSize,\r
   OUT UINT16      *SectionAttribute\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The implementation of Crc32 guided section GetInfo().\r
-\r
-Arguments:\r
-  InputSection          Buffer containing the input GUIDed section to be processed. \r
-  OutputBufferSize      The size of OutputBuffer.\r
-  ScratchBufferSize     The size of ScratchBuffer.\r
-  SectionAttribute      The attribute of the input guided section.\r
-\r
-Returns:\r
-\r
-  EFI_SUCCESS           - The size of destination buffer and the size of scratch buffer are successull retrieved.\r
-  EFI_INVALID_PARAMETER - The source data is corrupted, or\r
-                          The GUID in InputSection does not match this instance guid.\r
-\r
---*/\r
 {\r
+  //\r
+  // Check whether the input guid section is recognized.\r
+  //\r
   if (!CompareGuid (\r
         &gEfiCrc32GuidedSectionExtractionProtocolGuid, \r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
@@ -71,6 +70,20 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+\r
+  The implementation of Crc32 Guided section extraction to get the section data.\r
+\r
+  @param InputSection    Buffer containing the input GUIDed section to be processed.\r
+  @param OutputBuffer    to contain the output data, which is allocated by the caller.\r
+  @param ScratchBuffer   A pointer to a caller-allocated buffer for function internal use.\r
+  @param AuthenticationStatus A pointer to a caller-allocated UINT32 that indicates the\r
+                         authentication status of the output buffer.\r
+\r
+  @retval EFI_SUCCESS            Section Data and Auth Status is extracted successfully.\r
+  @retval EFI_INVALID_PARAMETER  The GUID in InputSection does not match this instance guid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 Crc32GuidedSectionHandler (\r
@@ -79,28 +92,6 @@ Crc32GuidedSectionHandler (
   IN        VOID    *ScratchBuffer,        OPTIONAL\r
   OUT       UINT32  *AuthenticationStatus\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  The implementation of Crc32 Guided section extraction.\r
-\r
-Arguments:\r
-  InputSection           Buffer containing the input GUIDed section to be processed. \r
-  OutputBuffer           OutputBuffer to point to the start of the section's contents.\r
-                         if guided data is not prcessed. Otherwise,\r
-                         OutputBuffer to contain the output data, which is allocated by the caller.\r
-  ScratchBuffer          A pointer to a caller-allocated buffer for function internal use. \r
-  AuthenticationStatus   A pointer to a caller-allocated UINT32 that indicates the\r
-                         authentication status of the output buffer. 
-\r
-Returns:\r
-\r
-  RETURN_SUCCESS           - Decompression is successfull\r
-  RETURN_INVALID_PARAMETER - The source data is corrupted, or\r
-                             The GUID in InputSection does not match this instance guid.\r
-\r
---*/\r
 {\r
   EFI_STATUS                Status;\r
   CRC32_SECTION_HEADER      *Crc32SectionHeader;\r
@@ -108,12 +99,18 @@ Returns:
   UINT32                    OutputBufferSize;\r
   VOID                      *DummyInterface;\r
 \r
+  //\r
+  // Check whether the input guid section is recognized.\r
+  //\r
   if (!CompareGuid (\r
         &gEfiCrc32GuidedSectionExtractionProtocolGuid, \r
         &(((EFI_GUID_DEFINED_SECTION *) InputSection)->SectionDefinitionGuid))) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-\r
+  \r
+  //\r
+  // Init Checksum value to Zero.\r
+  //\r
   Crc32Checksum = 0;\r
   //\r
   // Points to the Crc32 section header\r
@@ -134,6 +131,9 @@ Returns:
   //\r
   Status = gBS->LocateProtocol (&gEfiSecurityPolicyProtocolGuid, NULL, &DummyInterface);\r
   if (!EFI_ERROR (Status)) {\r
+    //\r
+    // If SecurityPolicy Protocol exist, AUTH platform override bit is set.\r
+    //\r
     *AuthenticationStatus |= EFI_AUTH_STATUS_PLATFORM_OVERRIDE;\r
   } else {\r
     //\r
@@ -142,9 +142,15 @@ Returns:
     Status = gBS->CalculateCrc32 (*OutputBuffer, OutputBufferSize, &Crc32Checksum);\r
     if (Status == EFI_SUCCESS) {\r
       if (Crc32Checksum != Crc32SectionHeader->CRC32Checksum) {\r
+        //\r
+        // If Crc32 checksum is not matched, AUTH tested failed bit is set.\r
+        //\r
         *AuthenticationStatus |= EFI_AUTH_STATUS_TEST_FAILED;\r
       }\r
     } else {\r
+      //\r
+      // If Crc32 checksum is not calculated, AUTH not tested bit is set.\r
+      //\r
       *AuthenticationStatus |= EFI_AUTH_STATUS_NOT_TESTED;\r
     }\r
   }\r
@@ -152,11 +158,11 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
-/**
+/**\r
   Register Crc32 section handler.\r
-
+\r
   @retval  RETURN_SUCCESS            Register successfully.\r
-  @retval  RETURN_OUT_OF_RESOURCES   No enough memory to store this handler.
+  @retval  RETURN_OUT_OF_RESOURCES   No enough memory to register this handler.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
index b5cbdcecf1ad8ce150c4530a3506f93d471b5301..170d0bed43ffb521a4d5680cdf2c42af181c07ef 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
-# Component description file for Crc32SectionExtract library.\r
+# Crc32SectionExtract library instance registers Crc32 handler into ExtractGuidedSectionLib.\r
 #\r
-# Copyright (c) 2006 - 2007, Intel Corporation\r
+# Copyright (c) 2006 - 2008, Intel Corporation\r
 #\r
 #  All rights reserved. This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -19,6 +19,7 @@
   FILE_GUID                      = 387A2490-81FC-4E7C-8E0A-3E58C30FCD0B\r
   MODULE_TYPE                    = DXE_DRIVER\r
   VERSION_STRING                 = 1.0\r
+  LIBRARY_CLASS                  = NULL|DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SAL_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER\r
   EDK_RELEASE_VERSION            = 0x00020000\r
   EFI_SPECIFICATION_VERSION      = 0x00020000\r
 \r
index 5e63e1ede9a4aa2f275c95eac0b308611b569dc4..40acc57c958727b783868b855389e42b60aeed39 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-  Recovery Library. This library class defines a set of methods related do recovery.\r
+  Null Recovery Library instance. \r
+  This library class defines a set of methods related do recovery.\r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -16,8 +17,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 /**\r
   Calling this function causes the system do recovery.\r
   \r
-  @retval EFI_SUCESS   Sucess to do recovery.\r
-  @retval Others       Fail to do recovery.\r
+  @retval EFI_UNSUPPORTED       Recovery is not supported.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
index 404eadd6768e5c5122e00e2054d94629065aeac3..10ea0cdbeadee1ee83461cc8d47565a3de204817 100644 (file)
@@ -1,6 +1,6 @@
 #/** @file\r
 #  \r
-#    Recovery for PEIM\r
+#  Null Recovery library instance for PEIM module\r
 #  \r
 #  Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 #  All rights reserved. This program and the accompanying materials\r
@@ -37,8 +37,4 @@
   MdePkg/MdePkg.dec\r
   MdeModulePkg/MdeModulePkg.dec\r
 \r
-[LibraryClasses]\r
-  BaseLib\r
-\r
-  \r
   
\ No newline at end of file
index f971f2b1c7c46123875328fc8433d767751d034c..b1ee94db69111b5695d3c0b2a317668fc165bebf 100644 (file)
@@ -50,7 +50,7 @@
   gEfiCapsuleVendorGuid                         # SOMETIMES_CONSUMED\r
 \r
 [Protocols]\r
-  gEfiCapsuleArchProtocolGuid                   # PROTOCOL ALWAYS_CONSUMED\r
+  gEfiCapsuleArchProtocolGuid                   # PROTOCOL ALWAYS_PRODUCED\r
 \r
 [FeaturePcd.common]\r
   gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleRest\r
index 35ae46bb4098d1b3130cdd5180846d59829e5652..dbb9563188b237edc5b06ae0bfb5e73bad7dc2ee 100644 (file)
@@ -1,5 +1,6 @@
 /** @file\r
-  Capsule Runtime Service.\r
+  Capsule Runtime Drivers produces two UEFI capsule runtime services.\r
+  (UpdateCapsule, QueryCapsuleCapabilities)\r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -14,6 +15,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 \r
 #include "CapsuleService.h"\r
 \r
+/**\r
+  Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended\r
+  consumption, the firmware may process the capsule immediately. If the payload should persist\r
+  across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
+  be passed into ResetSystem() and will cause the capsule to be processed by the firmware as\r
+  part of the reset process.\r
+\r
+  @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules\r
+                                being passed into update capsule.\r
+  @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in\r
+                                CaspuleHeaderArray.\r
+  @param  ScatterGatherList     Physical pointer to a set of\r
+                                EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
+                                location in physical memory of a set of capsules.\r
+\r
+  @retval EFI_SUCCESS           Valid capsule was passed. If\r
+                                CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
+                                capsule has been successfully processed by the firmware.\r
+  @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.\r
+  @retval EFI_INVALID_PARAMETER CapsuleCount is Zero, or CapsuleImage is not valid.\r
+                                For across reset capsule image, ScatterGatherList is NULL.\r
+  @retval EFI_UNSUPPORTED       CapsuleImage is not recognized by the firmware.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UpdateCapsule (\r
@@ -21,33 +46,14 @@ UpdateCapsule (
   IN UINTN                   CapsuleCount,\r
   IN EFI_PHYSICAL_ADDRESS    ScatterGatherList OPTIONAL\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code finds whether the capsules need reset to update, if not, update immediately.\r
-\r
-Arguments:\r
-\r
-  CapsuleHeaderArray             A array of pointers to capsule headers passed in\r
-  CapsuleCount                   The number of capsule\r
-  ScatterGatherList              Physical address of datablock list points to capsule\r
-\r
-Returns:\r
-\r
-  EFI STATUS\r
-  EFI_SUCCESS                    Valid capsule was passed.If CAPSULE_FLAG_PERSIT_ACROSS_RESET is\r
-                                 not set, the capsule has been successfully processed by the firmware.\r
-                                 If it set, the ScattlerGatherList is successfully to be set.\r
-  EFI_INVALID_PARAMETER          CapsuleCount is less than 1,CapsuleGuid is not supported.\r
-  EFI_DEVICE_ERROR               Failed to SetVariable or ProcessFirmwareVolume.\r
-\r
---*/\r
 {\r
   UINTN                     ArrayNumber;\r
   EFI_STATUS                Status;\r
   EFI_CAPSULE_HEADER        *CapsuleHeader;\r
-\r
+  \r
+  //\r
+  // Capsule Count can't be less than one.\r
+  //\r
   if (CapsuleCount < 1) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -76,7 +82,10 @@ Returns:
   // Assume that capsules have the same flags on reseting or not.\r
   //\r
   CapsuleHeader = CapsuleHeaderArray[0];\r
-\r
+  \r
+  //\r
+  //  Process across reset capsule image.\r
+  //\r
   if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {\r
     //\r
     // Check if the platform supports update capsule across a system reset\r
@@ -107,25 +116,27 @@ Returns:
         return Status;\r
       }\r
       //\r
-      // Successfully set the capsule image address into variable.\r
+      // Successfully set the capsule image address into EFI variable.\r
       //\r
       return EFI_SUCCESS;\r
     }\r
   }\r
 \r
   //\r
-  // The rest occurs in the condition of non-reset mode\r
-  // Now Runtime mode doesn't support the non-reset capsule image.\r
+  // Process the non-reset capsule image.\r
   //\r
   if (EfiAtRuntime ()) {\r
+    //\r
+    // Runtime mode doesn't support the non-reset capsule image.\r
+    //\r
     return EFI_UNSUPPORTED;\r
   }\r
 \r
   //\r
   // Here should be in the boot-time for non-reset capsule image\r
-  // Default process to Update Capsule image into Flash.\r
+  // Platform specific update for the non-reset capsule image.\r
   //\r
-  for (ArrayNumber = 0; ArrayNumber < CapsuleCount ; ArrayNumber++) {\r
+  for (ArrayNumber = 0; ArrayNumber < CapsuleCount; ArrayNumber++) {\r
     Status = ProcessCapsuleImage (CapsuleHeaderArray[ArrayNumber]);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
@@ -135,8 +146,25 @@ Returns:
   return EFI_SUCCESS;\r
 }\r
 \r
+/**\r
+  Returns if the capsule can be supported via UpdateCapsule().\r
+\r
+  @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules\r
+                                being passed into update capsule.\r
+  @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in\r
+                                CaspuleHeaderArray.\r
+  @param  MaxiumCapsuleSize     On output the maximum size that UpdateCapsule() can\r
+                                support as an argument to UpdateCapsule() via\r
+                                CapsuleHeaderArray and ScatterGatherList.\r
+  @param  ResetType             Returns the type of reset required for the capsule update.\r
 \r
+  @retval EFI_SUCCESS           Valid answer returned.\r
+  @retval EFI_UNSUPPORTED       The capsule image is not supported on this platform, and\r
+                                MaximumCapsuleSize and ResetType are undefined.\r
+  @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL, or ResetTyep is NULL,\r
+                                Or CapsuleCount is Zero, or CapsuleImage is not valid.\r
 \r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 QueryCapsuleCapabilities (\r
@@ -145,36 +173,20 @@ QueryCapsuleCapabilities (
   OUT UINT64               *MaxiumCapsuleSize,\r
   OUT EFI_RESET_TYPE       *ResetType\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code is to query about capsule capability.\r
-\r
-Arguments:\r
-\r
-  CapsuleHeaderArray              A array of pointers to capsule headers passed in\r
-  CapsuleCount                    The number of capsule\r
-  MaxiumCapsuleSize               Max capsule size is supported\r
-  ResetType                       Reset type the capsule indicates, if reset is not needed,return EfiResetCold.\r
-                                  If reset is needed, return EfiResetWarm.\r
-\r
-Returns:\r
-\r
-  EFI STATUS\r
-  EFI_SUCCESS                     Valid answer returned\r
-  EFI_INVALID_PARAMETER           MaxiumCapsuleSize is NULL,ResetType is NULL.CapsuleCount is less than 1,CapsuleGuid is not supported.\r
-  EFI_UNSUPPORTED                 The capsule type is not supported.\r
-\r
---*/\r
 {\r
   UINTN                     ArrayNumber;\r
   EFI_CAPSULE_HEADER        *CapsuleHeader;\r
 \r
+  //\r
+  // Capsule Count can't be less than one.\r
+  //\r
   if (CapsuleCount < 1) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
-\r
+  \r
+  //\r
+  // Check whether input paramter is valid\r
+  //\r
   if ((MaxiumCapsuleSize == NULL) ||(ResetType == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
@@ -191,7 +203,7 @@ Returns:
       return EFI_INVALID_PARAMETER;\r
     }\r
     //\r
-    // Check Capsule image without populate flag by firmware support capsule function  \r
+    // Check Capsule image without populate flag is supported by firmware\r
     //\r
     if (((CapsuleHeader->Flags & CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE) == 0) && \r
         (SupportCapsuleImage (CapsuleHeader) != EFI_SUCCESS)) {\r
@@ -200,7 +212,7 @@ Returns:
   }\r
 \r
   //\r
-  //Assume that capsules have the same flags on reseting or not.\r
+  // Assume that capsules have the same flags on reseting or not.\r
   //\r
   CapsuleHeader = CapsuleHeaderArray[0];\r
   if ((CapsuleHeader->Flags & CAPSULE_FLAGS_PERSIST_ACROSS_RESET) != 0) {\r
@@ -213,6 +225,9 @@ Returns:
     *ResetType = EfiResetWarm;\r
     *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizePopulateCapsule);\r
   } else {\r
+    //\r
+    // For non-reset capsule image.\r
+    //\r
     *ResetType = EfiResetCold;\r
     *MaxiumCapsuleSize = FixedPcdGet32(PcdMaxSizeNonPopulateCapsule);\r
   }\r
@@ -220,37 +235,35 @@ Returns:
 }\r
 \r
 \r
+/**\r
+\r
+  This code is to install 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
+  @retval EFI_SUCCESS    UEFI Capsule Runtime Services are installed successfully. \r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 CapsuleServiceInitialize (\r
   IN EFI_HANDLE         ImageHandle,\r
   IN EFI_SYSTEM_TABLE   *SystemTable\r
   )\r
-/*++\r
-\r
-Routine Description:\r
-\r
-  This code is capsule runtime service initialization.\r
-\r
-Arguments:\r
-\r
-  ImageHandle          The image handle\r
-  SystemTable          The system table.\r
-\r
-Returns:\r
-\r
-  EFI STATUS\r
-\r
---*/\r
 {\r
   EFI_STATUS  Status;\r
   EFI_HANDLE  NewHandle;\r
-\r
+  \r
+  //\r
+  // Install capsule runtime services into UEFI runtime service tables.\r
+  //\r
   SystemTable->RuntimeServices->UpdateCapsule                    = UpdateCapsule;\r
   SystemTable->RuntimeServices->QueryCapsuleCapabilities         = QueryCapsuleCapabilities;\r
 \r
   //\r
-  // Now install the Capsule Architectural Protocol on a new handle\r
+  // Install the Capsule Architectural Protocol on a new handle\r
+  // to signify the capsule runtime services are ready.\r
   //\r
   NewHandle = NULL;\r
 \r
index b9aa6f8c91eaa620940d23db3a4496b22844ef27..989f3a4632e48fd6b360d170b68f456c28da1040 100644 (file)
@@ -1,5 +1,5 @@
 /** @file\r
-  Capsule Runtime Service\r
+  Include the required header files for Capsule Runtime Service drivers.\r
 \r
 Copyright (c) 2006 - 2008, Intel Corporation. <BR>\r
 All rights reserved. This program and the accompanying materials\r
@@ -28,6 +28,30 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <Library/UefiBootServicesTableLib.h>\r
 #include <Library/CapsuleLib.h>\r
 \r
+/**\r
+  Passes capsules to the firmware with both virtual and physical mapping. Depending on the intended\r
+  consumption, the firmware may process the capsule immediately. If the payload should persist\r
+  across a system reset, the reset value returned from EFI_QueryCapsuleCapabilities must\r
+  be passed into ResetSystem() and will cause the capsule to be processed by the firmware as\r
+  part of the reset process.\r
+\r
+  @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules\r
+                                being passed into update capsule.\r
+  @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in\r
+                                CaspuleHeaderArray.\r
+  @param  ScatterGatherList     Physical pointer to a set of\r
+                                EFI_CAPSULE_BLOCK_DESCRIPTOR that describes the\r
+                                location in physical memory of a set of capsules.\r
+\r
+  @retval EFI_SUCCESS           Valid capsule was passed. If\r
+                                CAPSULE_FLAGS_PERSIT_ACROSS_RESET is not set, the\r
+                                capsule has been successfully processed by the firmware.\r
+  @retval EFI_DEVICE_ERROR      The capsule update was started, but failed due to a device error.\r
+  @retval EFI_INVALID_PARAMETER CapsuleCount is Zero, or CapsuleImage is not valid.\r
+                                For across reset capsule image, ScatterGatherList is NULL.\r
+  @retval EFI_UNSUPPORTED       CapsuleImage is not recognized by the firmware.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 UpdateCapsule(\r
@@ -36,6 +60,25 @@ UpdateCapsule(
   IN EFI_PHYSICAL_ADDRESS    ScatterGatherList OPTIONAL\r
   );\r
 \r
+/**\r
+  Returns if the capsule can be supported via UpdateCapsule().\r
+\r
+  @param  CapsuleHeaderArray    Virtual pointer to an array of virtual pointers to the capsules\r
+                                being passed into update capsule.\r
+  @param  CapsuleCount          Number of pointers to EFI_CAPSULE_HEADER in\r
+                                CaspuleHeaderArray.\r
+  @param  MaxiumCapsuleSize     On output the maximum size that UpdateCapsule() can\r
+                                support as an argument to UpdateCapsule() via\r
+                                CapsuleHeaderArray and ScatterGatherList.\r
+  @param  ResetType             Returns the type of reset required for the capsule update.\r
+\r
+  @retval EFI_SUCCESS           Valid answer returned.\r
+  @retval EFI_UNSUPPORTED       The capsule image is not supported on this platform, and\r
+                                MaximumCapsuleSize and ResetType are undefined.\r
+  @retval EFI_INVALID_PARAMETER MaximumCapsuleSize is NULL, or ResetTyep is NULL,\r
+                                Or CapsuleCount is Zero, or CapsuleImage is not valid.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 QueryCapsuleCapabilities(\r
index 2eb325ec56148fc124c0d944148a1701ba2f839c..f60c98ca433a00ba6bfaf556c19ed6f8f1853062 100644 (file)
@@ -1,7 +1,8 @@
 /** @file\r
-  This driver supports platform security service.\r
+  This driver implements one sample platform security service, which does \r
+  nothing and always return EFI_SUCCESS.\r
   \r
-  Copyright (c) 2006 - 2007, Intel Corporation                                              \r
+  Copyright (c) 2006 - 2008, Intel Corporation                                              \r
   All rights reserved. This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -60,18 +61,8 @@ EFI_SECURITY_ARCH_PROTOCOL  mSecurityStub = {
   @param  File             This is a pointer to the device path of the file that is\r
                            being dispatched. This will optionally be used for logging.\r
 \r
-  @retval EFI_SUCCESS           The file specified by File did authenticate, and the\r
-                                platform policy dictates that the DXE Core may use File.\r
-  @retval EFI_INVALID_PARAMETER Driver is NULL.\r
-  @retval EFI_SECURITY_VIOLATION The file specified by File did not authenticate, and\r
-                                the platform policy dictates that File should be placed\r
-                                in the untrusted state. A file may be promoted from\r
-                                the untrusted to the trusted state at a future time\r
-                                with a call to the Trust() DXE Service.\r
-  @retval EFI_ACCESS_DENIED     The file specified by File did not authenticate, and\r
-                                the platform policy dictates that File should not be\r
-                                used for any purpose.\r
-\r
+  @retval EFI_SUCCESS            Do nothing and return.\r
+  @retval EFI_INVALID_PARAMETER  File is NULL.\r
 **/\r
 EFI_STATUS\r
 EFIAPI\r
@@ -90,15 +81,14 @@ SecurityStubAuthenticateState (
 \r
 \r
 /**\r
-  The user Entry Point for DXE driver. The user code starts with this function\r
+  The user Entry Point installs SAP. The user code starts with this function\r
   as the real entry point for the image goes into a library that calls this \r
   function.\r
 \r
-  @param[in] ImageHandle    The firmware allocated handle for the EFI image.  \r
-  @param[in] SystemTable    A pointer to the EFI System Table.\r
+  @param ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param SystemTable    A pointer to the EFI System Table.\r
   \r
-  @retval EFI_SUCCESS       The entry point is executed successfully.\r
-  @retval other             Some error occurs when executing this entry point.\r
+  @retval EFI_SUCCESS   Install the sample Security Architectural Protocol successfully.\r
 \r
 **/\r
 EFI_STATUS\r
@@ -126,5 +116,5 @@ SecurityStubInitialize (
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  return Status;\r
+  return EFI_SUCCESS;\r
 }\r
index dedc14afdbe1e22ff4d3c47f982288cbcfeb4086..574957101d3cf3db1768a30258a723915759fbd0 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
-  Some definitions for Security Architectural Protocol stub driver\r
+  Inlcude the required definitions for Security Architectural Protocol stub driver\r
 \r
-  Copyright (c) 2006 - 2007, Intel Corporation                                              \r
+  Copyright (c) 2006 - 2008, Intel Corporation                                              \r
   All rights reserved. This program and the accompanying materials                          \r
   are licensed and made available under the terms and conditions of the BSD License         \r
   which accompanies this distribution.  The full text of the license may be found at        \r
@@ -12,8 +12,8 @@
 \r
 **/\r
 \r
-#ifndef _SECURITY_STUB_ARCH_PROTOCOL_H\r
-#define _SECURITY_STUB_ARCH_PROTOCOL_H\r
+#ifndef __SECURITY_STUB_ARCH_PROTOCOL_H__\r
+#define __SECURITY_STUB_ARCH_PROTOCOL_H__\r
 \r
 \r
 //\r
 //\r
 // Function prototypes\r
 //\r
+/**\r
+  The EFI_SECURITY_ARCH_PROTOCOL (SAP) is used to abstract platform-specific \r
+  policy from the DXE core response to an attempt to use a file that returns a \r
+  given status for the authentication check from the section extraction protocol.  \r
+\r
+  The possible responses in a given SAP implementation may include locking \r
+  flash upon failure to authenticate, attestation logging for all signed drivers, \r
+  and other exception operations.  The File parameter allows for possible logging \r
+  within the SAP of the driver.\r
+\r
+  If File is NULL, then EFI_INVALID_PARAMETER is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is safe for the DXE Core to use, then EFI_SUCCESS is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is not safe for the DXE Core to use under any circumstances, \r
+  then EFI_ACCESS_DENIED is returned.\r
+\r
+  If the file specified by File with an authentication status specified by \r
+  AuthenticationStatus is not safe for the DXE Core to use right now, but it \r
+  might be possible to use it at a future time, then EFI_SECURITY_VIOLATION is \r
+  returned.\r
+\r
+  @param  This             The EFI_SECURITY_ARCH_PROTOCOL instance.\r
+  @param  AuthenticationStatus \r
+                           This is the authentication type returned from the Section\r
+                           Extraction protocol. See the Section Extraction Protocol\r
+                           Specification for details on this type.\r
+  @param  File             This is a pointer to the device path of the file that is\r
+                           being dispatched. This will optionally be used for logging.\r
+\r
+  @retval EFI_SUCCESS            Do nothing and return.\r
+  @retval EFI_INVALID_PARAMETER  File is NULL.\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SecurityStubAuthenticateState (\r
@@ -36,6 +71,17 @@ SecurityStubAuthenticateState (
   IN  EFI_DEVICE_PATH_PROTOCOL           *File\r
   );\r
 \r
+/**\r
+  The user Entry Point for DXE driver. The user code starts with this function\r
+  as the real entry point for the image goes into a library that calls this \r
+  function.\r
+\r
+  @param ImageHandle    The firmware allocated handle for the EFI image.  \r
+  @param SystemTable    A pointer to the EFI System Table.\r
+  \r
+  @retval EFI_SUCCESS   Install the sample Security Architectural Protocol successfully.\r
+\r
+**/\r
 EFI_STATUS\r
 EFIAPI\r
 SecurityStubInitialize (\r
index ef6bc23f026317783dafe13033f1ece3958b6ced..dffb422ff100413a693af64755e9915e4460efd6 100644 (file)
@@ -1,7 +1,7 @@
 #/** @file\r
-#  Component description file for SecurityStub module\r
+#  Sample SecurityStub module implements the dummy platform security service.\r
 #\r
-#  Copyright (c) 2006 - 2007, Intel Corporation\r
+#  Copyright (c) 2006 - 2008, Intel Corporation\r
 #  All rights reserved. This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
 #  which accompanies this distribution. The full text of the license may be found at\r