1 | /** @file
|
---|
2 |
|
---|
3 | Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
|
---|
4 | SPDX-License-Identifier: BSD-2-Clause-Patent
|
---|
5 |
|
---|
6 | **/
|
---|
7 |
|
---|
8 | #ifndef _EDKII_ATA_PASS_THRU_PPI_H_
|
---|
9 | #define _EDKII_ATA_PASS_THRU_PPI_H_
|
---|
10 |
|
---|
11 | #include <Protocol/DevicePath.h>
|
---|
12 | #include <Protocol/AtaPassThru.h>
|
---|
13 |
|
---|
14 | ///
|
---|
15 | /// Global ID for the EDKII_PEI_ATA_PASS_THRU_PPI.
|
---|
16 | ///
|
---|
17 | #define EDKII_PEI_ATA_PASS_THRU_PPI_GUID \
|
---|
18 | { \
|
---|
19 | 0xa16473fd, 0xd474, 0x4c89, { 0xae, 0xc7, 0x90, 0xb8, 0x3c, 0x73, 0x86, 0x9 } \
|
---|
20 | }
|
---|
21 |
|
---|
22 | //
|
---|
23 | // Forward declaration for the EDKII_PEI_ATA_PASS_THRU_PPI.
|
---|
24 | //
|
---|
25 | typedef struct _EDKII_PEI_ATA_PASS_THRU_PPI EDKII_PEI_ATA_PASS_THRU_PPI;
|
---|
26 |
|
---|
27 | //
|
---|
28 | // Revision The revision to which the ATA Pass Thru PPI interface adheres.
|
---|
29 | // All future revisions must be backwards compatible.
|
---|
30 | // If a future version is not back wards compatible it is not the same GUID.
|
---|
31 | //
|
---|
32 | #define EDKII_PEI_ATA_PASS_THRU_PPI_REVISION 0x00010000
|
---|
33 |
|
---|
34 | /**
|
---|
35 | Sends an ATA command to an ATA device that is attached to the ATA controller.
|
---|
36 |
|
---|
37 | @param[in] This The PPI instance pointer.
|
---|
38 | @param[in] Port The port number of the ATA device to send
|
---|
39 | the command.
|
---|
40 | @param[in] PortMultiplierPort The port multiplier port number of the ATA
|
---|
41 | device to send the command.
|
---|
42 | If there is no port multiplier, then specify
|
---|
43 | 0xFFFF.
|
---|
44 | @param[in,out] Packet A pointer to the ATA command to send to
|
---|
45 | the ATA device specified by Port and
|
---|
46 | PortMultiplierPort.
|
---|
47 |
|
---|
48 | @retval EFI_SUCCESS The ATA command was sent by the host. For
|
---|
49 | bi-directional commands, InTransferLength bytes
|
---|
50 | were transferred from InDataBuffer. For write
|
---|
51 | and bi-directional commands, OutTransferLength
|
---|
52 | bytes were transferred by OutDataBuffer.
|
---|
53 | @retval EFI_NOT_FOUND The specified ATA device is not found.
|
---|
54 | @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command
|
---|
55 | was not sent, so no additional status information
|
---|
56 | is available.
|
---|
57 | @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number
|
---|
58 | of bytes that could be transferred is returned
|
---|
59 | in InTransferLength. For write and bi-directional
|
---|
60 | commands, OutTransferLength bytes were transferred
|
---|
61 | by OutDataBuffer.
|
---|
62 | @retval EFI_NOT_READY The ATA command could not be sent because there
|
---|
63 | are too many ATA commands already queued. The
|
---|
64 | caller may retry again later.
|
---|
65 | @retval EFI_DEVICE_ERROR A device error occurred while attempting to
|
---|
66 | send the ATA command.
|
---|
67 |
|
---|
68 | **/
|
---|
69 | typedef
|
---|
70 | EFI_STATUS
|
---|
71 | (EFIAPI *EDKII_PEI_ATA_PASS_THRU_PASSTHRU)(
|
---|
72 | IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
---|
73 | IN UINT16 Port,
|
---|
74 | IN UINT16 PortMultiplierPort,
|
---|
75 | IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet
|
---|
76 | );
|
---|
77 |
|
---|
78 | /**
|
---|
79 | Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.
|
---|
80 | These can either be the list of ports where ATA devices are actually present or the
|
---|
81 | list of legal port numbers for the ATA controller. Regardless, the caller of this
|
---|
82 | function must probe the port number returned to see if an ATA device is actually
|
---|
83 | present at that location on the ATA controller.
|
---|
84 |
|
---|
85 | The GetNextPort() function retrieves the port number on an ATA controller. If on
|
---|
86 | input Port is 0xFFFF, then the port number of the first port on the ATA controller
|
---|
87 | is returned in Port and EFI_SUCCESS is returned.
|
---|
88 |
|
---|
89 | If Port is a port number that was returned on a previous call to GetNextPort(),
|
---|
90 | then the port number of the next port on the ATA controller is returned in Port,
|
---|
91 | and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on
|
---|
92 | a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.
|
---|
93 |
|
---|
94 | If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND
|
---|
95 | is returned.
|
---|
96 |
|
---|
97 | @param[in] This The PPI instance pointer.
|
---|
98 | @param[in,out] Port On input, a pointer to the port number on the ATA controller.
|
---|
99 | On output, a pointer to the next port number on the ATA
|
---|
100 | controller. An input value of 0xFFFF retrieves the first
|
---|
101 | port number on the ATA controller.
|
---|
102 |
|
---|
103 | @retval EFI_SUCCESS The next port number on the ATA controller was
|
---|
104 | returned in Port.
|
---|
105 | @retval EFI_NOT_FOUND There are no more ports on this ATA controller.
|
---|
106 | @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned
|
---|
107 | on a previous call to GetNextPort().
|
---|
108 |
|
---|
109 | **/
|
---|
110 | typedef
|
---|
111 | EFI_STATUS
|
---|
112 | (EFIAPI *EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT)(
|
---|
113 | IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
---|
114 | IN OUT UINT16 *Port
|
---|
115 | );
|
---|
116 |
|
---|
117 | /**
|
---|
118 | Used to retrieve the list of legal port multiplier port numbers for ATA devices
|
---|
119 | on a port of an ATA controller. These can either be the list of port multiplier
|
---|
120 | ports where ATA devices are actually present on port or the list of legal port
|
---|
121 | multiplier ports on that port. Regardless, the caller of this function must probe
|
---|
122 | the port number and port multiplier port number returned to see if an ATA device
|
---|
123 | is actually present.
|
---|
124 |
|
---|
125 | The GetNextDevice() function retrieves the port multiplier port number of an ATA
|
---|
126 | device present on a port of an ATA controller.
|
---|
127 |
|
---|
128 | If PortMultiplierPort points to a port multiplier port number value that was
|
---|
129 | returned on a previous call to GetNextDevice(), then the port multiplier port
|
---|
130 | number of the next ATA device on the port of the ATA controller is returned in
|
---|
131 | PortMultiplierPort, and EFI_SUCCESS is returned.
|
---|
132 |
|
---|
133 | If PortMultiplierPort points to 0xFFFF, then the port multiplier port number
|
---|
134 | of the first ATA device on port of the ATA controller is returned in PortMultiplierPort
|
---|
135 | and EFI_SUCCESS is returned.
|
---|
136 |
|
---|
137 | If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort
|
---|
138 | was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER
|
---|
139 | is returned.
|
---|
140 |
|
---|
141 | If PortMultiplierPort is the port multiplier port number of the last ATA device
|
---|
142 | on the port of the ATA controller, then EFI_NOT_FOUND is returned.
|
---|
143 |
|
---|
144 | @param[in] This The PPI instance pointer.
|
---|
145 | @param[in] Port The port number present on the ATA controller.
|
---|
146 | @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier
|
---|
147 | port number of an ATA device present on the
|
---|
148 | ATA controller. If on input a PortMultiplierPort
|
---|
149 | of 0xFFFF is specified, then the port multiplier
|
---|
150 | port number of the first ATA device is returned.
|
---|
151 | On output, a pointer to the port multiplier port
|
---|
152 | number of the next ATA device present on an ATA
|
---|
153 | controller.
|
---|
154 |
|
---|
155 | @retval EFI_SUCCESS The port multiplier port number of the next ATA
|
---|
156 | device on the port of the ATA controller was
|
---|
157 | returned in PortMultiplierPort.
|
---|
158 | @retval EFI_NOT_FOUND There are no more ATA devices on this port of
|
---|
159 | the ATA controller.
|
---|
160 | @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort
|
---|
161 | was not returned on a previous call to GetNextDevice().
|
---|
162 |
|
---|
163 | **/
|
---|
164 | typedef
|
---|
165 | EFI_STATUS
|
---|
166 | (EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE)(
|
---|
167 | IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
---|
168 | IN UINT16 Port,
|
---|
169 | IN OUT UINT16 *PortMultiplierPort
|
---|
170 | );
|
---|
171 |
|
---|
172 | /**
|
---|
173 | Gets the device path information of the underlying ATA host controller.
|
---|
174 |
|
---|
175 | @param[in] This The PPI instance pointer.
|
---|
176 | @param[out] DevicePathLength The length of the device path in bytes specified
|
---|
177 | by DevicePath.
|
---|
178 | @param[out] DevicePath The device path of the underlying ATA host controller.
|
---|
179 | This field re-uses EFI Device Path Protocol as
|
---|
180 | defined by Section 10.2 EFI Device Path Protocol
|
---|
181 | of UEFI 2.7 Specification.
|
---|
182 |
|
---|
183 | @retval EFI_SUCCESS The device path of the ATA host controller has
|
---|
184 | been successfully returned.
|
---|
185 | @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.
|
---|
186 | @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path.
|
---|
187 |
|
---|
188 | **/
|
---|
189 | typedef
|
---|
190 | EFI_STATUS
|
---|
191 | (EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH)(
|
---|
192 | IN EDKII_PEI_ATA_PASS_THRU_PPI *This,
|
---|
193 | OUT UINTN *DevicePathLength,
|
---|
194 | OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
---|
195 | );
|
---|
196 |
|
---|
197 | //
|
---|
198 | // EDKII_PEI_ATA_PASS_THRU_PPI provides the services that are required to send
|
---|
199 | // ATA commands to an ATA device during PEI.
|
---|
200 | //
|
---|
201 | struct _EDKII_PEI_ATA_PASS_THRU_PPI {
|
---|
202 | UINT64 Revision;
|
---|
203 | EFI_ATA_PASS_THRU_MODE *Mode;
|
---|
204 | EDKII_PEI_ATA_PASS_THRU_PASSTHRU PassThru;
|
---|
205 | EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT GetNextPort;
|
---|
206 | EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE GetNextDevice;
|
---|
207 | EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH GetDevicePath;
|
---|
208 | };
|
---|
209 |
|
---|
210 | extern EFI_GUID gEdkiiPeiAtaPassThruPpiGuid;
|
---|
211 |
|
---|
212 | #endif
|
---|