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