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