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