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