]>
Commit | Line | Data |
---|---|---|
c3902377 | 1 | /*++\r |
2 | \r | |
3e0578d2 | 3 | Copyright (c) 2006 - 2007, Intel Corporation<BR>\r |
4 | All rights reserved. This program and the accompanying materials\r | |
5 | are licensed and made available under the terms and conditions of the BSD License\r | |
6 | which accompanies this distribution. The full text of the license may be found at\r | |
7 | http://opensource.org/licenses/bsd-license.php\r | |
8 | \r | |
9 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
c3902377 | 11 | \r |
12 | Module Name:\r | |
13 | \r | |
14 | IsaBus.h\r | |
15 | \r | |
16 | Abstract:\r | |
17 | \r | |
18 | The header file for ISA bus driver\r | |
19 | \r | |
20 | Revision History:\r | |
21 | \r | |
22 | --*/\r | |
23 | \r | |
24 | #ifndef _EFI_ISA_BUS_H\r | |
25 | #define _EFI_ISA_BUS_H\r | |
26 | \r | |
27 | //\r | |
c55fa8cc | 28 | // The package level header files this module uses\r |
c3902377 | 29 | //\r |
c55fa8cc | 30 | #include <PiDxe.h>\r |
31 | #include <FrameworkDxe.h>\r | |
32 | //\r | |
33 | // The protocols, PPI and GUID defintions for this module\r | |
34 | //\r | |
35 | #include <Protocol/PciIo.h>\r | |
36 | #include <Protocol/ComponentName.h>\r | |
37 | #include <Protocol/IsaIo.h>\r | |
38 | #include <Protocol/DevicePath.h>\r | |
39 | #include <Protocol/IsaAcpi.h>\r | |
40 | #include <Protocol/DriverBinding.h>\r | |
41 | #include <Protocol/GenericMemoryTest.h>\r | |
42 | #include <Guid/StatusCodeDataTypeId.h>\r | |
43 | //\r | |
44 | // The Library classes this module consumes\r | |
45 | //\r | |
46 | #include <Library/DebugLib.h>\r | |
47 | #include <Library/UefiDriverEntryPoint.h>\r | |
48 | #include <Library/UefiLib.h>\r | |
49 | #include <Library/DevicePathLib.h>\r | |
50 | #include <Library/BaseMemoryLib.h>\r | |
51 | #include <Library/MemoryAllocationLib.h>\r | |
52 | #include <Library/UefiBootServicesTableLib.h>\r | |
53 | #include <Library/ReportStatusCodeLib.h>\r | |
54 | #include <Library/PcdLib.h>\r | |
c3902377 | 55 | \r |
56 | #include "ComponentName.h"\r | |
57 | \r | |
58 | extern EFI_ISA_IO_PROTOCOL IsaIoInterface;\r | |
59 | \r | |
60 | typedef enum {\r | |
61 | IsaAccessTypeUnknown,\r | |
62 | IsaAccessTypeIo,\r | |
63 | IsaAccessTypeMem,\r | |
64 | IsaAccessTypeMaxType\r | |
65 | } ISA_ACCESS_TYPE;\r | |
66 | \r | |
67 | //\r | |
68 | // 16 MB Memory Range\r | |
69 | //\r | |
70 | #define ISA_MAX_MEMORY_ADDRESS 0x1000000\r | |
71 | //\r | |
72 | // 64K I/O Range\r | |
73 | //\r | |
74 | #define ISA_MAX_IO_ADDRESS 0x10000\r | |
75 | \r | |
76 | typedef struct {\r | |
77 | UINT8 Address;\r | |
78 | UINT8 Page;\r | |
79 | UINT8 Count;\r | |
80 | } EFI_ISA_DMA_REGISTERS;\r | |
81 | \r | |
82 | //\r | |
83 | // ISA I/O Device Structure\r | |
84 | //\r | |
85 | #define ISA_IO_DEVICE_SIGNATURE EFI_SIGNATURE_32 ('i', 's', 'a', 'i')\r | |
86 | \r | |
87 | typedef struct {\r | |
88 | UINT32 Signature;\r | |
89 | EFI_HANDLE Handle;\r | |
90 | EFI_ISA_IO_PROTOCOL IsaIo;\r | |
91 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
92 | EFI_PCI_IO_PROTOCOL *PciIo;\r | |
93 | } ISA_IO_DEVICE;\r | |
94 | \r | |
95 | #define ISA_IO_DEVICE_FROM_ISA_IO_THIS(a) CR (a, ISA_IO_DEVICE, IsaIo, ISA_IO_DEVICE_SIGNATURE)\r | |
96 | \r | |
97 | //\r | |
98 | // Global Variables\r | |
99 | //\r | |
100 | extern EFI_DRIVER_BINDING_PROTOCOL gIsaBusControllerDriver;\r | |
101 | \r | |
102 | //\r | |
103 | // Mapping structure for performing ISA DMA to a buffer above 16 MB\r | |
104 | //\r | |
105 | typedef struct {\r | |
106 | EFI_ISA_IO_PROTOCOL_OPERATION Operation;\r | |
107 | UINTN NumberOfBytes;\r | |
108 | UINTN NumberOfPages;\r | |
109 | EFI_PHYSICAL_ADDRESS HostAddress;\r | |
110 | EFI_PHYSICAL_ADDRESS MappedHostAddress;\r | |
111 | } ISA_MAP_INFO;\r | |
112 | \r | |
113 | //\r | |
114 | // EFI Driver Binding Protocol Interface Functions\r | |
115 | //\r | |
116 | \r | |
117 | EFI_STATUS\r | |
118 | EFIAPI\r | |
119 | IsaBusControllerDriverSupported (\r | |
120 | IN EFI_DRIVER_BINDING_PROTOCOL * This,\r | |
121 | IN EFI_HANDLE Controller,\r | |
122 | IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r | |
123 | )\r | |
124 | /*++\r | |
125 | \r | |
126 | Routine Description:\r | |
127 | \r | |
128 | This function checks to see if a controller can be managed by the ISA Bus \r | |
129 | Driver. This is done by checking to see if the controller supports the \r | |
130 | EFI_PCI_IO_PROTOCOL protocol, and then looking at the PCI Configuration \r | |
131 | Header to see if the device is a PCI to ISA bridge. The class code of \r | |
132 | PCI to ISA bridge: Base class 06h, Sub class 01h Interface 00h \r | |
133 | \r | |
134 | Arguments:\r | |
135 | \r | |
136 | This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
137 | Controller - The handle of the device to check.\r | |
138 | RemainingDevicePath - A pointer to the remaining portion of a device path.\r | |
139 | \r | |
140 | Returns:\r | |
141 | \r | |
142 | EFI_SUCCESS - The device is supported by this driver.\r | |
143 | EFI_UNSUPPORTED - The device is not supported by this driver.\r | |
144 | \r | |
145 | --*/\r | |
146 | ;\r | |
147 | \r | |
148 | EFI_STATUS\r | |
149 | EFIAPI\r | |
150 | IsaBusControllerDriverStart (\r | |
151 | IN EFI_DRIVER_BINDING_PROTOCOL * This,\r | |
152 | IN EFI_HANDLE Controller,\r | |
153 | IN EFI_DEVICE_PATH_PROTOCOL * RemainingDevicePath OPTIONAL\r | |
154 | )\r | |
155 | /*++\r | |
156 | \r | |
157 | Routine Description:\r | |
158 | \r | |
159 | This function tells the ISA Bus Driver to start managing a PCI to ISA \r | |
160 | Bridge controller. \r | |
161 | \r | |
162 | Arguments:\r | |
163 | \r | |
164 | This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
165 | Controller - A handle to the device being started. \r | |
166 | RemainingDevicePath - A pointer to the remaining portion of a device path.\r | |
167 | \r | |
168 | Returns:\r | |
169 | \r | |
170 | EFI_SUCCESS - The device was started.\r | |
171 | EFI_UNSUPPORTED - The device is not supported.\r | |
172 | EFI_DEVICE_ERROR - The device could not be started due to a device error.\r | |
173 | EFI_ALREADY_STARTED - The device has already been started.\r | |
174 | EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r | |
175 | EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r | |
176 | resources.\r | |
177 | \r | |
178 | --*/\r | |
179 | ;\r | |
180 | \r | |
181 | EFI_STATUS\r | |
182 | EFIAPI\r | |
183 | IsaBusControllerDriverStop (\r | |
184 | IN EFI_DRIVER_BINDING_PROTOCOL * This,\r | |
185 | IN EFI_HANDLE Controller,\r | |
186 | IN UINTN NumberOfChildren,\r | |
187 | IN EFI_HANDLE * ChildHandleBuffer OPTIONAL\r | |
188 | )\r | |
189 | /*++\r | |
190 | \r | |
191 | Routine Description:\r | |
192 | \r | |
193 | This function tells the ISA Bus Driver to stop managing a PCI to ISA \r | |
194 | Bridge controller. \r | |
195 | \r | |
196 | Arguments:\r | |
197 | \r | |
198 | This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
199 | Controller - A handle to the device being stopped.\r | |
200 | NumberOfChindren - The number of child device handles in ChildHandleBuffer.\r | |
201 | ChildHandleBuffer - An array of child handles to be freed.\r | |
202 | \r | |
203 | \r | |
204 | Returns:\r | |
205 | \r | |
206 | EFI_SUCCESS - The device was stopped.\r | |
207 | EFI_DEVICE_ERROR - The device could not be stopped due to a device error.\r | |
208 | EFI_NOT_STARTED - The device has not been started.\r | |
209 | EFI_INVALID_PARAMETER - One of the parameters has an invalid value.\r | |
210 | EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r | |
211 | resources.\r | |
212 | \r | |
213 | --*/\r | |
214 | ;\r | |
215 | \r | |
216 | //\r | |
217 | // Function Prototypes\r | |
218 | //\r | |
219 | \r | |
220 | EFI_STATUS\r | |
221 | IsaCreateDevice (\r | |
222 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
223 | IN EFI_HANDLE Controller,\r | |
224 | IN EFI_PCI_IO_PROTOCOL *PciIo,\r | |
225 | IN EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath,\r | |
226 | IN EFI_ISA_ACPI_RESOURCE_LIST *IsaDeviceResourceList,\r | |
227 | OUT EFI_DEVICE_PATH_PROTOCOL **ChildDevicePath\r | |
228 | )\r | |
229 | /*++\r | |
230 | \r | |
231 | Routine Description:\r | |
232 | \r | |
233 | Create ISA device found by IsaPnpProtocol \r | |
234 | \r | |
235 | Arguments:\r | |
236 | \r | |
237 | This - The EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
238 | Controller - The handle of ISA bus controller(PCI to ISA bridge)\r | |
239 | PciIo - The Pointer to the PCI protocol \r | |
240 | ParentDevicePath - Device path of the ISA bus controller\r | |
241 | IsaDeviceResourceList - The resource list of the ISA device\r | |
242 | ChildDevicePath - The pointer to the child device.\r | |
243 | \r | |
244 | Returns:\r | |
245 | \r | |
246 | EFI_SUCCESS - Create the child device.\r | |
247 | EFI_OUT_OF_RESOURCES - The request could not be completed due to a lack of \r | |
248 | resources.\r | |
249 | EFI_DEVICE_ERROR - Can not create child device.\r | |
250 | \r | |
251 | --*/\r | |
252 | ;\r | |
253 | \r | |
254 | EFI_STATUS\r | |
255 | InitializeIsaIoInstance (\r | |
256 | IN ISA_IO_DEVICE *IsaIoDevice,\r | |
257 | IN EFI_ISA_ACPI_RESOURCE_LIST *IsaDevice\r | |
258 | )\r | |
259 | /*++\r | |
260 | \r | |
261 | Routine Description:\r | |
262 | \r | |
263 | Initializes an ISA I/O Instance\r | |
264 | \r | |
265 | Arguments:\r | |
266 | \r | |
267 | IsaIoDevice - The iso device to be initialized.\r | |
268 | IsaDevice - The resource list.\r | |
269 | \r | |
270 | Returns:\r | |
271 | \r | |
272 | EFI_SUCCESS - Initial success.\r | |
273 | \r | |
274 | --*/\r | |
275 | ;\r | |
276 | \r | |
277 | #endif\r |