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] IsPeiDb If TRUE, the pcd entry is initialized in PEI phase, If FALSE, the pcd entry is initialized in DXE phase. @
| 198 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number. |
| 199 | **/ |
| 200 | EFI_STATUS |
| 201 | ExGetPcdInfo ( |
| 202 | IN BOOLEAN IsPeiDb, |
| 203 | IN CONST EFI_GUID *Guid, |
| 204 | IN UINTN TokenNumber, |
| 205 | OUT EFI_PCD_INFO *PcdInfo |
| 206 | ) |
| 207 | { |
| 208 | PCD_DATABASE_INIT *Database; |
| 209 | UINTN GuidTableIdx; |
| 210 | EFI_GUID *MatchGuid; |
| 211 | EFI_GUID *GuidTable; |
| 212 | DYNAMICEX_MAPPING *ExMapTable; |
| 213 | UINTN Index; |
| 214 | UINT32 LocalTokenNumber; |
| 215 | |
| 216 | Database = IsPeiDb ? mPcdDatabase.PeiDb: mPcdDatabase.DxeDb; |
| 217 | |
| 218 | GuidTable = (EFI_GUID *)((UINT8 *)Database + Database->GuidTableOffset); |
| 219 | MatchGuid = ScanGuid (GuidTable, Database->GuidTableCount * sizeof(EFI_GUID), Guid); |
| 220 | |
| 221 | if (MatchGuid == NULL) { |
| 222 | return EFI_NOT_FOUND; |
| 223 | } |
| 224 | |
| 225 | GuidTableIdx = MatchGuid - GuidTable; |
| 226 | |
| 227 | ExMapTable = (DYNAMICEX_MAPPING *)((UINT8 *)Database + Database->ExMapTableOffset); |
| 228 | |
| 229 | // |
| 230 | // Find the PCD by GuidTableIdx and ExTokenNumber in ExMapTable. |
| 231 | // |
| 232 | for (Index = 0; Index < Database->ExTokenCount; Index++) { |
| 233 | if (ExMapTable[Index].ExGuidIndex == GuidTableIdx) { |
| 234 | if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) { |
| 235 | // |
| 236 | // TokenNumber is 0, follow spec to set PcdType to EFI_PCD_TYPE_8, |
| 237 | // PcdSize to 0 and PcdName to the null-terminated ASCII string |
| 238 | // associated with the token's namespace Guid. |
| 239 | // |
| 240 | PcdInfo->PcdType = EFI_PCD_TYPE_8; |
| 241 | PcdInfo->PcdSize = 0; |
| 242 | // |
| 243 | // Here use one representative in the token space to get the TokenSpaceCName. |
| 244 | // |
| 245 | PcdInfo->PcdName = GetPcdName (TRUE, IsPeiDb, ExMapTable[Index].TokenNumber); |
| 246 | return EFI_SUCCESS; |
| 247 | } else if (ExMapTable[Index].ExTokenNumber == TokenNumber) { |
| 248 | PcdInfo->PcdSize = DxePcdGetSize (ExMapTable[Index].TokenNumber); |
| 249 | LocalTokenNumber = GetLocalTokenNumber (IsPeiDb, ExMapTable[Index].TokenNumber); |
| 250 | PcdInfo->PcdType = GetPcdType (LocalTokenNumber); |
| 251 | PcdInfo->PcdName = GetPcdName (FALSE, IsPeiDb, ExMapTable[Index].TokenNumber); |
| 252 | return EFI_SUCCESS; |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | |
| 257 | return EFI_NOT_FOUND; |
no test coverage detected