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