IdeController.h revision a495774f6982581e9591fe9995f2e0a4bf1854fa
1/** @file
2  Header file for IDE controller driver.
3
4  Copyright (c) 2008 Intel Corporation. <BR>
5  All rights reserved. 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 _IDE_CONTROLLER_H
16#define _IDE_CONTROLLER_H
17
18#include <Uefi.h>
19#include <Protocol/ComponentName.h>
20#include <Protocol/DriverBinding.h>
21#include <Protocol/PciIo.h>
22#include <Protocol/IdeControllerInit.h>
23#include <Library/UefiDriverEntryPoint.h>
24#include <Library/DebugLib.h>
25#include <Library/UefiLib.h>
26#include <Library/BaseLib.h>
27#include <Library/BaseMemoryLib.h>
28#include <Library/MemoryAllocationLib.h>
29#include <Library/UefiBootServicesTableLib.h>
30#include <IndustryStandard/Pci.h>
31
32//
33// Global Variables definitions
34//
35extern EFI_DRIVER_BINDING_PROTOCOL  gIdeControllerDriverBinding;
36extern EFI_COMPONENT_NAME_PROTOCOL  gIdeControllerComponentName;
37extern EFI_COMPONENT_NAME2_PROTOCOL gIdeControllerComponentName2;
38
39//
40// Supports 2 channel max
41//
42#define ICH_IDE_MAX_CHANNEL 0x02
43//
44// Supports 2 devices max
45//
46#define ICH_IDE_MAX_DEVICES 0x02
47#define ICH_IDE_ENUMER_ALL  FALSE
48
49//
50// Driver binding functions declaration
51//
52EFI_STATUS
53EFIAPI
54IdeControllerSupported (
55  IN EFI_DRIVER_BINDING_PROTOCOL       *This,
56  IN EFI_HANDLE                        Controller,
57  IN EFI_DEVICE_PATH_PROTOCOL          *RemainingDevicePath
58  )
59/*++
60
61  Routine Description:
62
63  Register Driver Binding protocol for this driver.
64
65  Arguments:
66
67    This                 -- a pointer points to the Binding Protocol instance
68    Controller           -- The handle of controller to be tested.
69    *RemainingDevicePath -- A pointer to the device path. Ignored by device
70                            driver but used by bus driver
71
72  Returns:
73
74    EFI_SUCCESS          -- Driver loaded.
75    other                -- Driver not loaded.
76--*/
77;
78
79EFI_STATUS
80EFIAPI
81IdeControllerStart (
82  IN EFI_DRIVER_BINDING_PROTOCOL        *This,
83  IN EFI_HANDLE                         Controller,
84  IN EFI_DEVICE_PATH_PROTOCOL           *RemainingDevicePath
85  )
86/*++
87
88  Routine Description:
89
90    This routine is called right after the .Supported() called and return
91    EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
92    are closed.
93
94  Arguments:
95
96    This                 -- a pointer points to the Binding Protocol instance
97    Controller           -- The handle of controller to be tested. Parameter
98                            passed by the caller
99    *RemainingDevicePath -- A pointer to the device path. Should be ignored by
100                            device driver
101--*/
102;
103
104EFI_STATUS
105EFIAPI
106IdeControllerStop (
107  IN  EFI_DRIVER_BINDING_PROTOCOL       *This,
108  IN  EFI_HANDLE                        Controller,
109  IN  UINTN                             NumberOfChildren,
110  IN  EFI_HANDLE                        *ChildHandleBuffer
111  )
112/*++
113
114  Routine Description:
115    Stop this driver on Controller Handle.
116
117  Arguments:
118    This              - Protocol instance pointer.
119    Controller        - Handle of device to stop driver on
120    NumberOfChildren  - Not used
121    ChildHandleBuffer - Not used
122
123  Returns:
124    EFI_SUCCESS       - This driver is removed DeviceHandle
125    other             - This driver was not removed from this device
126
127--*/
128;
129
130//
131// IDE controller init functions declaration
132//
133EFI_STATUS
134EFIAPI
135IdeInitGetChannelInfo (
136  IN   EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
137  IN   UINT8                            Channel,
138  OUT  BOOLEAN                          *Enabled,
139  OUT  UINT8                            *MaxDevices
140  )
141/*++
142
143Routine Description:
144
145  TODO: Add function description
146
147Arguments:
148
149  This        - TODO: add argument description
150  Channel     - TODO: add argument description
151  Enabled     - TODO: add argument description
152  MaxDevices  - TODO: add argument description
153
154Returns:
155
156  TODO: add return values
157
158--*/
159;
160
161EFI_STATUS
162EFIAPI
163IdeInitNotifyPhase (
164  IN  EFI_IDE_CONTROLLER_INIT_PROTOCOL  *This,
165  IN  EFI_IDE_CONTROLLER_ENUM_PHASE     Phase,
166  OUT UINT8                             Channel
167  )
168/*++
169
170Routine Description:
171
172  TODO: Add function description
173
174Arguments:
175
176  This    - TODO: add argument description
177  Phase   - TODO: add argument description
178  Channel - TODO: add argument description
179
180Returns:
181
182  TODO: add return values
183
184--*/
185;
186
187EFI_STATUS
188EFIAPI
189IdeInitSubmitData (
190  IN  EFI_IDE_CONTROLLER_INIT_PROTOCOL  *This,
191  IN  UINT8                             Channel,
192  IN  UINT8                             Device,
193  IN  EFI_IDENTIFY_DATA                 *IdentifyData
194  )
195/*++
196
197Routine Description:
198
199  TODO: Add function description
200
201Arguments:
202
203  This          - TODO: add argument description
204  Channel       - TODO: add argument description
205  Device        - TODO: add argument description
206  IdentifyData  - TODO: add argument description
207
208Returns:
209
210  TODO: add return values
211
212--*/
213;
214
215EFI_STATUS
216EFIAPI
217IdeInitSubmitFailingModes (
218  IN  EFI_IDE_CONTROLLER_INIT_PROTOCOL  *This,
219  IN  UINT8                             Channel,
220  IN  UINT8                             Device
221  )
222/*++
223
224Routine Description:
225
226  TODO: Add function description
227
228Arguments:
229
230  This    - TODO: add argument description
231  Channel - TODO: add argument description
232  Device  - TODO: add argument description
233
234Returns:
235
236  TODO: add return values
237
238--*/
239;
240
241EFI_STATUS
242EFIAPI
243IdeInitDisqualifyMode (
244  IN  EFI_IDE_CONTROLLER_INIT_PROTOCOL  *This,
245  IN  UINT8                             Channel,
246  IN  UINT8                             Device,
247  IN  EFI_ATA_COLLECTIVE_MODE           *BadModes
248  )
249/*++
250
251Routine Description:
252
253  TODO: Add function description
254
255Arguments:
256
257  This      - TODO: add argument description
258  Channel   - TODO: add argument description
259  Device    - TODO: add argument description
260  BadModes  - TODO: add argument description
261
262Returns:
263
264  TODO: add return values
265
266--*/
267;
268
269EFI_STATUS
270EFIAPI
271IdeInitCalculateMode (
272  IN  EFI_IDE_CONTROLLER_INIT_PROTOCOL  *This,
273  IN  UINT8                             Channel,
274  IN  UINT8                             Device,
275  IN  EFI_ATA_COLLECTIVE_MODE           **SupportedModes
276  )
277/*++
278
279Routine Description:
280
281  TODO: Add function description
282
283Arguments:
284
285  This            - TODO: add argument description
286  Channel         - TODO: add argument description
287  Device          - TODO: add argument description
288  SupportedModes  - TODO: add argument description
289
290Returns:
291
292  TODO: add return values
293
294--*/
295;
296
297EFI_STATUS
298EFIAPI
299IdeInitSetTiming (
300  IN  EFI_IDE_CONTROLLER_INIT_PROTOCOL  *This,
301  IN  UINT8                             Channel,
302  IN  UINT8                             Device,
303  IN  EFI_ATA_COLLECTIVE_MODE           *Modes
304  )
305/*++
306
307Routine Description:
308
309  TODO: Add function description
310
311Arguments:
312
313  This    - TODO: add argument description
314  Channel - TODO: add argument description
315  Device  - TODO: add argument description
316  Modes   - TODO: add argument description
317
318Returns:
319
320  TODO: add return values
321
322--*/
323;
324
325//
326// Forward reference declaration
327//
328EFI_STATUS
329EFIAPI
330IdeControllerComponentNameGetDriverName (
331  IN  EFI_COMPONENT_NAME_PROTOCOL  *This,
332  IN  CHAR8                        *Language,
333  OUT CHAR16                       **DriverName
334  )
335/*++
336
337  Routine Description:
338    Retrieves a Unicode string that is the user readable name of the EFI Driver.
339
340  Arguments:
341    This       - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
342    Language   - A pointer to a three character ISO 639-2 language identifier.
343                 This is the language of the driver name that that the caller
344                 is requesting, and it must match one of the languages specified
345                 in SupportedLanguages.  The number of languages supported by a
346                 driver is up to the driver writer.
347    DriverName - A pointer to the Unicode string to return.  This Unicode string
348                 is the name of the driver specified by This in the language
349                 specified by Language.
350
351  Returns:
352    EFI_SUCCESS           - The Unicode string for the Driver specified by This
353                            and the language specified by Language was returned
354                            in DriverName.
355    EFI_INVALID_PARAMETER - Language is NULL.
356    EFI_INVALID_PARAMETER - DriverName is NULL.
357    EFI_UNSUPPORTED       - The driver specified by This does not support the
358                            language specified by Language.
359
360--*/
361;
362
363EFI_STATUS
364EFIAPI
365IdeControllerComponentNameGetControllerName (
366  IN  EFI_COMPONENT_NAME_PROTOCOL                     *This,
367  IN  EFI_HANDLE                                      ControllerHandle,
368  IN  EFI_HANDLE                                      ChildHandle        OPTIONAL,
369  IN  CHAR8                                           *Language,
370  OUT CHAR16                                          **ControllerName
371  )
372/*++
373
374  Routine Description:
375    Retrieves a Unicode string that is the user readable name of the controller
376    that is being managed by an EFI Driver.
377
378  Arguments:
379    This             - A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
380    ControllerHandle - The handle of a controller that the driver specified by
381                       This is managing.  This handle specifies the controller
382                       whose name is to be returned.
383    ChildHandle      - The handle of the child controller to retrieve the name
384                       of.  This is an optional parameter that may be NULL.  It
385                       will be NULL for device drivers.  It will also be NULL
386                       for a bus drivers that wish to retrieve the name of the
387                       bus controller.  It will not be NULL for a bus driver
388                       that wishes to retrieve the name of a child controller.
389    Language         - A pointer to a three character ISO 639-2 language
390                       identifier.  This is the language of the controller name
391                       that that the caller is requesting, and it must match one
392                       of the languages specified in SupportedLanguages.  The
393                       number of languages supported by a driver is up to the
394                       driver writer.
395    ControllerName   - A pointer to the Unicode string to return.  This Unicode
396                       string is the name of the controller specified by
397                       ControllerHandle and ChildHandle in the language
398                       specified by Language from the point of view of the
399                       driver specified by This.
400
401  Returns:
402    EFI_SUCCESS           - The Unicode string for the user readable name in the
403                            language specified by Language for the driver
404                            specified by This was returned in DriverName.
405    EFI_INVALID_PARAMETER - ControllerHandle is not a valid EFI_HANDLE.
406    EFI_INVALID_PARAMETER - ChildHandle is not NULL and it is not a valid
407                            EFI_HANDLE.
408    EFI_INVALID_PARAMETER - Language is NULL.
409    EFI_INVALID_PARAMETER - ControllerName is NULL.
410    EFI_UNSUPPORTED       - The driver specified by This is not currently
411                            managing the controller specified by
412                            ControllerHandle and ChildHandle.
413    EFI_UNSUPPORTED       - The driver specified by This does not support the
414                            language specified by Language.
415
416--*/
417;
418
419#endif
420