]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Pci/AtapiPassThruDxe/AtapiPassThru.h
Update to support to produce Component Name and & Component Name 2 protocol based...
[mirror_edk2.git] / MdeModulePkg / Bus / Pci / AtapiPassThruDxe / AtapiPassThru.h
1 /** @file
2 Copyright (c) 2006, Intel Corporation
3 All rights reserved. This program and the accompanying materials
4 are licensed and made available under the terms and conditions of the BSD License
5 which accompanies this distribution. The full text of the license may be found at
6 http://opensource.org/licenses/bsd-license.php
7
8 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
9 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
10
11 Module Name: AtapiPassThru.h
12
13 **/
14
15 #ifndef _APT_H
16 #define _APT_H
17
18
19
20 #include <Uefi.h>
21
22 #include <Protocol/ScsiPassThru.h>
23 #include <Protocol/PciIo.h>
24
25 #include <Library/DebugLib.h>
26 #include <Library/UefiDriverEntryPoint.h>
27 #include <Library/BaseLib.h>
28 #include <Library/UefiLib.h>
29 #include <Library/BaseMemoryLib.h>
30 #include <Library/MemoryAllocationLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <IndustryStandard/pci22.h>
33
34 ///
35 /// bit definition
36 ///
37 #define bit(a) (1 << (a))
38
39 #define MAX_TARGET_ID 4
40
41 //
42 // IDE Registers
43 //
44 typedef union {
45 UINT16 Command; /* when write */
46 UINT16 Status; /* when read */
47 } IDE_CMD_OR_STATUS;
48
49 typedef union {
50 UINT16 Error; /* when read */
51 UINT16 Feature; /* when write */
52 } IDE_ERROR_OR_FEATURE;
53
54 typedef union {
55 UINT16 AltStatus; /* when read */
56 UINT16 DeviceControl; /* when write */
57 } IDE_AltStatus_OR_DeviceControl;
58
59
60 typedef enum {
61 IdePrimary = 0,
62 IdeSecondary = 1,
63 IdeMaxChannel = 2
64 } EFI_IDE_CHANNEL;
65
66 ///
67
68
69 //
70 // Bit definitions in Programming Interface byte of the Class Code field
71 // in PCI IDE controller's Configuration Space
72 //
73 #define IDE_PRIMARY_OPERATING_MODE BIT0
74 #define IDE_PRIMARY_PROGRAMMABLE_INDICATOR BIT1
75 #define IDE_SECONDARY_OPERATING_MODE BIT2
76 #define IDE_SECONDARY_PROGRAMMABLE_INDICATOR BIT3
77
78
79 #define ATAPI_MAX_CHANNEL 2
80
81 ///
82 /// IDE registers set
83 ///
84 typedef struct {
85 UINT16 Data;
86 IDE_ERROR_OR_FEATURE Reg1;
87 UINT16 SectorCount;
88 UINT16 SectorNumber;
89 UINT16 CylinderLsb;
90 UINT16 CylinderMsb;
91 UINT16 Head;
92 IDE_CMD_OR_STATUS Reg;
93 IDE_AltStatus_OR_DeviceControl Alt;
94 UINT16 DriveAddress;
95 } IDE_BASE_REGISTERS;
96
97 #define ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE EFI_SIGNATURE_32 ('a', 's', 'p', 't')
98
99 typedef struct {
100 UINTN Signature;
101 EFI_HANDLE Handle;
102 EFI_SCSI_PASS_THRU_PROTOCOL ScsiPassThru;
103 EFI_SCSI_PASS_THRU_MODE ScsiPassThruMode;
104 EFI_PCI_IO_PROTOCOL *PciIo;
105 //
106 // Local Data goes here
107 //
108 IDE_BASE_REGISTERS *IoPort;
109 IDE_BASE_REGISTERS AtapiIoPortRegisters[2];
110 CHAR16 ControllerName[100];
111 CHAR16 ChannelName[100];
112 UINT32 LatestTargetId;
113 UINT64 LatestLun;
114 } ATAPI_SCSI_PASS_THRU_DEV;
115
116 //
117 // IDE registers' base addresses
118 //
119 typedef struct {
120 UINT16 CommandBlockBaseAddr;
121 UINT16 ControlBlockBaseAddr;
122 } IDE_REGISTERS_BASE_ADDR;
123
124 #define ATAPI_SCSI_PASS_THRU_DEV_FROM_THIS(a) \
125 CR (a, \
126 ATAPI_SCSI_PASS_THRU_DEV, \
127 ScsiPassThru, \
128 ATAPI_SCSI_PASS_THRU_DEV_SIGNATURE \
129 )
130
131 //
132 // Global Variables
133 //
134 extern EFI_DRIVER_BINDING_PROTOCOL gAtapiScsiPassThruDriverBinding;
135 extern EFI_COMPONENT_NAME_PROTOCOL gAtapiScsiPassThruComponentName;
136 extern EFI_COMPONENT_NAME2_PROTOCOL gAtapiScsiPassThruComponentName2;
137
138 //
139 // ATAPI Command op code
140 //
141 #define OP_INQUIRY 0x12
142 #define OP_LOAD_UNLOAD_CD 0xa6
143 #define OP_MECHANISM_STATUS 0xbd
144 #define OP_MODE_SELECT_10 0x55
145 #define OP_MODE_SENSE_10 0x5a
146 #define OP_PAUSE_RESUME 0x4b
147 #define OP_PLAY_AUDIO_10 0x45
148 #define OP_PLAY_AUDIO_MSF 0x47
149 #define OP_PLAY_CD 0xbc
150 #define OP_PLAY_CD_MSF 0xb4
151 #define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
152 #define OP_READ_10 0x28
153 #define OP_READ_12 0xa8
154 #define OP_READ_CAPACITY 0x25
155 #define OP_READ_CD 0xbe
156 #define OP_READ_CD_MSF 0xb9
157 #define OP_READ_HEADER 0x44
158 #define OP_READ_SUB_CHANNEL 0x42
159 #define OP_READ_TOC 0x43
160 #define OP_REQUEST_SENSE 0x03
161 #define OP_SCAN 0xba
162 #define OP_SEEK_10 0x2b
163 #define OP_SET_CD_SPEED 0xbb
164 #define OP_STOPPLAY_SCAN 0x4e
165 #define OP_START_STOP_UNIT 0x1b
166 #define OP_TEST_UNIT_READY 0x00
167
168 #define OP_FORMAT_UNIT 0x04
169 #define OP_READ_FORMAT_CAPACITIES 0x23
170 #define OP_VERIFY 0x2f
171 #define OP_WRITE_10 0x2a
172 #define OP_WRITE_12 0xaa
173 #define OP_WRITE_AND_VERIFY 0x2e
174
175 //
176 // ATA Command
177 //
178 #define ATAPI_SOFT_RESET_CMD 0x08
179
180 typedef enum {
181 DataIn = 0,
182 DataOut = 1,
183 NoData = 2,
184 End = 0xff
185 } DATA_DIRECTION;
186
187 typedef struct {
188 UINT8 OpCode;
189 DATA_DIRECTION Direction;
190 } SCSI_COMMAND_SET;
191
192 #define MAX_CHANNEL 2
193
194 #define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0
195
196 //
197 // IDE registers bit definitions
198 //
199 // ATA Err Reg bitmap
200 //
201 #define BBK_ERR bit (7) ///< Bad block detected
202 #define UNC_ERR bit (6) ///< Uncorrectable Data
203 #define MC_ERR bit (5) ///< Media Change
204 #define IDNF_ERR bit (4) ///< ID Not Found
205 #define MCR_ERR bit (3) ///< Media Change Requested
206 #define ABRT_ERR bit (2) ///< Aborted Command
207 #define TK0NF_ERR bit (1) ///< Track 0 Not Found
208 #define AMNF_ERR bit (0) ///< Address Mark Not Found
209
210 //
211 // ATAPI Err Reg bitmap
212 //
213 #define SENSE_KEY_ERR (bit (7) | bit (6) | bit (5) | bit (4))
214 #define EOM_ERR bit (1) ///< End of Media Detected
215 #define ILI_ERR bit (0) ///< Illegal Length Indication
216
217 //
218 // Device/Head Reg
219 //
220 #define LBA_MODE bit (6)
221 #define DEV bit (4)
222 #define HS3 bit (3)
223 #define HS2 bit (2)
224 #define HS1 bit (1)
225 #define HS0 bit (0)
226 #define CHS_MODE (0)
227 #define DRV0 (0)
228 #define DRV1 (1)
229 #define MST_DRV DRV0
230 #define SLV_DRV DRV1
231
232 //
233 // Status Reg
234 //
235 #define BSY bit (7) ///< Controller Busy
236 #define DRDY bit (6) ///< Drive Ready
237 #define DWF bit (5) ///< Drive Write Fault
238 #define DSC bit (4) ///< Disk Seek Complete
239 #define DRQ bit (3) ///< Data Request
240 #define CORR bit (2) ///< Corrected Data
241 #define IDX bit (1) ///< Index
242 #define ERR bit (0) ///< Error
243 #define CHECK bit (0) ///< Check bit for ATAPI Status Reg
244
245 //
246 // Device Control Reg
247 //
248 #define SRST bit (2) ///< Software Reset
249 #define IEN_L bit (1) ///< Interrupt Enable
250
251 //
252 // ATAPI Feature Register
253 //
254 #define OVERLAP bit (1)
255 #define DMA bit (0)
256
257 //
258 // ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)
259 //
260 #define RELEASE bit (2)
261 #define IO bit (1)
262 #define CoD bit (0)
263
264 #define PACKET_CMD 0xA0
265
266 #define DEFAULT_CMD (0xa0)
267 //
268 // default content of device control register, disable INT
269 //
270 #define DEFAULT_CTL (0x0a)
271 #define MAX_ATAPI_BYTE_COUNT (0xfffe)
272
273 //
274 // function prototype
275 //
276
277 EFI_STATUS
278 EFIAPI
279 AtapiScsiPassThruDriverBindingSupported (
280 IN EFI_DRIVER_BINDING_PROTOCOL *This,
281 IN EFI_HANDLE Controller,
282 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
283 );
284
285 EFI_STATUS
286 EFIAPI
287 AtapiScsiPassThruDriverBindingStart (
288 IN EFI_DRIVER_BINDING_PROTOCOL *This,
289 IN EFI_HANDLE Controller,
290 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
291 );
292
293 EFI_STATUS
294 EFIAPI
295 AtapiScsiPassThruDriverBindingStop (
296 IN EFI_DRIVER_BINDING_PROTOCOL *This,
297 IN EFI_HANDLE Controller,
298 IN UINTN NumberOfChildren,
299 IN EFI_HANDLE *ChildHandleBuffer
300 );
301
302 //
303 // EFI Component Name Functions
304 //
305 /**
306 Retrieves a Unicode string that is the user readable name of the driver.
307
308 This function retrieves the user readable name of a driver in the form of a
309 Unicode string. If the driver specified by This has a user readable name in
310 the language specified by Language, then a pointer to the driver name is
311 returned in DriverName, and EFI_SUCCESS is returned. If the driver specified
312 by This does not support the language specified by Language,
313 then EFI_UNSUPPORTED is returned.
314
315 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
316 EFI_COMPONENT_NAME_PROTOCOL instance.
317
318 @param Language[in] A pointer to a Null-terminated ASCII string
319 array indicating the language. This is the
320 language of the driver name that the caller is
321 requesting, and it must match one of the
322 languages specified in SupportedLanguages. The
323 number of languages supported by a driver is up
324 to the driver writer. Language is specified
325 in RFC 3066 or ISO 639-2 language code format.
326
327 @param DriverName[out] A pointer to the Unicode string to return.
328 This Unicode string is the name of the
329 driver specified by This in the language
330 specified by Language.
331
332 @retval EFI_SUCCESS The Unicode string for the Driver specified by
333 This and the language specified by Language was
334 returned in DriverName.
335
336 @retval EFI_INVALID_PARAMETER Language is NULL.
337
338 @retval EFI_INVALID_PARAMETER DriverName is NULL.
339
340 @retval EFI_UNSUPPORTED The driver specified by This does not support
341 the language specified by Language.
342
343 **/
344 EFI_STATUS
345 EFIAPI
346 AtapiScsiPassThruComponentNameGetDriverName (
347 IN EFI_COMPONENT_NAME_PROTOCOL *This,
348 IN CHAR8 *Language,
349 OUT CHAR16 **DriverName
350 );
351
352
353 /**
354 Retrieves a Unicode string that is the user readable name of the controller
355 that is being managed by a driver.
356
357 This function retrieves the user readable name of the controller specified by
358 ControllerHandle and ChildHandle in the form of a Unicode string. If the
359 driver specified by This has a user readable name in the language specified by
360 Language, then a pointer to the controller name is returned in ControllerName,
361 and EFI_SUCCESS is returned. If the driver specified by This is not currently
362 managing the controller specified by ControllerHandle and ChildHandle,
363 then EFI_UNSUPPORTED is returned. If the driver specified by This does not
364 support the language specified by Language, then EFI_UNSUPPORTED is returned.
365
366 @param This[in] A pointer to the EFI_COMPONENT_NAME2_PROTOCOL or
367 EFI_COMPONENT_NAME_PROTOCOL instance.
368
369 @param ControllerHandle[in] The handle of a controller that the driver
370 specified by This is managing. This handle
371 specifies the controller whose name is to be
372 returned.
373
374 @param ChildHandle[in] The handle of the child controller to retrieve
375 the name of. This is an optional parameter that
376 may be NULL. It will be NULL for device
377 drivers. It will also be NULL for a bus drivers
378 that wish to retrieve the name of the bus
379 controller. It will not be NULL for a bus
380 driver that wishes to retrieve the name of a
381 child controller.
382
383 @param Language[in] A pointer to a Null-terminated ASCII string
384 array indicating the language. This is the
385 language of the driver name that the caller is
386 requesting, and it must match one of the
387 languages specified in SupportedLanguages. The
388 number of languages supported by a driver is up
389 to the driver writer. Language is specified in
390 RFC 3066 or ISO 639-2 language code format.
391
392 @param ControllerName[out] A pointer to the Unicode string to return.
393 This Unicode string is the name of the
394 controller specified by ControllerHandle and
395 ChildHandle in the language specified by
396 Language from the point of view of the driver
397 specified by This.
398
399 @retval EFI_SUCCESS The Unicode string for the user readable name in
400 the language specified by Language for the
401 driver specified by This was returned in
402 DriverName.
403
404 @retval EFI_INVALID_PARAMETER ControllerHandle is not a valid EFI_HANDLE.
405
406 @retval EFI_INVALID_PARAMETER ChildHandle is not NULL and it is not a valid
407 EFI_HANDLE.
408
409 @retval EFI_INVALID_PARAMETER Language is NULL.
410
411 @retval EFI_INVALID_PARAMETER ControllerName is NULL.
412
413 @retval EFI_UNSUPPORTED The driver specified by This is not currently
414 managing the controller specified by
415 ControllerHandle and ChildHandle.
416
417 @retval EFI_UNSUPPORTED The driver specified by This does not support
418 the language specified by Language.
419
420 **/
421 EFI_STATUS
422 EFIAPI
423 AtapiScsiPassThruComponentNameGetControllerName (
424 IN EFI_COMPONENT_NAME_PROTOCOL *This,
425 IN EFI_HANDLE ControllerHandle,
426 IN EFI_HANDLE ChildHandle OPTIONAL,
427 IN CHAR8 *Language,
428 OUT CHAR16 **ControllerName
429 );
430
431
432 /**
433 AtapiScsiPassThruDriverEntryPoint
434
435 @param ImageHandle
436 @param SystemTable
437
438 @todo Add function description
439 @todo ImageHandle - add argument description
440 @todo SystemTable - add argument description
441 @todo add return values
442 --*/
443 EFI_STATUS
444 EFIAPI
445 AtapiScsiPassThruDriverEntryPoint (
446 IN EFI_HANDLE ImageHandle,
447 IN EFI_SYSTEM_TABLE *SystemTable
448 )
449 ;
450
451 /**
452 RegisterAtapiScsiPassThru
453
454 @param This
455 @param Controller
456 @param PciIo
457
458 @todo Add function description
459 @todo This add argument description
460 @todo Controller add argument description
461 @todo PciIo add argument description
462 @todo add return values
463 **/
464 EFI_STATUS
465 RegisterAtapiScsiPassThru (
466 IN EFI_DRIVER_BINDING_PROTOCOL *This,
467 IN EFI_HANDLE Controller,
468 IN EFI_PCI_IO_PROTOCOL *PciIo
469 )
470 ;
471
472 /**
473 AtapiScsiPassThruFunction
474
475 @param This
476 @param Target
477 @param Lun
478 @param Packet
479 @param Event
480
481 @todo Add function description
482 @todo This - add argument description
483 @todo Target - add argument description
484 @todo Lun - add argument description
485 @todo Packet - add argument description
486 @todo Event - add argument description
487 @todo add return values
488 **/
489 EFI_STATUS
490 EFIAPI
491 AtapiScsiPassThruFunction (
492 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
493 IN UINT32 Target,
494 IN UINT64 Lun,
495 IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
496 IN EFI_EVENT Event OPTIONAL
497 )
498 ;
499
500 /**
501 AtapiScsiPassThruGetNextDevice
502
503 TODO: Add function description
504
505 @param This TODO: add argument description
506 @param Target TODO: add argument description
507 @param Lun TODO: add argument description
508
509 TODO: add return values
510
511 **/
512 EFI_STATUS
513 EFIAPI
514 AtapiScsiPassThruGetNextDevice (
515 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
516 IN OUT UINT32 *Target,
517 IN OUT UINT64 *Lun
518 )
519 ;
520
521 /**
522 AtapiScsiPassThruBuildDevicePath
523
524 TODO: Add function description
525
526 @param This TODO: add argument description
527 @param Target TODO: add argument description
528 @param Lun TODO: add argument description
529 @param DevicePath TODO: add argument description
530
531 TODO: add return values
532
533 **/
534 EFI_STATUS
535 EFIAPI
536 AtapiScsiPassThruBuildDevicePath (
537 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
538 IN UINT32 Target,
539 IN UINT64 Lun,
540 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
541 )
542 ;
543
544 /**
545 AtapiScsiPassThruGetTargetLun
546
547 TODO: Add function description
548
549 @param This TODO: add argument description
550 @param DevicePath TODO: add argument description
551 @param Target TODO: add argument description
552 @param Lun TODO: add argument description
553
554 TODO: add return values
555
556 **/
557 EFI_STATUS
558 EFIAPI
559 AtapiScsiPassThruGetTargetLun (
560 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
561 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
562 OUT UINT32 *Target,
563 OUT UINT64 *Lun
564 )
565 ;
566
567 /**
568 AtapiScsiPassThruResetChannel
569
570 TODO: Add function description
571
572 @param This TODO: add argument description
573
574 TODO: add return values
575
576 **/
577 EFI_STATUS
578 EFIAPI
579 AtapiScsiPassThruResetChannel (
580 IN EFI_SCSI_PASS_THRU_PROTOCOL *This
581 )
582 ;
583
584 /**
585 AtapiScsiPassThruResetTarget
586
587 TODO: Add function description
588
589 @param This TODO: add argument description
590 @param Target TODO: add argument description
591 @param Lun TODO: add argument description
592
593 TODO: add return values
594
595 **/
596 EFI_STATUS
597 EFIAPI
598 AtapiScsiPassThruResetTarget (
599 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
600 IN UINT32 Target,
601 IN UINT64 Lun
602 )
603 ;
604
605 /**
606 CheckSCSIRequestPacket
607
608 TODO: Add function description
609
610 @param Packet TODO: add argument description
611
612 TODO: add return values
613
614 **/
615 EFI_STATUS
616 CheckSCSIRequestPacket (
617 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
618 )
619 ;
620
621 /**
622 SubmitBlockingIoCommand
623
624 TODO: Add function description
625
626 @param AtapiScsiPrivate TODO: add argument description
627 @param Target TODO: add argument description
628 @param Packet TODO: add argument description
629
630 TODO: add return values
631
632 **/
633 EFI_STATUS
634 SubmitBlockingIoCommand (
635 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
636 UINT32 Target,
637 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
638 )
639 ;
640
641 /**
642 IsCommandValid
643
644 TODO: Add function description
645
646 @param Packet - TODO: add argument description
647
648 @return TODO: add return values
649
650 --*/
651 BOOLEAN
652 IsCommandValid (
653 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
654 )
655 ;
656
657 /**
658 RequestSenseCommand
659
660 TODO: Add function description
661
662 @param AtapiScsiPrivate TODO: add argument description
663 @param Target TODO: add argument description
664 @param Timeout TODO: add argument description
665 @param SenseData TODO: add argument description
666 @param SenseDataLength TODO: add argument description
667
668 TODO: add return values
669
670 **/
671 EFI_STATUS
672 RequestSenseCommand (
673 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
674 UINT32 Target,
675 UINT64 Timeout,
676 VOID *SenseData,
677 UINT8 *SenseDataLength
678 )
679 ;
680
681 /**
682 AtapiPacketCommand
683
684 TODO: Add function description
685
686 @param AtapiScsiPrivate TODO: add argument description
687 @param Target TODO: add argument description
688 @param PacketCommand TODO: add argument description
689 @param Buffer TODO: add argument description
690 @param ByteCount TODO: add argument description
691 @param Direction TODO: add argument description
692 @param TimeOutInMicroSeconds TODO: add argument description
693
694 TODO: add return values
695
696 **/
697 EFI_STATUS
698 AtapiPacketCommand (
699 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
700 UINT32 Target,
701 UINT8 *PacketCommand,
702 VOID *Buffer,
703 UINT32 *ByteCount,
704 DATA_DIRECTION Direction,
705 UINT64 TimeOutInMicroSeconds
706 )
707 ;
708
709
710 /**
711 ReadPortB
712
713 TODO: Add function description
714
715 @param PciIo TODO: add argument description
716 @param Port TODO: add argument description
717
718 TODO: add return values
719
720 **/
721 UINT8
722 ReadPortB (
723 IN EFI_PCI_IO_PROTOCOL *PciIo,
724 IN UINT16 Port
725 )
726 ;
727
728
729 /**
730 ReadPortW
731
732 TODO: Add function description
733
734 @param PciIo TODO: add argument description
735 @param Port TODO: add argument description
736
737 TODO: add return values
738
739 **/
740 UINT16
741 ReadPortW (
742 IN EFI_PCI_IO_PROTOCOL *PciIo,
743 IN UINT16 Port
744 )
745 ;
746
747
748 /**
749 WritePortB
750
751 TODO: Add function description
752
753 @param PciIo TODO: add argument description
754 @param Port TODO: add argument description
755 @param Data TODO: add argument description
756
757 TODO: add return values
758
759 **/
760 VOID
761 WritePortB (
762 IN EFI_PCI_IO_PROTOCOL *PciIo,
763 IN UINT16 Port,
764 IN UINT8 Data
765 )
766 ;
767
768
769 /**
770 WritePortW
771
772 TODO: Add function description
773
774 @param PciIo TODO: add argument description
775 @param Port TODO: add argument description
776 @param Data TODO: add argument description
777
778 TODO: add return values
779
780 **/
781 VOID
782 WritePortW (
783 IN EFI_PCI_IO_PROTOCOL *PciIo,
784 IN UINT16 Port,
785 IN UINT16 Data
786 )
787 ;
788
789 /**
790 StatusDRQClear
791
792 TODO: Add function description
793
794 @param AtapiScsiPrivate TODO: add argument description
795 @param TimeOutInMicroSeconds TODO: add argument description
796
797 TODO: add return values
798
799 **/
800 EFI_STATUS
801 StatusDRQClear (
802 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
803 UINT64 TimeOutInMicroSeconds
804 )
805 ;
806
807 /**
808 AltStatusDRQClear
809
810 TODO: Add function description
811
812 @param AtapiScsiPrivate TODO: add argument description
813 @param TimeOutInMicroSeconds TODO: add argument description
814
815 TODO: add return values
816
817 **/
818 EFI_STATUS
819 AltStatusDRQClear (
820 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
821 UINT64 TimeOutInMicroSeconds
822 )
823 ;
824
825 /**
826 StatusDRQReady
827
828 TODO: Add function description
829
830 @param AtapiScsiPrivate TODO: add argument description
831 @param TimeOutInMicroSeconds TODO: add argument description
832
833 TODO: add return values
834
835 **/
836 EFI_STATUS
837 StatusDRQReady (
838 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
839 UINT64 TimeOutInMicroSeconds
840 )
841 ;
842
843 /**
844 AltStatusDRQReady
845
846 TODO: Add function description
847
848 @param AtapiScsiPrivate TODO: add argument description
849 @param TimeOutInMicroSeconds TODO: add argument description
850
851 TODO: add return values
852
853 **/
854 EFI_STATUS
855 AltStatusDRQReady (
856 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
857 UINT64 TimeOutInMicroSeconds
858 )
859 ;
860
861 /**
862 TODO: Add function description
863
864 @param AtapiScsiPrivate TODO: add argument description
865 @param TimeoutInMicroSeconds TODO: add argument description
866
867 TODO: add return values
868
869 **/
870 EFI_STATUS
871 StatusWaitForBSYClear (
872 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
873 UINT64 TimeoutInMicroSeconds
874 )
875 ;
876
877 /**
878 TODO: Add function description
879
880 @param AtapiScsiPrivate TODO: add argument description
881 @param TimeoutInMicroSeconds TODO: add argument description
882
883 TODO: add return values
884
885 **/
886 EFI_STATUS
887 AltStatusWaitForBSYClear (
888 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
889 UINT64 TimeoutInMicroSeconds
890 )
891 ;
892
893 /**
894 TODO: Add function description
895
896 @param AtapiScsiPrivate TODO: add argument description
897 @param TimeoutInMicroSeconds TODO: add argument description
898
899 TODO: add return values
900
901 **/
902 EFI_STATUS
903 StatusDRDYReady (
904 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
905 UINT64 TimeoutInMicroSeconds
906 )
907 ;
908
909 /**
910 TODO: Add function description
911
912 @param AtapiScsiPrivate TODO: add argument description
913 @param TimeoutInMicroSeconds TODO: add argument description
914
915 TODO: add return values
916
917 **/
918 EFI_STATUS
919 AltStatusDRDYReady (
920 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
921 UINT64 TimeoutInMicroSeconds
922 )
923 ;
924
925 /**
926 TODO: Add function description
927
928 @param AtapiScsiPrivate TODO: add argument description
929 @param Buffer TODO: add argument description
930 @param ByteCount TODO: add argument description
931 @param Direction TODO: add argument description
932 @param TimeOutInMicroSeconds TODO: add argument description
933
934 TODO: add return values
935
936 **/
937 EFI_STATUS
938 AtapiPassThruPioReadWriteData (
939 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
940 UINT16 *Buffer,
941 UINT32 *ByteCount,
942 DATA_DIRECTION Direction,
943 UINT64 TimeOutInMicroSeconds
944 )
945 ;
946
947 /**
948 TODO: Add function description
949
950 @param AtapiScsiPrivate TODO: add argument description
951
952 TODO: add return values
953
954 **/
955 EFI_STATUS
956 AtapiPassThruCheckErrorStatus (
957 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate
958 )
959 ;
960 EFI_STATUS
961 GetIdeRegistersBaseAddr (
962 IN EFI_PCI_IO_PROTOCOL *PciIo,
963 OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
964 )
965 /*++
966
967 Routine Description:
968 Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,
969 use fixed addresses. In Native-PCI mode, get base addresses from BARs in
970 the PCI IDE controller's Configuration Space.
971
972 Arguments:
973 PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance
974 IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to
975 receive IDE IO port registers' base addresses
976
977 Returns:
978
979 EFI_STATUS
980
981 --*/
982 ;
983
984 VOID
985 InitAtapiIoPortRegisters (
986 IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
987 IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
988 )
989 /*++
990
991 Routine Description:
992
993 Initialize each Channel's Base Address of CommandBlock and ControlBlock.
994
995 Arguments:
996
997 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV
998 IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR
999
1000 Returns:
1001
1002 None
1003
1004 --*/
1005 ;
1006
1007 #endif