SaPolicyInitDxe.c 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /** @file
  2. This file is SampleCode for SA DXE Policy initialization.
  3. Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #include "SaPolicyInitDxe.h"
  7. //
  8. // Function implementations
  9. //
  10. /**
  11. Initialize SA DXE Policy
  12. @param[in] ImageHandle Image handle of this driver.
  13. @retval EFI_SUCCESS Initialization complete.
  14. @exception EFI_UNSUPPORTED The chipset is unsupported by this driver.
  15. @retval EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver.
  16. @retval EFI_DEVICE_ERROR Device error, driver exits abnormally.
  17. **/
  18. EFI_STATUS
  19. EFIAPI
  20. SaPolicyInitDxe (
  21. IN EFI_HANDLE ImageHandle
  22. )
  23. {
  24. EFI_STATUS Status;
  25. SA_POLICY_PROTOCOL *SaPolicy;
  26. //
  27. // Call CreateSaDxeConfigBlocks to create & initialize platform policy structure
  28. // and get all Intel default policy settings.
  29. //
  30. Status = CreateSaDxeConfigBlocks(&SaPolicy);
  31. DEBUG((DEBUG_INFO, "SaPolicy->TableHeader.NumberOfBlocks = 0x%x\n ", SaPolicy->TableHeader.NumberOfBlocks));
  32. ASSERT_EFI_ERROR(Status);
  33. UpdateDxeSaPolicyBoardConfig (SaPolicy);
  34. if (mFirmwareConfiguration != FwConfigDefault) {
  35. UpdateDxeSaPolicy (SaPolicy);
  36. }
  37. //
  38. // Install SaInstallPolicyProtocol.
  39. // While installed, RC assumes the Policy is ready and finalized. So please
  40. // update and override any setting before calling this function.
  41. //
  42. Status = SaInstallPolicyProtocol (ImageHandle, SaPolicy);
  43. ASSERT_EFI_ERROR (Status);
  44. return Status;
  45. }