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