1 /** @file
2   The Esrt Management Protocol used to register/set/update an updatable firmware resource .
3 
4 Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials are licensed and made available under
6 the terms and conditions of the BSD License that accompanies this distribution.
7 The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php.
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _ESRT_MANAGEMENT_H_
16 #define _ESRT_MANAGEMENT_H_
17 
18 #include <Guid/SystemResourceTable.h>
19 
20 ///
21 /// Global ID for the ESRT_MANAGEMENT_PROTOCOL.
22 ///
23 #define ESRT_MANAGEMENT_PROTOCOL_GUID \
24   { \
25     0xa340c064, 0x723c, 0x4a9c, { 0xa4, 0xdd, 0xd5, 0xb4, 0x7a, 0x26, 0xfb, 0xb0 } \
26   }
27 
28 ///
29 /// Forward declaration for the _ESRT_MANAGEMENT_PROTOCOL.
30 ///
31 typedef struct _ESRT_MANAGEMENT_PROTOCOL  ESRT_MANAGEMENT_PROTOCOL;
32 
33 /**
34   Get Variable name and data by Esrt Entry FwClass
35 
36   @param[in]       FwClass                FwClass of Esrt entry to get
37   @param[in out]  Entry                   Esrt entry returned
38 
39   @retval EFI_SUCCESS                  The variable saving this Esrt Entry exists.
40   @retval EF_NOT_FOUND                   No correct variable found.
41 
42 **/
43 typedef
44 EFI_STATUS
45 (EFIAPI *GET_ESRT_ENTRY)(
46   IN     EFI_GUID                  *FwClass,
47   IN OUT EFI_SYSTEM_RESOURCE_ENTRY *Entry
48   );
49 
50 
51 /**
52   Update one ESRT entry in ESRT Cache.
53 
54   @param[in]  Entry                         Esrt entry to be updated
55 
56   @retval EFI_SUCCESS                   Successfully update an ESRT entry in cache.
57   @retval EFI_INVALID_PARAMETER  Entry does't exist in ESRT Cache
58   @retval EFI_WRITE_PROTECTED     ESRT Cache repositoy is locked
59 
60 **/
61 typedef
62 EFI_STATUS
63 (EFIAPI *UPDATE_ESRT_ENTRY)(
64   IN EFI_SYSTEM_RESOURCE_ENTRY *Entry
65   );
66 
67 
68 /**
69   Non-FMP instance to unregister Esrt Entry from ESRT Cache.
70 
71   @param[in]    FwClass                FwClass of Esrt entry to Unregister
72 
73   @retval EFI_SUCCESS         Insert all entries Successfully
74   @retval EFI_NOT_FOUND     FwClass does not exsit
75 
76 **/
77 typedef
78 EFI_STATUS
79 (EFIAPI *UNREGISTER_ESRT_ENTRY)(
80   IN  EFI_GUID        *FwClass
81   );
82 
83 
84 /**
85   Non-FMP instance to register one ESRT entry into ESRT Cache.
86 
87   @param[in]  Entry                Esrt entry to be set
88 
89   @retval EFI_SUCCESS                   Successfully set a variable.
90   @retval EFI_INVALID_PARAMETER  ESRT Entry is already exist
91   @retval EFI_OUT_OF_RESOURCES  Non-FMP ESRT repository is full
92 
93 **/
94 typedef
95 EFI_STATUS
96 (EFIAPI *REGISTER_ESRT_ENTRY)(
97   IN EFI_SYSTEM_RESOURCE_ENTRY *Entry
98   );
99 
100 
101 /**
102   This function syn up Cached ESRT with data from FMP instances
103   Function should be called after Connect All in order to locate all FMP protocols
104   installed
105 
106   @retval EFI_SUCCESS                      Successfully sync cache repository from FMP instances
107   @retval EFI_NOT_FOUND                   No FMP Instance are found
108   @retval EFI_OUT_OF_RESOURCES     Resource allocaton fail
109 
110 **/
111 typedef
112 EFI_STATUS
113 (EFIAPI *SYNC_ESRT_FMP)(
114   VOID
115   );
116 
117 
118 /**
119   This function locks up Esrt repository to be readonly. It should be called
120   before gEfiEndOfDxeEventGroupGuid event signaled
121 
122   @retval EFI_SUCCESS              Locks up FMP Non-FMP repository successfully
123 
124 **/
125 typedef
126 EFI_STATUS
127 (EFIAPI *LOCK_ESRT_REPOSITORY)(
128   VOID
129   );
130 
131 
132 struct _ESRT_MANAGEMENT_PROTOCOL {
133   GET_ESRT_ENTRY        GetEsrtEntry;
134   UPDATE_ESRT_ENTRY     UpdateEsrtEntry;
135   REGISTER_ESRT_ENTRY   RegisterEsrtEntry;
136   UNREGISTER_ESRT_ENTRY UnRegisterEsrtEntry;
137   SYNC_ESRT_FMP         SyncEsrtFmp;
138   LOCK_ESRT_REPOSITORY  LockEsrtRepository;
139 };
140 
141 extern EFI_GUID gEsrtManagementProtocolGuid;
142 
143 #endif // #ifndef _ESRT_MANAGEMENT_H_
144 
145