AcpiPlatform.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /*++
  2. Copyright (c) 2004 - 2019, Intel Corporation. All rights reserved.<BR>
  3. SPDX-License-Identifier: BSD-2-Clause-Patent
  4. Module Name:
  5. AcpiPlatform.h
  6. Abstract:
  7. This is an implementation of the ACPI platform driver. Requirements for
  8. this driver are defined in the Tiano ACPI External Product Specification,
  9. revision 0.3.6.
  10. --*/
  11. #ifndef _ACPI_PLATFORM_H_
  12. #define _ACPI_PLATFORM_H_
  13. //
  14. // Statements that include other header files.
  15. //
  16. #include <PiDxe.h>
  17. #include <Base.h>
  18. #include <Library/UefiLib.h>
  19. #include <Library/BaseLib.h>
  20. #include <Library/UefiBootServicesTableLib.h>
  21. #include <Library/UefiRuntimeServicesTableLib.h>
  22. #include <Library/DebugLib.h>
  23. #include <Protocol/FirmwareVolume2.h>
  24. #include <Library/PcdLib.h>
  25. #include <IndustryStandard/HighPrecisionEventTimerTable.h>
  26. #include <IndustryStandard/Acpi.h>
  27. #include <Protocol/AcpiSystemDescriptionTable.h>
  28. #include <Protocol/MpService.h>
  29. #include <IndustryStandard/Acpi30.h>
  30. #include <IndustryStandard/Acpi20.h>
  31. #include <Library/HobLib.h>
  32. #include <AlertStandardFormatTable.h>
  33. #include <Guid/SetupVariable.h>
  34. #include <Protocol/GlobalNvsArea.h>
  35. #include <Library/BaseMemoryLib.h>
  36. #include <Library/MemoryAllocationLib.h>
  37. #include <PchRegs.h>
  38. #include <Library/PchPlatformLib.h>
  39. //
  40. // Global variables.
  41. //
  42. extern EFI_GLOBAL_NVS_AREA_PROTOCOL mGlobalNvsArea;
  43. //
  44. // ACPI table information used to initialize tables.
  45. #define EFI_ACPI_OEM_REVISION 0x00000003
  46. #define EFI_ACPI_CREATOR_ID SIGNATURE_32 ('V', 'L', 'V', '2')
  47. #define EFI_ACPI_CREATOR_REVISION 0x0100000D
  48. #define WPCN381U_CONFIG_INDEX 0x2E
  49. #define WPCN381U_CONFIG_DATA 0x2F
  50. #define WPCN381U_CHIP_ID 0xF4
  51. #define WDCP376_CHIP_ID 0xF1
  52. #define MOBILE_PLATFORM 1
  53. #define DESKTOP_PLATFORM 2
  54. //
  55. // Define macros to build data structure signatures from characters.
  56. //
  57. #ifndef EFI_SIGNATURE_16
  58. #define EFI_SIGNATURE_16(A, B) ((A) | (B << 8))
  59. #endif
  60. #ifndef EFI_SIGNATURE_32
  61. #define EFI_SIGNATURE_32(A, B, C, D) (EFI_SIGNATURE_16 (A, B) | (EFI_SIGNATURE_16 (C, D) << 16))
  62. #endif
  63. #ifndef EFI_SIGNATURE_64
  64. #define EFI_SIGNATURE_64(A, B, C, D, E, F, G, H) \
  65. (EFI_SIGNATURE_32 (A, B, C, D) | ((UINT64) (EFI_SIGNATURE_32 (E, F, G, H)) << 32))
  66. #endif
  67. #define GV3_SSDT_OEM_TABLE_IDBASE 0x4000
  68. //
  69. // Private Driver Data.
  70. //
  71. //
  72. // Define Union of IO APIC & Local APIC structure.
  73. //
  74. typedef union {
  75. EFI_ACPI_2_0_PROCESSOR_LOCAL_APIC_STRUCTURE AcpiLocalApic;
  76. EFI_ACPI_2_0_IO_APIC_STRUCTURE AcpiIoApic;
  77. struct {
  78. UINT8 Type;
  79. UINT8 Length;
  80. } AcpiApicCommon;
  81. } ACPI_APIC_STRUCTURE_PTR;
  82. //
  83. // Protocol private structure definition.
  84. //
  85. /**
  86. Entry point of the ACPI platform driver.
  87. @param[in] ImageHandle EFI_HANDLE: A handle for the image that is initializing this driver.
  88. @param[in] SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table.
  89. @retval EFI_SUCCESS Driver initialized successfully.
  90. @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded.
  91. @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources.
  92. **/
  93. EFI_STATUS
  94. InstallAcpiPlatform (
  95. IN EFI_HANDLE ImageHandle,
  96. IN EFI_SYSTEM_TABLE *SystemTable
  97. );
  98. /**
  99. Get Acpi Table Version.
  100. @param[in] ImageHandle EFI_HANDLE: A handle for the image that is initializing this driver.
  101. @param[in] SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table.
  102. @retval EFI_SUCCESS: Driver initialized successfully.
  103. @retval EFI_LOAD_ERROR: Failed to Initialize or has been loaded.
  104. @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources.
  105. --*/
  106. EFI_ACPI_TABLE_VERSION
  107. GetAcpiTableVersion (
  108. VOID
  109. );
  110. /**
  111. The funtion returns Oem specific information of Acpi Platform.
  112. @param[in] OemId OemId returned.
  113. @param[in] OemTableId OemTableId returned.
  114. @param[in] OemRevision OemRevision returned.
  115. @retval EFI_STATUS Status of function execution.
  116. **/
  117. EFI_STATUS
  118. AcpiPlatformGetOemFields (
  119. OUT UINT8 *OemId,
  120. OUT UINT64 *OemTableId,
  121. OUT UINT32 *OemRevision
  122. );
  123. /**
  124. The function returns Acpi table version.
  125. @param[in]
  126. @retval EFI_ACPI_TABLE_VERSION Acpi table version encoded as a UINT32.
  127. **/
  128. EFI_ACPI_TABLE_VERSION
  129. AcpiPlatformGetAcpiSetting (
  130. VOID
  131. );
  132. /**
  133. Entry point for Acpi platform driver.
  134. @param[in] ImageHandle A handle for the image that is initializing this driver.
  135. @param[in] SystemTable A pointer to the EFI system table.
  136. @retval EFI_SUCCESS Driver initialized successfully.
  137. @retval EFI_LOAD_ERROR Failed to Initialize or has been loaded.
  138. @retval EFI_OUT_OF_RESOURCES Could not allocate needed resources.
  139. **/
  140. EFI_STATUS
  141. EFIAPI
  142. AcpiPlatformEntryPoint (
  143. IN EFI_HANDLE ImageHandle,
  144. IN EFI_SYSTEM_TABLE *SystemTable
  145. );
  146. UINT8
  147. ReadCmosBank1Byte (
  148. IN UINT8 Index
  149. );
  150. VOID
  151. WriteCmosBank1Byte (
  152. IN UINT8 Index,
  153. IN UINT8 Data
  154. );
  155. VOID
  156. SelectNFCDevice (
  157. IN VOID
  158. );
  159. VOID
  160. SettingI2CTouchAddress (
  161. IN VOID
  162. );
  163. extern
  164. EFI_STATUS
  165. EFIAPI
  166. IsctDxeEntryPoint (
  167. IN EFI_HANDLE ImageHandle,
  168. IN EFI_SYSTEM_TABLE *SystemTable
  169. );
  170. #endif