Retrieve additional information associated with a PCD token. This includes information such as the type of value the TokenNumber is associated with as well as possible human readable name that is associated with the token. @param[in] Database PCD database. @param[in] Guid The 128-bit unique value that designates the namespace from which to extract the value. @par
| 156 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number. |
| 157 | **/ |
| 158 | EFI_STATUS |
| 159 | ExGetPcdInfo ( |
| 160 | IN PEI_PCD_DATABASE *Database, |
| 161 | IN CONST EFI_GUID *Guid, |
| 162 | IN UINTN TokenNumber, |
| 163 | OUT EFI_PCD_INFO *PcdInfo |
| 164 | ) |
| 165 | { |
| 166 | UINTN GuidTableIdx; |
| 167 | EFI_GUID *MatchGuid; |
| 168 | EFI_GUID *GuidTable; |
| 169 | DYNAMICEX_MAPPING *ExMapTable; |
| 170 | UINTN Index; |
| 171 | UINT32 LocalTokenNumber; |
| 172 | |
| 173 | GuidTable = (EFI_GUID *)((UINT8 *)Database + Database->GuidTableOffset); |
| 174 | MatchGuid = ScanGuid (GuidTable, Database->GuidTableCount * sizeof(EFI_GUID), Guid); |
| 175 | |
| 176 | if (MatchGuid == NULL) { |
| 177 | return EFI_NOT_FOUND; |
| 178 | } |
| 179 | |
| 180 | GuidTableIdx = MatchGuid - GuidTable; |
| 181 | |
| 182 | ExMapTable = (DYNAMICEX_MAPPING *)((UINT8 *)Database + Database->ExMapTableOffset); |
| 183 | |
| 184 | // |
| 185 | // Find the PCD by GuidTableIdx and ExTokenNumber in ExMapTable. |
| 186 | // |
| 187 | for (Index = 0; Index < Database->ExTokenCount; Index++) { |
| 188 | if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) { |
| 189 | if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) { |
| 190 | // |
| 191 | // TokenNumber is 0, follow spec to set PcdType to EFI_PCD_TYPE_8, |
| 192 | // PcdSize to 0 and PcdName to the null-terminated ASCII string |
| 193 | // associated with the token's namespace Guid. |
| 194 | // |
| 195 | PcdInfo->PcdType = EFI_PCD_TYPE_8; |
| 196 | PcdInfo->PcdSize = 0; |
| 197 | // |
| 198 | // Here use one representative in the token space to get the TokenSpaceCName. |
| 199 | // |
| 200 | PcdInfo->PcdName = GetPcdName (TRUE, Database, ExMapTable[Index].TokenNumber); |
| 201 | return EFI_SUCCESS; |
| 202 | } else if (ExMapTable[Index].ExTokenNumber == TokenNumber) { |
| 203 | PcdInfo->PcdSize = PeiPcdGetSize (ExMapTable[Index].TokenNumber); |
| 204 | LocalTokenNumber = GetLocalTokenNumber (Database, ExMapTable[Index].TokenNumber); |
| 205 | PcdInfo->PcdType = GetPcdType (LocalTokenNumber); |
| 206 | PcdInfo->PcdName = GetPcdName (FALSE, Database, ExMapTable[Index].TokenNumber); |
| 207 | return EFI_SUCCESS; |
| 208 | } |
| 209 | } |
| 210 | } |
| 211 | |
| 212 | return EFI_NOT_FOUND; |
| 213 | } |
| 214 | |
| 215 | /** |
no test coverage detected