audk/MdeModulePkg
Jin, Eric e314132fea MdeModulePkg/EsrtFmpDxe: Enhance ESRT to support multiple controllers
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1525

The patch is to merge multiple FMP instances into single ESRT entry
when they have the same GUID.

The policy to LastAttemptStatus/LastAttemptVersion of ESRT entry is:
If all the LastAttemptStatus are LAST_ATTEMPT_STATUS_SUCCESS, then
LastAttemptVersion should be the smallest of LastAttemptVersion. If
any of the LastAttemptStatus is not LAST_ATTEMPT_STATUS_SUCCESS,
then the LastAttemptVersion/LastAttemptStatus should be the values
of the first FMP instance whose LastAttemptStatus is not
LAST_ATTEMPT_STATUS_SUCCESS.

To detect possible duplicated GUID/HardwareInstance, a table of
GUID/HardwareInstance pairs from all the EFI_FIRMWARE_IMAGE_DESCRIPTORs
from all FMP instances is built. If a duplicate is found, then generate
a DEBUG_ERROR message, generate an ASSERT(), and ignore the duplicate
EFI_FIRMWARE_IMAGE_DESCRIPTOR.

Add an internal worker function called FmpGetFirmwareImageDescriptor()
that retrieves the list of EFI_FIRMWARE_IMAGE_DESCRIPTORs from a single
FMP instance and returns the descriptors in an allocated buffer. This
function is used to get the descriptors used to build the table of
unique GUID/HardwareInstance pairs.  It is then used again to generate
the ESRT Table from all the EFI_FIRMWARE_IMAGE_DESCRIPTORs from all the
FMP instances. 2 passes are performed so the total number of
descriptors is known. This allows the correct sized buffers to always
be allocated.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Eric Jin <eric.jin@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2019-08-07 13:18:32 +08:00
..
Application MdeModulePkg/CapsuleApp: Enhance Capsule-On-Disk related functions. 2019-06-26 15:08:18 +08:00
Bus MdeModulePkg/UsbBusDxe: Return error when the device is not present 2019-08-05 09:35:33 +08:00
Core MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull 2019-08-05 10:09:01 +08:00
Include MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull 2019-08-05 10:09:01 +08:00
Library MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull 2019-08-05 10:09:01 +08:00
Logo MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00
Universal MdeModulePkg/EsrtFmpDxe: Enhance ESRT to support multiple controllers 2019-08-07 13:18:32 +08:00
MdeModulePkg.dec MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull 2019-08-05 10:09:01 +08:00
MdeModulePkg.dsc MdeModulePkg: Remove RecoveryLib.h and PeiRecoveryLibNull 2019-08-05 10:09:01 +08:00
MdeModulePkg.uni MdeModulePkg: Add a pcd to set the OS indications bit 2019-07-01 14:59:20 +08:00
MdeModulePkgExtra.uni MdeModulePkg: Replace BSD License with BSD+Patent License 2019-04-09 10:58:08 -07:00