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