]>
Commit | Line | Data |
---|---|---|
ad86a50a | 1 | /** @file\r |
2 | Master header file for ATA Bus Driver.\r | |
3 | \r | |
4 | This file defines common data structures, macro definitions and some module\r | |
5 | internal function header files.\r | |
6 | \r | |
e519983a | 7 | Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r |
cd5ebaa0 | 8 | This program and the accompanying materials\r |
ad86a50a | 9 | are licensed and made available under the terms and conditions of the BSD License\r |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
12 | \r | |
13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | \r | |
18 | #ifndef _ATA_BUS_H_\r | |
19 | #define _ATA_BUS_H_\r | |
20 | \r | |
09ba0c46 | 21 | #include <Uefi.h>\r |
ad86a50a | 22 | \r |
23 | #include <Protocol/AtaPassThru.h>\r | |
24 | #include <Protocol/BlockIo.h>\r | |
25 | #include <Protocol/DiskInfo.h>\r | |
26 | #include <Protocol/DevicePath.h>\r | |
ad86a50a | 27 | \r |
28 | #include <Library/DebugLib.h>\r | |
29 | #include <Library/UefiDriverEntryPoint.h>\r | |
30 | #include <Library/BaseLib.h>\r | |
31 | #include <Library/UefiLib.h>\r | |
32 | #include <Library/BaseMemoryLib.h>\r | |
33 | #include <Library/MemoryAllocationLib.h>\r | |
34 | #include <Library/UefiBootServicesTableLib.h>\r | |
35 | #include <Library/DevicePathLib.h>\r | |
36 | \r | |
37 | #include <IndustryStandard/Atapi.h>\r | |
38 | \r | |
39 | //\r | |
40 | // Time out value for ATA pass through protocol\r | |
41 | //\r | |
e519983a | 42 | #define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)\r |
ad86a50a | 43 | \r |
44 | //\r | |
45 | // Maximum number of times to retry ATA command\r | |
46 | //\r | |
47 | #define MAX_RETRY_TIMES 3\r | |
48 | \r | |
49 | //\r | |
50 | // The maximum total sectors count in 28 bit addressing mode\r | |
51 | //\r | |
52 | #define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff\r | |
53 | \r | |
54 | //\r | |
55 | // The maximum ATA transaction sector count in 28 bit addressing mode. \r | |
56 | //\r | |
57 | #define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100\r | |
58 | \r | |
59 | //\r | |
60 | // The maximum ATA transaction sector count in 48 bit addressing mode. \r | |
61 | //\r | |
62 | #define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000\r | |
63 | \r | |
64 | //\r | |
65 | // The maximum model name in ATA identify data \r | |
66 | //\r | |
67 | #define MAX_MODEL_NAME_LEN 40\r | |
68 | \r | |
69 | \r | |
70 | //\r | |
71 | // ATA bus data structure for ATA controller\r | |
72 | //\r | |
73 | typedef struct {\r | |
74 | EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;\r | |
75 | EFI_HANDLE Controller;\r | |
76 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r | |
77 | EFI_HANDLE DriverBindingHandle;\r | |
78 | } ATA_BUS_DRIVER_DATA;\r | |
79 | \r | |
80 | #define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')\r | |
81 | \r | |
82 | //\r | |
83 | // ATA device data structure for each child device\r | |
84 | //\r | |
85 | typedef struct {\r | |
86 | UINT32 Signature;\r | |
87 | \r | |
88 | EFI_HANDLE Handle;\r | |
89 | EFI_BLOCK_IO_PROTOCOL BlockIo;\r | |
90 | EFI_BLOCK_IO_MEDIA BlockMedia;\r | |
91 | EFI_DISK_INFO_PROTOCOL DiskInfo;\r | |
92 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
93 | \r | |
94 | ATA_BUS_DRIVER_DATA *AtaBusDriverData;\r | |
95 | UINT16 Port;\r | |
96 | UINT16 PortMultiplierPort;\r | |
97 | \r | |
98 | //\r | |
99 | // Buffer for the execution of ATA pass through protocol\r | |
100 | //\r | |
101 | EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r | |
102 | EFI_ATA_COMMAND_BLOCK Acb;\r | |
103 | EFI_ATA_STATUS_BLOCK *Asb;\r | |
104 | \r | |
105 | BOOLEAN UdmaValid;\r | |
106 | BOOLEAN Lba48Bit;\r | |
107 | \r | |
108 | //\r | |
109 | // Cached data for ATA identify data\r | |
110 | //\r | |
6ea8e37b | 111 | ATA_IDENTIFY_DATA *IdentifyData;\r |
ad86a50a | 112 | \r |
113 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r | |
114 | CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];\r | |
115 | \r | |
116 | } ATA_DEVICE;\r | |
117 | \r | |
118 | #define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)\r | |
119 | #define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)\r | |
120 | \r | |
121 | //\r | |
122 | // Global Variables\r | |
123 | //\r | |
124 | extern EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding;\r | |
125 | extern EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName;\r | |
126 | extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;\r | |
127 | \r | |
128 | \r | |
129 | /**\r | |
130 | Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().\r | |
131 | \r | |
132 | This function wraps the ResetDevice() invocation for ATA pass through function\r | |
133 | for an ATA device. \r | |
134 | \r | |
135 | @param AtaDevice The ATA child device involved for the operation.\r | |
136 | \r | |
137 | @return The return status from EFI_ATA_PASS_THRU_PROTOCOL.PassThru().\r | |
138 | \r | |
139 | **/\r | |
140 | EFI_STATUS\r | |
141 | ResetAtaDevice (\r | |
142 | IN ATA_DEVICE *AtaDevice\r | |
143 | );\r | |
144 | \r | |
145 | \r | |
146 | /**\r | |
147 | Discovers whether it is a valid ATA device.\r | |
148 | \r | |
149 | This function issues ATA_CMD_IDENTIFY_DRIVE command to the ATA device to identify it.\r | |
150 | If the command is executed successfully, it then identifies it and initializes\r | |
151 | the Media information in Block IO protocol interface.\r | |
152 | \r | |
153 | @param AtaDevice The ATA child device involved for the operation.\r | |
154 | \r | |
155 | @retval EFI_SUCCESS The device is successfully identified and Media information\r | |
156 | is correctly initialized.\r | |
157 | @return others Some error occurs when discovering the ATA device. \r | |
158 | \r | |
159 | **/\r | |
160 | EFI_STATUS\r | |
161 | DiscoverAtaDevice (\r | |
162 | IN OUT ATA_DEVICE *AtaDevice\r | |
163 | );\r | |
164 | \r | |
165 | \r | |
166 | /**\r | |
167 | Read or write a number of blocks from ATA device.\r | |
168 | \r | |
169 | This function performs ATA pass through transactions to read/write data from/to\r | |
170 | ATA device. It may separate the read/write request into several ATA pass through\r | |
171 | transactions.\r | |
172 | \r | |
173 | @param AtaDevice The ATA child device involved for the operation.\r | |
174 | @param Buffer The pointer to the current transaction buffer.\r | |
175 | @param StartLba The starting logical block address to be accessed.\r | |
176 | @param NumberOfBlocks The block number or sector count of the transfer.\r | |
177 | @param IsWrite Indicates whether it is a write operation.\r | |
178 | \r | |
179 | @retval EFI_SUCCESS The data transfer is complete successfully.\r | |
180 | @return others Some error occurs when transferring data. \r | |
181 | \r | |
182 | **/\r | |
183 | EFI_STATUS \r | |
184 | AccessAtaDevice(\r | |
185 | IN OUT ATA_DEVICE *AtaDevice,\r | |
186 | IN OUT UINT8 *Buffer,\r | |
187 | IN EFI_LBA StartLba,\r | |
188 | IN UINTN NumberOfBlocks,\r | |
189 | IN BOOLEAN IsWrite\r | |
190 | );\r | |
191 | \r | |
192 | //\r | |
193 | // Protocol interface prototypes\r | |
194 | //\r | |
195 | /**\r | |
196 | Tests to see if this driver supports a given controller. If a child device is provided, \r | |
197 | it further tests to see if this driver supports creating a handle for the specified child device.\r | |
198 | \r | |
199 | This function checks to see if the driver specified by This supports the device specified by \r | |
200 | ControllerHandle. Drivers will typically use the device path attached to \r | |
201 | ControllerHandle and/or the services from the bus I/O abstraction attached to \r | |
202 | ControllerHandle to determine if the driver supports ControllerHandle. This function \r | |
203 | may be called many times during platform initialization. In order to reduce boot times, the tests \r | |
204 | performed by this function must be very small, and take as little time as possible to execute. This \r | |
205 | function must not change the state of any hardware devices, and this function must be aware that the \r | |
206 | device specified by ControllerHandle may already be managed by the same driver or a \r | |
207 | different driver. This function must match its calls to AllocatePages() with FreePages(), \r | |
208 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol(). \r | |
209 | Since ControllerHandle may have been previously started by the same driver, if a protocol is \r | |
210 | already in the opened state, then it must not be closed with CloseProtocol(). This is required \r | |
211 | to guarantee the state of ControllerHandle is not modified by this function.\r | |
212 | \r | |
213 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
214 | @param[in] ControllerHandle The handle of the controller to test. This handle \r | |
215 | must support a protocol interface that supplies \r | |
216 | an I/O abstraction to the driver.\r | |
217 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r | |
218 | parameter is ignored by device drivers, and is optional for bus \r | |
219 | drivers. For bus drivers, if this parameter is not NULL, then \r | |
220 | the bus driver must determine if the bus controller specified \r | |
221 | by ControllerHandle and the child controller specified \r | |
222 | by RemainingDevicePath are both supported by this \r | |
223 | bus driver.\r | |
224 | \r | |
225 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
226 | RemainingDevicePath is supported by the driver specified by This.\r | |
227 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
228 | RemainingDevicePath is already being managed by the driver\r | |
229 | specified by This.\r | |
230 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
231 | RemainingDevicePath is already being managed by a different\r | |
232 | driver or an application that requires exclusive access.\r | |
233 | Currently not implemented.\r | |
234 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
235 | RemainingDevicePath is not supported by the driver specified by This.\r | |
236 | **/\r | |
237 | EFI_STATUS\r | |
238 | EFIAPI\r | |
239 | AtaBusDriverBindingSupported (\r | |
240 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
241 | IN EFI_HANDLE Controller,\r | |
242 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
243 | );\r | |
244 | \r | |
245 | /**\r | |
246 | Starts a device controller or a bus controller.\r | |
247 | \r | |
248 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
249 | As a result, much of the error checking on the parameters to Start() has been moved into this \r | |
250 | common boot service. It is legal to call Start() from other locations, \r | |
251 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r | |
252 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
253 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r | |
254 | EFI_DEVICE_PATH_PROTOCOL.\r | |
255 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r | |
256 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS. \r | |
257 | \r | |
258 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
259 | @param[in] ControllerHandle The handle of the controller to start. This handle \r | |
260 | must support a protocol interface that supplies \r | |
261 | an I/O abstraction to the driver.\r | |
262 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This \r | |
263 | parameter is ignored by device drivers, and is optional for bus \r | |
264 | drivers. For a bus driver, if this parameter is NULL, then handles \r | |
265 | for all the children of Controller are created by this driver. \r | |
266 | If this parameter is not NULL and the first Device Path Node is \r | |
267 | not the End of Device Path Node, then only the handle for the \r | |
268 | child device specified by the first Device Path Node of \r | |
269 | RemainingDevicePath is created by this driver.\r | |
270 | If the first Device Path Node of RemainingDevicePath is \r | |
271 | the End of Device Path Node, no child handle is created by this\r | |
272 | driver.\r | |
273 | \r | |
274 | @retval EFI_SUCCESS The device was started.\r | |
275 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
276 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
277 | @retval Others The driver failded to start the device.\r | |
278 | \r | |
279 | **/\r | |
280 | EFI_STATUS\r | |
281 | EFIAPI\r | |
282 | AtaBusDriverBindingStart (\r | |
283 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
284 | IN EFI_HANDLE Controller,\r | |
285 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
286 | );\r | |
287 | \r | |
288 | /**\r | |
289 | Stops a device controller or a bus controller.\r | |
290 | \r | |
291 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController(). \r | |
292 | As a result, much of the error checking on the parameters to Stop() has been moved \r | |
293 | into this common boot service. It is legal to call Stop() from other locations, \r | |
294 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r | |
295 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
296 | same driver's Start() function.\r | |
297 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
298 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
299 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
300 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
301 | \r | |
302 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
303 | @param[in] ControllerHandle A handle to the device being stopped. The handle must \r | |
304 | support a bus specific I/O protocol for the driver \r | |
305 | to use to stop the device.\r | |
306 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
307 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL \r | |
308 | if NumberOfChildren is 0.\r | |
309 | \r | |
310 | @retval EFI_SUCCESS The device was stopped.\r | |
311 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
312 | \r | |
313 | **/\r | |
314 | EFI_STATUS\r | |
315 | EFIAPI\r | |
316 | AtaBusDriverBindingStop (\r | |
317 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
318 | IN EFI_HANDLE Controller,\r | |
319 | IN UINTN NumberOfChildren,\r | |
320 | IN EFI_HANDLE *ChildHandleBuffer\r | |
321 | );\r | |
322 | \r | |
323 | \r | |
324 | /**\r | |
325 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
326 | \r | |
327 | This function retrieves the user readable name of a driver in the form of a\r | |
328 | Unicode string. If the driver specified by This has a user readable name in\r | |
329 | the language specified by Language, then a pointer to the driver name is\r | |
330 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
331 | by This does not support the language specified by Language,\r | |
332 | then EFI_UNSUPPORTED is returned.\r | |
333 | \r | |
334 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
335 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
336 | \r | |
337 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
338 | array indicating the language. This is the\r | |
339 | language of the driver name that the caller is\r | |
340 | requesting, and it must match one of the\r | |
341 | languages specified in SupportedLanguages. The\r | |
342 | number of languages supported by a driver is up\r | |
343 | to the driver writer. Language is specified\r | |
344 | in RFC 4646 or ISO 639-2 language code format.\r | |
345 | \r | |
346 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
347 | This Unicode string is the name of the\r | |
348 | driver specified by This in the language\r | |
349 | specified by Language.\r | |
350 | \r | |
351 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
352 | This and the language specified by Language was\r | |
353 | returned in DriverName.\r | |
354 | \r | |
355 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
356 | \r | |
357 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
358 | \r | |
359 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
360 | the language specified by Language.\r | |
361 | \r | |
362 | **/\r | |
363 | EFI_STATUS\r | |
364 | EFIAPI\r | |
365 | AtaBusComponentNameGetDriverName (\r | |
366 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
367 | IN CHAR8 *Language,\r | |
368 | OUT CHAR16 **DriverName\r | |
369 | );\r | |
370 | \r | |
371 | \r | |
372 | /**\r | |
373 | Retrieves a Unicode string that is the user readable name of the controller\r | |
374 | that is being managed by a driver.\r | |
375 | \r | |
376 | This function retrieves the user readable name of the controller specified by\r | |
377 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
378 | driver specified by This has a user readable name in the language specified by\r | |
379 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
380 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
381 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
382 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
383 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
384 | \r | |
385 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
386 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
387 | \r | |
388 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
389 | specified by This is managing. This handle\r | |
390 | specifies the controller whose name is to be\r | |
391 | returned.\r | |
392 | \r | |
393 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
394 | the name of. This is an optional parameter that\r | |
395 | may be NULL. It will be NULL for device\r | |
396 | drivers. It will also be NULL for a bus drivers\r | |
397 | that wish to retrieve the name of the bus\r | |
398 | controller. It will not be NULL for a bus\r | |
399 | driver that wishes to retrieve the name of a\r | |
400 | child controller.\r | |
401 | \r | |
402 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
403 | array indicating the language. This is the\r | |
404 | language of the driver name that the caller is\r | |
405 | requesting, and it must match one of the\r | |
406 | languages specified in SupportedLanguages. The\r | |
407 | number of languages supported by a driver is up\r | |
408 | to the driver writer. Language is specified in\r | |
409 | RFC 4646 or ISO 639-2 language code format.\r | |
410 | \r | |
411 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
412 | This Unicode string is the name of the\r | |
413 | controller specified by ControllerHandle and\r | |
414 | ChildHandle in the language specified by\r | |
415 | Language from the point of view of the driver\r | |
416 | specified by This.\r | |
417 | \r | |
418 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
419 | the language specified by Language for the\r | |
420 | driver specified by This was returned in\r | |
421 | DriverName.\r | |
422 | \r | |
423 | @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.\r | |
424 | \r | |
425 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
426 | EFI_HANDLE.\r | |
427 | \r | |
428 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
429 | \r | |
430 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
431 | \r | |
432 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
433 | managing the controller specified by\r | |
434 | ControllerHandle and ChildHandle.\r | |
435 | \r | |
436 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
437 | the language specified by Language.\r | |
438 | \r | |
439 | **/\r | |
440 | EFI_STATUS\r | |
441 | EFIAPI\r | |
442 | AtaBusComponentNameGetControllerName (\r | |
443 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
444 | IN EFI_HANDLE ControllerHandle,\r | |
445 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
446 | IN CHAR8 *Language,\r | |
447 | OUT CHAR16 **ControllerName\r | |
448 | );\r | |
449 | \r | |
450 | \r | |
451 | /**\r | |
452 | Reset the Block Device.\r | |
453 | \r | |
454 | @param This Indicates a pointer to the calling context.\r | |
455 | @param ExtendedVerification Driver may perform diagnostics on reset.\r | |
456 | \r | |
457 | @retval EFI_SUCCESS The device was reset.\r | |
458 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r | |
459 | not be reset.\r | |
460 | \r | |
461 | **/\r | |
462 | EFI_STATUS\r | |
463 | EFIAPI\r | |
464 | AtaBlockIoReset (\r | |
465 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
466 | IN BOOLEAN ExtendedVerification\r | |
467 | );\r | |
468 | \r | |
469 | \r | |
470 | /**\r | |
471 | Read BufferSize bytes from Lba into Buffer.\r | |
472 | \r | |
473 | @param This Indicates a pointer to the calling context.\r | |
474 | @param MediaId Id of the media, changes every time the media is replaced.\r | |
475 | @param Lba The starting Logical Block Address to read from\r | |
476 | @param BufferSize Size of Buffer, must be a multiple of device block size.\r | |
477 | @param Buffer A pointer to the destination buffer for the data. The caller is\r | |
478 | responsible for either having implicit or explicit ownership of the buffer.\r | |
479 | \r | |
480 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
481 | @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r | |
482 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
483 | @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r | |
484 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
485 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid, \r | |
486 | or the buffer is not on proper alignment.\r | |
487 | \r | |
488 | **/\r | |
489 | EFI_STATUS\r | |
490 | EFIAPI\r | |
491 | AtaBlockIoReadBlocks (\r | |
492 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
493 | IN UINT32 MediaId,\r | |
494 | IN EFI_LBA Lba,\r | |
495 | IN UINTN BufferSize,\r | |
496 | OUT VOID *Buffer\r | |
497 | );\r | |
498 | \r | |
499 | \r | |
500 | /**\r | |
501 | Write BufferSize bytes from Lba into Buffer.\r | |
502 | \r | |
503 | @param This Indicates a pointer to the calling context.\r | |
504 | @param MediaId The media ID that the write request is for.\r | |
505 | @param Lba The starting logical block address to be written. The caller is\r | |
506 | responsible for writing to only legitimate locations.\r | |
507 | @param BufferSize Size of Buffer, must be a multiple of device block size.\r | |
508 | @param Buffer A pointer to the source buffer for the data.\r | |
509 | \r | |
510 | @retval EFI_SUCCESS The data was written correctly to the device.\r | |
511 | @retval EFI_WRITE_PROTECTED The device can not be written to.\r | |
512 | @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r | |
513 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
514 | @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r | |
515 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
516 | @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid, \r | |
517 | or the buffer is not on proper alignment.\r | |
518 | \r | |
519 | **/\r | |
520 | EFI_STATUS\r | |
521 | EFIAPI\r | |
522 | AtaBlockIoWriteBlocks (\r | |
523 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
524 | IN UINT32 MediaId,\r | |
525 | IN EFI_LBA Lba,\r | |
526 | IN UINTN BufferSize,\r | |
527 | IN VOID *Buffer\r | |
528 | );\r | |
529 | \r | |
530 | \r | |
531 | /**\r | |
532 | Flush the Block Device.\r | |
533 | \r | |
534 | @param This Indicates a pointer to the calling context.\r | |
535 | \r | |
536 | @retval EFI_SUCCESS All outstanding data was written to the device\r | |
537 | @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r | |
538 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
539 | \r | |
540 | **/\r | |
541 | EFI_STATUS\r | |
542 | EFIAPI\r | |
543 | AtaBlockIoFlushBlocks (\r | |
544 | IN EFI_BLOCK_IO_PROTOCOL *This\r | |
545 | );\r | |
546 | \r | |
547 | \r | |
548 | /**\r | |
549 | Provides inquiry information for the controller type.\r | |
550 | \r | |
551 | This function is used by the IDE bus driver to get inquiry data. Data format\r | |
552 | of Identify data is defined by the Interface GUID.\r | |
553 | \r | |
05a44e91 | 554 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
555 | @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r | |
556 | @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r | |
ad86a50a | 557 | \r |
558 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
559 | @retval EFI_NOT_FOUND Device does not support this data class \r | |
560 | @retval EFI_DEVICE_ERROR Error reading InquiryData from device \r | |
561 | @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough \r | |
562 | \r | |
563 | **/\r | |
564 | EFI_STATUS\r | |
565 | EFIAPI\r | |
566 | AtaDiskInfoInquiry (\r | |
567 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
568 | IN OUT VOID *InquiryData,\r | |
569 | IN OUT UINT32 *InquiryDataSize\r | |
570 | );\r | |
571 | \r | |
572 | \r | |
573 | /**\r | |
574 | Provides identify information for the controller type.\r | |
575 | \r | |
576 | This function is used by the IDE bus driver to get identify data. Data format\r | |
577 | of Identify data is defined by the Interface GUID.\r | |
578 | \r | |
05a44e91 | 579 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL \r |
ad86a50a | 580 | instance.\r |
05a44e91 | 581 | @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r |
582 | @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r | |
ad86a50a | 583 | size.\r |
584 | \r | |
585 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
586 | @retval EFI_NOT_FOUND Device does not support this data class \r | |
587 | @retval EFI_DEVICE_ERROR Error reading IdentifyData from device \r | |
588 | @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough \r | |
589 | \r | |
590 | **/\r | |
591 | EFI_STATUS\r | |
592 | EFIAPI\r | |
593 | AtaDiskInfoIdentify (\r | |
594 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
595 | IN OUT VOID *IdentifyData,\r | |
596 | IN OUT UINT32 *IdentifyDataSize\r | |
597 | );\r | |
598 | \r | |
599 | \r | |
600 | /**\r | |
601 | Provides sense data information for the controller type.\r | |
602 | \r | |
603 | This function is used by the IDE bus driver to get sense data. \r | |
604 | Data format of Sense data is defined by the Interface GUID.\r | |
605 | \r | |
05a44e91 | 606 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
607 | @param[in, out] SenseData Pointer to the SenseData.\r | |
608 | @param[in, out] SenseDataSize Size of SenseData in bytes.\r | |
609 | @param[out] SenseDataNumber Pointer to the value for the sense data size.\r | |
ad86a50a | 610 | \r |
611 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
612 | @retval EFI_NOT_FOUND Device does not support this data class.\r | |
613 | @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r | |
614 | @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r | |
615 | \r | |
616 | **/\r | |
617 | EFI_STATUS\r | |
618 | EFIAPI\r | |
619 | AtaDiskInfoSenseData (\r | |
620 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
621 | IN OUT VOID *SenseData,\r | |
622 | IN OUT UINT32 *SenseDataSize,\r | |
623 | OUT UINT8 *SenseDataNumber\r | |
624 | );\r | |
625 | \r | |
626 | \r | |
627 | /**\r | |
628 | This function is used by the IDE bus driver to get controller information.\r | |
629 | \r | |
630 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance. \r | |
631 | @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r | |
632 | @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r | |
633 | \r | |
634 | @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r | |
635 | @retval EFI_UNSUPPORTED This is not an IDE device.\r | |
636 | \r | |
637 | **/\r | |
638 | EFI_STATUS\r | |
639 | EFIAPI\r | |
640 | AtaDiskInfoWhichIde (\r | |
641 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
642 | OUT UINT32 *IdeChannel,\r | |
643 | OUT UINT32 *IdeDevice\r | |
644 | );\r | |
645 | \r | |
646 | #endif\r |