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