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