PcatIsaAcpi.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. /** @file
  2. EFI PCAT ISA ACPI Driver for a Generic PC Platform
  3. Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>
  4. SPDX-License-Identifier: BSD-2-Clause-Patent
  5. **/
  6. #ifndef _PCAT_ISA_ACPI_H_
  7. #define _PCAT_ISA_ACPI_H_
  8. #include <PiDxe.h>
  9. #include <IndustryStandard/Pci.h>
  10. #include <Protocol/DevicePath.h>
  11. #include <Protocol/PciIo.h>
  12. #include <Protocol/IsaIo.h>
  13. #include <Protocol/DriverBinding.h>
  14. #include <Protocol/ComponentName.h>
  15. #include <Protocol/ComponentName2.h>
  16. #include <Library/UefiLib.h>
  17. #include <Library/UefiBootServicesTableLib.h>
  18. #include <Library/BaseMemoryLib.h>
  19. #include <Library/PcdLib.h>
  20. #include <Protocol/IsaAcpi.h>
  21. //
  22. // PCAT ISA ACPI device private data structure
  23. //
  24. #define PCAT_ISA_ACPI_DEV_SIGNATURE SIGNATURE_32('L','P','C','D')
  25. typedef struct {
  26. UINTN Signature;
  27. EFI_HANDLE Handle;
  28. EFI_ISA_ACPI_PROTOCOL IsaAcpi;
  29. EFI_PCI_IO_PROTOCOL *PciIo;
  30. UINT64 OriginalAttributes;
  31. } PCAT_ISA_ACPI_DEV;
  32. #define PCAT_ISA_ACPI_DEV_FROM_THIS(a) BASE_CR(a, PCAT_ISA_ACPI_DEV, IsaAcpi)
  33. //
  34. // Global Variables
  35. //
  36. extern EFI_DRIVER_BINDING_PROTOCOL gPcatIsaAcpiDriverBinding;
  37. extern EFI_COMPONENT_NAME2_PROTOCOL gPcatIsaAcpiComponentName2;
  38. extern EFI_COMPONENT_NAME_PROTOCOL gPcatIsaAcpiComponentName;
  39. //
  40. // Prototypes for Driver model protocol interface
  41. //
  42. /**
  43. ControllerDriver Protocol Method
  44. @param This Driver Binding protocol instance pointer.
  45. @param Controller Handle of device to test.
  46. @param RemainingDevicePath Optional parameter use to pick a specific child
  47. device to start.
  48. @retval EFI_SUCCESS This driver supports this device.
  49. @retval other This driver does not support this device.
  50. **/
  51. EFI_STATUS
  52. EFIAPI
  53. PcatIsaAcpiDriverBindingSupported (
  54. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  55. IN EFI_HANDLE Controller,
  56. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
  57. );
  58. /**
  59. Install EFI_ISA_ACPI_PROTOCOL.
  60. @param This Driver Binding protocol instance pointer.
  61. @param ControllerHandle Handle of device to bind driver to.
  62. @param RemainingDevicePath Optional parameter use to pick a specific child
  63. device to start.
  64. @retval EFI_SUCCESS This driver is added to ControllerHandle
  65. @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
  66. @retval other This driver does not support this device
  67. **/
  68. EFI_STATUS
  69. EFIAPI
  70. PcatIsaAcpiDriverBindingStart (
  71. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  72. IN EFI_HANDLE Controller,
  73. IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
  74. );
  75. /**
  76. Stop this driver on ControllerHandle. Support stopping any child handles
  77. created by this driver.
  78. @param This Protocol instance pointer.
  79. @param ControllerHandle Handle of device to stop driver on
  80. @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
  81. children is zero stop the entire bus driver.
  82. @param ChildHandleBuffer List of Child Handles to Stop.
  83. @retval EFI_SUCCESS This driver is removed ControllerHandle
  84. @retval other This driver was not removed from this device
  85. **/
  86. EFI_STATUS
  87. EFIAPI
  88. PcatIsaAcpiDriverBindingStop (
  89. IN EFI_DRIVER_BINDING_PROTOCOL *This,
  90. IN EFI_HANDLE Controller,
  91. IN UINTN NumberOfChildren,
  92. IN EFI_HANDLE *ChildHandleBuffer
  93. );
  94. //
  95. // Prototypes for the ISA ACPI protocol interface
  96. //
  97. /**
  98. Enumerate the ISA devices on the ISA bus
  99. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  100. @param Device Point to device ID instance
  101. @retval EFI_NOT_FOUND Can not found the next Isa device.
  102. @retval EFI_SUCCESS Success retrieve the next Isa device for enumration.
  103. **/
  104. EFI_STATUS
  105. EFIAPI
  106. IsaDeviceEnumerate (
  107. IN EFI_ISA_ACPI_PROTOCOL *This,
  108. OUT EFI_ISA_ACPI_DEVICE_ID **Device
  109. );
  110. /**
  111. Set ISA device power
  112. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  113. @param Device Point to device ID instance
  114. @param OnOff TRUE for setting isa device power on,
  115. FALSE for setting isa device power off
  116. @return EFI_SUCCESS Success to change power status for isa device.
  117. **/
  118. EFI_STATUS
  119. EFIAPI
  120. IsaDeviceSetPower (
  121. IN EFI_ISA_ACPI_PROTOCOL *This,
  122. IN EFI_ISA_ACPI_DEVICE_ID *Device,
  123. IN BOOLEAN OnOff
  124. );
  125. /**
  126. Get current resource for the specific ISA device.
  127. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  128. @param Device Point to device ID instance
  129. @param ResourceList On return, point to resources instances for given isa device
  130. @retval EFI_NOT_FOUND Can not found the resource instance for given isa device
  131. @retval EFI_SUCCESS Success to get resource instance for given isa device.
  132. **/
  133. EFI_STATUS
  134. EFIAPI
  135. IsaGetCurrentResource (
  136. IN EFI_ISA_ACPI_PROTOCOL *This,
  137. IN EFI_ISA_ACPI_DEVICE_ID *Device,
  138. OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
  139. );
  140. /**
  141. Get possible resource for the specific ISA device.
  142. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  143. @param Device Point to device ID instance
  144. @param ResourceList On return, point to resources instances for given isa device
  145. @retval EFI_SUCCESS Success to get resource instance for given isa device.
  146. **/
  147. EFI_STATUS
  148. EFIAPI
  149. IsaGetPossibleResource (
  150. IN EFI_ISA_ACPI_PROTOCOL *This,
  151. IN EFI_ISA_ACPI_DEVICE_ID *Device,
  152. OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
  153. );
  154. /**
  155. Set resource for the specific ISA device.
  156. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  157. @param Device Point to device ID instance
  158. @param ResourceList Point to resources instances for given isa device
  159. @return EFI_SUCCESS Success to set resource.
  160. **/
  161. EFI_STATUS
  162. EFIAPI
  163. IsaSetResource (
  164. IN EFI_ISA_ACPI_PROTOCOL *This,
  165. IN EFI_ISA_ACPI_DEVICE_ID *Device,
  166. IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
  167. );
  168. /**
  169. Enable/Disable the specific ISA device.
  170. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  171. @param Device Point to device ID instance
  172. @param Enable Enable/Disable
  173. @return EFI_SUCCESS Success to enable/disable.
  174. **/
  175. EFI_STATUS
  176. EFIAPI
  177. IsaEnableDevice (
  178. IN EFI_ISA_ACPI_PROTOCOL *This,
  179. IN EFI_ISA_ACPI_DEVICE_ID *Device,
  180. IN BOOLEAN Enable
  181. );
  182. /**
  183. Initialize the specific ISA device.
  184. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  185. @param Device Point to device ID instance
  186. @return EFI_SUCCESS Success to initialize.
  187. **/
  188. EFI_STATUS
  189. EFIAPI
  190. IsaInitDevice (
  191. IN EFI_ISA_ACPI_PROTOCOL *This,
  192. IN EFI_ISA_ACPI_DEVICE_ID *Device
  193. );
  194. /**
  195. Initialize the ISA interface.
  196. @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
  197. @return EFI_SUCCESS Success to initialize ISA interface.
  198. **/
  199. EFI_STATUS
  200. EFIAPI
  201. IsaInterfaceInit (
  202. IN EFI_ISA_ACPI_PROTOCOL *This
  203. );
  204. /**
  205. Initialize the ISA device list.
  206. **/
  207. VOID
  208. InitializePcatIsaAcpiDeviceList (
  209. VOID
  210. );
  211. #endif