• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   EFI PCAT ISA ACPI Driver for a Generic PC Platform
3 
4 Copyright (c) 2006 - 2011, 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 } 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 //
53 extern EFI_DRIVER_BINDING_PROTOCOL gPcatIsaAcpiDriverBinding;
54 
55 extern EFI_COMPONENT_NAME2_PROTOCOL gPcatIsaAcpiComponentName2;
56 
57 extern 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 **/
74 EFI_STATUS
75 EFIAPI
76 PcatIsaAcpiDriverBindingSupported (
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 **/
94 EFI_STATUS
95 EFIAPI
96 PcatIsaAcpiDriverBindingStart (
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 **/
116 EFI_STATUS
117 EFIAPI
118 PcatIsaAcpiDriverBindingStop (
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 **/
139 EFI_STATUS
140 EFIAPI
141 IsaDeviceEnumerate (
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 **/
157 EFI_STATUS
158 EFIAPI
159 IsaDeviceSetPower (
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 **/
175 EFI_STATUS
176 EFIAPI
177 IsaGetCurrentResource (
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 **/
192 EFI_STATUS
193 EFIAPI
194 IsaGetPossibleResource (
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 **/
210 EFI_STATUS
211 EFIAPI
212 IsaSetResource (
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 **/
228 EFI_STATUS
229 EFIAPI
230 IsaEnableDevice (
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 **/
245 EFI_STATUS
246 EFIAPI
247 IsaInitDevice (
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 **/
260 EFI_STATUS
261 EFIAPI
262 IsaInterfaceInit (
263   IN EFI_ISA_ACPI_PROTOCOL  *This
264   );
265 
266 /**
267   Initialize the ISA device list.
268 **/
269 VOID
270 InitializePcatIsaAcpiDeviceList (
271   VOID
272   );
273 
274 #endif
275