]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AhciPei / AhciPeiPassThru.h
1 /** @file
2 The AhciPei driver is used to manage ATA hard disk device working under AHCI
3 mode at PEI phase.
4
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 **/
10
11 #ifndef _AHCI_PEI_PASSTHRU_H_
12 #define _AHCI_PEI_PASSTHRU_H_
13
14 /**
15 Sends an ATA command to an ATA device that is attached to the ATA controller.
16
17 @param[in] This The PPI instance pointer.
18 @param[in] Port The port number of the ATA device to send
19 the command.
20 @param[in] PortMultiplierPort The port multiplier port number of the ATA
21 device to send the command.
22 If there is no port multiplier, then specify
23 0xFFFF.
24 @param[in,out] Packet A pointer to the ATA command to send to
25 the ATA device specified by Port and
26 PortMultiplierPort.
27
28 @retval EFI_SUCCESS The ATA command was sent by the host. For
29 bi-directional commands, InTransferLength bytes
30 were transferred from InDataBuffer. For write
31 and bi-directional commands, OutTransferLength
32 bytes were transferred by OutDataBuffer.
33 @retval EFI_NOT_FOUND The specified ATA device is not found.
34 @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command
35 was not sent, so no additional status information
36 is available.
37 @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number
38 of bytes that could be transferred is returned
39 in InTransferLength. For write and bi-directional
40 commands, OutTransferLength bytes were transferred
41 by OutDataBuffer.
42 @retval EFI_NOT_READY The ATA command could not be sent because there
43 are too many ATA commands already queued. The
44 caller may retry again later.
45 @retval EFI_DEVICE_ERROR A device error occurred while attempting to
46 send the ATA command.
47
48 **/
49 EFI_STATUS
50 EFIAPI
51 AhciAtaPassThruPassThru (
52 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
53 IN UINT16 Port,
54 IN UINT16 PortMultiplierPort,
55 IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet
56 );
57
58 /**
59 Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.
60 These can either be the list of ports where ATA devices are actually present or the
61 list of legal port numbers for the ATA controller. Regardless, the caller of this
62 function must probe the port number returned to see if an ATA device is actually
63 present at that location on the ATA controller.
64
65 The GetNextPort() function retrieves the port number on an ATA controller. If on
66 input Port is 0xFFFF, then the port number of the first port on the ATA controller
67 is returned in Port and EFI_SUCCESS is returned.
68
69 If Port is a port number that was returned on a previous call to GetNextPort(),
70 then the port number of the next port on the ATA controller is returned in Port,
71 and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on
72 a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.
73
74 If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND
75 is returned.
76
77 @param[in] This The PPI instance pointer.
78 @param[in,out] Port On input, a pointer to the port number on the ATA controller.
79 On output, a pointer to the next port number on the ATA
80 controller. An input value of 0xFFFF retrieves the first
81 port number on the ATA controller.
82
83 @retval EFI_SUCCESS The next port number on the ATA controller was
84 returned in Port.
85 @retval EFI_NOT_FOUND There are no more ports on this ATA controller.
86 @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned
87 on a previous call to GetNextPort().
88
89 **/
90 EFI_STATUS
91 EFIAPI
92 AhciAtaPassThruGetNextPort (
93 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
94 IN OUT UINT16 *Port
95 );
96
97 /**
98 Used to retrieve the list of legal port multiplier port numbers for ATA devices
99 on a port of an ATA controller. These can either be the list of port multiplier
100 ports where ATA devices are actually present on port or the list of legal port
101 multiplier ports on that port. Regardless, the caller of this function must probe
102 the port number and port multiplier port number returned to see if an ATA device
103 is actually present.
104
105 The GetNextDevice() function retrieves the port multiplier port number of an ATA
106 device present on a port of an ATA controller.
107
108 If PortMultiplierPort points to a port multiplier port number value that was
109 returned on a previous call to GetNextDevice(), then the port multiplier port
110 number of the next ATA device on the port of the ATA controller is returned in
111 PortMultiplierPort, and EFI_SUCCESS is returned.
112
113 If PortMultiplierPort points to 0xFFFF, then the port multiplier port number
114 of the first ATA device on port of the ATA controller is returned in PortMultiplierPort
115 and EFI_SUCCESS is returned.
116
117 If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
118 was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
119 is returned.
120
121 If PortMultiplierPort is the port multiplier port number of the last ATA device
122 on the port of the ATA controller, then EFI_NOT_FOUND is returned.
123
124 @param[in] This The PPI instance pointer.
125 @param[in] Port The port number present on the ATA controller.
126 @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier
127 port number of an ATA device present on the
128 ATA controller. If on input a PortMultiplierPort
129 of 0xFFFF is specified, then the port multiplier
130 port number of the first ATA device is returned.
131 On output, a pointer to the port multiplier port
132 number of the next ATA device present on an ATA
133 controller.
134
135 @retval EFI_SUCCESS The port multiplier port number of the next ATA
136 device on the port of the ATA controller was
137 returned in PortMultiplierPort.
138 @retval EFI_NOT_FOUND There are no more ATA devices on this port of
139 the ATA controller.
140 @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort
141 was not returned on a previous call to GetNextDevice().
142
143 **/
144 EFI_STATUS
145 EFIAPI
146 AhciAtaPassThruGetNextDevice (
147 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
148 IN UINT16 Port,
149 IN OUT UINT16 *PortMultiplierPort
150 );
151
152 /**
153 Gets the device path information of the underlying ATA host controller.
154
155 @param[in] This The PPI instance pointer.
156 @param[out] DevicePathLength The length of the device path in bytes specified
157 by DevicePath.
158 @param[out] DevicePath The device path of the underlying ATA host controller.
159 This field re-uses EFI Device Path Protocol as
160 defined by Section 10.2 EFI Device Path Protocol
161 of UEFI 2.7 Specification.
162
163 @retval EFI_SUCCESS The device path of the ATA host controller has
164 been successfully returned.
165 @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
166 @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path.
167
168 **/
169 EFI_STATUS
170 EFIAPI
171 AhciAtaPassThruGetDevicePath (
172 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
173 OUT UINTN *DevicePathLength,
174 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
175 );
176
177 #endif