AcpiPlatform.h 5.4 KB

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