]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/IdeControllerDxe/IdeController.h
Add IDE support for edk2 Duet platform.
[mirror_edk2.git] / DuetPkg / IdeControllerDxe / IdeController.h
1 /*++
2
3 Copyright (c) 2006 Intel Corporation. All rights reserved
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
13 Module Name:
14
15 IdeController.h
16
17 Abstract:
18
19 Header file for chipset ATA controller driver.
20
21 Revision History
22 --*/
23
24 #ifndef _IDE_CONTROLLER_H
25 #define _IDE_CONTROLLER_H
26
27 #include <PiDxe.h>
28
29 #include <Library/UefiBootServicesTableLib.h>
30 #include <Library/UefiDriverEntryPoint.h>
31 #include <Library/BaseMemoryLib.h>
32 #include <Library/DebugLib.h>
33 #include <Library/MemoryAllocationLib.h>
34 #include <Library/UefiLib.h>
35 #include <Protocol/PciIo.h>
36 #include <Protocol/IdeControllerInit.h>
37
38 //
39 // Driver Binding Externs
40 //
41 extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding;
42 extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerName;
43 extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerName2;
44
45 #include <IndustryStandard/Pci22.h>
46
47 //
48 // Symbol definition, for PCI IDE configuration field
49 //
50 #define PCI_CLASS_MASS_STORAGE 0x01
51 #define PCI_SUB_CLASS_IDE 0x01
52
53 //
54 // Supports 2 channel max
55 //
56 #define ICH_IDE_MAX_CHANNEL 0x02
57 //
58 // Supports 2 devices max
59 //
60 #define ICH_IDE_MAX_DEVICES 0x02
61 #define ICH_IDE_ENUMER_ALL FALSE
62
63 #define IDE_CONTROLLER_SIGNATURE SIGNATURE_32 ('i', 'i', 'd', 'e')
64
65 //
66 // Ide controller driver private data structure
67 //
68 typedef struct {
69 //
70 // Standard signature used to identify Ide controller private data
71 //
72 UINT32 Signature;
73
74 //
75 // Protocol instance of IDE_CONTROLLER_INIT produced by this driver
76 //
77 EFI_IDE_CONTROLLER_INIT_PROTOCOL IdeInit;
78
79 //
80 // copy of protocol pointers used by this driver
81 //
82 EFI_PCI_IO_PROTOCOL *PciIo;
83
84 //
85 // The highest disqulified mode for each attached Ide device.
86 // Per ATA/ATAPI spec, if a mode is not supported, the modes higher than
87 // it should not be supported
88 //
89 EFI_ATA_COLLECTIVE_MODE DisqulifiedModes[ICH_IDE_MAX_CHANNEL][ICH_IDE_MAX_DEVICES];
90
91 //
92 // A copy of EFI_IDENTIFY_DATA data for each attached Ide device and its flag
93 //
94 EFI_IDENTIFY_DATA IdentifyData[ICH_IDE_MAX_CHANNEL][ICH_IDE_MAX_DEVICES];
95 BOOLEAN IdentifyValid[ICH_IDE_MAX_CHANNEL][ICH_IDE_MAX_DEVICES];
96
97 } EFI_IDE_CONTROLLER_PRIVATE_DATA;
98
99 #define IDE_CONTROLLER_PRIVATE_DATA_FROM_THIS(a) \
100 CR (a, \
101 EFI_IDE_CONTROLLER_PRIVATE_DATA, \
102 IdeInit, \
103 IDE_CONTROLLER_SIGNATURE \
104 )
105
106 //
107 // Driver binding functions declaration
108 //
109 EFI_STATUS
110 EFIAPI
111 IdeControllerSupported (
112 IN EFI_DRIVER_BINDING_PROTOCOL *This,
113 IN EFI_HANDLE Controller,
114 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
115 )
116 /*++
117
118 Routine Description:
119
120 Register Driver Binding protocol for this driver.
121
122 Arguments:
123
124 This -- a pointer points to the Binding Protocol instance
125 Controller -- The handle of controller to be tested.
126 *RemainingDevicePath -- A pointer to the device path. Ignored by device
127 driver but used by bus driver
128
129 Returns:
130
131 EFI_SUCCESS -- Driver loaded.
132 other -- Driver not loaded.
133 --*/
134 ;
135
136 EFI_STATUS
137 EFIAPI
138 IdeControllerStart (
139 IN EFI_DRIVER_BINDING_PROTOCOL *This,
140 IN EFI_HANDLE Controller,
141 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
142 )
143 /*++
144
145 Routine Description:
146
147 This routine is called right after the .Supported() called and return
148 EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
149 are closed.
150
151 Arguments:
152
153 This -- a pointer points to the Binding Protocol instance
154 Controller -- The handle of controller to be tested. Parameter
155 passed by the caller
156 *RemainingDevicePath -- A pointer to the device path. Should be ignored by
157 device driver
158 --*/
159 ;
160
161 EFI_STATUS
162 EFIAPI
163 IdeControllerStop (
164 IN EFI_DRIVER_BINDING_PROTOCOL *This,
165 IN EFI_HANDLE Controller,
166 IN UINTN NumberOfChildren,
167 IN EFI_HANDLE *ChildHandleBuffer
168 )
169 /*++
170
171 Routine Description:
172 Stop this driver on Controller Handle.
173
174 Arguments:
175 This - Protocol instance pointer.
176 Controller - Handle of device to stop driver on
177 NumberOfChildren - Not used
178 ChildHandleBuffer - Not used
179
180 Returns:
181 EFI_SUCCESS - This driver is removed DeviceHandle
182 other - This driver was not removed from this device
183
184 --*/
185 ;
186
187 //
188 // IDE controller init functions declaration
189 //
190 EFI_STATUS
191 EFIAPI
192 IdeInitGetChannelInfo (
193 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
194 IN UINT8 Channel,
195 OUT BOOLEAN *Enabled,
196 OUT UINT8 *MaxDevices
197 )
198 /*++
199
200 Routine Description:
201
202 TODO: Add function description
203
204 Arguments:
205
206 This - TODO: add argument description
207 Channel - TODO: add argument description
208 Enabled - TODO: add argument description
209 MaxDevices - TODO: add argument description
210
211 Returns:
212
213 TODO: add return values
214
215 --*/
216 ;
217
218 EFI_STATUS
219 EFIAPI
220 IdeInitNotifyPhase (
221 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
222 IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
223 OUT UINT8 Channel
224 )
225 /*++
226
227 Routine Description:
228
229 TODO: Add function description
230
231 Arguments:
232
233 This - TODO: add argument description
234 Phase - TODO: add argument description
235 Channel - TODO: add argument description
236
237 Returns:
238
239 TODO: add return values
240
241 --*/
242 ;
243
244 EFI_STATUS
245 EFIAPI
246 IdeInitSubmitData (
247 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
248 IN UINT8 Channel,
249 IN UINT8 Device,
250 IN EFI_IDENTIFY_DATA *IdentifyData
251 )
252 /*++
253
254 Routine Description:
255
256 TODO: Add function description
257
258 Arguments:
259
260 This - TODO: add argument description
261 Channel - TODO: add argument description
262 Device - TODO: add argument description
263 IdentifyData - TODO: add argument description
264
265 Returns:
266
267 TODO: add return values
268
269 --*/
270 ;
271
272 EFI_STATUS
273 EFIAPI
274 IdeInitSubmitFailingModes (
275 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
276 IN UINT8 Channel,
277 IN UINT8 Device
278 )
279 /*++
280
281 Routine Description:
282
283 TODO: Add function description
284
285 Arguments:
286
287 This - TODO: add argument description
288 Channel - TODO: add argument description
289 Device - TODO: add argument description
290
291 Returns:
292
293 TODO: add return values
294
295 --*/
296 ;
297
298 EFI_STATUS
299 EFIAPI
300 IdeInitDisqualifyMode (
301 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
302 IN UINT8 Channel,
303 IN UINT8 Device,
304 IN EFI_ATA_COLLECTIVE_MODE *BadModes
305 )
306 /*++
307
308 Routine Description:
309
310 TODO: Add function description
311
312 Arguments:
313
314 This - TODO: add argument description
315 Channel - TODO: add argument description
316 Device - TODO: add argument description
317 BadModes - TODO: add argument description
318
319 Returns:
320
321 TODO: add return values
322
323 --*/
324 ;
325
326 EFI_STATUS
327 EFIAPI
328 IdeInitCalculateMode (
329 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
330 IN UINT8 Channel,
331 IN UINT8 Device,
332 IN EFI_ATA_COLLECTIVE_MODE **SupportedModes
333 )
334 /*++
335
336 Routine Description:
337
338 TODO: Add function description
339
340 Arguments:
341
342 This - TODO: add argument description
343 Channel - TODO: add argument description
344 Device - TODO: add argument description
345 SupportedModes - TODO: add argument description
346
347 Returns:
348
349 TODO: add return values
350
351 --*/
352 ;
353
354 EFI_STATUS
355 EFIAPI
356 IdeInitSetTiming (
357 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
358 IN UINT8 Channel,
359 IN UINT8 Device,
360 IN EFI_ATA_COLLECTIVE_MODE *Modes
361 )
362 /*++
363
364 Routine Description:
365
366 TODO: Add function description
367
368 Arguments:
369
370 This - TODO: add argument description
371 Channel - TODO: add argument description
372 Device - TODO: add argument description
373 Modes - TODO: add argument description
374
375 Returns:
376
377 TODO: add return values
378
379 --*/
380 ;
381
382 #endif