]> git.proxmox.com Git - mirror_edk2.git/commitdiff
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceStorageAccessEnable
authorEric Jin <eric.jin@intel.com>
Fri, 26 Jul 2019 07:45:19 +0000 (15:45 +0800)
committerLiming Gao <liming.gao@intel.com>
Thu, 15 Aug 2019 09:22:24 +0000 (17:22 +0800)
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525

Add PCD PcdFmpDeviceStorageAccessEnable.  If this PCD is
TRUE, then the Firmware Management Protocol supports access
to the firmware storage device.  This is the default setting.
If FALSE, then Firmware Management Protocol services that
access the firmware storage device return EFI_UNSUPPORTED
except GetImageInfo().  Setting this value to FALSE produces
the smallest possible FmpDxe driver that still advertises the
updatable firmware component in the ESRT.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <liming.gao@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
FmpDevicePkg/FmpDevicePkg.dec
FmpDevicePkg/FmpDevicePkg.dsc
FmpDevicePkg/FmpDevicePkg.uni
FmpDevicePkg/FmpDxe/FmpDxe.c
FmpDevicePkg/FmpDxe/FmpDxe.inf
FmpDevicePkg/FmpDxe/FmpDxeLib.inf

index 56ed5fbb4aaa04293f99d92cfd8d71f0591a9e6f..8312b7cb22d44d3a42f2f5295286a04d0b826f14 100644 (file)
   ## Capsule Update Policy Protocol\r
   gEdkiiCapuleUpdatePolicyProtocolGuid = { 0x487784c5, 0x6299, 0x4ba6, { 0xb0, 0x96, 0x5c, 0xc5, 0x27, 0x7c, 0xf7, 0x57 } }\r
 \r
+[PcdsFeatureFlag]\r
+  ## Indicates if the Firmware Management Protocol supports access to\r
+  #  to a firmware storage device.  If set to FALSE, then only GetImageInfo()\r
+  #  is supported.  This is used by FMP drivers that require the samllest\r
+  #  possible Firmware Management Protocol implementation that supports\r
+  #  advertising the updatable firmware device in the ESRT.<BR>\r
+  #    TRUE  - All Firmware Management Protocol services supported.<BR>\r
+  #    FALSE - Firmware Management Protocol returns EFI_UNSUPPORTED for\r
+  #            all services except GetImageInfo().<BR>\r
+  # @Prompt Firmware Device Storage Access Enabled.\r
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceStorageAccessEnable|TRUE|BOOLEAN|0x40000011\r
+\r
 [PcdsFixedAtBuild]\r
   ## The SHA-256 hash of a PKCS7 test key that is used to detect if a test key\r
   #  is being used to authenticate capsules.  Test key detection is disabled by\r
index 4e2bd8de3dcc1827f2e8c3cccb6ff6fcaa74c4e9..bf283b93ea9fbe5741c409f2b7728d74f8eb4f65 100644 (file)
   DEFINE SYSTEM_FMP_ESRT_GUID   = B461B3BD-E62A-4A71-841C-50BA4E500267\r
   DEFINE DEVICE_FMP_ESRT_GUID   = 226034C4-8B67-4536-8653-D6EE7CE5A316\r
 \r
+  #\r
+  # TRUE  - Build FmpDxe module for with storage access enabled\r
+  # FALSE - Build FmpDxe module for with storage access disabled\r
+  #\r
+  DEFINE DEVICE_FMP_STORAGE_ACCESS_ENABLE = TRUE\r
+\r
 [LibraryClasses]\r
   UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf\r
   UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf\r
       # FILE_GUID is used as ESRT GUID\r
       #\r
       FILE_GUID = $(DEVICE_FMP_ESRT_GUID)\r
+    <PcdsFeatureFlag>\r
+      gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceStorageAccessEnable|$(DEVICE_FMP_STORAGE_ACCESS_ENABLE)\r
     <PcdsFixedAtBuild>\r
+!if $(DEVICE_FMP_STORAGE_ACCESS_ENABLE) == FALSE\r
+      #\r
+      # Disable test key detection\r
+      #\r
+      gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceTestKeySha256Digest|{0}\r
+!endif\r
       #\r
       # Unicode name string that is used to populate FMP Image Descriptor for this capsule update module\r
       #\r
+!if $(DEVICE_FMP_STORAGE_ACCESS_ENABLE) == TRUE\r
       gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName|L"Sample Firmware Device"\r
+!else\r
+      gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName|L"Sample Firmware Device No Storage Access"\r
+!endif\r
       #\r
       # Certificates used to authenticate capsule update image\r
       #\r
index b7fe643186f7fd513ac53752e59f4389ff9313f9..9e21130faedace533ffbb405fa9db6c1417723de 100644 (file)
 \r
 #string STR_PACKAGE_DESCRIPTION  #language en-US  "This package provides libraries that support the implementation of a module that produces the Firmware Management Protocol to support the update of a system firmware component."\r
 \r
+#string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceStorageAccessEnable_PROMPT  #language en-US "Firmware Device Storage Access Enabled."\r
+#string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceStorageAccessEnable_HELP    #language en-US "Indicates if the Firmware Management Protocol supports access to"\r
+                                                                                                "to a firmware storage device.  If set to FALSE, then only GetImageInfo()"\r
+                                                                                                "is supported.  This is used by FMP drivers that require the samllest"\r
+                                                                                                "possible Firmware Management Protocol implementation that supports"\r
+                                                                                                "advertising the updatable firmware device in the ESRT.<BR>"\r
+                                                                                                "  TRUE  - All Firmware Management Protocol services supported.<BR>"\r
+                                                                                                "  FALSE - Firmware Management Protocol returns EFI_UNSUPPORTED for"\r
+                                                                                                "          all services except GetImageInfo().<BR>"\r
+\r
 #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceTestKeySha256Digest_PROMPT  #language en-US "SHA-256 hash of PKCS7 test key."\r
 #string STR_gFmpDevicePkgTokenSpaceGuid_PcdFmpDeviceTestKeySha256Digest_HELP    #language en-US "The SHA-256 hash of a PKCS7 test key that is used to detect if a test key"\r
                                                                                                 "is being used to authenticate capsules.  Test key detection can be disabled"\r
index a53ded73807277cd5a4887125b8968bddcececba..3ca9d3526ad3ff91e4220af8fe55a32dab2f9530 100644 (file)
@@ -541,6 +541,10 @@ GetTheImage (
   FIRMWARE_MANAGEMENT_PRIVATE_DATA  *Private;\r
   UINTN                             Size;\r
 \r
+  if (!FeaturePcdGet (PcdFmpDeviceStorageAccessEnable)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   Status = EFI_SUCCESS;\r
 \r
   //\r
@@ -715,6 +719,10 @@ CheckTheImage (
   FmpHeaderSize    = 0;\r
   AllHeaderSize    = 0;\r
 \r
+  if (!FeaturePcdGet (PcdFmpDeviceStorageAccessEnable)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Retrieve the private context structure\r
   //\r
@@ -970,6 +978,10 @@ SetTheImage (
   IncommingFwVersion = 0;\r
   LastAttemptStatus  = LAST_ATTEMPT_STATUS_ERROR_UNSUCCESSFUL;\r
 \r
+  if (!FeaturePcdGet (PcdFmpDeviceStorageAccessEnable)) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Retrieve the private context structure\r
   //\r
index 65535a7f43f1df7ee789f56fc3e9fa2de6f7f9da..5487123935e2de95592b28bb9592df90976423f0 100644 (file)
@@ -61,6 +61,7 @@
   gEdkiiFirmwareManagementProgressProtocolGuid  ## PRODUCES\r
 \r
 [Pcd]\r
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceStorageAccessEnable              ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName                      ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceBuildTimeLowestSupportedVersion  ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceLockEventGuid                    ## CONSUMES\r
index 3b10b573772f0bb68c9e34d5905755100355f461..ba762b0b7782bf4c6b3ec175483de4d91d2c5a3d 100644 (file)
@@ -61,6 +61,7 @@
   gEdkiiFirmwareManagementProgressProtocolGuid  ## PRODUCES\r
 \r
 [Pcd]\r
+  gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceStorageAccessEnable              ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceImageIdName                      ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceBuildTimeLowestSupportedVersion  ## CONSUMES\r
   gFmpDevicePkgTokenSpaceGuid.PcdFmpDeviceLockEventGuid                    ## CONSUMES\r