0cb169786a284861cb5874b27284c52108b236ce
[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
137 //
138 // ATAPI Command op code
139 //
140 #define OP_INQUIRY 0x12
141 #define OP_LOAD_UNLOAD_CD 0xa6
142 #define OP_MECHANISM_STATUS 0xbd
143 #define OP_MODE_SELECT_10 0x55
144 #define OP_MODE_SENSE_10 0x5a
145 #define OP_PAUSE_RESUME 0x4b
146 #define OP_PLAY_AUDIO_10 0x45
147 #define OP_PLAY_AUDIO_MSF 0x47
148 #define OP_PLAY_CD 0xbc
149 #define OP_PLAY_CD_MSF 0xb4
150 #define OP_PREVENT_ALLOW_MEDIUM_REMOVAL 0x1e
151 #define OP_READ_10 0x28
152 #define OP_READ_12 0xa8
153 #define OP_READ_CAPACITY 0x25
154 #define OP_READ_CD 0xbe
155 #define OP_READ_CD_MSF 0xb9
156 #define OP_READ_HEADER 0x44
157 #define OP_READ_SUB_CHANNEL 0x42
158 #define OP_READ_TOC 0x43
159 #define OP_REQUEST_SENSE 0x03
160 #define OP_SCAN 0xba
161 #define OP_SEEK_10 0x2b
162 #define OP_SET_CD_SPEED 0xbb
163 #define OP_STOPPLAY_SCAN 0x4e
164 #define OP_START_STOP_UNIT 0x1b
165 #define OP_TEST_UNIT_READY 0x00
166
167 #define OP_FORMAT_UNIT 0x04
168 #define OP_READ_FORMAT_CAPACITIES 0x23
169 #define OP_VERIFY 0x2f
170 #define OP_WRITE_10 0x2a
171 #define OP_WRITE_12 0xaa
172 #define OP_WRITE_AND_VERIFY 0x2e
173
174 //
175 // ATA Command
176 //
177 #define ATAPI_SOFT_RESET_CMD 0x08
178
179 typedef enum {
180 DataIn = 0,
181 DataOut = 1,
182 NoData = 2,
183 End = 0xff
184 } DATA_DIRECTION;
185
186 typedef struct {
187 UINT8 OpCode;
188 DATA_DIRECTION Direction;
189 } SCSI_COMMAND_SET;
190
191 #define MAX_CHANNEL 2
192
193 #define ValidCdbLength(Len) ((Len) == 6 || (Len) == 10 || (Len) == 12) ? 1 : 0
194
195 //
196 // IDE registers bit definitions
197 //
198 // ATA Err Reg bitmap
199 //
200 #define BBK_ERR bit (7) ///< Bad block detected
201 #define UNC_ERR bit (6) ///< Uncorrectable Data
202 #define MC_ERR bit (5) ///< Media Change
203 #define IDNF_ERR bit (4) ///< ID Not Found
204 #define MCR_ERR bit (3) ///< Media Change Requested
205 #define ABRT_ERR bit (2) ///< Aborted Command
206 #define TK0NF_ERR bit (1) ///< Track 0 Not Found
207 #define AMNF_ERR bit (0) ///< Address Mark Not Found
208
209 //
210 // ATAPI Err Reg bitmap
211 //
212 #define SENSE_KEY_ERR (bit (7) | bit (6) | bit (5) | bit (4))
213 #define EOM_ERR bit (1) ///< End of Media Detected
214 #define ILI_ERR bit (0) ///< Illegal Length Indication
215
216 //
217 // Device/Head Reg
218 //
219 #define LBA_MODE bit (6)
220 #define DEV bit (4)
221 #define HS3 bit (3)
222 #define HS2 bit (2)
223 #define HS1 bit (1)
224 #define HS0 bit (0)
225 #define CHS_MODE (0)
226 #define DRV0 (0)
227 #define DRV1 (1)
228 #define MST_DRV DRV0
229 #define SLV_DRV DRV1
230
231 //
232 // Status Reg
233 //
234 #define BSY bit (7) ///< Controller Busy
235 #define DRDY bit (6) ///< Drive Ready
236 #define DWF bit (5) ///< Drive Write Fault
237 #define DSC bit (4) ///< Disk Seek Complete
238 #define DRQ bit (3) ///< Data Request
239 #define CORR bit (2) ///< Corrected Data
240 #define IDX bit (1) ///< Index
241 #define ERR bit (0) ///< Error
242 #define CHECK bit (0) ///< Check bit for ATAPI Status Reg
243
244 //
245 // Device Control Reg
246 //
247 #define SRST bit (2) ///< Software Reset
248 #define IEN_L bit (1) ///< Interrupt Enable
249
250 //
251 // ATAPI Feature Register
252 //
253 #define OVERLAP bit (1)
254 #define DMA bit (0)
255
256 //
257 // ATAPI Interrupt Reason Reson Reg (ATA Sector Count Register)
258 //
259 #define RELEASE bit (2)
260 #define IO bit (1)
261 #define CoD bit (0)
262
263 #define PACKET_CMD 0xA0
264
265 #define DEFAULT_CMD (0xa0)
266 //
267 // default content of device control register, disable INT
268 //
269 #define DEFAULT_CTL (0x0a)
270 #define MAX_ATAPI_BYTE_COUNT (0xfffe)
271
272 //
273 // function prototype
274 //
275
276 EFI_STATUS
277 EFIAPI
278 AtapiScsiPassThruDriverBindingSupported (
279 IN EFI_DRIVER_BINDING_PROTOCOL *This,
280 IN EFI_HANDLE Controller,
281 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
282 );
283
284 EFI_STATUS
285 EFIAPI
286 AtapiScsiPassThruDriverBindingStart (
287 IN EFI_DRIVER_BINDING_PROTOCOL *This,
288 IN EFI_HANDLE Controller,
289 IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath
290 );
291
292 EFI_STATUS
293 EFIAPI
294 AtapiScsiPassThruDriverBindingStop (
295 IN EFI_DRIVER_BINDING_PROTOCOL *This,
296 IN EFI_HANDLE Controller,
297 IN UINTN NumberOfChildren,
298 IN EFI_HANDLE *ChildHandleBuffer
299 );
300
301 //
302 // EFI Component Name Functions
303 //
304 EFI_STATUS
305 EFIAPI
306 AtapiScsiPassThruComponentNameGetDriverName (
307 IN EFI_COMPONENT_NAME_PROTOCOL *This,
308 IN CHAR8 *Language,
309 OUT CHAR16 **DriverName
310 );
311
312 EFI_STATUS
313 EFIAPI
314 AtapiScsiPassThruComponentNameGetControllerName (
315 IN EFI_COMPONENT_NAME_PROTOCOL *This,
316 IN EFI_HANDLE ControllerHandle,
317 IN EFI_HANDLE ChildHandle OPTIONAL,
318 IN CHAR8 *Language,
319 OUT CHAR16 **ControllerName
320 );
321
322 /**
323 AtapiScsiPassThruDriverEntryPoint
324
325 @param ImageHandle
326 @param SystemTable
327
328 @todo Add function description
329 @todo ImageHandle - add argument description
330 @todo SystemTable - add argument description
331 @todo add return values
332 --*/
333 EFI_STATUS
334 EFIAPI
335 AtapiScsiPassThruDriverEntryPoint (
336 IN EFI_HANDLE ImageHandle,
337 IN EFI_SYSTEM_TABLE *SystemTable
338 )
339 ;
340
341 /**
342 RegisterAtapiScsiPassThru
343
344 @param This
345 @param Controller
346 @param PciIo
347
348 @todo Add function description
349 @todo This add argument description
350 @todo Controller add argument description
351 @todo PciIo add argument description
352 @todo add return values
353 **/
354 EFI_STATUS
355 RegisterAtapiScsiPassThru (
356 IN EFI_DRIVER_BINDING_PROTOCOL *This,
357 IN EFI_HANDLE Controller,
358 IN EFI_PCI_IO_PROTOCOL *PciIo
359 )
360 ;
361
362 /**
363 AtapiScsiPassThruFunction
364
365 @param This
366 @param Target
367 @param Lun
368 @param Packet
369 @param Event
370
371 @todo Add function description
372 @todo This - add argument description
373 @todo Target - add argument description
374 @todo Lun - add argument description
375 @todo Packet - add argument description
376 @todo Event - add argument description
377 @todo add return values
378 **/
379 EFI_STATUS
380 EFIAPI
381 AtapiScsiPassThruFunction (
382 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
383 IN UINT32 Target,
384 IN UINT64 Lun,
385 IN OUT EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet,
386 IN EFI_EVENT Event OPTIONAL
387 )
388 ;
389
390 /**
391 AtapiScsiPassThruGetNextDevice
392
393 TODO: Add function description
394
395 @param This TODO: add argument description
396 @param Target TODO: add argument description
397 @param Lun TODO: add argument description
398
399 TODO: add return values
400
401 **/
402 EFI_STATUS
403 EFIAPI
404 AtapiScsiPassThruGetNextDevice (
405 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
406 IN OUT UINT32 *Target,
407 IN OUT UINT64 *Lun
408 )
409 ;
410
411 /**
412 AtapiScsiPassThruBuildDevicePath
413
414 TODO: Add function description
415
416 @param This TODO: add argument description
417 @param Target TODO: add argument description
418 @param Lun TODO: add argument description
419 @param DevicePath TODO: add argument description
420
421 TODO: add return values
422
423 **/
424 EFI_STATUS
425 EFIAPI
426 AtapiScsiPassThruBuildDevicePath (
427 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
428 IN UINT32 Target,
429 IN UINT64 Lun,
430 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
431 )
432 ;
433
434 /**
435 AtapiScsiPassThruGetTargetLun
436
437 TODO: Add function description
438
439 @param This TODO: add argument description
440 @param DevicePath TODO: add argument description
441 @param Target TODO: add argument description
442 @param Lun TODO: add argument description
443
444 TODO: add return values
445
446 **/
447 EFI_STATUS
448 EFIAPI
449 AtapiScsiPassThruGetTargetLun (
450 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
451 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath,
452 OUT UINT32 *Target,
453 OUT UINT64 *Lun
454 )
455 ;
456
457 /**
458 AtapiScsiPassThruResetChannel
459
460 TODO: Add function description
461
462 @param This TODO: add argument description
463
464 TODO: add return values
465
466 **/
467 EFI_STATUS
468 EFIAPI
469 AtapiScsiPassThruResetChannel (
470 IN EFI_SCSI_PASS_THRU_PROTOCOL *This
471 )
472 ;
473
474 /**
475 AtapiScsiPassThruResetTarget
476
477 TODO: Add function description
478
479 @param This TODO: add argument description
480 @param Target TODO: add argument description
481 @param Lun TODO: add argument description
482
483 TODO: add return values
484
485 **/
486 EFI_STATUS
487 EFIAPI
488 AtapiScsiPassThruResetTarget (
489 IN EFI_SCSI_PASS_THRU_PROTOCOL *This,
490 IN UINT32 Target,
491 IN UINT64 Lun
492 )
493 ;
494
495 /**
496 CheckSCSIRequestPacket
497
498 TODO: Add function description
499
500 @param Packet TODO: add argument description
501
502 TODO: add return values
503
504 **/
505 EFI_STATUS
506 CheckSCSIRequestPacket (
507 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
508 )
509 ;
510
511 /**
512 SubmitBlockingIoCommand
513
514 TODO: Add function description
515
516 @param AtapiScsiPrivate TODO: add argument description
517 @param Target TODO: add argument description
518 @param Packet TODO: add argument description
519
520 TODO: add return values
521
522 **/
523 EFI_STATUS
524 SubmitBlockingIoCommand (
525 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
526 UINT32 Target,
527 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
528 )
529 ;
530
531 /**
532 IsCommandValid
533
534 TODO: Add function description
535
536 @param Packet - TODO: add argument description
537
538 @return TODO: add return values
539
540 --*/
541 BOOLEAN
542 IsCommandValid (
543 EFI_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet
544 )
545 ;
546
547 /**
548 RequestSenseCommand
549
550 TODO: Add function description
551
552 @param AtapiScsiPrivate TODO: add argument description
553 @param Target TODO: add argument description
554 @param Timeout TODO: add argument description
555 @param SenseData TODO: add argument description
556 @param SenseDataLength TODO: add argument description
557
558 TODO: add return values
559
560 **/
561 EFI_STATUS
562 RequestSenseCommand (
563 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
564 UINT32 Target,
565 UINT64 Timeout,
566 VOID *SenseData,
567 UINT8 *SenseDataLength
568 )
569 ;
570
571 /**
572 AtapiPacketCommand
573
574 TODO: Add function description
575
576 @param AtapiScsiPrivate TODO: add argument description
577 @param Target TODO: add argument description
578 @param PacketCommand TODO: add argument description
579 @param Buffer TODO: add argument description
580 @param ByteCount TODO: add argument description
581 @param Direction TODO: add argument description
582 @param TimeOutInMicroSeconds TODO: add argument description
583
584 TODO: add return values
585
586 **/
587 EFI_STATUS
588 AtapiPacketCommand (
589 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
590 UINT32 Target,
591 UINT8 *PacketCommand,
592 VOID *Buffer,
593 UINT32 *ByteCount,
594 DATA_DIRECTION Direction,
595 UINT64 TimeOutInMicroSeconds
596 )
597 ;
598
599
600 /**
601 ReadPortB
602
603 TODO: Add function description
604
605 @param PciIo TODO: add argument description
606 @param Port TODO: add argument description
607
608 TODO: add return values
609
610 **/
611 UINT8
612 ReadPortB (
613 IN EFI_PCI_IO_PROTOCOL *PciIo,
614 IN UINT16 Port
615 )
616 ;
617
618
619 /**
620 ReadPortW
621
622 TODO: Add function description
623
624 @param PciIo TODO: add argument description
625 @param Port TODO: add argument description
626
627 TODO: add return values
628
629 **/
630 UINT16
631 ReadPortW (
632 IN EFI_PCI_IO_PROTOCOL *PciIo,
633 IN UINT16 Port
634 )
635 ;
636
637
638 /**
639 WritePortB
640
641 TODO: Add function description
642
643 @param PciIo TODO: add argument description
644 @param Port TODO: add argument description
645 @param Data TODO: add argument description
646
647 TODO: add return values
648
649 **/
650 VOID
651 WritePortB (
652 IN EFI_PCI_IO_PROTOCOL *PciIo,
653 IN UINT16 Port,
654 IN UINT8 Data
655 )
656 ;
657
658
659 /**
660 WritePortW
661
662 TODO: Add function description
663
664 @param PciIo TODO: add argument description
665 @param Port TODO: add argument description
666 @param Data TODO: add argument description
667
668 TODO: add return values
669
670 **/
671 VOID
672 WritePortW (
673 IN EFI_PCI_IO_PROTOCOL *PciIo,
674 IN UINT16 Port,
675 IN UINT16 Data
676 )
677 ;
678
679 /**
680 StatusDRQClear
681
682 TODO: Add function description
683
684 @param AtapiScsiPrivate TODO: add argument description
685 @param TimeOutInMicroSeconds TODO: add argument description
686
687 TODO: add return values
688
689 **/
690 EFI_STATUS
691 StatusDRQClear (
692 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
693 UINT64 TimeOutInMicroSeconds
694 )
695 ;
696
697 /**
698 AltStatusDRQClear
699
700 TODO: Add function description
701
702 @param AtapiScsiPrivate TODO: add argument description
703 @param TimeOutInMicroSeconds TODO: add argument description
704
705 TODO: add return values
706
707 **/
708 EFI_STATUS
709 AltStatusDRQClear (
710 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
711 UINT64 TimeOutInMicroSeconds
712 )
713 ;
714
715 /**
716 StatusDRQReady
717
718 TODO: Add function description
719
720 @param AtapiScsiPrivate TODO: add argument description
721 @param TimeOutInMicroSeconds TODO: add argument description
722
723 TODO: add return values
724
725 **/
726 EFI_STATUS
727 StatusDRQReady (
728 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
729 UINT64 TimeOutInMicroSeconds
730 )
731 ;
732
733 /**
734 AltStatusDRQReady
735
736 TODO: Add function description
737
738 @param AtapiScsiPrivate TODO: add argument description
739 @param TimeOutInMicroSeconds TODO: add argument description
740
741 TODO: add return values
742
743 **/
744 EFI_STATUS
745 AltStatusDRQReady (
746 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
747 UINT64 TimeOutInMicroSeconds
748 )
749 ;
750
751 /**
752 TODO: Add function description
753
754 @param AtapiScsiPrivate TODO: add argument description
755 @param TimeoutInMicroSeconds TODO: add argument description
756
757 TODO: add return values
758
759 **/
760 EFI_STATUS
761 StatusWaitForBSYClear (
762 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
763 UINT64 TimeoutInMicroSeconds
764 )
765 ;
766
767 /**
768 TODO: Add function description
769
770 @param AtapiScsiPrivate TODO: add argument description
771 @param TimeoutInMicroSeconds TODO: add argument description
772
773 TODO: add return values
774
775 **/
776 EFI_STATUS
777 AltStatusWaitForBSYClear (
778 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
779 UINT64 TimeoutInMicroSeconds
780 )
781 ;
782
783 /**
784 TODO: Add function description
785
786 @param AtapiScsiPrivate TODO: add argument description
787 @param TimeoutInMicroSeconds TODO: add argument description
788
789 TODO: add return values
790
791 **/
792 EFI_STATUS
793 StatusDRDYReady (
794 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
795 UINT64 TimeoutInMicroSeconds
796 )
797 ;
798
799 /**
800 TODO: Add function description
801
802 @param AtapiScsiPrivate TODO: add argument description
803 @param TimeoutInMicroSeconds TODO: add argument description
804
805 TODO: add return values
806
807 **/
808 EFI_STATUS
809 AltStatusDRDYReady (
810 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
811 UINT64 TimeoutInMicroSeconds
812 )
813 ;
814
815 /**
816 TODO: Add function description
817
818 @param AtapiScsiPrivate TODO: add argument description
819 @param Buffer TODO: add argument description
820 @param ByteCount TODO: add argument description
821 @param Direction TODO: add argument description
822 @param TimeOutInMicroSeconds TODO: add argument description
823
824 TODO: add return values
825
826 **/
827 EFI_STATUS
828 AtapiPassThruPioReadWriteData (
829 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
830 UINT16 *Buffer,
831 UINT32 *ByteCount,
832 DATA_DIRECTION Direction,
833 UINT64 TimeOutInMicroSeconds
834 )
835 ;
836
837 /**
838 TODO: Add function description
839
840 @param AtapiScsiPrivate TODO: add argument description
841
842 TODO: add return values
843
844 **/
845 EFI_STATUS
846 AtapiPassThruCheckErrorStatus (
847 ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate
848 )
849 ;
850 EFI_STATUS
851 GetIdeRegistersBaseAddr (
852 IN EFI_PCI_IO_PROTOCOL *PciIo,
853 OUT IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
854 )
855 /*++
856
857 Routine Description:
858 Get IDE IO port registers' base addresses by mode. In 'Compatibility' mode,
859 use fixed addresses. In Native-PCI mode, get base addresses from BARs in
860 the PCI IDE controller's Configuration Space.
861
862 Arguments:
863 PciIo - Pointer to the EFI_PCI_IO_PROTOCOL instance
864 IdeRegsBaseAddr - Pointer to IDE_REGISTERS_BASE_ADDR to
865 receive IDE IO port registers' base addresses
866
867 Returns:
868
869 EFI_STATUS
870
871 --*/
872 ;
873
874 VOID
875 InitAtapiIoPortRegisters (
876 IN ATAPI_SCSI_PASS_THRU_DEV *AtapiScsiPrivate,
877 IN IDE_REGISTERS_BASE_ADDR *IdeRegsBaseAddr
878 )
879 /*++
880
881 Routine Description:
882
883 Initialize each Channel's Base Address of CommandBlock and ControlBlock.
884
885 Arguments:
886
887 AtapiScsiPrivate - The pointer of ATAPI_SCSI_PASS_THRU_DEV
888 IdeRegsBaseAddr - The pointer of IDE_REGISTERS_BASE_ADDR
889
890 Returns:
891
892 None
893
894 --*/
895 ;
896
897 #endif