d48c5882d5fc9e8990ba427c7d441832cbdb0587
[mirror_edk2.git] / PcAtChipsetPkg / IsaAcpiDxe / PcatIsaAcpi.h
1 /** @file
2 EFI PCAT ISA ACPI Driver for a Generic PC Platform
3
4 Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _PCAT_ISA_ACPI_H_
16 #define _PCAT_ISA_ACPI_H_
17
18 #include <PiDxe.h>
19
20 #include <IndustryStandard/Pci.h>
21
22 #include <Protocol/DevicePath.h>
23 #include <Protocol/PciIo.h>
24 #include <Protocol/IsaIo.h>
25 #include <Protocol/DriverBinding.h>
26 #include <Protocol/ComponentName.h>
27 #include <Protocol/ComponentName2.h>
28
29
30 #include <Library/UefiLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/BaseMemoryLib.h>
33 #include <Library/PcdLib.h>
34
35 #include <Protocol/IsaAcpi.h>
36 //
37 // PCAT ISA ACPI device private data structure
38 //
39 #define PCAT_ISA_ACPI_DEV_SIGNATURE SIGNATURE_32('L','P','C','D')
40
41 typedef struct {
42 UINTN Signature;
43 EFI_HANDLE Handle;
44 EFI_ISA_ACPI_PROTOCOL IsaAcpi;
45 EFI_PCI_IO_PROTOCOL *PciIo;
46 UINT64 OriginalAttributes;
47 } PCAT_ISA_ACPI_DEV;
48
49 #define PCAT_ISA_ACPI_DEV_FROM_THIS(a) BASE_CR(a, PCAT_ISA_ACPI_DEV, IsaAcpi)
50
51 //
52 // Global Variables
53 //
54 extern EFI_DRIVER_BINDING_PROTOCOL gPcatIsaAcpiDriverBinding;
55
56 extern EFI_COMPONENT_NAME2_PROTOCOL gPcatIsaAcpiComponentName2;
57
58 extern EFI_COMPONENT_NAME_PROTOCOL gPcatIsaAcpiComponentName;
59
60
61 //
62 // Prototypes for Driver model protocol interface
63 //
64 /**
65 ControllerDriver Protocol Method
66
67 @param This Driver Binding protocol instance pointer.
68 @param Controller Handle of device to test.
69 @param RemainingDevicePath Optional parameter use to pick a specific child
70 device to start.
71 @retval EFI_SUCCESS This driver supports this device.
72 @retval other This driver does not support this device.
73
74 **/
75 EFI_STATUS
76 EFIAPI
77 PcatIsaAcpiDriverBindingSupported (
78 IN EFI_DRIVER_BINDING_PROTOCOL *This,
79 IN EFI_HANDLE Controller,
80 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
81 );
82
83 /**
84 Install EFI_ISA_ACPI_PROTOCOL.
85
86 @param This Driver Binding protocol instance pointer.
87 @param ControllerHandle Handle of device to bind driver to.
88 @param RemainingDevicePath Optional parameter use to pick a specific child
89 device to start.
90
91 @retval EFI_SUCCESS This driver is added to ControllerHandle
92 @retval EFI_ALREADY_STARTED This driver is already running on ControllerHandle
93 @retval other This driver does not support this device
94 **/
95 EFI_STATUS
96 EFIAPI
97 PcatIsaAcpiDriverBindingStart (
98 IN EFI_DRIVER_BINDING_PROTOCOL *This,
99 IN EFI_HANDLE Controller,
100 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
101 );
102
103 /**
104 Stop this driver on ControllerHandle. Support stopping any child handles
105 created by this driver.
106
107 @param This Protocol instance pointer.
108 @param ControllerHandle Handle of device to stop driver on
109 @param NumberOfChildren Number of Handles in ChildHandleBuffer. If number of
110 children is zero stop the entire bus driver.
111 @param ChildHandleBuffer List of Child Handles to Stop.
112
113 @retval EFI_SUCCESS This driver is removed ControllerHandle
114 @retval other This driver was not removed from this device
115
116 **/
117 EFI_STATUS
118 EFIAPI
119 PcatIsaAcpiDriverBindingStop (
120 IN EFI_DRIVER_BINDING_PROTOCOL *This,
121 IN EFI_HANDLE Controller,
122 IN UINTN NumberOfChildren,
123 IN EFI_HANDLE *ChildHandleBuffer
124 );
125
126 //
127 // Prototypes for the ISA ACPI protocol interface
128 //
129 /**
130 Enumerate the ISA devices on the ISA bus
131
132
133 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
134 @param Device Point to device ID instance
135
136 @retval EFI_NOT_FOUND Can not found the next Isa device.
137 @retval EFI_SUCCESS Success retrieve the next Isa device for enumration.
138
139 **/
140 EFI_STATUS
141 EFIAPI
142 IsaDeviceEnumerate (
143 IN EFI_ISA_ACPI_PROTOCOL *This,
144 OUT EFI_ISA_ACPI_DEVICE_ID **Device
145 );
146
147 /**
148 Set ISA device power
149
150
151 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
152 @param Device Point to device ID instance
153 @param OnOff TRUE for setting isa device power on,
154 FALSE for setting isa device power off
155
156 @return EFI_SUCCESS Success to change power status for isa device.
157 **/
158 EFI_STATUS
159 EFIAPI
160 IsaDeviceSetPower (
161 IN EFI_ISA_ACPI_PROTOCOL *This,
162 IN EFI_ISA_ACPI_DEVICE_ID *Device,
163 IN BOOLEAN OnOff
164 );
165
166 /**
167 Get current resource for the specific ISA device.
168
169 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
170 @param Device Point to device ID instance
171 @param ResourceList On return, point to resources instances for given isa device
172
173 @retval EFI_NOT_FOUND Can not found the resource instance for given isa device
174 @retval EFI_SUCCESS Success to get resource instance for given isa device.
175 **/
176 EFI_STATUS
177 EFIAPI
178 IsaGetCurrentResource (
179 IN EFI_ISA_ACPI_PROTOCOL *This,
180 IN EFI_ISA_ACPI_DEVICE_ID *Device,
181 OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
182 );
183
184 /**
185 Get possible resource for the specific ISA device.
186
187 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
188 @param Device Point to device ID instance
189 @param ResourceList On return, point to resources instances for given isa device
190
191 @retval EFI_SUCCESS Success to get resource instance for given isa device.
192 **/
193 EFI_STATUS
194 EFIAPI
195 IsaGetPossibleResource (
196 IN EFI_ISA_ACPI_PROTOCOL *This,
197 IN EFI_ISA_ACPI_DEVICE_ID *Device,
198 OUT EFI_ISA_ACPI_RESOURCE_LIST **ResourceList
199 );
200
201 /**
202 Set resource for the specific ISA device.
203
204 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
205 @param Device Point to device ID instance
206 @param ResourceList Point to resources instances for given isa device
207
208 @return EFI_SUCCESS Success to set resource.
209
210 **/
211 EFI_STATUS
212 EFIAPI
213 IsaSetResource (
214 IN EFI_ISA_ACPI_PROTOCOL *This,
215 IN EFI_ISA_ACPI_DEVICE_ID *Device,
216 IN EFI_ISA_ACPI_RESOURCE_LIST *ResourceList
217 );
218
219 /**
220 Enable/Disable the specific ISA device.
221
222 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
223 @param Device Point to device ID instance
224 @param Enable Enable/Disable
225
226 @return EFI_SUCCESS Success to enable/disable.
227
228 **/
229 EFI_STATUS
230 EFIAPI
231 IsaEnableDevice (
232 IN EFI_ISA_ACPI_PROTOCOL *This,
233 IN EFI_ISA_ACPI_DEVICE_ID *Device,
234 IN BOOLEAN Enable
235 );
236
237 /**
238 Initialize the specific ISA device.
239
240 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
241 @param Device Point to device ID instance
242
243 @return EFI_SUCCESS Success to initialize.
244
245 **/
246 EFI_STATUS
247 EFIAPI
248 IsaInitDevice (
249 IN EFI_ISA_ACPI_PROTOCOL *This,
250 IN EFI_ISA_ACPI_DEVICE_ID *Device
251 );
252
253 /**
254 Initialize the ISA interface.
255
256 @param This Point to instance of EFI_ISA_ACPI_PROTOCOL
257
258 @return EFI_SUCCESS Success to initialize ISA interface.
259
260 **/
261 EFI_STATUS
262 EFIAPI
263 IsaInterfaceInit (
264 IN EFI_ISA_ACPI_PROTOCOL *This
265 );
266
267 /**
268 Initialize the ISA device list.
269 **/
270 VOID
271 InitializePcatIsaAcpiDeviceList (
272 VOID
273 );
274
275 #endif