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] Guid The 128-bit unique value that designates the namespace from which to extract the value. @param[in] TokenNumber The PCD token number.
| 227 | @retval EFI_NOT_FOUND The PCD service could not find the requested token number. |
| 228 | **/ |
| 229 | EFI_STATUS |
| 230 | PeiGetPcdInfo ( |
| 231 | IN CONST EFI_GUID *Guid, |
| 232 | IN UINTN TokenNumber, |
| 233 | OUT EFI_PCD_INFO *PcdInfo |
| 234 | ) |
| 235 | { |
| 236 | PEI_PCD_DATABASE *PeiPcdDb; |
| 237 | BOOLEAN PeiExMapTableEmpty; |
| 238 | UINTN PeiNexTokenNumber; |
| 239 | UINT32 LocalTokenNumber; |
| 240 | |
| 241 | ASSERT (PcdInfo != NULL); |
| 242 | |
| 243 | PeiPcdDb = GetPcdDatabase (); |
| 244 | PeiNexTokenNumber = PeiPcdDb->LocalTokenCount - PeiPcdDb->ExTokenCount; |
| 245 | |
| 246 | if (PeiPcdDb->ExTokenCount == 0) { |
| 247 | PeiExMapTableEmpty = TRUE; |
| 248 | } else { |
| 249 | PeiExMapTableEmpty = FALSE; |
| 250 | } |
| 251 | |
| 252 | if (Guid == NULL) { |
| 253 | if (TokenNumber > PeiNexTokenNumber) { |
| 254 | return EFI_NOT_FOUND; |
| 255 | } else if (TokenNumber == PCD_INVALID_TOKEN_NUMBER) { |
| 256 | // |
| 257 | // TokenNumber is 0, follow spec to set PcdType to EFI_PCD_TYPE_8, |
| 258 | // PcdSize to 0 and PcdName to NULL for default Token Space. |
| 259 | // |
| 260 | PcdInfo->PcdType = EFI_PCD_TYPE_8; |
| 261 | PcdInfo->PcdSize = 0; |
| 262 | PcdInfo->PcdName = NULL; |
| 263 | } else { |
| 264 | PcdInfo->PcdSize = PeiPcdGetSize (TokenNumber); |
| 265 | LocalTokenNumber = GetLocalTokenNumber (PeiPcdDb, TokenNumber); |
| 266 | PcdInfo->PcdType = GetPcdType (LocalTokenNumber); |
| 267 | PcdInfo->PcdName = GetPcdName (FALSE, PeiPcdDb, TokenNumber); |
| 268 | } |
| 269 | return EFI_SUCCESS; |
| 270 | } else { |
| 271 | if (PeiExMapTableEmpty) { |
| 272 | return EFI_NOT_FOUND; |
| 273 | } |
| 274 | return ExGetPcdInfo ( |
| 275 | PeiPcdDb, |
| 276 | Guid, |
| 277 | TokenNumber, |
| 278 | PcdInfo |
| 279 | ); |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | The function registers the CallBackOnSet fucntion |
no test coverage detected