]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AtaAtapiPassThru.h
MdePkg Protocol/AtaPassThru.h: Update PortMultiplierPort related comments
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaAtapiPassThru / AtaAtapiPassThru.h
CommitLineData
4b738c76
HT
1/** @file\r
2 Header file for ATA/ATAPI PASS THRU driver.\r
3\r
4 Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR>\r
5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14#ifndef __ATA_ATAPI_PASS_THRU_H__\r
15#define __ATA_ATAPI_PASS_THRU_H__\r
16\r
17#include <Uefi.h>\r
18\r
19#include <IndustryStandard/Pci.h>\r
20#include <IndustryStandard/Atapi.h>\r
21#include <IndustryStandard/Scsi.h>\r
22\r
23#include <Protocol/PciIo.h>\r
24#include <Protocol/IdeControllerInit.h>\r
25#include <Protocol/AtaPassThru.h>\r
26#include <Protocol/ScsiPassThruExt.h>\r
27\r
28#include <Library/DebugLib.h>\r
29#include <Library/BaseLib.h>\r
30#include <Library/BaseMemoryLib.h>\r
31#include <Library/UefiDriverEntryPoint.h>\r
32#include <Library/UefiBootServicesTableLib.h>\r
33#include <Library/UefiLib.h>\r
34#include <Library/PciLib.h>\r
35#include <Library/PcdLib.h>\r
36#include <Library/TimerLib.h>\r
37#include <Library/MemoryAllocationLib.h>\r
38#include <Library/ReportStatusCodeLib.h>\r
39#include <Library/DevicePathLib.h>\r
40\r
41#include "IdeMode.h"\r
42#include "AhciMode.h"\r
43\r
44extern EFI_DRIVER_BINDING_PROTOCOL gAtaAtapiPassThruDriverBinding;\r
45extern EFI_COMPONENT_NAME_PROTOCOL gAtaAtapiPassThruComponentName;\r
46extern EFI_COMPONENT_NAME2_PROTOCOL gAtaAtapiPassThruComponentName2;\r
47\r
48#define ATA_ATAPI_PASS_THRU_SIGNATURE SIGNATURE_32 ('a', 'a', 'p', 't')\r
49#define ATA_ATAPI_DEVICE_SIGNATURE SIGNATURE_32 ('a', 'd', 'e', 'v')\r
50#define ATA_NONBLOCKING_TASK_SIGNATURE SIGNATURE_32 ('a', 't', 's', 'k')\r
51\r
52typedef struct _ATA_NONBLOCK_TASK ATA_NONBLOCK_TASK;\r
53\r
54typedef enum {\r
55 EfiAtaIdeMode,\r
56 EfiAtaAhciMode,\r
57 EfiAtaRaidMode,\r
58 EfiAtaUnknownMode\r
59} EFI_ATA_HC_WORK_MODE;\r
60\r
61typedef enum {\r
62 EfiIdeCdrom, /* ATAPI CDROM */\r
63 EfiIdeHarddisk, /* Hard Disk */\r
64 EfiPortMultiplier, /* Port Multiplier */\r
65 EfiIdeUnknown\r
66} EFI_ATA_DEVICE_TYPE;\r
67\r
68//\r
69// Ahci mode device info\r
70//\r
71typedef struct {\r
72 UINT32 Signature;\r
73 LIST_ENTRY Link;\r
74\r
75 UINT16 Port;\r
76 UINT16 PortMultiplier;\r
77 EFI_ATA_DEVICE_TYPE Type;\r
78\r
79 EFI_IDENTIFY_DATA *IdentifyData;\r
80} EFI_ATA_DEVICE_INFO;\r
81\r
82typedef struct {\r
83 UINT32 Signature;\r
84\r
85 EFI_HANDLE ControllerHandle;\r
86 EFI_PCI_IO_PROTOCOL *PciIo;\r
87 EFI_IDE_CONTROLLER_INIT_PROTOCOL *IdeControllerInit;\r
88\r
89 EFI_ATA_PASS_THRU_MODE AtaPassThruMode;\r
90 EFI_ATA_PASS_THRU_PROTOCOL AtaPassThru;\r
91 EFI_EXT_SCSI_PASS_THRU_MODE ExtScsiPassThruMode;\r
92 EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;\r
93\r
94 EFI_ATA_HC_WORK_MODE Mode;\r
95\r
96 EFI_IDE_REGISTERS IdeRegisters[EfiIdeMaxChannel];\r
97 EFI_AHCI_REGISTERS AhciRegisters;\r
98\r
99 //\r
100 // The attached device list\r
101 //\r
102 LIST_ENTRY DeviceList;\r
103 UINT64 OriginalPciAttributes;\r
104\r
105 //\r
106 // For AtaPassThru protocol, using the following bytes to record the previous call in\r
107 // GetNextPort()/GetNextDevice().\r
108 //\r
109 UINT16 PreviousPort;\r
110 UINT16 PreviousPortMultiplier;\r
111 //\r
112 // For ExtScsiPassThru protocol, using the following bytes to record the previous call in\r
113 // GetNextTarget()/GetNextTargetLun().\r
114 //\r
115 UINT16 PreviousTargetId;\r
116 UINT64 PreviousLun;\r
117\r
118 //\r
119 // For Non-blocking.\r
120 //\r
121 EFI_EVENT TimerEvent;\r
122 LIST_ENTRY NonBlockingTaskList;\r
123} ATA_ATAPI_PASS_THRU_INSTANCE;\r
124\r
125//\r
126// Task for Non-blocking mode.\r
127//\r
128struct _ATA_NONBLOCK_TASK {\r
129 UINT32 Signature;\r
130 LIST_ENTRY Link;\r
131\r
132 UINT16 Port;\r
133 UINT16 PortMultiplier;\r
134 EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet;\r
135 BOOLEAN IsStart;\r
136 EFI_EVENT Event;\r
137 UINT64 RetryTimes;\r
ab82122d
TF
138 BOOLEAN InfiniteWait;\r
139 VOID *Map; // Pointer to map.\r
140 VOID *TableMap; // Pointer to PRD table map.\r
4b738c76 141 EFI_ATA_DMA_PRD *MapBaseAddress; // Pointer to range Base address for Map.\r
ab82122d 142 UINTN PageCount; // The page numbers used by PCIO freebuffer.\r
4b738c76
HT
143};\r
144\r
145//\r
146// Timeout value which uses 100ns as a unit.\r
147// It means 3 second span.\r
148//\r
149#define ATA_ATAPI_TIMEOUT EFI_TIMER_PERIOD_SECONDS(3)\r
150\r
151#define IS_ALIGNED(addr, size) (((UINTN) (addr) & (size - 1)) == 0)\r
152\r
153#define ATA_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \\r
154 CR (a, \\r
155 ATA_ATAPI_PASS_THRU_INSTANCE, \\r
156 AtaPassThru, \\r
157 ATA_ATAPI_PASS_THRU_SIGNATURE \\r
158 )\r
159\r
160#define EXT_SCSI_PASS_THRU_PRIVATE_DATA_FROM_THIS(a) \\r
161 CR (a, \\r
162 ATA_ATAPI_PASS_THRU_INSTANCE, \\r
163 ExtScsiPassThru, \\r
164 ATA_ATAPI_PASS_THRU_SIGNATURE \\r
165 )\r
166\r
167#define ATA_ATAPI_DEVICE_INFO_FROM_THIS(a) \\r
168 CR (a, \\r
169 EFI_ATA_DEVICE_INFO, \\r
170 Link, \\r
171 ATA_ATAPI_DEVICE_SIGNATURE \\r
172 );\r
173\r
174#define ATA_NON_BLOCK_TASK_FROM_ENTRY(a) \\r
175 CR (a, \\r
176 ATA_NONBLOCK_TASK, \\r
177 Link, \\r
178 ATA_NONBLOCKING_TASK_SIGNATURE \\r
179 );\r
180\r
181/**\r
182 Retrieves a Unicode string that is the user readable name of the driver.\r
183\r
184 This function retrieves the user readable name of a driver in the form of a\r
185 Unicode string. If the driver specified by This has a user readable name in\r
186 the language specified by Language, then a pointer to the driver name is\r
187 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
188 by This does not support the language specified by Language,\r
189 then EFI_UNSUPPORTED is returned.\r
190\r
191 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
192 EFI_COMPONENT_NAME_PROTOCOL instance.\r
193\r
194 @param Language[in] A pointer to a Null-terminated ASCII string\r
195 array indicating the language. This is the\r
196 language of the driver name that the caller is\r
197 requesting, and it must match one of the\r
198 languages specified in SupportedLanguages. The\r
199 number of languages supported by a driver is up\r
200 to the driver writer. Language is specified\r
201 in RFC 4646 or ISO 639-2 language code format.\r
202\r
203 @param DriverName[out] A pointer to the Unicode string to return.\r
204 This Unicode string is the name of the\r
205 driver specified by This in the language\r
206 specified by Language.\r
207\r
208 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
209 This and the language specified by Language was\r
210 returned in DriverName.\r
211\r
212 @retval EFI_INVALID_PARAMETER Language is NULL.\r
213\r
214 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
215\r
216 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
217 the language specified by Language.\r
218\r
219**/\r
220EFI_STATUS\r
221EFIAPI\r
222AtaAtapiPassThruComponentNameGetDriverName (\r
223 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
224 IN CHAR8 *Language,\r
225 OUT CHAR16 **DriverName\r
226 );\r
227\r
228/**\r
229 Retrieves a Unicode string that is the user readable name of the controller\r
230 that is being managed by a driver.\r
231\r
232 This function retrieves the user readable name of the controller specified by\r
233 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
234 driver specified by This has a user readable name in the language specified by\r
235 Language, then a pointer to the controller name is returned in ControllerName,\r
236 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
237 managing the controller specified by ControllerHandle and ChildHandle,\r
238 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
239 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
240\r
241 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
242 EFI_COMPONENT_NAME_PROTOCOL instance.\r
243\r
244 @param ControllerHandle[in] The handle of a controller that the driver\r
245 specified by This is managing. This handle\r
246 specifies the controller whose name is to be\r
247 returned.\r
248\r
249 @param ChildHandle[in] The handle of the child controller to retrieve\r
250 the name of. This is an optional parameter that\r
251 may be NULL. It will be NULL for device\r
252 drivers. It will also be NULL for a bus drivers\r
253 that wish to retrieve the name of the bus\r
254 controller. It will not be NULL for a bus\r
255 driver that wishes to retrieve the name of a\r
256 child controller.\r
257\r
258 @param Language[in] A pointer to a Null-terminated ASCII string\r
259 array indicating the language. This is the\r
260 language of the driver name that the caller is\r
261 requesting, and it must match one of the\r
262 languages specified in SupportedLanguages. The\r
263 number of languages supported by a driver is up\r
264 to the driver writer. Language is specified in\r
265 RFC 4646 or ISO 639-2 language code format.\r
266\r
267 @param ControllerName[out] A pointer to the Unicode string to return.\r
268 This Unicode string is the name of the\r
269 controller specified by ControllerHandle and\r
270 ChildHandle in the language specified by\r
271 Language from the point of view of the driver\r
272 specified by This.\r
273\r
274 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
275 the language specified by Language for the\r
276 driver specified by This was returned in\r
277 DriverName.\r
278\r
279 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
280\r
281 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
282 EFI_HANDLE.\r
283\r
284 @retval EFI_INVALID_PARAMETER Language is NULL.\r
285\r
286 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
287\r
288 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
289 managing the controller specified by\r
290 ControllerHandle and ChildHandle.\r
291\r
292 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
293 the language specified by Language.\r
294\r
295**/\r
296EFI_STATUS\r
297EFIAPI\r
298AtaAtapiPassThruComponentNameGetControllerName (\r
299 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
300 IN EFI_HANDLE ControllerHandle,\r
301 IN EFI_HANDLE ChildHandle OPTIONAL,\r
302 IN CHAR8 *Language,\r
303 OUT CHAR16 **ControllerName\r
304 );\r
305\r
306/**\r
307 Tests to see if this driver supports a given controller. If a child device is provided,\r
308 it further tests to see if this driver supports creating a handle for the specified child device.\r
309\r
310 This function checks to see if the driver specified by This supports the device specified by\r
311 ControllerHandle. Drivers will typically use the device path attached to\r
312 ControllerHandle and/or the services from the bus I/O abstraction attached to\r
313 ControllerHandle to determine if the driver supports ControllerHandle. This function\r
314 may be called many times during platform initialization. In order to reduce boot times, the tests\r
315 performed by this function must be very small, and take as little time as possible to execute. This\r
316 function must not change the state of any hardware devices, and this function must be aware that the\r
317 device specified by ControllerHandle may already be managed by the same driver or a\r
318 different driver. This function must match its calls to AllocatePages() with FreePages(),\r
319 AllocatePool() with FreePool(), and OpenProtocol() with CloseProtocol().\r
320 Because ControllerHandle may have been previously started by the same driver, if a protocol is\r
321 already in the opened state, then it must not be closed with CloseProtocol(). This is required\r
322 to guarantee the state of ControllerHandle is not modified by this function.\r
323\r
324 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
325 @param[in] ControllerHandle The handle of the controller to test. This handle\r
326 must support a protocol interface that supplies\r
327 an I/O abstraction to the driver.\r
328 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
329 parameter is ignored by device drivers, and is optional for bus\r
330 drivers. For bus drivers, if this parameter is not NULL, then\r
331 the bus driver must determine if the bus controller specified\r
332 by ControllerHandle and the child controller specified\r
333 by RemainingDevicePath are both supported by this\r
334 bus driver.\r
335\r
336 @retval EFI_SUCCESS The device specified by ControllerHandle and\r
337 RemainingDevicePath is supported by the driver specified by This.\r
338 @retval EFI_ALREADY_STARTED The device specified by ControllerHandle and\r
339 RemainingDevicePath is already being managed by the driver\r
340 specified by This.\r
341 @retval EFI_ACCESS_DENIED The device specified by ControllerHandle and\r
342 RemainingDevicePath is already being managed by a different\r
343 driver or an application that requires exclusive access.\r
344 Currently not implemented.\r
345 @retval EFI_UNSUPPORTED The device specified by ControllerHandle and\r
346 RemainingDevicePath is not supported by the driver specified by This.\r
347**/\r
348EFI_STATUS\r
349EFIAPI\r
350AtaAtapiPassThruSupported (\r
351 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
352 IN EFI_HANDLE Controller,\r
353 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
354 );\r
355\r
356/**\r
357 Starts a device controller or a bus controller.\r
358\r
359 The Start() function is designed to be invoked from the EFI boot service ConnectController().\r
360 As a result, much of the error checking on the parameters to Start() has been moved into this\r
361 common boot service. It is legal to call Start() from other locations,\r
362 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
363 1. ControllerHandle must be a valid EFI_HANDLE.\r
364 2. If RemainingDevicePath is not NULL, then it must be a pointer to a naturally aligned\r
365 EFI_DEVICE_PATH_PROTOCOL.\r
366 3. Prior to calling Start(), the Supported() function for the driver specified by This must\r
367 have been called with the same calling parameters, and Supported() must have returned EFI_SUCCESS.\r
368\r
369 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
370 @param[in] ControllerHandle The handle of the controller to start. This handle\r
371 must support a protocol interface that supplies\r
372 an I/O abstraction to the driver.\r
373 @param[in] RemainingDevicePath A pointer to the remaining portion of a device path. This\r
374 parameter is ignored by device drivers, and is optional for bus\r
375 drivers. For a bus driver, if this parameter is NULL, then handles\r
376 for all the children of Controller are created by this driver.\r
377 If this parameter is not NULL and the first Device Path Node is\r
378 not the End of Device Path Node, then only the handle for the\r
379 child device specified by the first Device Path Node of\r
380 RemainingDevicePath is created by this driver.\r
381 If the first Device Path Node of RemainingDevicePath is\r
382 the End of Device Path Node, no child handle is created by this\r
383 driver.\r
384\r
385 @retval EFI_SUCCESS The device was started.\r
386 @retval EFI_DEVICE_ERROR The device could not be started due to a device error.Currently not implemented.\r
387 @retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack of resources.\r
388 @retval Others The driver failded to start the device.\r
389\r
390**/\r
391EFI_STATUS\r
392EFIAPI\r
393AtaAtapiPassThruStart (\r
394 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
395 IN EFI_HANDLE Controller,\r
396 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
397 );\r
398\r
399/**\r
400 Stops a device controller or a bus controller.\r
401\r
402 The Stop() function is designed to be invoked from the EFI boot service DisconnectController().\r
403 As a result, much of the error checking on the parameters to Stop() has been moved\r
404 into this common boot service. It is legal to call Stop() from other locations,\r
405 but the following calling restrictions must be followed, or the system behavior will not be deterministic.\r
406 1. ControllerHandle must be a valid EFI_HANDLE that was used on a previous call to this\r
407 same driver's Start() function.\r
408 2. The first NumberOfChildren handles of ChildHandleBuffer must all be a valid\r
409 EFI_HANDLE. In addition, all of these handles must have been created in this driver's\r
410 Start() function, and the Start() function must have called OpenProtocol() on\r
411 ControllerHandle with an Attribute of EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER.\r
412\r
413 @param[in] This A pointer to the EFI_DRIVER_BINDING_PROTOCOL instance.\r
414 @param[in] ControllerHandle A handle to the device being stopped. The handle must\r
415 support a bus specific I/O protocol for the driver\r
416 to use to stop the device.\r
417 @param[in] NumberOfChildren The number of child device handles in ChildHandleBuffer.\r
418 @param[in] ChildHandleBuffer An array of child handles to be freed. May be NULL\r
419 if NumberOfChildren is 0.\r
420\r
421 @retval EFI_SUCCESS The device was stopped.\r
422 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
423\r
424**/\r
425EFI_STATUS\r
426EFIAPI\r
427AtaAtapiPassThruStop (\r
428 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
429 IN EFI_HANDLE Controller,\r
430 IN UINTN NumberOfChildren,\r
431 IN EFI_HANDLE *ChildHandleBuffer\r
432 );\r
433\r
434/**\r
435 Traverse the attached ATA devices list to find out the device to access.\r
436\r
437 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
438 @param[in] Port The port number of the ATA device to send the command.\r
439 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
440 If there is no port multiplier, then specify 0.\r
441 @param[in] DeviceType The device type of the ATA device.\r
442\r
443 @retval The pointer to the data structure of the device info to access.\r
444\r
445**/\r
446LIST_ENTRY *\r
447EFIAPI\r
448SearchDeviceInfoList (\r
449 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
450 IN UINT16 Port,\r
451 IN UINT16 PortMultiplier,\r
452 IN EFI_ATA_DEVICE_TYPE DeviceType\r
453 );\r
454\r
455/**\r
456 Allocate device info data structure to contain device info.\r
457 And insert the data structure to the tail of device list for tracing.\r
458\r
459 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
460 @param[in] Port The port number of the ATA device to send the command.\r
461 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
462 If there is no port multiplier, then specify 0.\r
463 @param[in] DeviceType The device type of the ATA device.\r
464 @param[in] IdentifyData The data buffer to store the output of the IDENTIFY cmd.\r
465\r
466 @retval EFI_SUCCESS Successfully insert the ata device to the tail of device list.\r
467 @retval EFI_OUT_OF_RESOURCES Can not allocate enough resource for use.\r
468\r
469**/\r
470EFI_STATUS\r
471EFIAPI\r
472CreateNewDeviceInfo (\r
473 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
474 IN UINT16 Port,\r
475 IN UINT16 PortMultiplier,\r
476 IN EFI_ATA_DEVICE_TYPE DeviceType,\r
477 IN EFI_IDENTIFY_DATA *IdentifyData\r
478 );\r
479\r
480/**\r
481 Destroy all attached ATA devices info.\r
482\r
483 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
484\r
485**/\r
486VOID\r
487EFIAPI\r
488DestroyDeviceInfoList (\r
489 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
490 );\r
491\r
492/**\r
493 Destroy all pending non blocking tasks.\r
494\r
495 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
496 @param[in] IsSigEvent Indicate whether signal the task event when remove the\r
497 task.\r
498\r
499**/\r
500VOID\r
501EFIAPI\r
502DestroyAsynTaskList (\r
503 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
504 IN BOOLEAN IsSigEvent\r
505 );\r
506\r
507/**\r
508 Enumerate all attached ATA devices at IDE mode or AHCI mode separately.\r
509\r
510 The function is designed to enumerate all attached ATA devices.\r
511\r
512 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
513\r
514 @retval EFI_SUCCESS Successfully enumerate attached ATA devices.\r
515 @retval EFI_DEVICE_ERROR The device could not be stopped due to a device error.\r
516\r
517**/\r
518EFI_STATUS\r
519EFIAPI\r
520EnumerateAttachedDevice (\r
521 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
522 );\r
523\r
524/**\r
525 Call back funtion when the timer event is signaled.\r
526\r
527 @param[in] Event The Event this notify function registered to.\r
528 @param[in] Context Pointer to the context data registered to the\r
529 Event.\r
530\r
531**/\r
532VOID\r
533EFIAPI\r
534AsyncNonBlockingTransferRoutine (\r
535 EFI_EVENT Event,\r
536 VOID* Context\r
537 );\r
538\r
539/**\r
540 Sends an ATA command to an ATA device that is attached to the ATA controller. This function\r
541 supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,\r
542 and the non-blocking I/O functionality is optional.\r
543\r
544 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
545 @param[in] Port The port number of the ATA device to send the command.\r
546 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
547 If there is no port multiplier, then specify 0.\r
548 @param[in, out] Packet A pointer to the ATA command to send to the ATA device specified by Port\r
549 and PortMultiplierPort.\r
550 @param[in] Event If non-blocking I/O is not supported then Event is ignored, and blocking\r
551 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
552 Event is not NULL and non blocking I/O is supported, then non-blocking\r
553 I/O is performed, and Event will be signaled when the ATA command completes.\r
554\r
555 @retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands,\r
556 InTransferLength bytes were transferred from InDataBuffer. For write and\r
557 bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.\r
558 @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred\r
559 is returned in InTransferLength. For write and bi-directional commands,\r
560 OutTransferLength bytes were transferred by OutDataBuffer.\r
561 @retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands\r
562 already queued. The caller may retry again later.\r
563 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the ATA command.\r
564 @retval EFI_INVALID_PARAMETER Port, PortMultiplierPort, or the contents of Acb are invalid. The ATA\r
565 command was not sent, so no additional status information is available.\r
566\r
567**/\r
568EFI_STATUS\r
569EFIAPI\r
570AtaPassThruPassThru (\r
571 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
572 IN UINT16 Port,\r
573 IN UINT16 PortMultiplierPort,\r
574 IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,\r
575 IN EFI_EVENT Event OPTIONAL\r
576 );\r
577\r
578/**\r
579 Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.\r
580 These can either be the list of ports where ATA devices are actually present or the\r
581 list of legal port numbers for the ATA controller. Regardless, the caller of this\r
582 function must probe the port number returned to see if an ATA device is actually\r
583 present at that location on the ATA controller.\r
584\r
585 The GetNextPort() function retrieves the port number on an ATA controller. If on input\r
586 Port is 0xFFFF, then the port number of the first port on the ATA controller is returned\r
587 in Port and EFI_SUCCESS is returned.\r
588\r
589 If Port is a port number that was returned on a previous call to GetNextPort(), then the\r
590 port number of the next port on the ATA controller is returned in Port, and EFI_SUCCESS\r
591 is returned. If Port is not 0xFFFF and Port was not returned on a previous call to\r
592 GetNextPort(), then EFI_INVALID_PARAMETER is returned.\r
593\r
594 If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is\r
595 returned.\r
596\r
597 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
598 @param[in, out] Port On input, a pointer to the port number on the ATA controller.\r
599 On output, a pointer to the next port number on the ATA\r
600 controller. An input value of 0xFFFF retrieves the first port\r
601 number on the ATA controller.\r
602\r
603 @retval EFI_SUCCESS The next port number on the ATA controller was returned in Port.\r
604 @retval EFI_NOT_FOUND There are no more ports on this ATA controller.\r
605 @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned on a previous call\r
606 to GetNextPort().\r
607\r
608**/\r
609EFI_STATUS\r
610EFIAPI\r
611AtaPassThruGetNextPort (\r
612 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
613 IN OUT UINT16 *Port\r
614 );\r
615\r
616/**\r
617 Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA\r
618 controller. These can either be the list of port multiplier ports where ATA devices are actually\r
619 present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this\r
620 function must probe the port number and port multiplier port number returned to see if an ATA\r
621 device is actually present.\r
622\r
623 The GetNextDevice() function retrieves the port multiplier port number of an ATA device\r
624 present on a port of an ATA controller.\r
625\r
626 If PortMultiplierPort points to a port multiplier port number value that was returned on a\r
627 previous call to GetNextDevice(), then the port multiplier port number of the next ATA device\r
628 on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is\r
629 returned.\r
630\r
631 If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first\r
632 ATA device on port of the ATA controller is returned in PortMultiplierPort and\r
633 EFI_SUCCESS is returned.\r
634\r
635 If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort\r
636 was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER\r
637 is returned.\r
638\r
639 If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of\r
640 the ATA controller, then EFI_NOT_FOUND is returned.\r
641\r
642 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
643 @param[in] Port The port number present on the ATA controller.\r
644 @param[in, out] PortMultiplierPort On input, a pointer to the port multiplier port number of an\r
645 ATA device present on the ATA controller.\r
646 If on input a PortMultiplierPort of 0xFFFF is specified,\r
647 then the port multiplier port number of the first ATA device\r
648 is returned. On output, a pointer to the port multiplier port\r
649 number of the next ATA device present on an ATA controller.\r
650\r
651 @retval EFI_SUCCESS The port multiplier port number of the next ATA device on the port\r
652 of the ATA controller was returned in PortMultiplierPort.\r
653 @retval EFI_NOT_FOUND There are no more ATA devices on this port of the ATA controller.\r
654 @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort was not\r
655 returned on a previous call to GetNextDevice().\r
656\r
657**/\r
658EFI_STATUS\r
659EFIAPI\r
660AtaPassThruGetNextDevice (\r
661 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
662 IN UINT16 Port,\r
663 IN OUT UINT16 *PortMultiplierPort\r
664 );\r
665\r
666/**\r
667 Used to allocate and build a device path node for an ATA device on an ATA controller.\r
668\r
669 The BuildDevicePath() function allocates and builds a single device node for the ATA\r
670 device specified by Port and PortMultiplierPort. If the ATA device specified by Port and\r
671 PortMultiplierPort is not present on the ATA controller, then EFI_NOT_FOUND is returned.\r
672 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned. If there are not enough\r
673 resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.\r
674\r
675 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of\r
676 DevicePath are initialized to describe the ATA device specified by Port and PortMultiplierPort,\r
677 and EFI_SUCCESS is returned.\r
678\r
679 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
680 @param[in] Port Port specifies the port number of the ATA device for which a\r
681 device path node is to be allocated and built.\r
682 @param[in] PortMultiplierPort The port multiplier port number of the ATA device for which a\r
683 device path node is to be allocated and built. If there is no\r
684 port multiplier, then specify 0.\r
685 @param[in, out] DevicePath A pointer to a single device path node that describes the ATA\r
686 device specified by Port and PortMultiplierPort. This function\r
687 is responsible for allocating the buffer DevicePath with the\r
688 boot service AllocatePool(). It is the caller's responsibility\r
689 to free DevicePath when the caller is finished with DevicePath.\r
690 @retval EFI_SUCCESS The device path node that describes the ATA device specified by\r
691 Port and PortMultiplierPort was allocated and returned in DevicePath.\r
692 @retval EFI_NOT_FOUND The ATA device specified by Port and PortMultiplierPort does not\r
693 exist on the ATA controller.\r
694 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
695 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
696\r
697**/\r
698EFI_STATUS\r
699EFIAPI\r
700AtaPassThruBuildDevicePath (\r
701 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
702 IN UINT16 Port,\r
703 IN UINT16 PortMultiplierPort,\r
704 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
705 );\r
706\r
707/**\r
708 Used to translate a device path node to a port number and port multiplier port number.\r
709\r
710 The GetDevice() function determines the port and port multiplier port number associated with\r
711 the ATA device described by DevicePath. If DevicePath is a device path node type that the\r
712 ATA Pass Thru driver supports, then the ATA Pass Thru driver will attempt to translate the contents\r
713 DevicePath into a port number and port multiplier port number.\r
714\r
715 If this translation is successful, then that port number and port multiplier port number are returned\r
716 in Port and PortMultiplierPort, and EFI_SUCCESS is returned.\r
717\r
718 If DevicePath, Port, or PortMultiplierPort are NULL, then EFI_INVALID_PARAMETER is returned.\r
719\r
720 If DevicePath is not a device path node type that the ATA Pass Thru driver supports, then\r
721 EFI_UNSUPPORTED is returned.\r
722\r
723 If DevicePath is a device path node type that the ATA Pass Thru driver supports, but there is not\r
724 a valid translation from DevicePath to a port number and port multiplier port number, then\r
725 EFI_NOT_FOUND is returned.\r
726\r
727 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
728 @param[in] DevicePath A pointer to the device path node that describes an ATA device on the\r
729 ATA controller.\r
730 @param[out] Port On return, points to the port number of an ATA device on the ATA controller.\r
731 @param[out] PortMultiplierPort On return, points to the port multiplier port number of an ATA device\r
732 on the ATA controller.\r
733\r
734 @retval EFI_SUCCESS DevicePath was successfully translated to a port number and port multiplier\r
735 port number, and they were returned in Port and PortMultiplierPort.\r
736 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
737 @retval EFI_INVALID_PARAMETER Port is NULL.\r
738 @retval EFI_INVALID_PARAMETER PortMultiplierPort is NULL.\r
739 @retval EFI_UNSUPPORTED This driver does not support the device path node type in DevicePath.\r
740 @retval EFI_NOT_FOUND A valid translation from DevicePath to a port number and port multiplier\r
741 port number does not exist.\r
742\r
743**/\r
744EFI_STATUS\r
745EFIAPI\r
746AtaPassThruGetDevice (\r
747 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
748 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
749 OUT UINT16 *Port,\r
750 OUT UINT16 *PortMultiplierPort\r
751 );\r
752\r
753/**\r
754 Resets a specific port on the ATA controller. This operation also resets all the ATA devices\r
755 connected to the port.\r
756\r
757 The ResetChannel() function resets an a specific port on an ATA controller. This operation\r
758 resets all the ATA devices connected to that port. If this ATA controller does not support\r
759 a reset port operation, then EFI_UNSUPPORTED is returned.\r
760\r
761 If a device error occurs while executing that port reset operation, then EFI_DEVICE_ERROR is\r
762 returned.\r
763\r
764 If a timeout occurs during the execution of the port reset operation, then EFI_TIMEOUT is returned.\r
765\r
766 If the port reset operation is completed, then EFI_SUCCESS is returned.\r
767\r
768 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
769 @param[in] Port The port number on the ATA controller.\r
770\r
771 @retval EFI_SUCCESS The ATA controller port was reset.\r
772 @retval EFI_UNSUPPORTED The ATA controller does not support a port reset operation.\r
773 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the ATA port.\r
774 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the ATA port.\r
775\r
776**/\r
777EFI_STATUS\r
778EFIAPI\r
779AtaPassThruResetPort (\r
780 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
781 IN UINT16 Port\r
782 );\r
783\r
784/**\r
785 Resets an ATA device that is connected to an ATA controller.\r
786\r
787 The ResetDevice() function resets the ATA device specified by Port and PortMultiplierPort.\r
788 If this ATA controller does not support a device reset operation, then EFI_UNSUPPORTED is\r
789 returned.\r
790\r
791 If Port or PortMultiplierPort are not in a valid range for this ATA controller, then\r
792 EFI_INVALID_PARAMETER is returned.\r
793\r
794 If a device error occurs while executing that device reset operation, then EFI_DEVICE_ERROR\r
795 is returned.\r
796\r
797 If a timeout occurs during the execution of the device reset operation, then EFI_TIMEOUT is\r
798 returned.\r
799\r
800 If the device reset operation is completed, then EFI_SUCCESS is returned.\r
801\r
802 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
803 @param[in] Port Port represents the port number of the ATA device to be reset.\r
804 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to reset.\r
805 If there is no port multiplier, then specify 0.\r
806 @retval EFI_SUCCESS The ATA device specified by Port and PortMultiplierPort was reset.\r
807 @retval EFI_UNSUPPORTED The ATA controller does not support a device reset operation.\r
808 @retval EFI_INVALID_PARAMETER Port or PortMultiplierPort are invalid.\r
809 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the ATA device\r
810 specified by Port and PortMultiplierPort.\r
811 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the ATA device\r
812 specified by Port and PortMultiplierPort.\r
813\r
814**/\r
815EFI_STATUS\r
816EFIAPI\r
817AtaPassThruResetDevice (\r
818 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
819 IN UINT16 Port,\r
820 IN UINT16 PortMultiplierPort\r
821 );\r
822\r
823/**\r
824 Sends a SCSI Request Packet to a SCSI device that is attached to the SCSI channel. This function\r
825 supports both blocking I/O and nonblocking I/O. The blocking I/O functionality is required, and the\r
826 nonblocking I/O functionality is optional.\r
827\r
828 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
829 @param Target The Target is an array of size TARGET_MAX_BYTES and it represents\r
830 the id of the SCSI device to send the SCSI Request Packet. Each\r
831 transport driver may choose to utilize a subset of this size to suit the needs\r
832 of transport target representation. For example, a Fibre Channel driver\r
833 may use only 8 bytes (WWN) to represent an FC target.\r
834 @param Lun The LUN of the SCSI device to send the SCSI Request Packet.\r
835 @param Packet A pointer to the SCSI Request Packet to send to the SCSI device\r
836 specified by Target and Lun.\r
837 @param Event If nonblocking I/O is not supported then Event is ignored, and blocking\r
838 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
839 Event is not NULL and non blocking I/O is supported, then\r
840 nonblocking I/O is performed, and Event will be signaled when the\r
841 SCSI Request Packet completes.\r
842\r
843 @retval EFI_SUCCESS The SCSI Request Packet was sent by the host. For bi-directional\r
844 commands, InTransferLength bytes were transferred from\r
845 InDataBuffer. For write and bi-directional commands,\r
846 OutTransferLength bytes were transferred by\r
847 OutDataBuffer.\r
848 @retval EFI_BAD_BUFFER_SIZE The SCSI Request Packet was not executed. The number of bytes that\r
849 could be transferred is returned in InTransferLength. For write\r
850 and bi-directional commands, OutTransferLength bytes were\r
851 transferred by OutDataBuffer.\r
852 @retval EFI_NOT_READY The SCSI Request Packet could not be sent because there are too many\r
853 SCSI Request Packets already queued. The caller may retry again later.\r
854 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the SCSI Request\r
855 Packet.\r
856 @retval EFI_INVALID_PARAMETER Target, Lun, or the contents of ScsiRequestPacket are invalid.\r
857 @retval EFI_UNSUPPORTED The command described by the SCSI Request Packet is not supported\r
858 by the host adapter. This includes the case of Bi-directional SCSI\r
859 commands not supported by the implementation. The SCSI Request\r
860 Packet was not sent, so no additional status information is available.\r
861 @retval EFI_TIMEOUT A timeout occurred while waiting for the SCSI Request Packet to execute.\r
862\r
863**/\r
864EFI_STATUS\r
865EFIAPI\r
866ExtScsiPassThruPassThru (\r
867 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
868 IN UINT8 *Target,\r
869 IN UINT64 Lun,\r
870 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
871 IN EFI_EVENT Event OPTIONAL\r
872 );\r
873\r
874/**\r
875 Used to retrieve the list of legal Target IDs and LUNs for SCSI devices on a SCSI channel. These\r
876 can either be the list SCSI devices that are actually present on the SCSI channel, or the list of legal\r
877 Target Ids and LUNs for the SCSI channel. Regardless, the caller of this function must probe the\r
878 Target ID and LUN returned to see if a SCSI device is actually present at that location on the SCSI\r
879 channel.\r
880\r
881 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
882 @param Target On input, a pointer to the Target ID (an array of size\r
883 TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
884 On output, a pointer to the Target ID (an array of\r
885 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
886 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
887 Target array retrieves the Target ID of the first SCSI device present on a\r
888 SCSI channel.\r
889 @param Lun On input, a pointer to the LUN of a SCSI device present on the SCSI\r
890 channel. On output, a pointer to the LUN of the next SCSI device present\r
891 on a SCSI channel.\r
892\r
893 @retval EFI_SUCCESS The Target ID and LUN of the next SCSI device on the SCSI\r
894 channel was returned in Target and Lun.\r
895 @retval EFI_INVALID_PARAMETER Target array is not all 0xF, and Target and Lun were\r
896 not returned on a previous call to GetNextTargetLun().\r
897 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
898\r
899**/\r
900EFI_STATUS\r
901EFIAPI\r
902ExtScsiPassThruGetNextTargetLun (\r
903 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
904 IN OUT UINT8 **Target,\r
905 IN OUT UINT64 *Lun\r
906 );\r
907\r
908/**\r
909 Used to allocate and build a device path node for a SCSI device on a SCSI channel.\r
910\r
911 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
912 @param Target The Target is an array of size TARGET_MAX_BYTES and it specifies the\r
913 Target ID of the SCSI device for which a device path node is to be\r
914 allocated and built. Transport drivers may chose to utilize a subset of\r
915 this size to suit the representation of targets. For example, a Fibre\r
916 Channel driver may use only 8 bytes (WWN) in the array to represent a\r
917 FC target.\r
918 @param Lun The LUN of the SCSI device for which a device path node is to be\r
919 allocated and built.\r
920 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
921 specified by Target and Lun. This function is responsible for\r
922 allocating the buffer DevicePath with the boot service\r
923 AllocatePool(). It is the caller's responsibility to free\r
924 DevicePath when the caller is finished with DevicePath.\r
925\r
926 @retval EFI_SUCCESS The device path node that describes the SCSI device specified by\r
927 Target and Lun was allocated and returned in\r
928 DevicePath.\r
929 @retval EFI_INVALID_PARAMETER DevicePath is NULL.\r
930 @retval EFI_NOT_FOUND The SCSI devices specified by Target and Lun does not exist\r
931 on the SCSI channel.\r
932 @retval EFI_OUT_OF_RESOURCES There are not enough resources to allocate DevicePath.\r
933\r
934**/\r
935EFI_STATUS\r
936EFIAPI\r
937ExtScsiPassThruBuildDevicePath (\r
938 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
939 IN UINT8 *Target,\r
940 IN UINT64 Lun,\r
941 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
942 );\r
943\r
944/**\r
945 Used to translate a device path node to a Target ID and LUN.\r
946\r
947 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
948 @param DevicePath A pointer to a single device path node that describes the SCSI device\r
949 on the SCSI channel.\r
950 @param Target A pointer to the Target Array which represents the ID of a SCSI device\r
951 on the SCSI channel.\r
952 @param Lun A pointer to the LUN of a SCSI device on the SCSI channel.\r
953\r
954 @retval EFI_SUCCESS DevicePath was successfully translated to a Target ID and\r
955 LUN, and they were returned in Target and Lun.\r
956 @retval EFI_INVALID_PARAMETER DevicePath or Target or Lun is NULL.\r
957 @retval EFI_NOT_FOUND A valid translation from DevicePath to a Target ID and LUN\r
958 does not exist.\r
959 @retval EFI_UNSUPPORTED This driver does not support the device path node type in\r
960 DevicePath.\r
961\r
962**/\r
963EFI_STATUS\r
964EFIAPI\r
965ExtScsiPassThruGetTargetLun (\r
966 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
967 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
968 OUT UINT8 **Target,\r
969 OUT UINT64 *Lun\r
970 );\r
971\r
972/**\r
973 Resets a SCSI channel. This operation resets all the SCSI devices connected to the SCSI channel.\r
974\r
975 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
976\r
977 @retval EFI_SUCCESS The SCSI channel was reset.\r
978 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI channel.\r
979 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI channel.\r
980 @retval EFI_UNSUPPORTED The SCSI channel does not support a channel reset operation.\r
981\r
982**/\r
983EFI_STATUS\r
984EFIAPI\r
985ExtScsiPassThruResetChannel (\r
986 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
987 );\r
988\r
989/**\r
990 Resets a SCSI logical unit that is connected to a SCSI channel.\r
991\r
992 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
993 @param Target The Target is an array of size TARGET_MAX_BYTE and it represents the\r
994 target port ID of the SCSI device containing the SCSI logical unit to\r
995 reset. Transport drivers may chose to utilize a subset of this array to suit\r
996 the representation of their targets.\r
997 @param Lun The LUN of the SCSI device to reset.\r
998\r
999 @retval EFI_SUCCESS The SCSI device specified by Target and Lun was reset.\r
1000 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
1001 @retval EFI_TIMEOUT A timeout occurred while attempting to reset the SCSI device\r
1002 specified by Target and Lun.\r
1003 @retval EFI_UNSUPPORTED The SCSI channel does not support a target reset operation.\r
1004 @retval EFI_DEVICE_ERROR A device error occurred while attempting to reset the SCSI device\r
1005 specified by Target and Lun.\r
1006\r
1007**/\r
1008EFI_STATUS\r
1009EFIAPI\r
1010ExtScsiPassThruResetTargetLun (\r
1011 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
1012 IN UINT8 *Target,\r
1013 IN UINT64 Lun\r
1014 );\r
1015\r
1016/**\r
1017 Used to retrieve the list of legal Target IDs for SCSI devices on a SCSI channel. These can either\r
1018 be the list SCSI devices that are actually present on the SCSI channel, or the list of legal Target IDs\r
1019 for the SCSI channel. Regardless, the caller of this function must probe the Target ID returned to\r
1020 see if a SCSI device is actually present at that location on the SCSI channel.\r
1021\r
1022 @param This A pointer to the EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
1023 @param Target (TARGET_MAX_BYTES) of a SCSI device present on the SCSI channel.\r
1024 On output, a pointer to the Target ID (an array of\r
1025 TARGET_MAX_BYTES) of the next SCSI device present on a SCSI\r
1026 channel. An input value of 0xF(all bytes in the array are 0xF) in the\r
1027 Target array retrieves the Target ID of the first SCSI device present on a\r
1028 SCSI channel.\r
1029\r
1030 @retval EFI_SUCCESS The Target ID of the next SCSI device on the SCSI\r
1031 channel was returned in Target.\r
1032 @retval EFI_INVALID_PARAMETER Target or Lun is NULL.\r
1033 @retval EFI_TIMEOUT Target array is not all 0xF, and Target was not\r
1034 returned on a previous call to GetNextTarget().\r
1035 @retval EFI_NOT_FOUND There are no more SCSI devices on this SCSI channel.\r
1036\r
1037**/\r
1038EFI_STATUS\r
1039EFIAPI\r
1040ExtScsiPassThruGetNextTarget (\r
1041 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
1042 IN OUT UINT8 **Target\r
1043 );\r
1044\r
1045/**\r
1046 Initialize ATA host controller at IDE mode.\r
1047\r
1048 The function is designed to initialize ATA host controller.\r
1049\r
1050 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
1051\r
1052**/\r
1053EFI_STATUS\r
1054EFIAPI\r
1055IdeModeInitialization (\r
1056 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
1057 );\r
1058\r
1059/**\r
1060 Initialize ATA host controller at AHCI mode.\r
1061\r
1062 The function is designed to initialize ATA host controller.\r
1063\r
1064 @param[in] Instance A pointer to the ATA_ATAPI_PASS_THRU_INSTANCE instance.\r
1065\r
1066**/\r
1067EFI_STATUS\r
1068EFIAPI\r
1069AhciModeInitialization (\r
1070 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance\r
1071 );\r
1072\r
1073/**\r
1074 Start a non data transfer on specific port.\r
1075\r
1076 @param[in] PciIo The PCI IO protocol instance.\r
1077 @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.\r
1078 @param[in] Port The number of port.\r
1079 @param[in] PortMultiplier The timeout value of stop.\r
1080 @param[in] AtapiCommand The atapi command will be used for the\r
1081 transfer.\r
1082 @param[in] AtapiCommandLength The length of the atapi command.\r
1083 @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data.\r
1084 @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data.\r
1085 @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit.\r
1086 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1087 used by non-blocking mode.\r
1088\r
1089 @retval EFI_DEVICE_ERROR The non data transfer abort with error occurs.\r
1090 @retval EFI_TIMEOUT The operation is time out.\r
1091 @retval EFI_UNSUPPORTED The device is not ready for transfer.\r
1092 @retval EFI_SUCCESS The non data transfer executes successfully.\r
1093\r
1094**/\r
1095EFI_STATUS\r
1096EFIAPI\r
1097AhciNonDataTransfer (\r
1098 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1099 IN EFI_AHCI_REGISTERS *AhciRegisters,\r
1100 IN UINT8 Port,\r
1101 IN UINT8 PortMultiplier,\r
1102 IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,\r
1103 IN UINT8 AtapiCommandLength,\r
1104 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1105 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1106 IN UINT64 Timeout,\r
1107 IN ATA_NONBLOCK_TASK *Task\r
1108 );\r
1109\r
1110/**\r
1111 Start a DMA data transfer on specific port\r
1112\r
1113 @param[in] Instance The ATA_ATAPI_PASS_THRU_INSTANCE protocol instance.\r
1114 @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.\r
1115 @param[in] Port The number of port.\r
1116 @param[in] PortMultiplier The timeout value of stop.\r
1117 @param[in] AtapiCommand The atapi command will be used for the\r
1118 transfer.\r
1119 @param[in] AtapiCommandLength The length of the atapi command.\r
1120 @param[in] Read The transfer direction.\r
1121 @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data.\r
1122 @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data.\r
1123 @param[in, out] MemoryAddr The pointer to the data buffer.\r
1124 @param[in] DataCount The data count to be transferred.\r
1125 @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit.\r
1126 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1127 used by non-blocking mode.\r
1128\r
1129 @retval EFI_DEVICE_ERROR The DMA data transfer abort with error occurs.\r
1130 @retval EFI_TIMEOUT The operation is time out.\r
1131 @retval EFI_UNSUPPORTED The device is not ready for transfer.\r
1132 @retval EFI_SUCCESS The DMA data transfer executes successfully.\r
1133\r
1134**/\r
1135EFI_STATUS\r
1136EFIAPI\r
1137AhciDmaTransfer (\r
1138 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
1139 IN EFI_AHCI_REGISTERS *AhciRegisters,\r
1140 IN UINT8 Port,\r
1141 IN UINT8 PortMultiplier,\r
1142 IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,\r
1143 IN UINT8 AtapiCommandLength,\r
1144 IN BOOLEAN Read,\r
1145 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1146 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1147 IN OUT VOID *MemoryAddr,\r
1148 IN UINT32 DataCount,\r
1149 IN UINT64 Timeout,\r
1150 IN ATA_NONBLOCK_TASK *Task\r
1151 );\r
1152\r
1153/**\r
1154 Start a PIO data transfer on specific port.\r
1155\r
1156 @param[in] PciIo The PCI IO protocol instance.\r
1157 @param[in] AhciRegisters The pointer to the EFI_AHCI_REGISTERS.\r
1158 @param[in] Port The number of port.\r
1159 @param[in] PortMultiplier The timeout value of stop.\r
1160 @param[in] AtapiCommand The atapi command will be used for the\r
1161 transfer.\r
1162 @param[in] AtapiCommandLength The length of the atapi command.\r
1163 @param[in] Read The transfer direction.\r
1164 @param[in] AtaCommandBlock The EFI_ATA_COMMAND_BLOCK data.\r
1165 @param[in, out] AtaStatusBlock The EFI_ATA_STATUS_BLOCK data.\r
1166 @param[in, out] MemoryAddr The pointer to the data buffer.\r
1167 @param[in] DataCount The data count to be transferred.\r
1168 @param[in] Timeout The timeout value of non data transfer, uses 100ns as a unit.\r
1169 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1170 used by non-blocking mode.\r
1171\r
1172 @retval EFI_DEVICE_ERROR The PIO data transfer abort with error occurs.\r
1173 @retval EFI_TIMEOUT The operation is time out.\r
1174 @retval EFI_UNSUPPORTED The device is not ready for transfer.\r
1175 @retval EFI_SUCCESS The PIO data transfer executes successfully.\r
1176\r
1177**/\r
1178EFI_STATUS\r
1179EFIAPI\r
1180AhciPioTransfer (\r
1181 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1182 IN EFI_AHCI_REGISTERS *AhciRegisters,\r
1183 IN UINT8 Port,\r
1184 IN UINT8 PortMultiplier,\r
1185 IN EFI_AHCI_ATAPI_COMMAND *AtapiCommand OPTIONAL,\r
1186 IN UINT8 AtapiCommandLength,\r
1187 IN BOOLEAN Read,\r
1188 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1189 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1190 IN OUT VOID *MemoryAddr,\r
1191 IN UINT32 DataCount,\r
1192 IN UINT64 Timeout,\r
1193 IN ATA_NONBLOCK_TASK *Task\r
1194 );\r
1195\r
1196/**\r
1197 Send ATA command into device with NON_DATA protocol\r
1198\r
1199 @param[in] PciIo A pointer to ATA_ATAPI_PASS_THRU_INSTANCE\r
1200 data structure.\r
1201 @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.\r
1202 @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data\r
1203 structure.\r
1204 @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure.\r
1205 @param[in] Timeout The time to complete the command, uses 100ns as a unit.\r
1206 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1207 used by non-blocking mode.\r
1208\r
1209 @retval EFI_SUCCESS Reading succeed\r
1210 @retval EFI_ABORTED Command failed\r
1211 @retval EFI_DEVICE_ERROR Device status error.\r
1212\r
1213**/\r
1214EFI_STATUS\r
1215EFIAPI\r
1216AtaNonDataCommandIn (\r
1217 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1218 IN EFI_IDE_REGISTERS *IdeRegisters,\r
1219 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1220 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1221 IN UINT64 Timeout,\r
1222 IN ATA_NONBLOCK_TASK *Task\r
1223 );\r
1224\r
1225/**\r
1226 Perform an ATA Udma operation (Read, ReadExt, Write, WriteExt).\r
1227\r
1228 @param[in] Instance A pointer to ATA_ATAPI_PASS_THRU_INSTANCE data\r
1229 structure.\r
1230 @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.\r
1231 @param[in] Read Flag used to determine the data transfer\r
1232 direction. Read equals 1, means data transferred\r
1233 from device to host;Read equals 0, means data\r
1234 transferred from host to device.\r
1235 @param[in] DataBuffer A pointer to the source buffer for the data.\r
1236 @param[in] DataLength The length of the data.\r
1237 @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data structure.\r
1238 @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure.\r
1239 @param[in] Timeout The time to complete the command, uses 100ns as a unit.\r
1240 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1241 used by non-blocking mode.\r
1242\r
1243 @retval EFI_SUCCESS the operation is successful.\r
1244 @retval EFI_OUT_OF_RESOURCES Build PRD table failed\r
1245 @retval EFI_UNSUPPORTED Unknown channel or operations command\r
1246 @retval EFI_DEVICE_ERROR Ata command execute failed\r
1247\r
1248**/\r
1249EFI_STATUS\r
1250EFIAPI\r
1251AtaUdmaInOut (\r
1252 IN ATA_ATAPI_PASS_THRU_INSTANCE *Instance,\r
1253 IN EFI_IDE_REGISTERS *IdeRegisters,\r
1254 IN BOOLEAN Read,\r
1255 IN VOID *DataBuffer,\r
1256 IN UINT64 DataLength,\r
1257 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1258 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1259 IN UINT64 Timeout,\r
1260 IN ATA_NONBLOCK_TASK *Task\r
1261 );\r
1262\r
1263/**\r
1264 This function is used to send out ATA commands conforms to the PIO Data In Protocol.\r
1265\r
1266 @param[in] PciIo A pointer to ATA_ATAPI_PASS_THRU_INSTANCE data\r
1267 structure.\r
1268 @param[in] IdeRegisters A pointer to EFI_IDE_REGISTERS data structure.\r
1269 @param[in, out] Buffer A pointer to the source buffer for the data.\r
1270 @param[in] ByteCount The length of the data.\r
1271 @param[in] Read Flag used to determine the data transfer direction.\r
1272 Read equals 1, means data transferred from device\r
1273 to host;Read equals 0, means data transferred\r
1274 from host to device.\r
1275 @param[in] AtaCommandBlock A pointer to EFI_ATA_COMMAND_BLOCK data structure.\r
1276 @param[in, out] AtaStatusBlock A pointer to EFI_ATA_STATUS_BLOCK data structure.\r
1277 @param[in] Timeout The time to complete the command, uses 100ns as a unit.\r
1278 @param[in] Task Optional. Pointer to the ATA_NONBLOCK_TASK\r
1279 used by non-blocking mode.\r
1280\r
1281 @retval EFI_SUCCESS send out the ATA command and device send required data successfully.\r
1282 @retval EFI_DEVICE_ERROR command sent failed.\r
1283\r
1284**/\r
1285EFI_STATUS\r
1286EFIAPI\r
1287AtaPioDataInOut (\r
1288 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1289 IN EFI_IDE_REGISTERS *IdeRegisters,\r
1290 IN OUT VOID *Buffer,\r
1291 IN UINT64 ByteCount,\r
1292 IN BOOLEAN Read,\r
1293 IN EFI_ATA_COMMAND_BLOCK *AtaCommandBlock,\r
1294 IN OUT EFI_ATA_STATUS_BLOCK *AtaStatusBlock,\r
1295 IN UINT64 Timeout,\r
1296 IN ATA_NONBLOCK_TASK *Task\r
1297 );\r
1298\r
1299#endif\r
1300\r