BoardInitDxe.c 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /** @file
  2. BOARD INIT DXE Driver.
  3. @copyright
  4. Copyright 2014 - 2021 Intel Corporation.
  5. Copyright (c) 2021 - 2022, American Megatrends International LLC. <BR>
  6. SPDX-License-Identifier: BSD-2-Clause-Patent
  7. **/
  8. #include "BoardInitDxe.h"
  9. #include <PlatformInfoTypes.h>
  10. /**
  11. The Driver Entry Point.
  12. The function is the driver Entry point.
  13. @param ImageHandle A handle for the image that is initializing this driver
  14. @param SystemTable A pointer to the EFI system table
  15. @retval EFI_SUCCESS: Driver initialized successfully
  16. @retval EFI_LOAD_ERROR: Failed to Initialize or has been loaded
  17. @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources
  18. **/
  19. EFI_STATUS
  20. EFIAPI
  21. BoardInitDxeDriverEntry (
  22. IN EFI_HANDLE ImageHandle,
  23. IN EFI_SYSTEM_TABLE *SystemTable
  24. )
  25. {
  26. EFI_STATUS Status = EFI_SUCCESS;
  27. UBA_CONFIG_DATABASE_PROTOCOL *UbaConfigProtocol = NULL;
  28. UINT32 PlatformType = 0;
  29. EFI_HANDLE Handle = NULL;
  30. Status = gBS->LocateProtocol (
  31. &gUbaConfigDatabaseProtocolGuid,
  32. NULL,
  33. (VOID **) &UbaConfigProtocol
  34. );
  35. if (EFI_ERROR(Status)) {
  36. return Status;
  37. }
  38. Status = UbaConfigProtocol->GetSku(
  39. UbaConfigProtocol,
  40. &PlatformType,
  41. NULL,
  42. NULL
  43. );
  44. ASSERT_EFI_ERROR (Status);
  45. DEBUG ((DEBUG_INFO, "Uba init Dxe driver:PlatformType=%d\n", PlatformType));
  46. //according to the platform type to install different dummy maker.
  47. //later, the PEIM will be loaded by the dependency.
  48. switch(PlatformType)
  49. {
  50. case TypeWilsonCityRP:
  51. Status = gBS->InstallProtocolInterface (
  52. &Handle,
  53. &gEfiPlatformTypeWilsonCityRPProtocolGuid,
  54. EFI_NATIVE_INTERFACE,
  55. NULL
  56. );
  57. ASSERT_EFI_ERROR (Status);
  58. break;
  59. case TypeWilsonCitySMT:
  60. Status = gBS->InstallProtocolInterface(
  61. &Handle,
  62. &gEfiPlatformTypeWilsonCitySMTProtocolGuid,
  63. EFI_NATIVE_INTERFACE,
  64. NULL
  65. );
  66. ASSERT_EFI_ERROR(Status);
  67. break;
  68. case TypeCooperCityRP:
  69. Status = gBS->InstallProtocolInterface (
  70. &Handle,
  71. &gEfiPlatformTypeCooperCityRPProtocolGuid,
  72. EFI_NATIVE_INTERFACE,
  73. NULL
  74. );
  75. ASSERT_EFI_ERROR (Status);
  76. break;
  77. case TypeJunctionCity:
  78. Status = gBS->InstallProtocolInterface (
  79. &Handle,
  80. &gEfiPlatformTypeJunctionCityProtocolGuid,
  81. EFI_NATIVE_INTERFACE,
  82. NULL
  83. );
  84. ASSERT_EFI_ERROR (Status);
  85. break;
  86. case TypeAowanda:
  87. Status = gBS->InstallProtocolInterface (
  88. &Handle,
  89. &gEfiPlatformTypeAowandaProtocolGuid,
  90. EFI_NATIVE_INTERFACE,
  91. NULL
  92. );
  93. ASSERT_EFI_ERROR (Status);
  94. break;
  95. default:
  96. // CAN'T GO TO HERE.
  97. ASSERT (FALSE);
  98. }
  99. return Status;
  100. }