UbaFpkConfigLib.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /** @file
  2. UBA FPK configuration library
  3. @copyright
  4. Copyright 2016 Intel Corporation. <BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include <Base.h>
  8. #include <Uefi.h>
  9. #include <Library/UefiBootServicesTableLib.h>
  10. #include <Library/DebugLib.h>
  11. #include <Protocol/UbaCfgDb.h>
  12. #include <Library/UbaFpkConfigLib.h>
  13. /**
  14. Retrieves FPK config struct from UBA database
  15. @retval EFI_SUCCESS Config struct is retrieved.
  16. @retval EFI_NOT_FOUND UBA protocol, platform or data not found.
  17. @retval EFI_INVALID_PARAMETER If PlatformFpkConfigStruct is NULL.
  18. **/
  19. EFI_STATUS
  20. FpkConfigGetConfigStruct (
  21. OUT PLATFORM_FPK_CONFIG_STRUCT *PlatformFpkConfigStruct
  22. )
  23. {
  24. EFI_STATUS Status;
  25. UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol = NULL;
  26. UINTN DataLength = 0;
  27. Status = gBS->LocateProtocol (
  28. &gUbaConfigDatabaseProtocolGuid,
  29. NULL,
  30. (VOID **) &UbaConfigProtocol
  31. );
  32. if (EFI_ERROR (Status)) {
  33. return Status;
  34. }
  35. DataLength = sizeof (*PlatformFpkConfigStruct);
  36. Status = UbaConfigProtocol->GetData (
  37. UbaConfigProtocol,
  38. &gPlatformFpkConfigDataGuid,
  39. PlatformFpkConfigStruct,
  40. &DataLength
  41. );
  42. if (EFI_ERROR (Status)) {
  43. return Status;
  44. }
  45. ASSERT (PlatformFpkConfigStruct->Signature == PLATFORM_FPK_CONFIG_SIGNATURE);
  46. ASSERT (PlatformFpkConfigStruct->Version == PLATFORM_FPK_CONFIG_VERSION);
  47. return EFI_SUCCESS;
  48. }