SystemConfigUpdateDxe.c 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /** @file
  2. System Congfig Update.
  3. @copyright
  4. Copyright 2017 - 2021 Intel Corporation. <BR>
  5. SPDX-License-Identifier: BSD-2-Clause-Patent
  6. **/
  7. #include "SystemConfigUpdateDxe.h"
  8. #include <PlatformInfoTypes.h>
  9. EFI_PLATFORM_INFO *mPlatformInfo = NULL;
  10. /**
  11. Update the IioDefaults
  12. @param *SYSTEM_CONFIGURATION Pointer to the SystemConfiguration structure
  13. @retval None
  14. **/
  15. VOID
  16. IioDefaultConfigUpdateCallback (
  17. IN SYSTEM_CONFIGURATION *Default
  18. )
  19. {
  20. UINT8 BoardId;
  21. BoardId = mPlatformInfo->BoardId;
  22. Default->PlatformOCSupport = 0;
  23. if (BoardId == TypeHedtCRB) {
  24. Default->PlatformOCSupport = 1;
  25. }
  26. }
  27. SYSTEM_CONFIG_UPDATE_DATA SystemConfigUpdateTable = {
  28. SYSTEM_CONFIG_UPDATE_SIGNATURE,
  29. SYSTEM_CONFIG_UPDATE_VERSION,
  30. IioDefaultConfigUpdateCallback
  31. };
  32. /**
  33. The Driver Entry Point.
  34. The function is the driver Entry point.
  35. @param ImageHandle A handle for the image that is initializing this driver
  36. @param SystemTable A pointer to the EFI system table
  37. @retval EFI_SUCCESS: Driver initialized successfully
  38. @retval EFI_LOAD_ERROR: Failed to Initialize or has been loaded
  39. @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
  40. **/
  41. EFI_STATUS
  42. EFIAPI
  43. SystemConfigUpdateEntry (
  44. IN EFI_HANDLE ImageHandle,
  45. IN EFI_SYSTEM_TABLE *SystemTable
  46. )
  47. {
  48. EFI_STATUS Status;
  49. UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol = NULL;
  50. EFI_HOB_GUID_TYPE *GuidHob;
  51. GuidHob = GetFirstGuidHob (&gEfiPlatformInfoGuid);
  52. ASSERT (GuidHob != NULL);
  53. mPlatformInfo = GET_GUID_HOB_DATA(GuidHob);
  54. DEBUG((DEBUG_INFO, "UBA:System Config Update Table.\n"));
  55. Status = gBS->LocateProtocol (
  56. &gUbaConfigDatabaseProtocolGuid,
  57. NULL,
  58. (VOID **) &UbaConfigProtocol
  59. );
  60. if (EFI_ERROR(Status)) {
  61. return Status;
  62. }
  63. Status = UbaConfigProtocol->AddData (
  64. UbaConfigProtocol,
  65. &gSystemConfigUpdateDataGuid,
  66. &SystemConfigUpdateTable,
  67. sizeof(SystemConfigUpdateTable)
  68. );
  69. if (EFI_ERROR(Status)) {
  70. return Status;
  71. }
  72. return Status;
  73. }