3 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
14 #ifndef _EDKII_ATA_PASS_THRU_PPI_H_
15 #define _EDKII_ATA_PASS_THRU_PPI_H_
17 #include <Protocol/DevicePath.h>
18 #include <Protocol/AtaPassThru.h>
21 /// Global ID for the EDKII_PEI_ATA_PASS_THRU_PPI.
23 #define EDKII_PEI_ATA_PASS_THRU_PPI_GUID \
25 0xa16473fd, 0xd474, 0x4c89, { 0xae, 0xc7, 0x90, 0xb8, 0x3c, 0x73, 0x86, 0x9 } \
29 // Forward declaration for the EDKII_PEI_ATA_PASS_THRU_PPI.
31 typedef struct _EDKII_PEI_ATA_PASS_THRU_PPI EDKII_PEI_ATA_PASS_THRU_PPI
;
34 // Revision The revision to which the ATA Pass Thru PPI interface adheres.
35 // All future revisions must be backwards compatible.
36 // If a future version is not back wards compatible it is not the same GUID.
38 #define EDKII_PEI_ATA_PASS_THRU_PPI_REVISION 0x00010000
42 Sends an ATA command to an ATA device that is attached to the ATA controller.
44 @param[in] This The PPI instance pointer.
45 @param[in] Port The port number of the ATA device to send
47 @param[in] PortMultiplierPort The port multiplier port number of the ATA
48 device to send the command.
49 If there is no port multiplier, then specify
51 @param[in,out] Packet A pointer to the ATA command to send to
52 the ATA device specified by Port and
55 @retval EFI_SUCCESS The ATA command was sent by the host. For
56 bi-directional commands, InTransferLength bytes
57 were transferred from InDataBuffer. For write
58 and bi-directional commands, OutTransferLength
59 bytes were transferred by OutDataBuffer.
60 @retval EFI_NOT_FOUND The specified ATA device is not found.
61 @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command
62 was not sent, so no additional status information
64 @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number
65 of bytes that could be transferred is returned
66 in InTransferLength. For write and bi-directional
67 commands, OutTransferLength bytes were transferred
69 @retval EFI_NOT_READY The ATA command could not be sent because there
70 are too many ATA commands already queued. The
71 caller may retry again later.
72 @retval EFI_DEVICE_ERROR A device error occurred while attempting to
78 (EFIAPI
*EDKII_PEI_ATA_PASS_THRU_PASSTHRU
) (
79 IN EDKII_PEI_ATA_PASS_THRU_PPI
*This
,
81 IN UINT16 PortMultiplierPort
,
82 IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET
*Packet
86 Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.
87 These can either be the list of ports where ATA devices are actually present or the
88 list of legal port numbers for the ATA controller. Regardless, the caller of this
89 function must probe the port number returned to see if an ATA device is actually
90 present at that location on the ATA controller.
92 The GetNextPort() function retrieves the port number on an ATA controller. If on
93 input Port is 0xFFFF, then the port number of the first port on the ATA controller
94 is returned in Port and EFI_SUCCESS is returned.
96 If Port is a port number that was returned on a previous call to GetNextPort(),
97 then the port number of the next port on the ATA controller is returned in Port,
98 and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on
99 a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.
101 If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND
104 @param[in] This The PPI instance pointer.
105 @param[in,out] Port On input, a pointer to the port number on the ATA controller.
106 On output, a pointer to the next port number on the ATA
107 controller. An input value of 0xFFFF retrieves the first
108 port number on the ATA controller.
110 @retval EFI_SUCCESS The next port number on the ATA controller was
112 @retval EFI_NOT_FOUND There are no more ports on this ATA controller.
113 @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned
114 on a previous call to GetNextPort().
119 (EFIAPI
*EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT
) (
120 IN EDKII_PEI_ATA_PASS_THRU_PPI
*This
,
125 Used to retrieve the list of legal port multiplier port numbers for ATA devices
126 on a port of an ATA controller. These can either be the list of port multiplier
127 ports where ATA devices are actually present on port or the list of legal port
128 multiplier ports on that port. Regardless, the caller of this function must probe
129 the port number and port multiplier port number returned to see if an ATA device
132 The GetNextDevice() function retrieves the port multiplier port number of an ATA
133 device present on a port of an ATA controller.
135 If PortMultiplierPort points to a port multiplier port number value that was
136 returned on a previous call to GetNextDevice(), then the port multiplier port
137 number of the next ATA device on the port of the ATA controller is returned in
138 PortMultiplierPort, and EFI_SUCCESS is returned.
140 If PortMultiplierPort points to 0xFFFF, then the port multiplier port number
141 of the first ATA device on port of the ATA controller is returned in PortMultiplierPort
142 and EFI_SUCCESS is returned.
144 If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
145 was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
148 If PortMultiplierPort is the port multiplier port number of the last ATA device
149 on the port of the ATA controller, then EFI_NOT_FOUND is returned.
151 @param[in] This The PPI instance pointer.
152 @param[in] Port The port number present on the ATA controller.
153 @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier
154 port number of an ATA device present on the
155 ATA controller. If on input a PortMultiplierPort
156 of 0xFFFF is specified, then the port multiplier
157 port number of the first ATA device is returned.
158 On output, a pointer to the port multiplier port
159 number of the next ATA device present on an ATA
162 @retval EFI_SUCCESS The port multiplier port number of the next ATA
163 device on the port of the ATA controller was
164 returned in PortMultiplierPort.
165 @retval EFI_NOT_FOUND There are no more ATA devices on this port of
167 @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort
168 was not returned on a previous call to GetNextDevice().
173 (EFIAPI
*EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE
) (
174 IN EDKII_PEI_ATA_PASS_THRU_PPI
*This
,
176 IN OUT UINT16
*PortMultiplierPort
180 Gets the device path information of the underlying ATA host controller.
182 @param[in] This The PPI instance pointer.
183 @param[out] DevicePathLength The length of the device path in bytes specified
185 @param[out] DevicePath The device path of the underlying ATA host controller.
186 This field re-uses EFI Device Path Protocol as
187 defined by Section 10.2 EFI Device Path Protocol
188 of UEFI 2.7 Specification.
190 @retval EFI_SUCCESS The device path of the ATA host controller has
191 been successfully returned.
192 @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
193 @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path.
198 (EFIAPI
*EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH
) (
199 IN EDKII_PEI_ATA_PASS_THRU_PPI
*This
,
200 OUT UINTN
*DevicePathLength
,
201 OUT EFI_DEVICE_PATH_PROTOCOL
**DevicePath
205 // EDKII_PEI_ATA_PASS_THRU_PPI provides the services that are required to send
206 // ATA commands to an ATA device during PEI.
208 struct _EDKII_PEI_ATA_PASS_THRU_PPI
{
210 EFI_ATA_PASS_THRU_MODE
*Mode
;
211 EDKII_PEI_ATA_PASS_THRU_PASSTHRU PassThru
;
212 EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT GetNextPort
;
213 EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE GetNextDevice
;
214 EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH GetDevicePath
;
217 extern EFI_GUID gEdkiiPeiAtaPassThruPpiGuid
;