BdsPlatform.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /** @file
  2. Header file for BDS Platform specific code
  3. Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _BDS_PLATFORM_H
  7. #define _BDS_PLATFORM_H
  8. #include <PiDxe.h>
  9. #include <Protocol/DevicePath.h>
  10. #include <Protocol/SimpleNetwork.h>
  11. #include <Protocol/PciRootBridgeIo.h>
  12. #include <Protocol/LoadFile.h>
  13. #include <Protocol/PciIo.h>
  14. #include <Protocol/CpuIo2.h>
  15. #include <Protocol/LoadedImage.h>
  16. #include <Protocol/DiskInfo.h>
  17. #include <Protocol/GraphicsOutput.h>
  18. #include <Protocol/UgaDraw.h>
  19. #include <Protocol/GenericMemoryTest.h>
  20. #include <Protocol/DevicePathToText.h>
  21. #include <Protocol/FirmwareVolume2.h>
  22. #include <Protocol/SimpleFileSystem.h>
  23. #include <Guid/CapsuleVendor.h>
  24. #include <Guid/MemoryTypeInformation.h>
  25. #include <Guid/GlobalVariable.h>
  26. #include <Guid/MemoryOverwriteControl.h>
  27. #include <Guid/FileInfo.h>
  28. #include <Library/DebugLib.h>
  29. #include <Library/BaseMemoryLib.h>
  30. #include <Library/UefiBootServicesTableLib.h>
  31. #include <Library/UefiRuntimeServicesTableLib.h>
  32. #include <Library/MemoryAllocationLib.h>
  33. #include <Library/BaseLib.h>
  34. #include <Library/PcdLib.h>
  35. #include <Library/PlatformBootManagerLib.h>
  36. #include <Library/DevicePathLib.h>
  37. #include <Library/UefiLib.h>
  38. #include <Library/HobLib.h>
  39. #include <Library/DxeServicesLib.h>
  40. #include <Library/DxeServicesTableLib.h>
  41. #include <Library/PrintLib.h>
  42. #include <Library/HiiLib.h>
  43. #include <Library/CapsuleLib.h>
  44. #include <Library/PerformanceLib.h>
  45. #include <IndustryStandard/Pci30.h>
  46. #include <IndustryStandard/PciCodeId.h>
  47. ///
  48. /// ConnectType
  49. ///
  50. #define CONSOLE_OUT 0x00000001
  51. #define STD_ERROR 0x00000002
  52. #define CONSOLE_IN 0x00000004
  53. #define CONSOLE_ALL (CONSOLE_OUT | CONSOLE_IN | STD_ERROR)
  54. extern EFI_GUID gUefiShellFileGuid;
  55. extern EFI_BOOT_MODE gBootMode;
  56. #define gPciRootBridge \
  57. { \
  58. { \
  59. ACPI_DEVICE_PATH, \
  60. ACPI_DP, \
  61. { \
  62. (UINT8) (sizeof (ACPI_HID_DEVICE_PATH)), \
  63. (UINT8) ((sizeof (ACPI_HID_DEVICE_PATH)) >> 8) \
  64. }, \
  65. }, \
  66. EISA_PNP_ID (0x0A03), \
  67. 0 \
  68. }
  69. #define gEndEntire \
  70. { \
  71. END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { END_DEVICE_PATH_LENGTH, 0 } \
  72. }
  73. typedef struct {
  74. EFI_DEVICE_PATH_PROTOCOL *DevicePath;
  75. UINTN ConnectType;
  76. } BDS_CONSOLE_CONNECT_ENTRY;
  77. //
  78. // Platform Root Bridge
  79. //
  80. typedef struct {
  81. ACPI_HID_DEVICE_PATH PciRootBridge;
  82. EFI_DEVICE_PATH_PROTOCOL End;
  83. } PLATFORM_ROOT_BRIDGE_DEVICE_PATH;
  84. //
  85. // Below is the platform console device path
  86. //
  87. typedef struct {
  88. ACPI_HID_DEVICE_PATH PciRootBridge;
  89. PCI_DEVICE_PATH IsaBridge;
  90. ACPI_HID_DEVICE_PATH Keyboard;
  91. EFI_DEVICE_PATH_PROTOCOL End;
  92. } PLATFORM_KEYBOARD_DEVICE_PATH;
  93. typedef struct {
  94. ACPI_HID_DEVICE_PATH PciRootBridge;
  95. PCI_DEVICE_PATH PciDevice;
  96. EFI_DEVICE_PATH_PROTOCOL End;
  97. } PLATFORM_ONBOARD_CONTROLLER_DEVICE_PATH;
  98. typedef struct {
  99. ACPI_HID_DEVICE_PATH PciRootBridge;
  100. PCI_DEVICE_PATH Pci0Device;
  101. EFI_DEVICE_PATH_PROTOCOL End;
  102. } PLATFORM_PEG_ROOT_CONTROLLER_DEVICE_PATH;
  103. typedef struct {
  104. ACPI_HID_DEVICE_PATH PciRootBridge;
  105. PCI_DEVICE_PATH PciBridge;
  106. PCI_DEVICE_PATH PciDevice;
  107. EFI_DEVICE_PATH_PROTOCOL End;
  108. } PLATFORM_PCI_CONTROLLER_DEVICE_PATH;
  109. //
  110. // Below is the boot option device path
  111. //
  112. #define CLASS_HID 3
  113. #define SUBCLASS_BOOT 1
  114. #define PROTOCOL_KEYBOARD 1
  115. typedef struct {
  116. USB_CLASS_DEVICE_PATH UsbClass;
  117. EFI_DEVICE_PATH_PROTOCOL End;
  118. } USB_CLASS_FORMAT_DEVICE_PATH;
  119. extern USB_CLASS_FORMAT_DEVICE_PATH gUsbClassKeyboardDevicePath;
  120. //
  121. // Platform BDS Functions
  122. //
  123. /**
  124. Perform the memory test base on the memory test intensive level,
  125. and update the memory resource.
  126. @param Level The memory test intensive level.
  127. @retval EFI_STATUS Success test all the system memory and update
  128. the memory resource
  129. **/
  130. EFI_STATUS
  131. MemoryTest (
  132. IN EXTENDMEM_COVERAGE_LEVEL Level
  133. );
  134. VOID
  135. ConnectSequence (
  136. IN EFI_BOOT_MODE BootMode
  137. );
  138. INTN
  139. EFIAPI
  140. CompareBootOption (
  141. CONST VOID *Left,
  142. CONST VOID *Right
  143. );
  144. VOID
  145. RegisterStaticHotkey (
  146. VOID
  147. );
  148. VOID
  149. RegisterDefaultBootOption (
  150. VOID
  151. );
  152. #endif