]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/AtaPassThru.h
add AtaPassThruProtocol into MdePkg.
[mirror_edk2.git] / MdePkg / Include / Protocol / AtaPassThru.h
Content-type: text/html ]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Protocol/AtaPassThru.h


500 - Internal Server Error

Malformed UTF-8 character (fatal) at (eval 6) line 1, <$fd> line 658.
CommitLineData
54f594e4 1/** @file\r
2 The EFI_ATA_PASS_THRU_PROTOCOL provides information about an ATA controller and the ability\r
3 to send ATA Command Blocks to any ATA device attached to that ATA controller. The information\r
4 includes the attributes of the ATA controller.\r
5\r
6 Copyright (c) 2009, Intel Corporation \r
7 All rights reserved. This program and the accompanying materials \r
8 are licensed and made available under the terms and conditions of the BSD License \r
9 which accompanies this distribution. The full text of the license may be found at \r
10 http://opensource.org/licenses/bsd-license.php \r
11\r
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
14\r
15**/\r
16\r
17#ifndef __ATA_PASS_THROUGH_H__\r
18#define __ATA_PASS_THROUGH_H__\r
19\r
20#define EFI_ATA_PASS_THRU_PROTOCOL_GUID \\r
21 { \\r
22 0x1d3de7f0, 0x807, 0x424f, {0xaa, 0x69, 0x11, 0xa5, 0x4e, 0x19, 0xa4, 0x6f } \\r
23 }\r
24\r
25typedef struct _EFI_ATA_PASS_THRU_PROTOCOL EFI_ATA_PASS_THRU_PROTOCOL;\r
26\r
27typedef struct {\r
28 UINT32 Attributes;\r
29 UINT32 IoAlign;\r
30} EFI_ATA_PASS_THRU_MODE;\r
31\r
32///\r
33/// If this bit is set, then the EFI_ATA_PASS_THRU_PROTOCOL interface is for physical\r
34/// devices on the ATA controller.\r
35///\r
36#define EFI_ATA_PASS_THRU_ATTRIBUTES_PHYSICAL 0x0001\r
37///\r
38/// If this bit is set, then the EFI_ATA_PASS_THRU_PROTOCOL interface is for logical\r
39/// devices on the ATA controller.\r
40///\r
41#define EFI_ATA_PASS_THRU_ATTRIBUTES_LOGICAL 0x0002\r
42///\r
43/// If this bit is set, then the EFI_ATA_PASS_THRU_PROTOCOL interface supports non blocking\r
44/// I/O. Every EFI_ATA_PASS_THRU_PROTOCOL must support blocking I/O. The support of non-blocking\r
45/// I/O is optional.\r
46///\r
47#define EFI_ATA_PASS_THRU_ATTRIBUTES_NONBLOCKIO 0x0004\r
48\r
49typedef struct _EFI_ATA_COMMAND_BLOCK {\r
50 UINT8 Reserved1[2];\r
51 UINT8 AtaCommand;\r
52 UINT8 AtaFeatures;\r
53 UINT8 AtaSectorNumber;\r
54 UINT8 AtaCylinderLow;\r
55 UINT8 AtaCylinderHigh;\r
56 UINT8 AtaDeviceHead;\r
57 UINT8 AtaSectorNumberExp;\r
58 UINT8 AtaCylinderLowExp;\r
59 UINT8 AtaCylinderHighExp; \r
60 UINT8 AtaFeaturesExp;\r
61 UINT8 AtaSectorCount;\r
62 UINT8 AtaSectorCountExp;\r
63 UINT8 Reserved2[6];\r
64} EFI_ATA_COMMAND_BLOCK;\r
65\r
66typedef struct _EFI_ATA_STATUS_BLOCK {\r
67 UINT8 Reserved1[2];\r
68 UINT8 AtaStatus;\r
69 UINT8 AtaError;\r
70 UINT8 AtaSectorNumber;\r
71 UINT8 AtaCylinderLow;\r
72 UINT8 AtaCylinderHigh;\r
73 UINT8 AtaDeviceHead;\r
74 UINT8 AtaSectorNumberExp;\r
75 UINT8 AtaCylinderLowExp;\r
76 UINT8 AtaCylinderHighExp; \r
77 UINT8 Reserved2;\r
78 UINT8 AtaSectorCount;\r
79 UINT8 AtaSectorCountExp;\r
80 UINT8 Reserved2[6];\r
81} EFI_ATA_STATUS_BLOCK;\r
82\r
83typedef UINT8 EFI_ATA_PASS_THRU_CMD_PROTOCOL;\r
84\r
85#define EFI_ATA_PASS_THRU_PROTOCOL_ATA_HARDWARE_RESET 0x00\r
86#define EFI_ATA_PASS_THRU_PROTOCOL_ATA_SOFTWARE_RESET 0x01\r
87#define EFI_ATA_PASS_THRU_PROTOCOL_ATA_NON_DATA 0x02\r
88#define EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_IN 0x04\r
89#define EFI_ATA_PASS_THRU_PROTOCOL_PIO_DATA_OUT 0x05\r
90#define EFI_ATA_PASS_THRU_PROTOCOL_DMA 0x06\r
91#define EFI_ATA_PASS_THRU_PROTOCOL_DMA_QUEUED 0x07\r
92#define EFI_ATA_PASS_THRU_PROTOCOL_DEVICE_DIAGNOSTIC 0x08\r
93#define EFI_ATA_PASS_THRU_PROTOCOL_DEVICE_RESET 0x09\r
94#define EFI_ATA_PASS_THRU_PROTOCOL_UDMA_DATA_IN 0x0A\r
95#define EFI_ATA_PASS_THRU_PROTOCOL_UDMA_DATA_OUT 0x0B\r
96#define EFI_ATA_PASS_THRU_PROTOCOL_FPDMA 0x0C\r
97#define EFI_ATA_PASS_THRU_PROTOCOL_RETURN_RESPONSE 0xFF\r
98\r
99typedef UINT8 EFI_ATA_PASS_THRU_LENGTH;\r
100\r
101#define EFI_ATA_PASS_THRU_LENGTH_BYTES 0x80\r
102\r
103\r
104#define EFI_ATA_PASS_THRU_LENGTH_MASK 0x70\r
105#define EFI_ATA_PASS_THRU_LENGTH_NO_DATA_TRANSFER 0x00\r
106#define EFI_ATA_PASS_THRU_LENGTH_FEATURES 0x10\r
107#define EFI_ATA_PASS_THRU_LENGTH_SECTOR_COUNT 0x20\r
108#define EFI_ATA_PASS_THRU_LENGTH_TPSIU 0x30\r
109\r
110#define EFI_ATA_PASS_THRU_LENGTH_COUNT 0x0F\r
111\r
112typedef struct {\r
113 ///\r
114 /// A pointer to the sense data that was generated by the execution of the ATA\r
115 /// command. It must be aligned to the boundary specified in the IoAlign field\r
116 /// in the EFI_ATA_PASS_THRU_MODE structure.\r
117 ///\r
118 EFI_ATA_STATUS_BLOCK *Asb;\r
119 ///\r
120 /// A pointer to buffer that contains the Command Data Block to send to the ATA\r
121 /// device specified by Port and PortMultiplierPort.\r
122 ///\r
123 EFI_ATA_COMMAND_BLOCK *Acb;\r
124 ///\r
125 /// The timeout, in 100 ns units, to use for the execution of this ATA command.\r
126 /// A Timeout value of 0 means that this function will wait indefinitely for the\r
127 /// ATA command to execute. If Timeout is greater than zero, then this function\r
128 /// will return EFI_TIMEOUT if the time required to execute the ATA command is\r
129 /// greater than Timeout.\r
130 ///\r
131 UINT64 Timeout;\r
132 ///\r
133 /// A pointer to the data buffer to transfer between the ATA controller and the\r
134 /// ATA device for read and bidirectional commands. For all write and non data\r
135 /// commands where InTransferLength is 0 this field is optional and may be NULL.\r
136 /// If this field is not NULL, then it must be aligned on the boundary specified\r
137 /// by the IoAlign field in the EFI_ATA_PASS_THRU_MODE structure.\r
138 ///\r
139 VOID *InDataBuffer;\r
140 ///\r
141 /// A pointer to the data buffer to transfer between the ATA controller and the\r
142 /// ATA device for write or bidirectional commands. For all read and non data\r
143 /// commands where OutTransferLength is 0 this field is optional and may be NULL.\r
144 /// If this field is not NULL, then it must be aligned on the boundary specified\r
145 /// by the IoAlign field in the EFI_ATA_PASS_THRU_MODE structure.\r
146 ///\r
147 VOID *OutDataBuffer;\r
148 ///\r
149 /// On input, the size, in bytes, of InDataBuffer. On output, the number of bytes\r
150 /// transferred between the ATA controller and the ATA device. If InTransferLength\r
151 /// is larger than the ATA controller can handle, no data will be transferred,\r
152 /// InTransferLength will be updated to contain the number of bytes that the ATA\r
153 /// controller is able to transfer, and EFI_BAD_BUFFER_SIZE will be returned.\r
154 ///\r
155 UINT32 InTransferLength;\r
156 ///\r
157 /// On Input, the size, in bytes of OutDataBuffer. On Output, the Number of bytes\r
158 /// transferred between ATA Controller and the ATA device. If OutTransferLength is\r
159 /// larger than the ATA controller can handle, no data will be transferred, \r
160 /// OutTransferLength will be updated to contain the number of bytes that the ATA\r
161 /// controller is able to transfer, and EFI_BAD_BUFFER_SIZE will be returned.\r
162 ///\r
163 UINT32 OutTransferLength;\r
164 ///\r
165 /// Specifies the protocol used when the ATA device executes the command.\r
166 ///\r
167 EFI_ATA_PASS_THRU_CMD_PROTOCOL Protocol;\r
168 ///\r
169 /// Specifies the way in which the ATA command length is encoded.\r
170 ///\r
171 EFI_ATA_PASS_THRU_LENGTH Length;\r
172} EFI_ATA_PASS_THRU_COMMAND_PACKET;\r
173\r
174\r
175/**\r
176 Sends an ATA command to an ATA device that is attached to the ATA controller. This function\r
177 supports both blocking I/O and non-blocking I/O. The blocking I/O functionality is required,\r
178 and the non-blocking I/O functionality is optional.\r
179\r
180 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. \r
181 @param[in] Port The port number of the ATA device to send the command. \r
182 @param[in] PortMultiplierPort The port multiplier port number of the ATA device to send the command.\r
183 If there is no port multiplier, then specify 0.\r
184 @param[in,out] Packet A pointer to the ATA command to send to the ATA device specified by Port\r
185 and PortMultiplierPort.\r
186 @param[in] Event If non-blocking I/O is not supported then Event is ignored, and blocking\r
187 I/O is performed. If Event is NULL, then blocking I/O is performed. If\r
188 Event is not NULL and non blocking I/O is supported, then non-blocking\r
189 I/O is performed, and Event will be signaled when the ATA command completes.\r
190\r
191 @retval EFI_SUCCESS The ATA command was sent by the host. For bi-directional commands, \r
192 InTransferLength bytes were transferred from InDataBuffer. For write and\r
193 bi-directional commands, OutTransferLength bytes were transferred by OutDataBuffer.\r
194 @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number of bytes that could be transferred\r
195 is returned in InTransferLength. For write and bi-directional commands, \r
196 OutTransferLength bytes were transferred by OutDataBuffer.\r
197 @retval EFI_NOT_READY The ATA command could not be sent because there are too many ATA commands\r
198 already queued. The caller may retry again later.\r
199 @retval EFI_DEVICE_ERROR A device error occurred while attempting to send the ATA command.\r
200 @retval EFI_INVALID_PARAMETER Port, PortMultiplierPort, or the contents of Acb are invalid. The ATA\r
201 command was not sent, so no additional status information is available.\r
202\r
203**/\r
204typedef\r
205EFI_STATUS\r
206(EFIAPI *EFI_ATA_PASS_THRU_PASSTHRU)(\r
207 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
208 IN UINT16 Port,\r
209 IN UINT16 PortMultiplierPort,\r
210 IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet,\r
211 IN EFI_EVENT Event OPTIONAL\r
212 );\r
213\r
214/**\r
215 Used to retrieve the lis t of legal port numbers for ATA devices on an ATA controller.\r
216 These can either be the list of ports where ATA devices are actually present or the\r
217 list of legal port numbers for the ATA controller. Regardless, the caller of this\r
218 function must probe the port number returned to see if an ATA device is actually\r
219 present at that location on the ATA controller.\r
220\r
221 The GetNextPort() function retrieves the port number on an ATA controller. If on input\r
222 Port is 0xFFFF, then the port number of the first port on the ATA controller is returned\r
223 in Port and EFI_SUCCESS is returned.\r
224\r
225 If Port is a port number that was returned on a previous call to GetNextPort(), then the\r
226 port number of the next port on the ATA controller is returned in Port, and EFI_SUCCESS\r
227 is returned. If Port is not 0xFFFF and Port was not returned on a previous call to\r
228 GetNextPort(), then EFI_INVALID_PARAMETER is returned.\r
229\r
230 If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND is\r
231 returned.\r
232\r
233 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance. \r
234 @param[in,out] Port On input, a pointer to the port number on the ATA controller.\r
235 On output, a pointer to the next port number on the ATA\r
236 controller. An input value of 0xFFFF retrieves the first port\r
237 number on the ATA controller.\r
238\r
239 @retval EFI_SUCCESS The next port number on the ATA controller was returned in Port.\r
240 @retval EFI_NOT_FOUND There are no more ports on this ATA controller.\r
241 @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned on a previous call\r
242 to GetNextPort().\r
243\r
244**/\r
245typedef\r
246EFI_STATUS\r
247(EFIAPI *EFI_ATA_PASS_THRU_GET_NEXT_PORT)(\r
248 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
249 IN OUT UINT16 *Port\r
250 );\r
251\r
252/**\r
253 Used to retrieve the list of legal port multiplier port numbers for ATA devices on a port of an ATA \r
254 controller. These can either be the list of port multiplier ports where ATA devices are actually \r
255 present on port or the list of legal port multiplier ports on that port. Regardless, the caller of this \r
256 function must probe the port number and port multiplier port number returned to see if an ATA \r
257 device is actually present.\r
258\r
259 The GetNextDevice() function retrieves the port multiplier port number of an ATA device \r
260 present on a port of an ATA controller.\r
261 \r
262 If PortMultiplierPort points to a port multiplier port number value that was returned on a \r
263 previous call to GetNextDevice(), then the port multiplier port number of the next ATA device\r
264 on the port of the ATA controller is returned in PortMultiplierPort, and EFI_SUCCESS is\r
265 returned.\r
266 \r
267 If PortMultiplierPort points to 0xFFFF, then the port multiplier port number of the first \r
268 ATA device on port of the ATA controller is returned in PortMultiplierPort and \r
269 EFI_SUCCESS is returned.\r
270 \r
271 If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort\r
272 was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER\r
273 is returned.\r
274 \r
275 If PortMultiplierPort is the port multiplier port number of the last ATA device on the port of \r
276 the ATA controller, then EFI_NOT_FOUND is returned.\r
277\r
278 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
279 @param[in] Port The port number present on the ATA controller.\r
280 @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier port number of an\r
281 ATA device present on the ATA controller. \r
282 If on input a PortMultiplierPort of 0xFFFF is specified, \r
283 then the port multiplier port number of the first ATA device\r
284 is returned. On output, a pointer to the port multiplier port\r
285 number of the next ATA device present on an ATA controller.\r
286\r
287 @retval EFI_SUCCESS The port multiplier port number of the next ATA device on the port\r
288 of the ATA controller was returned in PortMultiplierPort.\r
289 @retval EFI_NOT_FOUND There are no more ATA devices on this port of the ATA controller.\r
290 @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort was not\r
291 returned on a previous call to GetNextDevice().\r
292\r
293**/\r
294typedef\r
295EFI_STATUS\r
296(EFIAPI *EFI_ATA_PASS_THRU_GET_NEXT_DEVICE)(\r
297 IN EFI_ATA_PASS_THRU_PROTOCOL *This,\r
298 IN UINT16 Port,\r
299 IN OUT UINT16 *PortMultiplierPort\r
300 );\r
301\r
302/**\r
303 Used to allocate and build a device path node for an ATA device on an ATA controller.\r
304\r
305 The BuildDevicePath() function allocates and builds a single device node for the ATA\r
306 device specified by Port and PortMultiplierPort. If the ATA device specified by Port and\r
307 PortMultiplierPort is not present on the ATA controller, then EFI_NOT_FOUND is returned.\r
308 If DevicePath is NULL, then EFI_INVALID_PARAMETER is returned. If there are not enough\r
309 resources to allocate the device path node, then EFI_OUT_OF_RESOURCES is returned.\r
310\r
311 Otherwise, DevicePath is allocated with the boot service AllocatePool(), the contents of\r
312 DevicePath are initialized to describe the ATA device specified by Port and PortMultiplierPort,\r
313 and EFI_SUCCESS is returned.\r
314\r
315 @param[in] This A pointer to the EFI_ATA_PASS_THRU_PROTOCOL instance.\r
316 @param[in] Port Port specifies the port number of the ATA device for which a\r
317 device path node is to be allocated and built.\r
318 @param[in] PortMultiplierPort The port multiplier port number of the ATA device for which a\r
319 device path node is to be allocated and built. If there is no\r
320 port multiplier, then specify 0.\r
321 @param[in,out] DevicePath A pointer to a single device path node that describes the ATA\r
322 device specified by Port and PortMultiplierPort. This function\r
323 is responsible for allocating the buffer DevicePath with the\r
324