MdeModulePkg: Add ESRT management protocol definition

Add ESRT management protocol definition into MdeModulePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Gao Liming <liming.gao@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17425 6f19259b-4bc3-4df7-8a09-765794883524
diff --git a/MdeModulePkg/Include/Protocol/EsrtManagement.h b/MdeModulePkg/Include/Protocol/EsrtManagement.h
new file mode 100644
index 0000000..305fd5c
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/EsrtManagement.h
@@ -0,0 +1,144 @@
+/** @file

+  The Esrt Management Protocol used to register/set/update an updatable firmware resource .

+

+Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>

+This program and the accompanying materials are licensed and made available under 

+the terms and conditions of the BSD License that accompanies this distribution.  

+The full text of the license may be found at

+http://opensource.org/licenses/bsd-license.php.                                              

+

+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     

+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

+

+**/

+

+#ifndef _ESRT_MANAGEMENT_H_

+#define _ESRT_MANAGEMENT_H_

+

+#include <Guid/SystemResourceTable.h>

+

+///

+/// Global ID for the ESRT_MANAGEMENT_PROTOCOL.

+///

+#define ESRT_MANAGEMENT_PROTOCOL_GUID \

+  { \

+    0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 } \

+  }

+

+///

+/// Forward declaration for the _ESRT_MANAGEMENT_PROTOCOL.

+///

+typedef struct _ESRT_MANAGEMENT_PROTOCOL  ESRT_MANAGEMENT_PROTOCOL;

+

+/**

+  Get Variable name and data by Esrt Entry FwClass 

+

+  @param[in]       FwClass                FwClass of Esrt entry to get  

+  @param[in out]  Entry                   Esrt entry returned 

+  

+  @retval EFI_SUCCESS                  The variable saving this Esrt Entry exists.

+  @retval EF_NOT_FOUND                   No correct variable found.

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *GET_ESRT_ENTRY)(

+  IN     EFI_GUID                  *FwClass,

+  IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry

+  );

+ 

+

+/**

+  Update one ESRT entry in ESRT Cache.

+

+  @param[in]  Entry                         Esrt entry to be updated

+  

+  @retval EFI_SUCCESS                   Successfully update an ESRT entry in cache.

+  @retval EFI_INVALID_PARAMETER  Entry does't exist in ESRT Cache

+  @retval EFI_WRITE_PROTECTED     ESRT Cache repositoy is locked

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *UPDATE_ESRT_ENTRY)(

+  IN EFI_SYSTEM_RESOURCE_ENTRY *Entry

+  );

+

+

+/**

+  Non-FMP instance to unregister Esrt Entry from ESRT Cache. 

+

+  @param[in]    FwClass                FwClass of Esrt entry to Unregister  

+  

+  @retval EFI_SUCCESS         Insert all entries Successfully 

+  @retval EFI_NOT_FOUND     FwClass does not exsit

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *UNREGISTER_ESRT_ENTRY)(

+  IN  EFI_GUID        *FwClass

+  );

+

+

+/**

+  Non-FMP instance to register one ESRT entry into ESRT Cache.

+

+  @param[in]  Entry                Esrt entry to be set

+

+  @retval EFI_SUCCESS                   Successfully set a variable.

+  @retval EFI_INVALID_PARAMETER  ESRT Entry is already exist

+  @retval EFI_OUT_OF_RESOURCES  Non-FMP ESRT repository is full

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *REGISTER_ESRT_ENTRY)(

+  IN EFI_SYSTEM_RESOURCE_ENTRY *Entry

+  );

+

+

+/**

+  This function syn up Cached ESRT with data from FMP instances

+  Function should be called after Connect All in order to locate all FMP protocols

+  installed

+

+  @retval EFI_SUCCESS                      Successfully sync cache repository from FMP instances

+  @retval EFI_NOT_FOUND                   No FMP Instance are found

+  @retval EFI_OUT_OF_RESOURCES     Resource allocaton fail

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *SYNC_ESRT_FMP)(

+  VOID

+  );

+

+

+/**

+  This function locks up Esrt repository to be readonly. It should be called 

+  before gEfiEndOfDxeEventGroupGuid event signaled

+

+  @retval EFI_SUCCESS              Locks up FMP Non-FMP repository successfully 

+

+**/

+typedef

+EFI_STATUS

+(EFIAPI *LOCK_ESRT_REPOSITORY)(

+  VOID

+  );

+

+

+struct _ESRT_MANAGEMENT_PROTOCOL {

+  GET_ESRT_ENTRY        GetEsrtEntry;

+  UPDATE_ESRT_ENTRY     UpdateEsrtEntry;

+  REGISTER_ESRT_ENTRY   RegisterEsrtEntry;

+  UNREGISTER_ESRT_ENTRY UnRegisterEsrtEntry;

+  SYNC_ESRT_FMP         SyncEsrtFmp;

+  LOCK_ESRT_REPOSITORY  LockEsrtRepository;

+};

+

+extern EFI_GUID gEsrtManagementProtocolGuid;

+

+#endif // #ifndef _ESRT_MANAGEMENT_H_

+

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index ec4e76e..bb953ed 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -409,6 +409,9 @@
 

   ## Include/Protocol/UfsHostController.h

   gEdkiiUfsHostControllerProtocolGuid = { 0xebc01af5, 0x7a9, 0x489e, { 0xb7, 0xce, 0xdc, 0x8, 0x9e, 0x45, 0x9b, 0x2f } }

+  

+  ## Include/Protocol/EsrtManagement.h

+  gEsrtManagementProtocolGuid         = { 0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 }}

 

 #

 # [Error.gEfiMdeModulePkgTokenSpaceGuid]

@@ -925,7 +928,7 @@
   ## Serial Port Extended Transmit FIFO Size.  The default is 64 bytes. 

   # @Prompt Serial Port Extended Transmit FIFO Size in Bytes

   gEfiMdeModulePkgTokenSpaceGuid.PcdSerialExtendedTxFifoSize|64|UINT32|0x00010068

-

+  

   ## This PCD points to the file name GUID of the BootManagerMenuApp

   #  Platform can customize the PCD to point to different application for Boot Manager Menu

   gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0xdc, 0x5b, 0xc2, 0xee, 0xf2, 0x67, 0x95, 0x4d, 0xb1, 0xd5, 0xf8, 0x1b, 0x20, 0x39, 0xd1, 0x1d }|VOID*|0x0001006b

@@ -1262,6 +1265,21 @@
   # @Prompt Mmio base address of pci-based UFS host controller.

   gEfiMdeModulePkgTokenSpaceGuid.PcdUfsPciHostControllerMmioBase|0xd0000000|UINT32|0x10000061

 

+  ## Specify Max ESRT cache entry number supported for FMP instances

+  #

+  # @Prompt Max FMP ESRT entry number to be synced & cached in repository.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxFmpEsrtCacheNum|32|UINT32|0x0000006b

+

+  ## Specify Max ESRT cache entry number supported for Non FMP instances

+  #

+  # @Prompt Max Non-FMP ESRT entry number to be cached in repository.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxNonFmpEsrtCacheNum|32|UINT32|0x0000006c

+

+  ## Specify of Capsule Flag defined by CapsuleGuid to request system reboot after capsule process

+  #

+  # @Prompt Flag to request system reboot after processing capsule.

+  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemRebootAfterCapsuleProcessFlag|0x0001|UINT16|0x0000006d

+

 [PcdsPatchableInModule]

   ## Specify memory size with page number for PEI code when

   #  Loading Module at Fixed Address feature is enabled.

diff --git a/MdeModulePkg/MdeModulePkg.uni b/MdeModulePkg/MdeModulePkg.uni
index a3ed93e..7d767b0 100644
--- a/MdeModulePkg/MdeModulePkg.uni
+++ b/MdeModulePkg/MdeModulePkg.uni
Binary files differ