]>
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 | |
58727f29 | 7 | Copyright (c) 2009 - 2012, 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 | |
490b5ea1 | 25 | #include <Protocol/BlockIo2.h>\r |
ad86a50a | 26 | #include <Protocol/DiskInfo.h>\r |
27 | #include <Protocol/DevicePath.h>\r | |
c24097a5 | 28 | #include <Protocol/StorageSecurityCommand.h>\r |
ad86a50a | 29 | \r |
30 | #include <Library/DebugLib.h>\r | |
31 | #include <Library/UefiDriverEntryPoint.h>\r | |
32 | #include <Library/BaseLib.h>\r | |
33 | #include <Library/UefiLib.h>\r | |
34 | #include <Library/BaseMemoryLib.h>\r | |
35 | #include <Library/MemoryAllocationLib.h>\r | |
36 | #include <Library/UefiBootServicesTableLib.h>\r | |
37 | #include <Library/DevicePathLib.h>\r | |
58727f29 | 38 | #include <Library/TimerLib.h>\r |
ad86a50a | 39 | \r |
40 | #include <IndustryStandard/Atapi.h>\r | |
41 | \r | |
42 | //\r | |
43 | // Time out value for ATA pass through protocol\r | |
44 | //\r | |
e519983a | 45 | #define ATA_TIMEOUT EFI_TIMER_PERIOD_SECONDS (3)\r |
ad86a50a | 46 | \r |
47 | //\r | |
48 | // Maximum number of times to retry ATA command\r | |
49 | //\r | |
50 | #define MAX_RETRY_TIMES 3\r | |
51 | \r | |
52 | //\r | |
53 | // The maximum total sectors count in 28 bit addressing mode\r | |
54 | //\r | |
55 | #define MAX_28BIT_ADDRESSING_CAPACITY 0xfffffff\r | |
56 | \r | |
57 | //\r | |
58727f29 | 58 | // The maximum ATA transaction sector count in 28 bit addressing mode.\r |
ad86a50a | 59 | //\r |
60 | #define MAX_28BIT_TRANSFER_BLOCK_NUM 0x100\r | |
61 | \r | |
62 | //\r | |
58727f29 | 63 | // The maximum ATA transaction sector count in 48 bit addressing mode.\r |
ad86a50a | 64 | //\r |
490b5ea1 | 65 | //#define MAX_48BIT_TRANSFER_BLOCK_NUM 0x10000\r |
66 | \r | |
67 | //\r | |
68 | // BugBug: if the TransferLength is equal with 0x10000 (the 48bit max length),\r | |
69 | // there is a bug that even the register interrupt bit has been sit, the buffer\r | |
70 | // seems not ready. Change the Maximum Sector Numbers to 0xFFFF to work round\r | |
71 | // this issue.\r | |
72 | //\r | |
73 | #define MAX_48BIT_TRANSFER_BLOCK_NUM 0xFFFF\r | |
ad86a50a | 74 | \r |
75 | //\r | |
58727f29 | 76 | // The maximum model name in ATA identify data\r |
ad86a50a | 77 | //\r |
78 | #define MAX_MODEL_NAME_LEN 40\r | |
79 | \r | |
c24097a5 | 80 | #define ATA_TASK_SIGNATURE SIGNATURE_32 ('A', 'T', 'S', 'K')\r |
81 | #define ATA_DEVICE_SIGNATURE SIGNATURE_32 ('A', 'B', 'I', 'D')\r | |
58727f29 | 82 | #define ATA_SUB_TASK_SIGNATURE SIGNATURE_32 ('A', 'S', 'T', 'S')\r |
c24097a5 | 83 | #define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r |
490b5ea1 | 84 | \r |
ad86a50a | 85 | //\r |
86 | // ATA bus data structure for ATA controller\r | |
87 | //\r | |
88 | typedef struct {\r | |
89 | EFI_ATA_PASS_THRU_PROTOCOL *AtaPassThru;\r | |
90 | EFI_HANDLE Controller;\r | |
91 | EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;\r | |
92 | EFI_HANDLE DriverBindingHandle;\r | |
93 | } ATA_BUS_DRIVER_DATA;\r | |
94 | \r | |
ad86a50a | 95 | //\r |
96 | // ATA device data structure for each child device\r | |
97 | //\r | |
98 | typedef struct {\r | |
490b5ea1 | 99 | UINT32 Signature;\r |
ad86a50a | 100 | \r |
490b5ea1 | 101 | EFI_HANDLE Handle;\r |
102 | EFI_BLOCK_IO_PROTOCOL BlockIo;\r | |
103 | EFI_BLOCK_IO2_PROTOCOL BlockIo2;\r | |
104 | EFI_BLOCK_IO_MEDIA BlockMedia;\r | |
105 | EFI_DISK_INFO_PROTOCOL DiskInfo;\r | |
106 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
c24097a5 | 107 | EFI_STORAGE_SECURITY_COMMAND_PROTOCOL StorageSecurity;\r |
ad86a50a | 108 | \r |
490b5ea1 | 109 | ATA_BUS_DRIVER_DATA *AtaBusDriverData;\r |
110 | UINT16 Port;\r | |
111 | UINT16 PortMultiplierPort;\r | |
ad86a50a | 112 | \r |
113 | //\r | |
114 | // Buffer for the execution of ATA pass through protocol\r | |
115 | //\r | |
490b5ea1 | 116 | EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r |
117 | EFI_ATA_COMMAND_BLOCK Acb;\r | |
118 | EFI_ATA_STATUS_BLOCK *Asb;\r | |
ad86a50a | 119 | \r |
490b5ea1 | 120 | BOOLEAN UdmaValid;\r |
121 | BOOLEAN Lba48Bit;\r | |
ad86a50a | 122 | \r |
123 | //\r | |
124 | // Cached data for ATA identify data\r | |
125 | //\r | |
490b5ea1 | 126 | ATA_IDENTIFY_DATA *IdentifyData;\r |
ad86a50a | 127 | \r |
490b5ea1 | 128 | EFI_UNICODE_STRING_TABLE *ControllerNameTable;\r |
129 | CHAR16 ModelName[MAX_MODEL_NAME_LEN + 1];\r | |
ad86a50a | 130 | \r |
c24097a5 | 131 | LIST_ENTRY AtaTaskList;\r |
58727f29 | 132 | LIST_ENTRY AtaSubTaskList;\r |
ad86a50a | 133 | } ATA_DEVICE;\r |
134 | \r | |
58727f29 | 135 | //\r |
136 | // Sub-Task for the non blocking I/O\r | |
137 | //\r | |
138 | typedef struct {\r | |
139 | UINT32 Signature;\r | |
140 | ATA_DEVICE *AtaDevice;\r | |
141 | EFI_BLOCK_IO2_TOKEN *Token;\r | |
142 | UINTN *UnsignalledEventCount;\r | |
143 | EFI_ATA_PASS_THRU_COMMAND_PACKET Packet;\r | |
144 | BOOLEAN *IsError;// Indicate whether meeting error during source allocation for new task.\r | |
145 | LIST_ENTRY TaskEntry;\r | |
146 | } ATA_BUS_ASYN_SUB_TASK;\r | |
147 | \r | |
148 | //\r | |
149 | // Task for the non blocking I/O\r | |
150 | //\r | |
151 | typedef struct {\r | |
152 | UINT32 Signature;\r | |
153 | EFI_BLOCK_IO2_TOKEN *Token;\r | |
154 | ATA_DEVICE *AtaDevice;\r | |
155 | UINT8 *Buffer;\r | |
156 | EFI_LBA StartLba;\r | |
157 | UINTN NumberOfBlocks;\r | |
158 | BOOLEAN IsWrite;\r | |
159 | LIST_ENTRY TaskEntry;\r | |
160 | } ATA_BUS_ASYN_TASK;\r | |
161 | \r | |
490b5ea1 | 162 | #define ATA_DEVICE_FROM_BLOCK_IO(a) CR (a, ATA_DEVICE, BlockIo, ATA_DEVICE_SIGNATURE)\r |
163 | #define ATA_DEVICE_FROM_BLOCK_IO2(a) CR (a, ATA_DEVICE, BlockIo2, ATA_DEVICE_SIGNATURE)\r | |
164 | #define ATA_DEVICE_FROM_DISK_INFO(a) CR (a, ATA_DEVICE, DiskInfo, ATA_DEVICE_SIGNATURE)\r | |
c24097a5 | 165 | #define ATA_DEVICE_FROM_STORAGE_SECURITY(a) CR (a, ATA_DEVICE, StorageSecurity, ATA_DEVICE_SIGNATURE)\r |
58727f29 | 166 | #define ATA_AYNS_SUB_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_SUB_TASK, TaskEntry, ATA_SUB_TASK_SIGNATURE)\r |
490b5ea1 | 167 | #define ATA_AYNS_TASK_FROM_ENTRY(a) CR (a, ATA_BUS_ASYN_TASK, TaskEntry, ATA_TASK_SIGNATURE)\r |
ad86a50a | 168 | \r |
169 | //\r | |
170 | // Global Variables\r | |
171 | //\r | |
172 | extern EFI_DRIVER_BINDING_PROTOCOL gAtaBusDriverBinding;\r | |
173 | extern EFI_COMPONENT_NAME_PROTOCOL gAtaBusComponentName;\r | |
174 | extern EFI_COMPONENT_NAME2_PROTOCOL gAtaBusComponentName2;\r | |
175 | \r | |
490b5ea1 | 176 | /**\r |
177 | Allocates an aligned buffer for ATA device.\r | |
178 | \r | |
179 | This function allocates an aligned buffer for the ATA device to perform\r | |
180 | ATA pass through operations. The alignment requirement is from ATA pass\r | |
181 | through interface.\r | |
182 | \r | |
183 | @param AtaDevice The ATA child device involved for the operation.\r | |
184 | @param BufferSize The request buffer size.\r | |
185 | \r | |
186 | @return A pointer to the aligned buffer or NULL if the allocation fails.\r | |
187 | \r | |
188 | **/\r | |
189 | VOID *\r | |
190 | AllocateAlignedBuffer (\r | |
191 | IN ATA_DEVICE *AtaDevice,\r | |
192 | IN UINTN BufferSize\r | |
193 | );\r | |
194 | \r | |
195 | /**\r | |
196 | Frees an aligned buffer for ATA device.\r | |
197 | \r | |
198 | This function frees an aligned buffer for the ATA device to perform\r | |
199 | ATA pass through operations.\r | |
200 | \r | |
201 | @param Buffer The aligned buffer to be freed.\r | |
202 | @param BufferSize The request buffer size.\r | |
203 | \r | |
204 | **/\r | |
205 | VOID\r | |
206 | FreeAlignedBuffer (\r | |
207 | IN VOID *Buffer,\r | |
208 | IN UINTN BufferSize\r | |
209 | );\r | |
210 | \r | |
211 | /**\r | |
58727f29 | 212 | Free SubTask.\r |
490b5ea1 | 213 | \r |
214 | @param[in, out] Task Pointer to task to be freed.\r | |
58727f29 | 215 | \r |
490b5ea1 | 216 | **/\r |
217 | VOID\r | |
58727f29 | 218 | EFIAPI\r |
490b5ea1 | 219 | FreeAtaSubTask (\r |
58727f29 | 220 | IN OUT ATA_BUS_ASYN_SUB_TASK *Task\r |
490b5ea1 | 221 | );\r |
ad86a50a | 222 | \r |
223 | /**\r | |
224 | Wrapper for EFI_ATA_PASS_THRU_PROTOCOL.ResetDevice().\r | |
225 | \r | |
226 | This function wraps the ResetDevice() invocation for ATA pass through function\r | |
58727f29 | 227 | for an ATA device.\r |
ad86a50a | 228 | \r |
229 | @param AtaDevice The ATA child device involved for the operation.\r | |
230 | \r | |
231 | @return The return status from EFI_ATA_PASS_THRU_PROTOCOL.PassThru().\r | |
232 | \r | |
233 | **/\r | |
234 | EFI_STATUS\r | |
235 | ResetAtaDevice (\r | |
236 | IN ATA_DEVICE *AtaDevice\r | |
237 | );\r | |
238 | \r | |
239 | \r | |
240 | /**\r | |
241 | Discovers whether it is a valid ATA device.\r | |
242 | \r | |
243 | This function issues ATA_CMD_IDENTIFY_DRIVE command to the ATA device to identify it.\r | |
244 | If the command is executed successfully, it then identifies it and initializes\r | |
245 | the Media information in Block IO protocol interface.\r | |
246 | \r | |
247 | @param AtaDevice The ATA child device involved for the operation.\r | |
248 | \r | |
249 | @retval EFI_SUCCESS The device is successfully identified and Media information\r | |
250 | is correctly initialized.\r | |
58727f29 | 251 | @return others Some error occurs when discovering the ATA device.\r |
ad86a50a | 252 | \r |
253 | **/\r | |
254 | EFI_STATUS\r | |
255 | DiscoverAtaDevice (\r | |
256 | IN OUT ATA_DEVICE *AtaDevice\r | |
257 | );\r | |
258 | \r | |
ad86a50a | 259 | /**\r |
260 | Read or write a number of blocks from ATA device.\r | |
261 | \r | |
262 | This function performs ATA pass through transactions to read/write data from/to\r | |
263 | ATA device. It may separate the read/write request into several ATA pass through\r | |
264 | transactions.\r | |
265 | \r | |
490b5ea1 | 266 | @param[in, out] AtaDevice The ATA child device involved for the operation.\r |
267 | @param[in, out] Buffer The pointer to the current transaction buffer.\r | |
268 | @param[in] StartLba The starting logical block address to be accessed.\r | |
269 | @param[in] NumberOfBlocks The block number or sector count of the transfer.\r | |
270 | @param[in] IsWrite Indicates whether it is a write operation.\r | |
271 | @param[in, out] Token A pointer to the token associated with the transaction.\r | |
ad86a50a | 272 | \r |
273 | @retval EFI_SUCCESS The data transfer is complete successfully.\r | |
58727f29 | 274 | @return others Some error occurs when transferring data.\r |
ad86a50a | 275 | \r |
276 | **/\r | |
58727f29 | 277 | EFI_STATUS\r |
ad86a50a | 278 | AccessAtaDevice(\r |
279 | IN OUT ATA_DEVICE *AtaDevice,\r | |
280 | IN OUT UINT8 *Buffer,\r | |
281 | IN EFI_LBA StartLba,\r | |
282 | IN UINTN NumberOfBlocks,\r | |
490b5ea1 | 283 | IN BOOLEAN IsWrite,\r |
284 | IN OUT EFI_BLOCK_IO2_TOKEN *Token\r | |
ad86a50a | 285 | );\r |
c24097a5 | 286 | /**\r |
287 | Trust transfer data from/to ATA device.\r | |
288 | \r | |
289 | This function performs one ATA pass through transaction to do a trust transfer from/to\r | |
290 | ATA device. It chooses the appropriate ATA command and protocol to invoke PassThru\r | |
291 | interface of ATA pass through.\r | |
292 | \r | |
293 | @param AtaDevice The ATA child device involved for the operation.\r | |
294 | @param Buffer The pointer to the current transaction buffer.\r | |
295 | @param SecurityProtocolId The value of the "Security Protocol" parameter of\r | |
296 | the security protocol command to be sent.\r | |
297 | @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r | |
298 | of the security protocol command to be sent.\r | |
299 | @param TransferLength The block number or sector count of the transfer.\r | |
300 | @param IsTrustSend Indicates whether it is a trust send operation or not.\r | |
301 | @param Timeout The timeout, in 100ns units, to use for the execution\r | |
302 | of the security protocol command. A Timeout value of 0\r | |
303 | means that this function will wait indefinitely for the\r | |
304 | security protocol command to execute. If Timeout is greater\r | |
305 | than zero, then this function will return EFI_TIMEOUT\r | |
306 | if the time required to execute the receive data command\r | |
307 | is greater than Timeout.\r | |
86d8e199 | 308 | @param TransferLengthOut A pointer to a buffer to store the size in bytes of the data\r |
309 | written to the buffer. Ignore it when IsTrustSend is TRUE.\r | |
c24097a5 | 310 | \r |
311 | @retval EFI_SUCCESS The data transfer is complete successfully.\r | |
58727f29 | 312 | @return others Some error occurs when transferring data.\r |
c24097a5 | 313 | \r |
314 | **/\r | |
315 | EFI_STATUS\r | |
316 | EFIAPI\r | |
317 | TrustTransferAtaDevice (\r | |
318 | IN OUT ATA_DEVICE *AtaDevice,\r | |
319 | IN OUT VOID *Buffer,\r | |
320 | IN UINT8 SecurityProtocolId,\r | |
321 | IN UINT16 SecurityProtocolSpecificData,\r | |
322 | IN UINTN TransferLength,\r | |
323 | IN BOOLEAN IsTrustSend,\r | |
324 | IN UINT64 Timeout,\r | |
325 | OUT UINTN *TransferLengthOut\r | |
326 | );\r | |
ad86a50a | 327 | \r |
328 | //\r | |
329 | // Protocol interface prototypes\r | |
330 | //\r | |
331 | /**\r | |
58727f29 | 332 | Tests to see if this driver supports a given controller. If a child device is provided,\r |
ad86a50a | 333 | it further tests to see if this driver supports creating a handle for the specified child device.\r |
334 | \r | |
58727f29 | 335 | This function checks to see if the driver specified by This supports the device specified by\r |
336 | ControllerHandle. Drivers will typically use the device path attached to\r | |
337 | ControllerHandle and/or the services from the bus I/O abstraction attached to\r | |
338 | ControllerHandle to determine if the driver supports ControllerHandle. This function\r | |
339 | may be called many times during platform initialization. In order to reduce boot times, the tests\r | |
340 | performed by this function must be very small, and take as little time as possible to execute. This\r | |
341 | function must not change the state of any hardware devices, and this function must be aware that the\r | |
342 | device specified by ControllerHandle may already be managed by the same driver or a\r | |
343 | different driver. This function must match its calls to AllocatePages() with FreePages(),\r | |
344 | AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r | |
345 | Since ControllerHandle may have been previously started by the same driver, if a protocol is\r | |
346 | already in the opened state, then it must not be closed with CloseProtocol(). This is required\r | |
ad86a50a | 347 | to guarantee the state of ControllerHandle is not modified by this function.\r |
348 | \r | |
349 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
58727f29 | 350 | @param[in] ControllerHandle The handle of the controller to test. This handle\r |
351 | must support a protocol interface that supplies\r | |
ad86a50a | 352 | an I/O abstraction to the driver.\r |
58727f29 | 353 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r |
354 | parameter is ignored by device drivers, and is optional for bus\r | |
355 | drivers. For bus drivers, if this parameter is not NULL, then\r | |
356 | the bus driver must determine if the bus controller specified\r | |
357 | by ControllerHandle and the child controller specified\r | |
358 | by RemainingDevicePath are both supported by this\r | |
ad86a50a | 359 | bus driver.\r |
360 | \r | |
361 | @retval EFI_SUCCESS The device specified by ControllerHandle and\r | |
362 | RemainingDevicePath is supported by the driver specified by This.\r | |
363 | @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r | |
364 | RemainingDevicePath is already being managed by the driver\r | |
365 | specified by This.\r | |
366 | @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r | |
367 | RemainingDevicePath is already being managed by a different\r | |
368 | driver or an application that requires exclusive access.\r | |
369 | Currently not implemented.\r | |
370 | @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r | |
371 | RemainingDevicePath is not supported by the driver specified by This.\r | |
372 | **/\r | |
373 | EFI_STATUS\r | |
374 | EFIAPI\r | |
375 | AtaBusDriverBindingSupported (\r | |
376 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
377 | IN EFI_HANDLE Controller,\r | |
378 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
379 | );\r | |
380 | \r | |
381 | /**\r | |
382 | Starts a device controller or a bus controller.\r | |
383 | \r | |
384 | The Start() function is designed to be invoked from the EFI boot service ConnectController().\r | |
58727f29 | 385 | As a result, much of the error checking on the parameters to Start() has been moved into this\r |
386 | common boot service. It is legal to call Start() from other locations,\r | |
ad86a50a | 387 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r |
388 | 1. ControllerHandle must be a valid EFI_HANDLE.\r | |
389 | 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r | |
390 | EFI_DEVICE_PATH_PROTOCOL.\r | |
391 | 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r | |
58727f29 | 392 | have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r |
ad86a50a | 393 | \r |
394 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r | |
58727f29 | 395 | @param[in] ControllerHandle The handle of the controller to start. This handle\r |
396 | must support a protocol interface that supplies\r | |
ad86a50a | 397 | an I/O abstraction to the driver.\r |
58727f29 | 398 | @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r |
399 | parameter is ignored by device drivers, and is optional for bus\r | |
400 | drivers. For a bus driver, if this parameter is NULL, then handles\r | |
401 | for all the children of Controller are created by this driver.\r | |
402 | If this parameter is not NULL and the first Device Path Node is\r | |
403 | not the End of Device Path Node, then only the handle for the\r | |
404 | child device specified by the first Device Path Node of\r | |
ad86a50a | 405 | RemainingDevicePath is created by this driver.\r |
58727f29 | 406 | If the first Device Path Node of RemainingDevicePath is\r |
ad86a50a | 407 | the End of Device Path Node, no child handle is created by this\r |
408 | driver.\r | |
409 | \r | |
410 | @retval EFI_SUCCESS The device was started.\r | |
411 | @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r | |
412 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r | |
413 | @retval Others The driver failded to start the device.\r | |
414 | \r | |
415 | **/\r | |
416 | EFI_STATUS\r | |
417 | EFIAPI\r | |
418 | AtaBusDriverBindingStart (\r | |
419 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
420 | IN EFI_HANDLE Controller,\r | |
421 | IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r | |
422 | );\r | |
423 | \r | |
424 | /**\r | |
425 | Stops a device controller or a bus controller.\r | |
58727f29 | 426 | \r |
427 | The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r | |
428 | As a result, much of the error checking on the parameters to Stop() has been moved\r | |
429 | into this common boot service. It is legal to call Stop() from other locations,\r | |
ad86a50a | 430 | but the following calling restrictions must be followed or the system behavior will not be deterministic.\r |
431 | 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r | |
432 | same driver's Start() function.\r | |
433 | 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r | |
434 | EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r | |
435 | Start() function, and the Start() function must have called OpenProtocol() on\r | |
436 | ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r | |
58727f29 | 437 | \r |
ad86a50a | 438 | @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r |
58727f29 | 439 | @param[in] ControllerHandle A handle to the device being stopped. The handle must\r |
440 | support a bus specific I/O protocol for the driver\r | |
ad86a50a | 441 | to use to stop the device.\r |
442 | @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r | |
58727f29 | 443 | @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r |
ad86a50a | 444 | if NumberOfChildren is 0.\r |
445 | \r | |
446 | @retval EFI_SUCCESS The device was stopped.\r | |
447 | @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r | |
448 | \r | |
449 | **/\r | |
450 | EFI_STATUS\r | |
451 | EFIAPI\r | |
452 | AtaBusDriverBindingStop (\r | |
453 | IN EFI_DRIVER_BINDING_PROTOCOL *This,\r | |
454 | IN EFI_HANDLE Controller,\r | |
455 | IN UINTN NumberOfChildren,\r | |
456 | IN EFI_HANDLE *ChildHandleBuffer\r | |
457 | );\r | |
458 | \r | |
459 | \r | |
460 | /**\r | |
461 | Retrieves a Unicode string that is the user readable name of the driver.\r | |
462 | \r | |
463 | This function retrieves the user readable name of a driver in the form of a\r | |
464 | Unicode string. If the driver specified by This has a user readable name in\r | |
465 | the language specified by Language, then a pointer to the driver name is\r | |
466 | returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r | |
467 | by This does not support the language specified by Language,\r | |
468 | then EFI_UNSUPPORTED is returned.\r | |
469 | \r | |
470 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
471 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
472 | \r | |
473 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
474 | array indicating the language. This is the\r | |
475 | language of the driver name that the caller is\r | |
476 | requesting, and it must match one of the\r | |
477 | languages specified in SupportedLanguages. The\r | |
478 | number of languages supported by a driver is up\r | |
479 | to the driver writer. Language is specified\r | |
480 | in RFC 4646 or ISO 639-2 language code format.\r | |
481 | \r | |
482 | @param DriverName[out] A pointer to the Unicode string to return.\r | |
483 | This Unicode string is the name of the\r | |
484 | driver specified by This in the language\r | |
485 | specified by Language.\r | |
486 | \r | |
487 | @retval EFI_SUCCESS The Unicode string for the Driver specified by\r | |
488 | This and the language specified by Language was\r | |
489 | returned in DriverName.\r | |
490 | \r | |
491 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
492 | \r | |
493 | @retval EFI_INVALID_PARAMETER DriverName is NULL.\r | |
494 | \r | |
495 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
496 | the language specified by Language.\r | |
497 | \r | |
498 | **/\r | |
499 | EFI_STATUS\r | |
500 | EFIAPI\r | |
501 | AtaBusComponentNameGetDriverName (\r | |
502 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
503 | IN CHAR8 *Language,\r | |
504 | OUT CHAR16 **DriverName\r | |
505 | );\r | |
506 | \r | |
507 | \r | |
508 | /**\r | |
509 | Retrieves a Unicode string that is the user readable name of the controller\r | |
510 | that is being managed by a driver.\r | |
511 | \r | |
512 | This function retrieves the user readable name of the controller specified by\r | |
513 | ControllerHandle and ChildHandle in the form of a Unicode string. If the\r | |
514 | driver specified by This has a user readable name in the language specified by\r | |
515 | Language, then a pointer to the controller name is returned in ControllerName,\r | |
516 | and EFI_SUCCESS is returned. If the driver specified by This is not currently\r | |
517 | managing the controller specified by ControllerHandle and ChildHandle,\r | |
518 | then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r | |
519 | support the language specified by Language, then EFI_UNSUPPORTED is returned.\r | |
520 | \r | |
521 | @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r | |
522 | EFI_COMPONENT_NAME_PROTOCOL instance.\r | |
523 | \r | |
524 | @param ControllerHandle[in] The handle of a controller that the driver\r | |
525 | specified by This is managing. This handle\r | |
526 | specifies the controller whose name is to be\r | |
527 | returned.\r | |
528 | \r | |
529 | @param ChildHandle[in] The handle of the child controller to retrieve\r | |
530 | the name of. This is an optional parameter that\r | |
531 | may be NULL. It will be NULL for device\r | |
532 | drivers. It will also be NULL for a bus drivers\r | |
533 | that wish to retrieve the name of the bus\r | |
534 | controller. It will not be NULL for a bus\r | |
535 | driver that wishes to retrieve the name of a\r | |
536 | child controller.\r | |
537 | \r | |
538 | @param Language[in] A pointer to a Null-terminated ASCII string\r | |
539 | array indicating the language. This is the\r | |
540 | language of the driver name that the caller is\r | |
541 | requesting, and it must match one of the\r | |
542 | languages specified in SupportedLanguages. The\r | |
543 | number of languages supported by a driver is up\r | |
544 | to the driver writer. Language is specified in\r | |
545 | RFC 4646 or ISO 639-2 language code format.\r | |
546 | \r | |
547 | @param ControllerName[out] A pointer to the Unicode string to return.\r | |
548 | This Unicode string is the name of the\r | |
549 | controller specified by ControllerHandle and\r | |
550 | ChildHandle in the language specified by\r | |
551 | Language from the point of view of the driver\r | |
552 | specified by This.\r | |
553 | \r | |
554 | @retval EFI_SUCCESS The Unicode string for the user readable name in\r | |
555 | the language specified by Language for the\r | |
556 | driver specified by This was returned in\r | |
557 | DriverName.\r | |
558 | \r | |
284ee2e8 | 559 | @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r |
ad86a50a | 560 | \r |
561 | @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r | |
562 | EFI_HANDLE.\r | |
563 | \r | |
564 | @retval EFI_INVALID_PARAMETER Language is NULL.\r | |
565 | \r | |
566 | @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r | |
567 | \r | |
568 | @retval EFI_UNSUPPORTED The driver specified by This is not currently\r | |
569 | managing the controller specified by\r | |
570 | ControllerHandle and ChildHandle.\r | |
571 | \r | |
572 | @retval EFI_UNSUPPORTED The driver specified by This does not support\r | |
573 | the language specified by Language.\r | |
574 | \r | |
575 | **/\r | |
576 | EFI_STATUS\r | |
577 | EFIAPI\r | |
578 | AtaBusComponentNameGetControllerName (\r | |
579 | IN EFI_COMPONENT_NAME_PROTOCOL *This,\r | |
580 | IN EFI_HANDLE ControllerHandle,\r | |
581 | IN EFI_HANDLE ChildHandle OPTIONAL,\r | |
582 | IN CHAR8 *Language,\r | |
583 | OUT CHAR16 **ControllerName\r | |
584 | );\r | |
585 | \r | |
586 | \r | |
587 | /**\r | |
588 | Reset the Block Device.\r | |
589 | \r | |
590 | @param This Indicates a pointer to the calling context.\r | |
591 | @param ExtendedVerification Driver may perform diagnostics on reset.\r | |
592 | \r | |
593 | @retval EFI_SUCCESS The device was reset.\r | |
594 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r | |
595 | not be reset.\r | |
596 | \r | |
597 | **/\r | |
598 | EFI_STATUS\r | |
599 | EFIAPI\r | |
600 | AtaBlockIoReset (\r | |
601 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
602 | IN BOOLEAN ExtendedVerification\r | |
603 | );\r | |
604 | \r | |
605 | \r | |
606 | /**\r | |
607 | Read BufferSize bytes from Lba into Buffer.\r | |
608 | \r | |
609 | @param This Indicates a pointer to the calling context.\r | |
610 | @param MediaId Id of the media, changes every time the media is replaced.\r | |
611 | @param Lba The starting Logical Block Address to read from\r | |
612 | @param BufferSize Size of Buffer, must be a multiple of device block size.\r | |
613 | @param Buffer A pointer to the destination buffer for the data. The caller is\r | |
614 | responsible for either having implicit or explicit ownership of the buffer.\r | |
615 | \r | |
616 | @retval EFI_SUCCESS The data was read correctly from the device.\r | |
617 | @retval EFI_DEVICE_ERROR The device reported an error while performing the read.\r | |
618 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
619 | @retval EFI_MEDIA_CHANGED The MediaId does not matched the current device.\r | |
620 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
58727f29 | 621 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r |
ad86a50a | 622 | or the buffer is not on proper alignment.\r |
623 | \r | |
624 | **/\r | |
625 | EFI_STATUS\r | |
626 | EFIAPI\r | |
627 | AtaBlockIoReadBlocks (\r | |
628 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
629 | IN UINT32 MediaId,\r | |
630 | IN EFI_LBA Lba,\r | |
631 | IN UINTN BufferSize,\r | |
632 | OUT VOID *Buffer\r | |
633 | );\r | |
634 | \r | |
635 | \r | |
636 | /**\r | |
637 | Write BufferSize bytes from Lba into Buffer.\r | |
638 | \r | |
639 | @param This Indicates a pointer to the calling context.\r | |
640 | @param MediaId The media ID that the write request is for.\r | |
641 | @param Lba The starting logical block address to be written. The caller is\r | |
642 | responsible for writing to only legitimate locations.\r | |
643 | @param BufferSize Size of Buffer, must be a multiple of device block size.\r | |
644 | @param Buffer A pointer to the source buffer for the data.\r | |
645 | \r | |
646 | @retval EFI_SUCCESS The data was written correctly to the device.\r | |
647 | @retval EFI_WRITE_PROTECTED The device can not be written to.\r | |
648 | @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r | |
649 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
650 | @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r | |
651 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
58727f29 | 652 | @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r |
ad86a50a | 653 | or the buffer is not on proper alignment.\r |
654 | \r | |
655 | **/\r | |
656 | EFI_STATUS\r | |
657 | EFIAPI\r | |
658 | AtaBlockIoWriteBlocks (\r | |
659 | IN EFI_BLOCK_IO_PROTOCOL *This,\r | |
660 | IN UINT32 MediaId,\r | |
661 | IN EFI_LBA Lba,\r | |
662 | IN UINTN BufferSize,\r | |
663 | IN VOID *Buffer\r | |
664 | );\r | |
665 | \r | |
666 | \r | |
667 | /**\r | |
668 | Flush the Block Device.\r | |
669 | \r | |
670 | @param This Indicates a pointer to the calling context.\r | |
671 | \r | |
672 | @retval EFI_SUCCESS All outstanding data was written to the device\r | |
673 | @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r | |
674 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
675 | \r | |
676 | **/\r | |
677 | EFI_STATUS\r | |
678 | EFIAPI\r | |
679 | AtaBlockIoFlushBlocks (\r | |
680 | IN EFI_BLOCK_IO_PROTOCOL *This\r | |
681 | );\r | |
682 | \r | |
490b5ea1 | 683 | /**\r |
684 | Reset the Block Device throught Block I/O2 protocol.\r | |
685 | \r | |
686 | @param[in] This Indicates a pointer to the calling context.\r | |
687 | @param[in] ExtendedVerification Driver may perform diagnostics on reset.\r | |
688 | \r | |
689 | @retval EFI_SUCCESS The device was reset.\r | |
690 | @retval EFI_DEVICE_ERROR The device is not functioning properly and could\r | |
691 | not be reset.\r | |
692 | \r | |
693 | **/\r | |
694 | EFI_STATUS\r | |
695 | EFIAPI\r | |
696 | AtaBlockIoResetEx (\r | |
697 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r | |
698 | IN BOOLEAN ExtendedVerification\r | |
699 | );\r | |
700 | \r | |
701 | /**\r | |
702 | Read BufferSize bytes from Lba into Buffer.\r | |
703 | \r | |
704 | @param[in] This Indicates a pointer to the calling context.\r | |
705 | @param[in] MediaId Id of the media, changes every time the media is replaced.\r | |
706 | @param[in] Lba The starting Logical Block Address to read from.\r | |
707 | @param[in, out] Token A pointer to the token associated with the transaction.\r | |
708 | @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r | |
709 | @param[out] Buffer A pointer to the destination buffer for the data. The caller is\r | |
710 | responsible for either having implicit or explicit ownership of the buffer.\r | |
711 | \r | |
712 | @retval EFI_SUCCESS The read request was queued if Event is not NULL.\r | |
713 | The data was read correctly from the device if\r | |
714 | the Event is NULL.\r | |
715 | @retval EFI_DEVICE_ERROR The device reported an error while performing\r | |
716 | the read.\r | |
717 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
718 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
719 | @retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the\r | |
720 | intrinsic block size of the device.\r | |
58727f29 | 721 | @retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,\r |
490b5ea1 | 722 | or the buffer is not on proper alignment.\r |
723 | @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack\r | |
724 | of resources.\r | |
725 | \r | |
726 | **/\r | |
727 | EFI_STATUS\r | |
728 | EFIAPI\r | |
729 | AtaBlockIoReadBlocksEx (\r | |
730 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r | |
731 | IN UINT32 MediaId,\r | |
732 | IN EFI_LBA Lba,\r | |
733 | IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r | |
734 | IN UINTN BufferSize,\r | |
735 | OUT VOID *Buffer\r | |
736 | );\r | |
737 | \r | |
738 | /**\r | |
739 | Write BufferSize bytes from Lba into Buffer.\r | |
740 | \r | |
741 | @param[in] This Indicates a pointer to the calling context.\r | |
742 | @param[in] MediaId The media ID that the write request is for.\r | |
743 | @param[in] Lba The starting logical block address to be written. The\r | |
744 | caller is responsible for writing to only legitimate\r | |
745 | locations.\r | |
746 | @param[in, out] Token A pointer to the token associated with the transaction.\r | |
747 | @param[in] BufferSize Size of Buffer, must be a multiple of device block size.\r | |
748 | @param[in] Buffer A pointer to the source buffer for the data.\r | |
749 | \r | |
750 | @retval EFI_SUCCESS The data was written correctly to the device.\r | |
751 | @retval EFI_WRITE_PROTECTED The device can not be written to.\r | |
752 | @retval EFI_DEVICE_ERROR The device reported an error while performing the write.\r | |
753 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
754 | @retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.\r | |
755 | @retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.\r | |
58727f29 | 756 | @retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,\r |
490b5ea1 | 757 | or the buffer is not on proper alignment.\r |
758 | \r | |
759 | **/\r | |
760 | EFI_STATUS\r | |
761 | EFIAPI\r | |
762 | AtaBlockIoWriteBlocksEx (\r | |
763 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r | |
764 | IN UINT32 MediaId,\r | |
765 | IN EFI_LBA Lba,\r | |
766 | IN OUT EFI_BLOCK_IO2_TOKEN *Token,\r | |
767 | IN UINTN BufferSize,\r | |
768 | IN VOID *Buffer\r | |
769 | );\r | |
770 | \r | |
771 | /**\r | |
772 | Flush the Block Device.\r | |
773 | \r | |
774 | @param[in] This Indicates a pointer to the calling context.\r | |
775 | @param[in, out] Token A pointer to the token associated with the transaction.\r | |
776 | \r | |
777 | @retval EFI_SUCCESS All outstanding data was written to the device\r | |
778 | @retval EFI_DEVICE_ERROR The device reported an error while writing back the data\r | |
779 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
780 | \r | |
781 | **/\r | |
782 | EFI_STATUS\r | |
783 | EFIAPI\r | |
784 | AtaBlockIoFlushBlocksEx (\r | |
785 | IN EFI_BLOCK_IO2_PROTOCOL *This,\r | |
786 | IN OUT EFI_BLOCK_IO2_TOKEN *Token\r | |
787 | );\r | |
ad86a50a | 788 | \r |
789 | /**\r | |
790 | Provides inquiry information for the controller type.\r | |
58727f29 | 791 | \r |
ad86a50a | 792 | This function is used by the IDE bus driver to get inquiry data. Data format\r |
793 | of Identify data is defined by the Interface GUID.\r | |
794 | \r | |
05a44e91 | 795 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
796 | @param[in, out] InquiryData Pointer to a buffer for the inquiry data.\r | |
797 | @param[in, out] InquiryDataSize Pointer to the value for the inquiry data size.\r | |
ad86a50a | 798 | \r |
799 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
58727f29 | 800 | @retval EFI_NOT_FOUND Device does not support this data class\r |
801 | @retval EFI_DEVICE_ERROR Error reading InquiryData from device\r | |
802 | @retval EFI_BUFFER_TOO_SMALL InquiryDataSize not big enough\r | |
ad86a50a | 803 | \r |
804 | **/\r | |
805 | EFI_STATUS\r | |
806 | EFIAPI\r | |
807 | AtaDiskInfoInquiry (\r | |
808 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
809 | IN OUT VOID *InquiryData,\r | |
810 | IN OUT UINT32 *InquiryDataSize\r | |
811 | );\r | |
812 | \r | |
813 | \r | |
814 | /**\r | |
815 | Provides identify information for the controller type.\r | |
816 | \r | |
817 | This function is used by the IDE bus driver to get identify data. Data format\r | |
818 | of Identify data is defined by the Interface GUID.\r | |
819 | \r | |
58727f29 | 820 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL\r |
ad86a50a | 821 | instance.\r |
05a44e91 | 822 | @param[in, out] IdentifyData Pointer to a buffer for the identify data.\r |
823 | @param[in, out] IdentifyDataSize Pointer to the value for the identify data\r | |
ad86a50a | 824 | size.\r |
825 | \r | |
826 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
58727f29 | 827 | @retval EFI_NOT_FOUND Device does not support this data class\r |
828 | @retval EFI_DEVICE_ERROR Error reading IdentifyData from device\r | |
829 | @retval EFI_BUFFER_TOO_SMALL IdentifyDataSize not big enough\r | |
ad86a50a | 830 | \r |
831 | **/\r | |
832 | EFI_STATUS\r | |
833 | EFIAPI\r | |
834 | AtaDiskInfoIdentify (\r | |
835 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
836 | IN OUT VOID *IdentifyData,\r | |
837 | IN OUT UINT32 *IdentifyDataSize\r | |
838 | );\r | |
839 | \r | |
840 | \r | |
841 | /**\r | |
842 | Provides sense data information for the controller type.\r | |
58727f29 | 843 | \r |
844 | This function is used by the IDE bus driver to get sense data.\r | |
ad86a50a | 845 | Data format of Sense data is defined by the Interface GUID.\r |
846 | \r | |
05a44e91 | 847 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
848 | @param[in, out] SenseData Pointer to the SenseData.\r | |
849 | @param[in, out] SenseDataSize Size of SenseData in bytes.\r | |
850 | @param[out] SenseDataNumber Pointer to the value for the sense data size.\r | |
ad86a50a | 851 | \r |
852 | @retval EFI_SUCCESS The command was accepted without any errors.\r | |
853 | @retval EFI_NOT_FOUND Device does not support this data class.\r | |
854 | @retval EFI_DEVICE_ERROR Error reading SenseData from device.\r | |
855 | @retval EFI_BUFFER_TOO_SMALL SenseDataSize not big enough.\r | |
856 | \r | |
857 | **/\r | |
858 | EFI_STATUS\r | |
859 | EFIAPI\r | |
860 | AtaDiskInfoSenseData (\r | |
861 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
862 | IN OUT VOID *SenseData,\r | |
863 | IN OUT UINT32 *SenseDataSize,\r | |
864 | OUT UINT8 *SenseDataNumber\r | |
865 | );\r | |
866 | \r | |
867 | \r | |
868 | /**\r | |
869 | This function is used by the IDE bus driver to get controller information.\r | |
870 | \r | |
58727f29 | 871 | @param[in] This Pointer to the EFI_DISK_INFO_PROTOCOL instance.\r |
ad86a50a | 872 | @param[out] IdeChannel Pointer to the Ide Channel number. Primary or secondary.\r |
873 | @param[out] IdeDevice Pointer to the Ide Device number. Master or slave.\r | |
874 | \r | |
875 | @retval EFI_SUCCESS IdeChannel and IdeDevice are valid.\r | |
876 | @retval EFI_UNSUPPORTED This is not an IDE device.\r | |
877 | \r | |
878 | **/\r | |
879 | EFI_STATUS\r | |
880 | EFIAPI\r | |
881 | AtaDiskInfoWhichIde (\r | |
882 | IN EFI_DISK_INFO_PROTOCOL *This,\r | |
883 | OUT UINT32 *IdeChannel,\r | |
884 | OUT UINT32 *IdeDevice\r | |
885 | );\r | |
886 | \r | |
c24097a5 | 887 | /**\r |
888 | Send a security protocol command to a device that receives data and/or the result\r | |
889 | of one or more commands sent by SendData.\r | |
890 | \r | |
891 | The ReceiveData function sends a security protocol command to the given MediaId.\r | |
892 | The security protocol command sent is defined by SecurityProtocolId and contains\r | |
893 | the security protocol specific data SecurityProtocolSpecificData. The function\r | |
894 | returns the data from the security protocol command in PayloadBuffer.\r | |
895 | \r | |
896 | For devices supporting the SCSI command set, the security protocol command is sent\r | |
897 | using the SECURITY PROTOCOL IN command defined in SPC-4.\r | |
898 | \r | |
899 | For devices supporting the ATA command set, the security protocol command is sent\r | |
900 | using one of the TRUSTED RECEIVE commands defined in ATA8-ACS if PayloadBufferSize\r | |
901 | is non-zero.\r | |
902 | \r | |
903 | If the PayloadBufferSize is zero, the security protocol command is sent using the\r | |
904 | Trusted Non-Data command defined in ATA8-ACS.\r | |
905 | \r | |
906 | If PayloadBufferSize is too small to store the available data from the security\r | |
907 | protocol command, the function shall copy PayloadBufferSize bytes into the\r | |
908 | PayloadBuffer and return EFI_WARN_BUFFER_TOO_SMALL.\r | |
909 | \r | |
910 | If PayloadBuffer or PayloadTransferSize is NULL and PayloadBufferSize is non-zero,\r | |
911 | the function shall return EFI_INVALID_PARAMETER.\r | |
912 | \r | |
913 | If the given MediaId does not support security protocol commands, the function shall\r | |
914 | return EFI_UNSUPPORTED. If there is no media in the device, the function returns\r | |
915 | EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the device,\r | |
916 | the function returns EFI_MEDIA_CHANGED.\r | |
917 | \r | |
918 | If the security protocol fails to complete within the Timeout period, the function\r | |
919 | shall return EFI_TIMEOUT.\r | |
920 | \r | |
921 | If the security protocol command completes without an error, the function shall\r | |
922 | return EFI_SUCCESS. If the security protocol command completes with an error, the\r | |
923 | function shall return EFI_DEVICE_ERROR.\r | |
924 | \r | |
925 | @param This Indicates a pointer to the calling context.\r | |
926 | @param MediaId ID of the medium to receive data from.\r | |
927 | @param Timeout The timeout, in 100ns units, to use for the execution\r | |
928 | of the security protocol command. A Timeout value of 0\r | |
929 | means that this function will wait indefinitely for the\r | |
930 | security protocol command to execute. If Timeout is greater\r | |
931 | than zero, then this function will return EFI_TIMEOUT\r | |
932 | if the time required to execute the receive data command\r | |
933 | is greater than Timeout.\r | |
934 | @param SecurityProtocolId The value of the "Security Protocol" parameter of\r | |
935 | the security protocol command to be sent.\r | |
936 | @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r | |
937 | of the security protocol command to be sent.\r | |
938 | @param PayloadBufferSize Size in bytes of the payload data buffer.\r | |
939 | @param PayloadBuffer A pointer to a destination buffer to store the security\r | |
940 | protocol command specific payload data for the security\r | |
941 | protocol command. The caller is responsible for having\r | |
942 | either implicit or explicit ownership of the buffer.\r | |
943 | @param PayloadTransferSize A pointer to a buffer to store the size in bytes of the\r | |
944 | data written to the payload data buffer.\r | |
945 | \r | |
946 | @retval EFI_SUCCESS The security protocol command completed successfully.\r | |
947 | @retval EFI_WARN_BUFFER_TOO_SMALL The PayloadBufferSize was too small to store the available\r | |
948 | data from the device. The PayloadBuffer contains the truncated data.\r | |
949 | @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r | |
950 | @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r | |
951 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
952 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
953 | @retval EFI_INVALID_PARAMETER The PayloadBuffer or PayloadTransferSize is NULL and\r | |
954 | PayloadBufferSize is non-zero.\r | |
955 | @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r | |
956 | protocol command to execute.\r | |
957 | \r | |
958 | **/\r | |
959 | EFI_STATUS\r | |
960 | EFIAPI\r | |
961 | AtaStorageSecurityReceiveData (\r | |
962 | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r | |
963 | IN UINT32 MediaId,\r | |
964 | IN UINT64 Timeout,\r | |
965 | IN UINT8 SecurityProtocolId,\r | |
966 | IN UINT16 SecurityProtocolSpecificData,\r | |
967 | IN UINTN PayloadBufferSize,\r | |
968 | OUT VOID *PayloadBuffer,\r | |
969 | OUT UINTN *PayloadTransferSize\r | |
86d8e199 | 970 | );\r |
c24097a5 | 971 | \r |
972 | /**\r | |
973 | Send a security protocol command to a device.\r | |
974 | \r | |
975 | The SendData function sends a security protocol command containing the payload\r | |
976 | PayloadBuffer to the given MediaId. The security protocol command sent is\r | |
977 | defined by SecurityProtocolId and contains the security protocol specific data\r | |
978 | SecurityProtocolSpecificData. If the underlying protocol command requires a\r | |
979 | specific padding for the command payload, the SendData function shall add padding\r | |
980 | bytes to the command payload to satisfy the padding requirements.\r | |
981 | \r | |
982 | For devices supporting the SCSI command set, the security protocol command is sent\r | |
983 | using the SECURITY PROTOCOL OUT command defined in SPC-4.\r | |
984 | \r | |
985 | For devices supporting the ATA command set, the security protocol command is sent\r | |
986 | using one of the TRUSTED SEND commands defined in ATA8-ACS if PayloadBufferSize\r | |
987 | is non-zero. If the PayloadBufferSize is zero, the security protocol command is\r | |
988 | sent using the Trusted Non-Data command defined in ATA8-ACS.\r | |
989 | \r | |
990 | If PayloadBuffer is NULL and PayloadBufferSize is non-zero, the function shall\r | |
991 | return EFI_INVALID_PARAMETER.\r | |
992 | \r | |
993 | If the given MediaId does not support security protocol commands, the function\r | |
994 | shall return EFI_UNSUPPORTED. If there is no media in the device, the function\r | |
995 | returns EFI_NO_MEDIA. If the MediaId is not the ID for the current media in the\r | |
996 | device, the function returns EFI_MEDIA_CHANGED.\r | |
997 | \r | |
998 | If the security protocol fails to complete within the Timeout period, the function\r | |
999 | shall return EFI_TIMEOUT.\r | |
1000 | \r | |
1001 | If the security protocol command completes without an error, the function shall return\r | |
1002 | EFI_SUCCESS. If the security protocol command completes with an error, the function\r | |
1003 | shall return EFI_DEVICE_ERROR.\r | |
1004 | \r | |
1005 | @param This Indicates a pointer to the calling context.\r | |
1006 | @param MediaId ID of the medium to receive data from.\r | |
1007 | @param Timeout The timeout, in 100ns units, to use for the execution\r | |
1008 | of the security protocol command. A Timeout value of 0\r | |
1009 | means that this function will wait indefinitely for the\r | |
1010 | security protocol command to execute. If Timeout is greater\r | |
1011 | than zero, then this function will return EFI_TIMEOUT\r | |
1012 | if the time required to execute the receive data command\r | |
1013 | is greater than Timeout.\r | |
1014 | @param SecurityProtocolId The value of the "Security Protocol" parameter of\r | |
1015 | the security protocol command to be sent.\r | |
1016 | @param SecurityProtocolSpecificData The value of the "Security Protocol Specific" parameter\r | |
1017 | of the security protocol command to be sent.\r | |
1018 | @param PayloadBufferSize Size in bytes of the payload data buffer.\r | |
1019 | @param PayloadBuffer A pointer to a destination buffer to store the security\r | |
1020 | protocol command specific payload data for the security\r | |
1021 | protocol command.\r | |
1022 | \r | |
1023 | @retval EFI_SUCCESS The security protocol command completed successfully.\r | |
1024 | @retval EFI_UNSUPPORTED The given MediaId does not support security protocol commands.\r | |
1025 | @retval EFI_DEVICE_ERROR The security protocol command completed with an error.\r | |
1026 | @retval EFI_NO_MEDIA There is no media in the device.\r | |
1027 | @retval EFI_MEDIA_CHANGED The MediaId is not for the current media.\r | |
1028 | @retval EFI_INVALID_PARAMETER The PayloadBuffer is NULL and PayloadBufferSize is non-zero.\r | |
1029 | @retval EFI_TIMEOUT A timeout occurred while waiting for the security\r | |
1030 | protocol command to execute.\r | |
1031 | \r | |
1032 | **/\r | |
1033 | EFI_STATUS\r | |
1034 | EFIAPI\r | |
1035 | AtaStorageSecuritySendData (\r | |
1036 | IN EFI_STORAGE_SECURITY_COMMAND_PROTOCOL *This,\r | |
1037 | IN UINT32 MediaId,\r | |
1038 | IN UINT64 Timeout,\r | |
1039 | IN UINT8 SecurityProtocolId,\r | |
1040 | IN UINT16 SecurityProtocolSpecificData,\r | |
1041 | IN UINTN PayloadBufferSize,\r | |
1042 | IN VOID *PayloadBuffer\r | |
86d8e199 | 1043 | );\r |
c24097a5 | 1044 | \r |
ad86a50a | 1045 | #endif\r |