]> git.proxmox.com Git - mirror_edk2.git/blob - PcAtChipsetPkg/Bus/Pci/IdeControllerDxe/IdeController.h
Refine function comment to follow doxygen format.
[mirror_edk2.git] / PcAtChipsetPkg / Bus / Pci / IdeControllerDxe / IdeController.h
1 /** @file
2 Header file for IDE controller driver.
3
4 Copyright (c) 2008 - 2010, 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 _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 //
35 extern EFI_DRIVER_BINDING_PROTOCOL gIdeControllerDriverBinding;
36 extern EFI_COMPONENT_NAME_PROTOCOL gIdeControllerComponentName;
37 extern 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 //
52 /**
53 Register Driver Binding protocol for this driver.
54
55 @param This A pointer points to the Binding Protocol instance
56 @param Controller The handle of controller to be tested.
57 @param RemainingDevicePath A pointer to the device path. Ignored by device
58 driver but used by bus driver
59
60 @retval EFI_SUCCESS Driver loaded.
61 @retval !EFI_SUCESS Driver not loaded.
62 **/
63 EFI_STATUS
64 EFIAPI
65 IdeControllerSupported (
66 IN EFI_DRIVER_BINDING_PROTOCOL *This,
67 IN EFI_HANDLE Controller,
68 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
69 )
70 ;
71
72 /**
73 This routine is called right after the .Supported() called and return
74 EFI_SUCCESS. Notes: The supported protocols are checked but the Protocols
75 are closed.
76
77 @param This A pointer points to the Binding Protocol instance
78 @param Controller The handle of controller to be tested. Parameter
79 passed by the caller
80 @param RemainingDevicePath A pointer to the device path. Should be ignored by
81 device driver
82
83 @return EFI_STATUS Status of InstallMultipleProtocolInterfaces()
84 **/
85 EFI_STATUS
86 EFIAPI
87 IdeControllerStart (
88 IN EFI_DRIVER_BINDING_PROTOCOL *This,
89 IN EFI_HANDLE Controller,
90 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
91 )
92 ;
93
94 /**
95 Stop this driver on Controller Handle.
96
97 @param This Protocol instance pointer.
98 @param Controller Handle of device to stop driver on
99 @param NumberOfChildren Not used
100 @param ChildHandleBuffer Not used
101
102 @retval EFI_SUCESS This driver is removed DeviceHandle
103 @retval !EFI_SUCCESS This driver was not removed from this device
104 **/
105 EFI_STATUS
106 EFIAPI
107 IdeControllerStop (
108 IN EFI_DRIVER_BINDING_PROTOCOL *This,
109 IN EFI_HANDLE Controller,
110 IN UINTN NumberOfChildren,
111 IN EFI_HANDLE *ChildHandleBuffer
112 )
113 ;
114
115 //
116 // IDE controller init functions declaration
117 //
118 /**
119 This function can be used to obtain information about a specified channel.
120 It's usually used by IDE Bus driver during enumeration process.
121
122 @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
123 @param Channel Channel number (0 based, either 0 or 1)
124 @param Enabled TRUE if the channel is enabled. If the channel is disabled,
125 then it will no be enumerated.
126 @param MaxDevices The Max number of IDE devices that the bus driver can expect
127 on this channel. For ATA/ATAPI, this number is either 1 or 2.
128
129 @retval EFI_SUCCESS Success to get channel information
130 @retval EFI_INVALID_PARAMETER Invalid channel id.
131 **/
132 EFI_STATUS
133 EFIAPI
134 IdeInitGetChannelInfo (
135 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
136 IN UINT8 Channel,
137 OUT BOOLEAN *Enabled,
138 OUT UINT8 *MaxDevices
139 )
140 ;
141
142 /**
143 This function is called by IdeBus driver before executing certain actions.
144 This allows IDE Controller Init to prepare for each action.
145
146 @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
147 @param Phase phase indicator defined by IDE_CONTROLLER_INIT protocol
148 @param Channel Channel number (0 based, either 0 or 1)
149
150 @return EFI_SUCCESS Success operation.
151 **/
152 EFI_STATUS
153 EFIAPI
154 IdeInitNotifyPhase (
155 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
156 IN EFI_IDE_CONTROLLER_ENUM_PHASE Phase,
157 OUT UINT8 Channel
158 )
159 ;
160
161 /**
162 This function is called by IdeBus driver to submit EFI_IDENTIFY_DATA data structure
163 obtained from IDE deivce. This structure is used to set IDE timing
164
165 @param This The EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
166 @param Channel IDE channel number (0 based, either 0 or 1)
167 @param Device IDE device number
168 @param IdentifyData A pointer to EFI_IDENTIFY_DATA data structure
169
170 @return EFI_SUCCESS Success operation.
171 **/
172 EFI_STATUS
173 EFIAPI
174 IdeInitSubmitData (
175 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
176 IN UINT8 Channel,
177 IN UINT8 Device,
178 IN EFI_IDENTIFY_DATA *IdentifyData
179 )
180 ;
181
182 /**
183 This function is called by IdeBus driver to disqualify unsupported operation
184 mode on specfic IDE device
185
186 @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
187 @param Channel IDE channel number (0 based, either 0 or 1)
188 @param Device IDE device number
189 @param BadModes Operation mode indicator
190
191 @return EFI_SUCCESS Success operation.
192 **/
193 EFI_STATUS
194 EFIAPI
195 IdeInitDisqualifyMode (
196 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
197 IN UINT8 Channel,
198 IN UINT8 Device,
199 IN EFI_ATA_COLLECTIVE_MODE *BadModes
200 )
201 ;
202
203 /**
204 This function is called by IdeBus driver to calculate the best operation mode
205 supported by specific IDE device
206
207 @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
208 @param Channel IDE channel number (0 based, either 0 or 1)
209 @param Device IDE device number
210 @param SupportedModes Modes collection supported by IDE device
211
212 @retval EFI_OUT_OF_RESOURCES Fail to allocate pool.
213 @retval EFI_INVALID_PARAMETER Invalid channel id and device id.
214 **/
215 EFI_STATUS
216 EFIAPI
217 IdeInitCalculateMode (
218 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
219 IN UINT8 Channel,
220 IN UINT8 Device,
221 IN EFI_ATA_COLLECTIVE_MODE **SupportedModes
222 )
223 ;
224
225 /**
226 This function is called by IdeBus driver to set appropriate timing on IDE
227 controller according supported operation mode.
228
229 @param This the EFI_IDE_CONTROLLER_INIT_PROTOCOL instance.
230 @param Channel IDE channel number (0 based, either 0 or 1)
231 @param Device IDE device number
232 @param Modes IDE device modes
233
234 @retval EFI_SUCCESS Sucess operation.
235 **/
236 EFI_STATUS
237 EFIAPI
238 IdeInitSetTiming (
239 IN EFI_IDE_CONTROLLER_INIT_PROTOCOL *This,
240 IN UINT8 Channel,
241 IN UINT8 Device,
242 IN EFI_ATA_COLLECTIVE_MODE *Modes
243 )
244 ;
245
246 //
247 // Forward reference declaration
248 //
249 /**
250 Retrieves a Unicode string that is the user readable name of the EFI Driver.
251
252 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
253 @param Language A pointer to a three character ISO 639-2 language identifier.
254 This is the language of the driver name that that the caller
255 is requesting, and it must match one of the languages specified
256 in SupportedLanguages. The number of languages supported by a
257 driver is up to the driver writer.
258 @param DriverName A pointer to the Unicode string to return. This Unicode string
259 is the name of the driver specified by This in the language
260 specified by Language.
261
262 @retval EFI_SUCCESS The Unicode string for the Driver specified by This
263 and the language specified by Language was returned
264 in DriverName.
265 @retval EFI_INVALID_PARAMETER Language is NULL.
266 @retval EFI_INVALID_PARAMETER DriverName is NULL.
267 @retval EFI_UNSUPPORTED The driver specified by This does not support the
268 language specified by Language.
269 **/
270 EFI_STATUS
271 EFIAPI
272 IdeControllerComponentNameGetDriverName (
273 IN EFI_COMPONENT_NAME_PROTOCOL *This,
274 IN CHAR8 *Language,
275 OUT CHAR16 **DriverName
276 )
277 ;
278
279 /**
280 Retrieves a Unicode string that is the user readable name of the controller
281 that is being managed by an EFI Driver.
282
283 @param This A pointer to the EFI_COMPONENT_NAME_PROTOCOL instance.
284 @param ControllerHandle The handle of a controller that the driver specified by
285 This is managing. This handle specifies the controller
286 whose name is to be returned.
287 @param OPTIONAL The handle of the child controller to retrieve the name
288 of. This is an optional parameter that may be NULL. It
289 will be NULL for device drivers. It will also be NULL
290 for a bus drivers that wish to retrieve the name of the
291 bus controller. It will not be NULL for a bus driver
292 that wishes to retrieve the name of a child controller.
293 @param Language A pointer to a three character ISO 639-2 language
294 identifier. This is the language of the controller name
295 that that the caller is requesting, and it must match one
296 of the languages specified in SupportedLanguages. The
297 number of languages supported by a driver is up to the
298 driver writer.
299 @param ControllerName A pointer to the Unicode string to return. This Unicode
300 string is the name of the controller specified by
301 ControllerHandle and ChildHandle in the language
302 specified by Language from the point of view of the
303 driver specified by This.
304
305 @retval EFI_SUCCESS The Unicode string for the user readable name in the
306 language specified by Language for the driver
307 specified by This was returned in DriverName.
308 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
309 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
310 EFI_HANDLE.
311 @retval EFI_INVALID_PARAMETER Language is NULL.
312 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
313 @retval EFI_UNSUPPORTED The driver specified by This is not currently
314 managing the controller specified by
315 ControllerHandle and ChildHandle.
316 @retval EFI_UNSUPPORTED The driver specified by This does not support the
317 language specified by Language.
318 **/
319 EFI_STATUS
320 EFIAPI
321 IdeControllerComponentNameGetControllerName (
322 IN EFI_COMPONENT_NAME_PROTOCOL *This,
323 IN EFI_HANDLE ControllerHandle,
324 IN EFI_HANDLE ChildHandle OPTIONAL,
325 IN CHAR8 *Language,
326 OUT CHAR16 **ControllerName
327 )
328 ;
329
330 #endif