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