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