BaseTools/Capsule: Do not support -o with --dump-info
[mirror_edk2.git] / OptionRomPkg / AtapiPassThruDxe / AtapiPassThru.h
CommitLineData
823f7d4f 1/** @file\r
b28b274d 2 Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
ac1ca104 3 This program and the accompanying materials\r
823f7d4f 4 are licensed and made available under the terms and conditions of the BSD License\r
5 which accompanies this distribution. The full text of the license may be found at\r
6 http://opensource.org/licenses/bsd-license.php\r
7\r
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
10\r
11 Module Name: AtapiPassThru.h\r
12\r
13**/\r
14\r
15#ifndef _APT_H\r
16#define _APT_H\r
17\r
18\r
19\r
20#include <Uefi.h>\r
21\r
22#include <Protocol/ScsiPassThru.h>\r
23#include <Protocol/ScsiPassThruExt.h>\r
24#include <Protocol/PciIo.h>\r
4cc9af6c 25#include <Protocol/DriverSupportedEfiVersion.h>\r
823f7d4f 26\r
27#include <Library/DebugLib.h>\r
28#include <Library/UefiDriverEntryPoint.h>\r
29#include <Library/BaseLib.h>\r
30#include <Library/UefiLib.h>\r
31#include <Library/BaseMemoryLib.h>\r
32#include <Library/MemoryAllocationLib.h>\r
33#include <Library/UefiBootServicesTableLib.h>\r
34#include <Library/PcdLib.h>\r
3501cc99 35#include <Library/DevicePathLib.h>\r
36\r
5781db08 37#include <IndustryStandard/Pci.h>\r
823f7d4f 38\r
39#define MAX_TARGET_ID 4\r
40\r
41//\r
42// IDE Registers\r
43//\r
44typedef union {\r
45 UINT16 Command; /* when write */\r
46 UINT16 Status; /* when read */\r
47} IDE_CMD_OR_STATUS;\r
48\r
49typedef union {\r
50 UINT16 Error; /* when read */\r
51 UINT16 Feature; /* when write */\r
52} IDE_ERROR_OR_FEATURE;\r
53\r
54typedef union {\r
55 UINT16 AltStatus; /* when read */\r
56 UINT16 DeviceControl; /* when write */\r
57} IDE_AltStatus_OR_DeviceControl;\r
58\r
59\r
60typedef enum {\r
61 IdePrimary = 0,\r
62 IdeSecondary = 1,\r
63 IdeMaxChannel = 2\r
64} EFI_IDE_CHANNEL;\r
65\r
66///\r
67\r
68\r
69//\r
70// Bit definitions in Programming Interface byte of the Class Code field\r
71// in PCI IDE controller's Configuration Space\r
72//\r
73#define IDE_PRIMARY_OPERATING_MODE BIT0\r
74#define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1\r
75#define IDE_SECONDARY_OPERATING_MODE BIT2\r
76#define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3\r
77\r
78\r
79#define ATAPI_MAX_CHANNEL 2\r
80\r
81///\r
82/// IDE registers set\r
83///\r
84typedef struct {\r
85 UINT16 Data;\r
86 IDE_ERROR_OR_FEATURE Reg1;\r
87 UINT16 SectorCount;\r
88 UINT16 SectorNumber;\r
89 UINT16 CylinderLsb;\r
90 UINT16 CylinderMsb;\r
91 UINT16 Head;\r
92 IDE_CMD_OR_STATUS Reg;\r
93 IDE_AltStatus_OR_DeviceControl Alt;\r
94 UINT16 DriveAddress;\r
95} IDE_BASE_REGISTERS;\r
96\r
32438080 97#define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE SIGNATURE_32 ('a', 's', 'p', 't')\r
823f7d4f 98\r
99typedef struct {\r
100 UINTN Signature;\r
101 EFI_HANDLE Handle;\r
102 EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;\r
103 EFI_EXT_SCSI_PASS_THRU_PROTOCOL ExtScsiPassThru;\r
104 EFI_PCI_IO_PROTOCOL *PciIo;\r
105 UINT64 OriginalPciAttributes;\r
106 //\r
107 // Local Data goes here\r
108 //\r
109 IDE_BASE_REGISTERS *IoPort;\r
110 IDE_BASE_REGISTERS AtapiIoPortRegisters[2];\r
111 UINT32 LatestTargetId;\r
112 UINT64 LatestLun;\r
113} ATAPI_SCSI_PASS_THRU_DEV;\r
114\r
115//\r
116// IDE registers' base addresses\r
117//\r
118typedef struct {\r
119 UINT16 CommandBlockBaseAddr;\r
120 UINT16 ControlBlockBaseAddr;\r
121} IDE_REGISTERS_BASE_ADDR;\r
122\r
123#define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \\r
124 CR (a, \\r
125 ATAPI_SCSI_PASS_THRU_DEV, \\r
126 ScsiPassThru, \\r
127 ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \\r
128 )\r
129\r
130#define ATAPI_EXT_SCSI_PASS_THRU_DEV_FROM_THIS(a) \\r
131 CR (a, \\r
132 ATAPI_SCSI_PASS_THRU_DEV, \\r
133 ExtScsiPassThru, \\r
134 ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \\r
135 )\r
136\r
137//\r
138// Global Variables\r
139//\r
4cc9af6c 140extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;\r
141extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;\r
142extern EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2;\r
143extern EFI_DRIVER_SUPPORTED_EFI_VERSION_PROTOCOL gAtapiScsiPassThruDriverSupportedEfiVersion;\r
823f7d4f 144\r
145//\r
146// ATAPI Command op code\r
147//\r
148#define OP_INQUIRY 0x12\r
149#define OP_LOAD_UNLOAD_CD 0xa6\r
150#define OP_MECHANISM_STATUS 0xbd\r
151#define OP_MODE_SELECT_10 0x55\r
152#define OP_MODE_SENSE_10 0x5a\r
153#define OP_PAUSE_RESUME 0x4b\r
154#define OP_PLAY_AUDIO_10 0x45\r
155#define OP_PLAY_AUDIO_MSF 0x47\r
156#define OP_PLAY_CD 0xbc\r
157#define OP_PLAY_CD_MSF 0xb4\r
158#define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e\r
159#define OP_READ_10 0x28\r
160#define OP_READ_12 0xa8\r
161#define OP_READ_CAPACITY 0x25\r
162#define OP_READ_CD 0xbe\r
163#define OP_READ_CD_MSF 0xb9\r
164#define OP_READ_HEADER 0x44\r
165#define OP_READ_SUB_CHANNEL 0x42\r
166#define OP_READ_TOC 0x43\r
167#define OP_REQUEST_SENSE 0x03\r
168#define OP_SCAN 0xba\r
169#define OP_SEEK_10 0x2b\r
170#define OP_SET_CD_SPEED 0xbb\r
171#define OP_STOPPLAY_SCAN 0x4e\r
172#define OP_START_STOP_UNIT 0x1b\r
173#define OP_TEST_UNIT_READY 0x00\r
174\r
175#define OP_FORMAT_UNIT 0x04\r
176#define OP_READ_FORMAT_CAPACITIES 0x23\r
177#define OP_VERIFY 0x2f\r
178#define OP_WRITE_10 0x2a\r
179#define OP_WRITE_12 0xaa\r
180#define OP_WRITE_AND_VERIFY 0x2e\r
181\r
182//\r
183// ATA Command\r
184//\r
185#define ATAPI_SOFT_RESET_CMD 0x08\r
186\r
187typedef enum {\r
188 DataIn = 0,\r
189 DataOut = 1,\r
190 DataBi = 2,\r
191 NoData = 3,\r
192 End = 0xff\r
193} DATA_DIRECTION;\r
194\r
195typedef struct {\r
196 UINT8 OpCode;\r
197 DATA_DIRECTION Direction;\r
198} SCSI_COMMAND_SET;\r
199\r
200#define MAX_CHANNEL 2\r
201\r
202#define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0\r
203\r
204//\r
205// IDE registers bit definitions\r
206//\r
207// ATA Err Reg bitmap\r
208//\r
5781db08 209#define BBK_ERR BIT7 ///< Bad block detected\r
210#define UNC_ERR BIT6 ///< Uncorrectable Data\r
211#define MC_ERR BIT5 ///< Media Change\r
212#define IDNF_ERR BIT4 ///< ID Not Found\r
213#define MCR_ERR BIT3 ///< Media Change Requested\r
214#define ABRT_ERR BIT2 ///< Aborted Command\r
215#define TK0NF_ERR BIT1 ///< Track 0 Not Found\r
216#define AMNF_ERR BIT0 ///< Address Mark Not Found\r
823f7d4f 217\r
218//\r
219// ATAPI Err Reg bitmap\r
220//\r
5781db08 221#define SENSE_KEY_ERR (BIT7 | BIT6 | BIT5 | BIT4)\r
222#define EOM_ERR BIT1 ///< End of Media Detected\r
223#define ILI_ERR BIT0 ///< Illegal Length Indication\r
823f7d4f 224\r
225//\r
226// Device/Head Reg\r
227//\r
5781db08 228#define LBA_MODE BIT6\r
229#define DEV BIT4\r
230#define HS3 BIT3\r
231#define HS2 BIT2\r
232#define HS1 BIT1\r
233#define HS0 BIT0\r
823f7d4f 234#define CHS_MODE (0)\r
235#define DRV0 (0)\r
236#define DRV1 (1)\r
237#define MST_DRV DRV0\r
238#define SLV_DRV DRV1\r
239\r
240//\r
241// Status Reg\r
242//\r
5781db08 243#define BSY BIT7 ///< Controller Busy\r
244#define DRDY BIT6 ///< Drive Ready\r
245#define DWF BIT5 ///< Drive Write Fault\r
246#define DSC BIT4 ///< Disk Seek Complete\r
247#define DRQ BIT3 ///< Data Request\r
248#define CORR BIT2 ///< Corrected Data\r
249#define IDX BIT1 ///< Index\r
250#define ERR BIT0 ///< Error\r
251#define CHECK BIT0 ///< Check bit for ATAPI Status Reg\r
823f7d4f 252\r
253//\r
254// Device Control Reg\r
255//\r
5781db08 256#define SRST BIT2 ///< Software Reset\r
257#define IEN_L BIT1 ///< Interrupt Enable\r
823f7d4f 258\r
259//\r
260// ATAPI Feature Register\r
261//\r
5781db08 262#define OVERLAP BIT1\r
263#define DMA BIT0\r
823f7d4f 264\r
265//\r
266// ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)\r
267//\r
5781db08 268#define RELEASE BIT2\r
269#define IO BIT1\r
270#define CoD BIT0\r
823f7d4f 271\r
272#define PACKET_CMD 0xA0\r
273\r
274#define DEFAULT_CMD (0xa0)\r
275//\r
276// default content of device control register, disable INT\r
277//\r
278#define DEFAULT_CTL (0x0a)\r
279#define MAX_ATAPI_BYTE_COUNT (0xfffe)\r
280\r
281//\r
282// function prototype\r
283//\r
284\r
285EFI_STATUS\r
286EFIAPI\r
287AtapiScsiPassThruDriverBindingSupported (\r
288 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
289 IN EFI_HANDLE Controller,\r
290 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
291 );\r
292\r
293EFI_STATUS\r
294EFIAPI\r
295AtapiScsiPassThruDriverBindingStart (\r
296 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
297 IN EFI_HANDLE Controller,\r
298 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath\r
299 );\r
300\r
301EFI_STATUS\r
302EFIAPI\r
303AtapiScsiPassThruDriverBindingStop (\r
304 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
305 IN EFI_HANDLE Controller,\r
306 IN UINTN NumberOfChildren,\r
307 IN EFI_HANDLE *ChildHandleBuffer\r
308 );\r
309\r
310//\r
311// EFI Component Name Functions\r
312//\r
313/**\r
314 Retrieves a Unicode string that is the user readable name of the driver.\r
315\r
316 This function retrieves the user readable name of a driver in the form of a\r
317 Unicode string. If the driver specified by This has a user readable name in\r
318 the language specified by Language, then a pointer to the driver name is\r
319 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified\r
320 by This does not support the language specified by Language,\r
321 then EFI_UNSUPPORTED is returned.\r
322\r
323 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
324 EFI_COMPONENT_NAME_PROTOCOL instance.\r
325\r
326 @param Language[in] A pointer to a Null-terminated ASCII string\r
327 array indicating the language. This is the\r
328 language of the driver name that the caller is\r
329 requesting, and it must match one of the\r
330 languages specified in SupportedLanguages. The\r
331 number of languages supported by a driver is up\r
332 to the driver writer. Language is specified\r
8469b662 333 in RFC 4646 or ISO 639-2 language code format.\r
823f7d4f 334\r
335 @param DriverName[out] A pointer to the Unicode string to return.\r
336 This Unicode string is the name of the\r
337 driver specified by This in the language\r
338 specified by Language.\r
339\r
340 @retval EFI_SUCCESS The Unicode string for the Driver specified by\r
341 This and the language specified by Language was\r
342 returned in DriverName.\r
343\r
344 @retval EFI_INVALID_PARAMETER Language is NULL.\r
345\r
346 @retval EFI_INVALID_PARAMETER DriverName is NULL.\r
347\r
348 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
349 the language specified by Language.\r
350\r
351**/\r
352EFI_STATUS\r
353EFIAPI\r
354AtapiScsiPassThruComponentNameGetDriverName (\r
355 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
356 IN CHAR8 *Language,\r
357 OUT CHAR16 **DriverName\r
358 );\r
359\r
360\r
361/**\r
362 Retrieves a Unicode string that is the user readable name of the controller\r
363 that is being managed by a driver.\r
364\r
365 This function retrieves the user readable name of the controller specified by\r
366 ControllerHandle and ChildHandle in the form of a Unicode string. If the\r
367 driver specified by This has a user readable name in the language specified by\r
368 Language, then a pointer to the controller name is returned in ControllerName,\r
369 and EFI_SUCCESS is returned. If the driver specified by This is not currently\r
370 managing the controller specified by ControllerHandle and ChildHandle,\r
371 then EFI_UNSUPPORTED is returned. If the driver specified by This does not\r
372 support the language specified by Language, then EFI_UNSUPPORTED is returned.\r
373\r
374 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or\r
375 EFI_COMPONENT_NAME_PROTOCOL instance.\r
376\r
377 @param ControllerHandle[in] The handle of a controller that the driver\r
378 specified by This is managing. This handle\r
379 specifies the controller whose name is to be\r
380 returned.\r
381\r
382 @param ChildHandle[in] The handle of the child controller to retrieve\r
383 the name of. This is an optional parameter that\r
384 may be NULL. It will be NULL for device\r
385 drivers. It will also be NULL for a bus drivers\r
386 that wish to retrieve the name of the bus\r
387 controller. It will not be NULL for a bus\r
388 driver that wishes to retrieve the name of a\r
389 child controller.\r
390\r
391 @param Language[in] A pointer to a Null-terminated ASCII string\r
392 array indicating the language. This is the\r
393 language of the driver name that the caller is\r
394 requesting, and it must match one of the\r
395 languages specified in SupportedLanguages. The\r
396 number of languages supported by a driver is up\r
397 to the driver writer. Language is specified in\r
8469b662 398 RFC 4646 or ISO 639-2 language code format.\r
823f7d4f 399\r
400 @param ControllerName[out] A pointer to the Unicode string to return.\r
401 This Unicode string is the name of the\r
402 controller specified by ControllerHandle and\r
403 ChildHandle in the language specified by\r
404 Language from the point of view of the driver\r
405 specified by This.\r
406\r
407 @retval EFI_SUCCESS The Unicode string for the user readable name in\r
408 the language specified by Language for the\r
409 driver specified by This was returned in\r
410 DriverName.\r
411\r
b28b274d 412 @retval EFI_INVALID_PARAMETER ControllerHandle is NULL.\r
823f7d4f 413\r
414 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid\r
415 EFI_HANDLE.\r
416\r
417 @retval EFI_INVALID_PARAMETER Language is NULL.\r
418\r
419 @retval EFI_INVALID_PARAMETER ControllerName is NULL.\r
420\r
421 @retval EFI_UNSUPPORTED The driver specified by This is not currently\r
422 managing the controller specified by\r
423 ControllerHandle and ChildHandle.\r
424\r
425 @retval EFI_UNSUPPORTED The driver specified by This does not support\r
426 the language specified by Language.\r
427\r
428**/\r
429EFI_STATUS\r
430EFIAPI\r
431AtapiScsiPassThruComponentNameGetControllerName (\r
432 IN EFI_COMPONENT_NAME_PROTOCOL *This,\r
433 IN EFI_HANDLE ControllerHandle,\r
434 IN EFI_HANDLE ChildHandle OPTIONAL,\r
435 IN CHAR8 *Language,\r
436 OUT CHAR16 **ControllerName\r
437 );\r
438\r
439\r
440EFI_STATUS\r
441EFIAPI\r
442AtapiScsiPassThruDriverEntryPoint (\r
443 IN EFI_HANDLE ImageHandle,\r
444 IN EFI_SYSTEM_TABLE *SystemTable\r
445 )\r
446 /*++\r
447\r
448Routine Description:\r
449\r
450 Entry point for EFI drivers.\r
451\r
452Arguments:\r
453\r
454 ImageHandle - EFI_HANDLE\r
455 SystemTable - EFI_SYSTEM_TABLE\r
456\r
457Returns:\r
458\r
459 EFI_SUCCESS\r
460 Others \r
461\r
462--*/\r
463;\r
464\r
465EFI_STATUS\r
466RegisterAtapiScsiPassThru (\r
467 IN EFI_DRIVER_BINDING_PROTOCOL *This,\r
468 IN EFI_HANDLE Controller,\r
469 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
470 IN UINT64 OriginalPciAttributes\r
471 )\r
472/*++\r
473\r
474Routine Description:\r
475 Attaches SCSI Pass Thru Protocol for specified IDE channel.\r
476 \r
477Arguments:\r
478 This - Protocol instance pointer.\r
479 Controller - Parent device handle to the IDE channel. \r
480 PciIo - PCI I/O protocol attached on the "Controller". \r
481 \r
482Returns:\r
483 Always return EFI_SUCCESS unless installing SCSI Pass Thru Protocol failed.\r
484\r
485--*/\r
486;\r
487\r
488EFI_STATUS\r
489EFIAPI\r
490AtapiScsiPassThruFunction (\r
491 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
492 IN UINT32 Target,\r
493 IN UINT64 Lun,\r
494 IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
495 IN EFI_EVENT Event OPTIONAL\r
496 )\r
497/*++\r
498\r
499Routine Description:\r
500\r
501 Implements EFI_SCSI_PASS_THRU_PROTOCOL.PassThru() function.\r
502\r
503Arguments:\r
504\r
505 This: The EFI_SCSI_PASS_THRU_PROTOCOL instance.\r
506 Target: The Target ID of the ATAPI device to send the SCSI \r
507 Request Packet. To ATAPI devices attached on an IDE\r
508 Channel, Target ID 0 indicates Master device;Target\r
509 ID 1 indicates Slave device.\r
510 Lun: The LUN of the ATAPI device to send the SCSI Request\r
511 Packet. To the ATAPI device, Lun is always 0.\r
512 Packet: The SCSI Request Packet to send to the ATAPI device \r
513 specified by Target and Lun.\r
514 Event: If non-blocking I/O is not supported then Event is ignored, \r
515 and blocking I/O is performed.\r
516 If Event is NULL, then blocking I/O is performed.\r
517 If Event is not NULL and non blocking I/O is supported, \r
518 then non-blocking I/O is performed, and Event will be signaled \r
519 when the SCSI Request Packet completes. \r
520\r
521Returns: \r
522\r
523 EFI_STATUS\r
524\r
525--*/\r
526;\r
527\r
528EFI_STATUS\r
529EFIAPI\r
530AtapiScsiPassThruGetNextDevice (\r
531 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
532 IN OUT UINT32 *Target,\r
533 IN OUT UINT64 *Lun\r
534 )\r
535/*++\r
536\r
537Routine Description:\r
538\r
539 Used to retrieve the list of legal Target IDs for SCSI devices \r
540 on a SCSI channel.\r
541\r
542Arguments:\r
543\r
544 This - Protocol instance pointer.\r
545 Target - On input, a pointer to the Target ID of a SCSI \r
546 device present on the SCSI channel. On output, \r
547 a pointer to the Target ID of the next SCSI device\r
548 present on a SCSI channel. An input value of \r
549 0xFFFFFFFF retrieves the Target ID of the first \r
550 SCSI device present on a SCSI channel.\r
551 Lun - On input, a pointer to the LUN of a SCSI device\r
552 present on the SCSI channel. On output, a pointer\r
553 to the LUN of the next SCSI device present on \r
554 a SCSI channel.\r
555Returns:\r
556\r
557 EFI_SUCCESS - The Target ID and Lun of the next SCSI device \r
558 on the SCSI channel was returned in Target and Lun.\r
559 EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r
560 EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r
561 returned on a previous call to GetNextDevice().\r
562\r
563--*/\r
564;\r
565\r
566EFI_STATUS\r
567EFIAPI\r
568AtapiScsiPassThruBuildDevicePath (\r
569 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
570 IN UINT32 Target,\r
571 IN UINT64 Lun,\r
572 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
573 )\r
574/*++\r
575\r
576Routine Description:\r
577\r
578 Used to allocate and build a device path node for a SCSI device \r
579 on a SCSI channel. Would not build device path for a SCSI Host Controller.\r
580\r
581Arguments:\r
582\r
583 This - Protocol instance pointer.\r
584 Target - The Target ID of the SCSI device for which\r
585 a device path node is to be allocated and built.\r
586 Lun - The LUN of the SCSI device for which a device \r
587 path node is to be allocated and built.\r
588 DevicePath - A pointer to a single device path node that \r
589 describes the SCSI device specified by \r
590 Target and Lun. This function is responsible \r
591 for allocating the buffer DevicePath with the boot\r
592 service AllocatePool(). It is the caller's \r
593 responsibility to free DevicePath when the caller\r
594 is finished with DevicePath. \r
595 Returns:\r
596 EFI_SUCCESS - The device path node that describes the SCSI device\r
597 specified by Target and Lun was allocated and \r
598 returned in DevicePath.\r
599 EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does\r
600 not exist on the SCSI channel.\r
601 EFI_INVALID_PARAMETER - DevicePath is NULL.\r
602 EFI_OUT_OF_RESOURCES - There are not enough resources to allocate \r
603 DevicePath.\r
604\r
605--*/\r
606;\r
607\r
608EFI_STATUS\r
609EFIAPI\r
610AtapiScsiPassThruGetTargetLun (\r
611 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
612 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
613 OUT UINT32 *Target,\r
614 OUT UINT64 *Lun\r
615 )\r
616/*++\r
617\r
618Routine Description:\r
619\r
620 Used to translate a device path node to a Target ID and LUN.\r
621\r
622Arguments:\r
623\r
624 This - Protocol instance pointer.\r
625 DevicePath - A pointer to the device path node that \r
626 describes a SCSI device on the SCSI channel.\r
627 Target - A pointer to the Target ID of a SCSI device \r
628 on the SCSI channel. \r
629 Lun - A pointer to the LUN of a SCSI device on \r
630 the SCSI channel. \r
631Returns:\r
632\r
633 EFI_SUCCESS - DevicePath was successfully translated to a \r
634 Target ID and LUN, and they were returned \r
635 in Target and Lun.\r
636 EFI_INVALID_PARAMETER - DevicePath/Target/Lun is NULL.\r
637 EFI_UNSUPPORTED - This driver does not support the device path \r
638 node type in DevicePath.\r
639 EFI_NOT_FOUND - A valid translation from DevicePath to a \r
640 Target ID and LUN does not exist.\r
641\r
642--*/\r
643;\r
644\r
645EFI_STATUS\r
646EFIAPI\r
647AtapiScsiPassThruResetChannel (\r
648 IN EFI_SCSI_PASS_THRU_PROTOCOL *This\r
649 )\r
650/*++\r
651\r
652Routine Description:\r
653\r
654 Resets a SCSI channel.This operation resets all the \r
655 SCSI devices connected to the SCSI channel.\r
656\r
657Arguments:\r
658\r
659 This - Protocol instance pointer.\r
660\r
661Returns:\r
662\r
663 EFI_SUCCESS - The SCSI channel was reset.\r
664 EFI_UNSUPPORTED - The SCSI channel does not support \r
665 a channel reset operation.\r
666 EFI_DEVICE_ERROR - A device error occurred while \r
667 attempting to reset the SCSI channel.\r
668 EFI_TIMEOUT - A timeout occurred while attempting \r
669 to reset the SCSI channel.\r
670\r
671--*/\r
672;\r
673\r
674EFI_STATUS\r
675EFIAPI\r
676AtapiScsiPassThruResetTarget (\r
677 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,\r
678 IN UINT32 Target,\r
679 IN UINT64 Lun\r
680 )\r
681/*++\r
682\r
683Routine Description:\r
684\r
685 Resets a SCSI device that is connected to a SCSI channel.\r
686\r
687Arguments:\r
688\r
689 This - Protocol instance pointer.\r
690 Target - The Target ID of the SCSI device to reset. \r
691 Lun - The LUN of the SCSI device to reset.\r
692 \r
693Returns:\r
694\r
695 EFI_SUCCESS - The SCSI device specified by Target and \r
696 Lun was reset.\r
697 EFI_UNSUPPORTED - The SCSI channel does not support a target\r
698 reset operation.\r
699 EFI_INVALID_PARAMETER - Target or Lun are invalid.\r
700 EFI_DEVICE_ERROR - A device error occurred while attempting \r
701 to reset the SCSI device specified by Target \r
702 and Lun.\r
703 EFI_TIMEOUT - A timeout occurred while attempting to reset \r
704 the SCSI device specified by Target and Lun.\r
705\r
706--*/\r
707;\r
708\r
709EFI_STATUS\r
710EFIAPI\r
711AtapiExtScsiPassThruFunction (\r
712 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
713 IN UINT8 *Target,\r
714 IN UINT64 Lun,\r
715 IN OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,\r
716 IN EFI_EVENT Event OPTIONAL\r
717 )\r
718/*++\r
719\r
720Routine Description:\r
721\r
722 Implements EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() function.\r
723\r
724Arguments:\r
725\r
726 This: The EFI_EXT_SCSI_PASS_THRU_PROTOCOL instance.\r
727 Target: The Target ID of the ATAPI device to send the SCSI \r
728 Request Packet. To ATAPI devices attached on an IDE\r
729 Channel, Target ID 0 indicates Master device;Target\r
730 ID 1 indicates Slave device.\r
731 Lun: The LUN of the ATAPI device to send the SCSI Request\r
732 Packet. To the ATAPI device, Lun is always 0.\r
733 Packet: The SCSI Request Packet to send to the ATAPI device \r
734 specified by Target and Lun.\r
735 Event: If non-blocking I/O is not supported then Event is ignored, \r
736 and blocking I/O is performed.\r
737 If Event is NULL, then blocking I/O is performed.\r
738 If Event is not NULL and non blocking I/O is supported, \r
739 then non-blocking I/O is performed, and Event will be signaled \r
740 when the SCSI Request Packet completes. \r
741\r
742Returns: \r
743\r
744 EFI_STATUS\r
745\r
746--*/\r
747;\r
748\r
749EFI_STATUS\r
750EFIAPI\r
751AtapiExtScsiPassThruGetNextTargetLun (\r
752 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
753 IN OUT UINT8 **Target,\r
754 IN OUT UINT64 *Lun\r
755 )\r
756/*++\r
757\r
758Routine Description:\r
759\r
760 Used to retrieve the list of legal Target IDs for SCSI devices \r
761 on a SCSI channel.\r
762\r
763Arguments:\r
764\r
765 This - Protocol instance pointer.\r
766 Target - On input, a pointer to the Target ID of a SCSI \r
767 device present on the SCSI channel. On output, \r
768 a pointer to the Target ID of the next SCSI device\r
769 present on a SCSI channel. An input value of \r
770 0xFFFFFFFF retrieves the Target ID of the first \r
771 SCSI device present on a SCSI channel.\r
772 Lun - On input, a pointer to the LUN of a SCSI device\r
773 present on the SCSI channel. On output, a pointer\r
774 to the LUN of the next SCSI device present on \r
775 a SCSI channel.\r
776Returns:\r
777\r
778 EFI_SUCCESS - The Target ID and Lun of the next SCSI device \r
779 on the SCSI channel was returned in Target and Lun.\r
780 EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r
781 EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r
782 returned on a previous call to GetNextDevice().\r
783\r
784--*/\r
785;\r
786\r
787EFI_STATUS\r
788EFIAPI\r
789AtapiExtScsiPassThruBuildDevicePath (\r
790 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
791 IN UINT8 *Target,\r
792 IN UINT64 Lun,\r
793 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
794 )\r
795/*++\r
796\r
797Routine Description:\r
798\r
799 Used to allocate and build a device path node for a SCSI device \r
800 on a SCSI channel. Would not build device path for a SCSI Host Controller.\r
801\r
802Arguments:\r
803\r
804 This - Protocol instance pointer.\r
805 Target - The Target ID of the SCSI device for which\r
806 a device path node is to be allocated and built.\r
807 Lun - The LUN of the SCSI device for which a device \r
808 path node is to be allocated and built.\r
809 DevicePath - A pointer to a single device path node that \r
810 describes the SCSI device specified by \r
811 Target and Lun. This function is responsible \r
812 for allocating the buffer DevicePath with the boot\r
813 service AllocatePool(). It is the caller's \r
814 responsibility to free DevicePath when the caller\r
815 is finished with DevicePath. \r
816 Returns:\r
817 EFI_SUCCESS - The device path node that describes the SCSI device\r
818 specified by Target and Lun was allocated and \r
819 returned in DevicePath.\r
820 EFI_NOT_FOUND - The SCSI devices specified by Target and Lun does\r
821 not exist on the SCSI channel.\r
822 EFI_INVALID_PARAMETER - DevicePath is NULL.\r
823 EFI_OUT_OF_RESOURCES - There are not enough resources to allocate \r
824 DevicePath.\r
825\r
826--*/\r
827;\r
828\r
829EFI_STATUS\r
830EFIAPI\r
831AtapiExtScsiPassThruGetTargetLun (\r
832 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
833 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,\r
834 OUT UINT8 **Target,\r
835 OUT UINT64 *Lun\r
836 )\r
837/*++\r
838\r
839Routine Description:\r
840\r
841 Used to translate a device path node to a Target ID and LUN.\r
842\r
843Arguments:\r
844\r
845 This - Protocol instance pointer.\r
846 DevicePath - A pointer to the device path node that \r
847 describes a SCSI device on the SCSI channel.\r
848 Target - A pointer to the Target ID of a SCSI device \r
849 on the SCSI channel. \r
850 Lun - A pointer to the LUN of a SCSI device on \r
851 the SCSI channel. \r
852Returns:\r
853\r
854 EFI_SUCCESS - DevicePath was successfully translated to a \r
855 Target ID and LUN, and they were returned \r
856 in Target and Lun.\r
857 EFI_INVALID_PARAMETER - DevicePath/Target/Lun is NULL.\r
858 EFI_UNSUPPORTED - This driver does not support the device path \r
859 node type in DevicePath.\r
860 EFI_NOT_FOUND - A valid translation from DevicePath to a \r
861 Target ID and LUN does not exist.\r
862\r
863--*/\r
864;\r
865\r
866EFI_STATUS\r
867EFIAPI\r
868AtapiExtScsiPassThruResetChannel (\r
869 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This\r
870 )\r
871/*++\r
872\r
873Routine Description:\r
874\r
875 Resets a SCSI channel.This operation resets all the \r
876 SCSI devices connected to the SCSI channel.\r
877\r
878Arguments:\r
879\r
880 This - Protocol instance pointer.\r
881\r
882Returns:\r
883\r
884 EFI_SUCCESS - The SCSI channel was reset.\r
885 EFI_UNSUPPORTED - The SCSI channel does not support \r
886 a channel reset operation.\r
887 EFI_DEVICE_ERROR - A device error occurred while \r
888 attempting to reset the SCSI channel.\r
889 EFI_TIMEOUT - A timeout occurred while attempting \r
890 to reset the SCSI channel.\r
891\r
892--*/\r
893;\r
894\r
895EFI_STATUS\r
896EFIAPI\r
897AtapiExtScsiPassThruResetTarget (\r
898 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
899 IN UINT8 *Target,\r
900 IN UINT64 Lun\r
901 )\r
902/*++\r
903\r
904Routine Description:\r
905\r
906 Resets a SCSI device that is connected to a SCSI channel.\r
907\r
908Arguments:\r
909\r
910 This - Protocol instance pointer.\r
911 Target - The Target ID of the SCSI device to reset. \r
912 Lun - The LUN of the SCSI device to reset.\r
913 \r
914Returns:\r
915\r
916 EFI_SUCCESS - The SCSI device specified by Target and \r
917 Lun was reset.\r
918 EFI_UNSUPPORTED - The SCSI channel does not support a target\r
919 reset operation.\r
920 EFI_INVALID_PARAMETER - Target or Lun are invalid.\r
921 EFI_DEVICE_ERROR - A device error occurred while attempting \r
922 to reset the SCSI device specified by Target \r
923 and Lun.\r
924 EFI_TIMEOUT - A timeout occurred while attempting to reset \r
925 the SCSI device specified by Target and Lun.\r
926\r
927--*/\r
928;\r
929\r
930EFI_STATUS\r
931EFIAPI\r
932AtapiExtScsiPassThruGetNextTarget (\r
933 IN EFI_EXT_SCSI_PASS_THRU_PROTOCOL *This,\r
934 IN OUT UINT8 **Target\r
935 )\r
936/*++\r
937\r
938Routine Description:\r
939 Used to retrieve the list of legal Target IDs for SCSI devices \r
940 on a SCSI channel.\r
941\r
942Arguments:\r
943 This - Protocol instance pointer.\r
944 Target - On input, a pointer to the Target ID of a SCSI \r
945 device present on the SCSI channel. On output, \r
946 a pointer to the Target ID of the next SCSI device\r
947 present on a SCSI channel. An input value of \r
948 0xFFFFFFFF retrieves the Target ID of the first \r
949 SCSI device present on a SCSI channel.\r
950 Lun - On input, a pointer to the LUN of a SCSI device\r
951 present on the SCSI channel. On output, a pointer\r
952 to the LUN of the next SCSI device present on \r
953 a SCSI channel.\r
954 \r
955Returns:\r
956 EFI_SUCCESS - The Target ID and Lun of the next SCSI device \r
957 on the SCSI channel was returned in Target and Lun.\r
958 EFI_NOT_FOUND - There are no more SCSI devices on this SCSI channel.\r
959 EFI_INVALID_PARAMETER - Target is not 0xFFFFFFFF,and Target and Lun were not\r
960 returned on a previous call to GetNextDevice().\r
961\r
962--*/\r
963;\r
964\r
965EFI_STATUS\r
966CheckSCSIRequestPacket (\r
967 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
968 )\r
969/*++\r
970\r
971Routine Description:\r
972\r
973 Checks the parameters in the SCSI Request Packet to make sure\r
974 they are valid for a SCSI Pass Thru request.\r
975\r
976Arguments:\r
977\r
978 Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET \r
979\r
980Returns:\r
981\r
982 EFI_STATUS\r
983\r
984--*/\r
985;\r
986\r
987EFI_STATUS\r
988SubmitBlockingIoCommand (\r
989 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
990 UINT32 Target,\r
991 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
992 )\r
993/*++\r
994\r
995Routine Description:\r
996\r
997 Performs blocking I/O request.\r
998 \r
999Arguments:\r
1000\r
1001 AtapiScsiPrivate: Private data structure for the specified channel.\r
1002 Target: The Target ID of the ATAPI device to send the SCSI \r
1003 Request Packet. To ATAPI devices attached on an IDE\r
1004 Channel, Target ID 0 indicates Master device;Target\r
1005 ID 1 indicates Slave device.\r
1006 Packet: The SCSI Request Packet to send to the ATAPI device \r
1007 specified by Target.\r
1008 \r
1009 Returns: EFI_STATUS \r
1010\r
1011--*/\r
1012;\r
1013\r
1014BOOLEAN\r
1015IsCommandValid (\r
1016 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
1017 )\r
1018 /*++\r
1019\r
1020Routine Description:\r
1021\r
1022 Checks the requested SCSI command: \r
1023 Is it supported by this driver?\r
1024 Is the Data transfer direction reasonable?\r
1025\r
1026Arguments:\r
1027\r
1028 Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET \r
1029\r
1030Returns:\r
1031\r
1032 EFI_STATUS\r
1033\r
1034--*/\r
1035;\r
1036\r
1037EFI_STATUS\r
1038CheckExtSCSIRequestPacket (\r
1039 EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
1040 )\r
1041/*++\r
1042\r
1043Routine Description:\r
1044\r
1045 Checks the parameters in the SCSI Request Packet to make sure\r
1046 they are valid for a SCSI Pass Thru request.\r
1047\r
1048Arguments:\r
1049\r
1050 Packet - The pointer of EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET\r
1051 \r
1052Returns:\r
1053 \r
1054 EFI_STATUS\r
1055\r
1056--*/\r
1057;\r
1058\r
1059\r
1060BOOLEAN\r
1061IsExtCommandValid (\r
1062 EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
1063 )\r
1064/*++\r
1065 \r
1066Routine Description:\r
1067\r
1068 Checks the requested SCSI command: \r
1069 Is it supported by this driver?\r
1070 Is the Data transfer direction reasonable?\r
1071\r
1072Arguments:\r
1073\r
1074 Packet - The pointer of EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET \r
1075\r
1076Returns:\r
1077\r
1078 EFI_STATUS\r
1079\r
1080--*/\r
1081;\r
1082\r
1083EFI_STATUS\r
1084SubmitExtBlockingIoCommand (\r
1085 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1086 UINT8 Target,\r
1087 EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet\r
1088 )\r
1089/*++\r
1090\r
1091Routine Description:\r
1092\r
1093 Performs blocking I/O request.\r
1094 \r
1095Arguments:\r
1096\r
1097 AtapiScsiPrivate: Private data structure for the specified channel.\r
1098 Target: The Target ID of the ATAPI device to send the SCSI \r
1099 Request Packet. To ATAPI devices attached on an IDE\r
1100 Channel, Target ID 0 indicates Master device;Target\r
1101 ID 1 indicates Slave device.\r
1102 Packet: The SCSI Request Packet to send to the ATAPI device \r
1103 specified by Target.\r
1104 \r
1105 Returns: EFI_STATUS \r
1106 \r
1107--*/\r
1108;\r
1109\r
1110EFI_STATUS\r
1111RequestSenseCommand (\r
1112 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1113 UINT32 Target,\r
1114 UINT64 Timeout,\r
1115 VOID *SenseData,\r
1116 UINT8 *SenseDataLength\r
1117 )\r
1118/*++\r
1119\r
1120Routine Description:\r
1121\r
be900781 1122 Submit request sense command\r
823f7d4f 1123\r
1124Arguments:\r
1125\r
be900781 1126 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
823f7d4f 1127 Target - The target ID\r
1128 Timeout - The time to complete the command\r
1129 SenseData - The buffer to fill in sense data\r
1130 SenseDataLength - The length of buffer\r
1131\r
1132Returns:\r
1133\r
1134 EFI_STATUS\r
1135\r
1136--*/\r
1137;\r
1138\r
1139EFI_STATUS\r
1140AtapiPacketCommand (\r
1141 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1142 UINT32 Target,\r
1143 UINT8 *PacketCommand,\r
1144 VOID *Buffer,\r
1145 UINT32 *ByteCount,\r
1146 DATA_DIRECTION Direction,\r
1147 UINT64 TimeOutInMicroSeconds\r
1148 )\r
1149/*++\r
1150\r
1151Routine Description:\r
1152\r
1153 Submits ATAPI command packet to the specified ATAPI device.\r
1154 \r
1155Arguments:\r
1156\r
1157 AtapiScsiPrivate: Private data structure for the specified channel.\r
1158 Target: The Target ID of the ATAPI device to send the SCSI \r
1159 Request Packet. To ATAPI devices attached on an IDE\r
1160 Channel, Target ID 0 indicates Master device;Target\r
1161 ID 1 indicates Slave device.\r
1162 PacketCommand: Points to the ATAPI command packet.\r
1163 Buffer: Points to the transferred data.\r
1164 ByteCount: When input,indicates the buffer size; when output,\r
1165 indicates the actually transferred data size.\r
1166 Direction: Indicates the data transfer direction. \r
1167 TimeoutInMicroSeconds:\r
1168 The timeout, in micro second units, to use for the \r
1169 execution of this ATAPI command.\r
1170 A TimeoutInMicroSeconds value of 0 means that \r
1171 this function will wait indefinitely for the ATAPI \r
1172 command to execute.\r
1173 If TimeoutInMicroSeconds is greater than zero, then \r
1174 this function will return EFI_TIMEOUT if the time \r
1175 required to execute the ATAPI command is greater \r
1176 than TimeoutInMicroSeconds.\r
1177 \r
1178Returns:\r
1179\r
1180 EFI_STATUS\r
1181\r
1182--*/\r
1183;\r
1184\r
1185\r
1186UINT8\r
1187ReadPortB (\r
1188 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1189 IN UINT16 Port\r
1190 )\r
1191/*++\r
1192\r
1193Routine Description:\r
1194\r
1195 Read one byte from a specified I/O port.\r
1196\r
1197Arguments:\r
1198\r
1199 PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r
1200 Port - IO port\r
1201 \r
1202Returns:\r
1203\r
1204 A byte read out\r
1205\r
1206--*/\r
1207;\r
1208\r
1209\r
1210UINT16\r
1211ReadPortW (\r
1212 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1213 IN UINT16 Port\r
1214 )\r
1215/*++\r
1216\r
1217Routine Description:\r
1218\r
1219 Read one word from a specified I/O port.\r
1220\r
1221Arguments:\r
1222\r
1223 PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r
1224 Port - IO port\r
1225 \r
1226Returns: \r
1227\r
1228 A word read out\r
1229\r
1230--*/\r
1231;\r
1232\r
1233\r
1234VOID\r
1235WritePortB (\r
1236 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1237 IN UINT16 Port,\r
1238 IN UINT8 Data\r
1239 )\r
1240/*++\r
1241\r
1242Routine Description:\r
1243\r
1244 Write one byte to a specified I/O port.\r
1245\r
1246Arguments:\r
1247\r
1248 PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r
1249 Port - IO port\r
1250 Data - The data to write\r
1251 \r
1252Returns:\r
1253 \r
1254 NONE\r
1255 \r
1256--*/\r
1257;\r
1258\r
1259\r
1260VOID\r
1261WritePortW (\r
1262 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1263 IN UINT16 Port,\r
1264 IN UINT16 Data\r
1265 )\r
1266/*++\r
1267\r
1268Routine Description:\r
1269\r
1270 Write one word to a specified I/O port.\r
1271\r
1272Arguments:\r
1273\r
1274 PciIo - The pointer of EFI_PCI_IO_PROTOCOL\r
1275 Port - IO port\r
1276 Data - The data to write\r
1277 \r
1278Returns:\r
1279\r
1280 NONE\r
1281 \r
1282--*/\r
1283;\r
1284\r
1285EFI_STATUS\r
1286StatusDRQClear (\r
1287 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1288 UINT64 TimeOutInMicroSeconds\r
1289 )\r
1290/*++\r
1291\r
1292Routine Description:\r
1293\r
1294 Check whether DRQ is clear in the Status Register. (BSY must also be cleared)\r
1295 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1296 DRQ clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1297 elapsed.\r
1298\r
1299Arguments:\r
1300\r
1301 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1302 TimeoutInMicroSeconds - The time to wait for\r
1303 \r
1304Returns:\r
1305\r
1306 EFI_STATUS\r
1307\r
1308--*/\r
1309;\r
1310\r
1311EFI_STATUS\r
1312AltStatusDRQClear (\r
1313 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1314 UINT64 TimeOutInMicroSeconds\r
1315 )\r
1316/*++\r
1317\r
1318Routine Description:\r
1319\r
1320 Check whether DRQ is clear in the Alternate Status Register. \r
1321 (BSY must also be cleared).If TimeoutInMicroSeconds is zero, this routine should \r
1322 wait infinitely for DRQ clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1323 elapsed.\r
1324\r
1325Arguments:\r
1326\r
1327 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1328 TimeoutInMicroSeconds - The time to wait for\r
1329 \r
1330Returns:\r
1331\r
1332 EFI_STATUS\r
1333\r
1334--*/\r
1335;\r
1336\r
1337EFI_STATUS\r
1338StatusDRQReady (\r
1339 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1340 UINT64 TimeOutInMicroSeconds\r
1341 )\r
1342/*++\r
1343\r
1344Routine Description:\r
1345\r
1346 Check whether DRQ is ready in the Status Register. (BSY must also be cleared)\r
1347 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1348 DRQ ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1349 elapsed.\r
1350\r
1351Arguments:\r
1352\r
1353 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1354 TimeoutInMicroSeconds - The time to wait for\r
1355 \r
1356Returns:\r
1357\r
1358 EFI_STATUS\r
1359\r
1360--*/\r
1361;\r
1362\r
1363EFI_STATUS\r
1364AltStatusDRQReady (\r
1365 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1366 UINT64 TimeOutInMicroSeconds\r
1367 )\r
1368/*++\r
1369\r
1370Routine Description:\r
1371\r
1372 Check whether DRQ is ready in the Alternate Status Register. \r
1373 (BSY must also be cleared)\r
1374 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1375 DRQ ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1376 elapsed.\r
1377\r
1378Arguments:\r
1379\r
1380 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1381 TimeoutInMicroSeconds - The time to wait for\r
1382 \r
1383Returns:\r
1384\r
1385 EFI_STATUS\r
1386\r
1387--*/\r
1388;\r
1389\r
1390EFI_STATUS\r
1391StatusWaitForBSYClear (\r
1392 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1393 UINT64 TimeoutInMicroSeconds\r
1394 )\r
1395/*++\r
1396\r
1397Routine Description:\r
1398\r
1399 Check whether BSY is clear in the Status Register.\r
1400 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1401 BSY clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1402 elapsed.\r
1403\r
1404Arguments:\r
1405\r
1406 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1407 TimeoutInMicroSeconds - The time to wait for\r
1408 \r
1409Returns:\r
1410\r
1411 EFI_STATUS\r
1412\r
1413--*/\r
1414;\r
1415\r
1416EFI_STATUS\r
1417AltStatusWaitForBSYClear (\r
1418 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1419 UINT64 TimeoutInMicroSeconds\r
1420 )\r
1421/*++\r
1422\r
1423Routine Description:\r
1424\r
1425 Check whether BSY is clear in the Alternate Status Register.\r
1426 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1427 BSY clear. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1428 elapsed.\r
1429\r
1430Arguments:\r
1431\r
1432 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1433 TimeoutInMicroSeconds - The time to wait for\r
1434 \r
1435Returns:\r
1436\r
1437 EFI_STATUS\r
1438\r
1439--*/\r
1440;\r
1441\r
1442EFI_STATUS\r
1443StatusDRDYReady (\r
1444 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1445 UINT64 TimeoutInMicroSeconds\r
1446 )\r
1447/*++\r
1448\r
1449Routine Description:\r
1450\r
1451 Check whether DRDY is ready in the Status Register. \r
1452 (BSY must also be cleared)\r
1453 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1454 DRDY ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1455 elapsed.\r
1456\r
1457Arguments:\r
1458\r
1459 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1460 TimeoutInMicroSeconds - The time to wait for\r
1461 \r
1462Returns:\r
1463\r
1464 EFI_STATUS\r
1465\r
1466--*/\r
1467;\r
1468\r
1469EFI_STATUS\r
1470AltStatusDRDYReady (\r
1471 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1472 UINT64 TimeoutInMicroSeconds\r
1473 )\r
1474/*++\r
1475\r
1476Routine Description:\r
1477\r
1478 Check whether DRDY is ready in the Alternate Status Register. \r
1479 (BSY must also be cleared)\r
1480 If TimeoutInMicroSeconds is zero, this routine should wait infinitely for\r
1481 DRDY ready. Otherwise, it will return EFI_TIMEOUT when specified time is \r
1482 elapsed.\r
1483\r
1484Arguments:\r
1485\r
1486 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1487 TimeoutInMicroSeconds - The time to wait for\r
1488 \r
1489Returns:\r
1490\r
1491 EFI_STATUS\r
1492\r
1493--*/\r
1494;\r
1495\r
1496EFI_STATUS\r
1497AtapiPassThruPioReadWriteData (\r
1498 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1499 UINT16 *Buffer,\r
1500 UINT32 *ByteCount,\r
1501 DATA_DIRECTION Direction,\r
1502 UINT64 TimeOutInMicroSeconds\r
1503 )\r
1504/*++\r
1505\r
1506Routine Description:\r
1507\r
1508 Performs data transfer between ATAPI device and host after the\r
1509 ATAPI command packet is sent.\r
1510 \r
1511Arguments:\r
1512\r
1513 AtapiScsiPrivate: Private data structure for the specified channel. \r
1514 Buffer: Points to the transferred data.\r
1515 ByteCount: When input,indicates the buffer size; when output,\r
1516 indicates the actually transferred data size.\r
1517 Direction: Indicates the data transfer direction. \r
1518 TimeoutInMicroSeconds:\r
1519 The timeout, in micro second units, to use for the \r
1520 execution of this ATAPI command.\r
1521 A TimeoutInMicroSeconds value of 0 means that \r
1522 this function will wait indefinitely for the ATAPI \r
1523 command to execute.\r
1524 If TimeoutInMicroSeconds is greater than zero, then \r
1525 this function will return EFI_TIMEOUT if the time \r
1526 required to execute the ATAPI command is greater \r
1527 than TimeoutInMicroSeconds.\r
1528 Returns:\r
1529\r
1530 EFI_STATUS\r
1531\r
1532--*/\r
1533;\r
1534\r
1535EFI_STATUS\r
1536AtapiPassThruCheckErrorStatus (\r
1537 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate\r
1538 )\r
1539/*++\r
1540\r
1541Routine Description:\r
1542\r
1543 Check Error Register for Error Information. \r
1544 \r
1545Arguments:\r
1546\r
1547 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1548 \r
1549Returns:\r
1550\r
1551 EFI_STATUS\r
1552\r
1553--*/\r
1554;\r
1555\r
1556\r
1557EFI_STATUS\r
1558GetIdeRegistersBaseAddr (\r
1559 IN EFI_PCI_IO_PROTOCOL *PciIo,\r
1560 OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r
1561 )\r
1562/*++\r
1563\r
1564Routine Description:\r
1565 Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,\r
1566 use fixed addresses. In Native-PCI mode, get base addresses from BARs in\r
1567 the PCI IDE controller's Configuration Space.\r
1568\r
1569Arguments:\r
1570 PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance\r
1571 IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to \r
1572 receive IDE IO port registers' base addresses\r
1573 \r
1574Returns:\r
1575\r
1576 EFI_STATUS\r
1577 \r
1578--*/\r
1579;\r
1580\r
1581\r
1582VOID\r
1583InitAtapiIoPortRegisters (\r
1584 IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,\r
1585 IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr\r
1586 )\r
1587/*++\r
1588\r
1589Routine Description:\r
1590\r
1591 Initialize each Channel's Base Address of CommandBlock and ControlBlock.\r
1592\r
1593Arguments:\r
1594 \r
1595 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV\r
1596 IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR\r
1597 \r
1598Returns:\r
1599 \r
1600 None\r
1601\r
1602--*/ \r
1603;\r
1604\r
1605/**\r
1606 Installs Scsi Pass Thru and/or Ext Scsi Pass Thru \r
1607 protocols based on feature flags. \r
1608\r
1609 @param Controller The controller handle to \r
1610 install these protocols on.\r
1611 @param AtapiScsiPrivate A pointer to the protocol private\r
1612 data structure.\r
1613\r
1614 @retval EFI_SUCCESS The installation succeeds. \r
1615 @retval other The installation fails. \r
1616 \r
1617**/\r
1618EFI_STATUS\r
1619InstallScsiPassThruProtocols (\r
1620 IN EFI_HANDLE *ControllerHandle,\r
1621 IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate\r
1622 );\r
1623\r
1624#endif\r