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