]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Bus/Ata/AhciPei/AhciPeiPassThru.h
MdeModulePkg/AhciPei: Add AHCI mode ATA device support in PEI
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AhciPei / AhciPeiPassThru.h
CommitLineData
87bc3f19
HW
1/** @file\r
2 The AhciPei driver is used to manage ATA hard disk device working under AHCI\r
3 mode at PEI phase.\r
4\r
5 Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
6\r
7 This program and the accompanying materials\r
8 are licensed and made available under the terms and conditions\r
9 of the BSD License which accompanies this distribution. The\r
10 full text of the license may be found at\r
11 http://opensource.org/licenses/bsd-license.php\r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15\r
16**/\r
17\r
18#ifndef _AHCI_PEI_PASSTHRU_H_\r
19#define _AHCI_PEI_PASSTHRU_H_\r
20\r
21/**\r
22 Sends an ATA command to an ATA device that is attached to the ATA controller.\r
23\r
24 @param[in] This The PPI instance pointer.\r
25 @param[in] Port The port number of the ATA device to send\r
26 the command.\r
27 @param[in] PortMultiplierPort The port multiplier port number of the ATA\r
28 device to send the command.\r
29 If there is no port multiplier, then specify\r
30 0xFFFF.\r
31 @param[in,out] Packet A pointer to the ATA command to send to\r
32 the ATA device specified by Port and\r
33 PortMultiplierPort.\r
34\r
35 @retval EFI_SUCCESS The ATA command was sent by the host. For\r
36 bi-directional commands, InTransferLength bytes\r
37 were transferred from InDataBuffer. For write\r
38 and bi-directional commands, OutTransferLength\r
39 bytes were transferred by OutDataBuffer.\r
40 @retval EFI_NOT_FOUND The specified ATA device is not found.\r
41 @retval EFI_INVALID_PARAMETER The contents of Acb are invalid. The ATA command\r
42 was not sent, so no additional status information\r
43 is available.\r
44 @retval EFI_BAD_BUFFER_SIZE The ATA command was not executed. The number\r
45 of bytes that could be transferred is returned\r
46 in InTransferLength. For write and bi-directional\r
47 commands, OutTransferLength bytes were transferred\r
48 by OutDataBuffer.\r
49 @retval EFI_NOT_READY The ATA command could not be sent because there\r
50 are too many ATA commands already queued. The\r
51 caller may retry again later.\r
52 @retval EFI_DEVICE_ERROR A device error occurred while attempting to\r
53 send the ATA command.\r
54\r
55**/\r
56EFI_STATUS\r
57EFIAPI\r
58AhciAtaPassThruPassThru (\r
59 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,\r
60 IN UINT16 Port,\r
61 IN UINT16 PortMultiplierPort,\r
62 IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET *Packet\r
63 );\r
64\r
65/**\r
66 Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.\r
67 These can either be the list of ports where ATA devices are actually present or the\r
68 list of legal port numbers for the ATA controller. Regardless, the caller of this\r
69 function must probe the port number returned to see if an ATA device is actually\r
70 present at that location on the ATA controller.\r
71\r
72 The GetNextPort() function retrieves the port number on an ATA controller. If on\r
73 input Port is 0xFFFF, then the port number of the first port on the ATA controller\r
74 is returned in Port and EFI_SUCCESS is returned.\r
75\r
76 If Port is a port number that was returned on a previous call to GetNextPort(),\r
77 then the port number of the next port on the ATA controller is returned in Port,\r
78 and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on\r
79 a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.\r
80\r
81 If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND\r
82 is returned.\r
83\r
84 @param[in] This The PPI instance pointer.\r
85 @param[in,out] Port On input, a pointer to the port number on the ATA controller.\r
86 On output, a pointer to the next port number on the ATA\r
87 controller. An input value of 0xFFFF retrieves the first\r
88 port number on the ATA controller.\r
89\r
90 @retval EFI_SUCCESS The next port number on the ATA controller was\r
91 returned in Port.\r
92 @retval EFI_NOT_FOUND There are no more ports on this ATA controller.\r
93 @retval EFI_INVALID_PARAMETER Port is not 0xFFFF and Port was not returned\r
94 on a previous call to GetNextPort().\r
95\r
96**/\r
97EFI_STATUS\r
98EFIAPI\r
99AhciAtaPassThruGetNextPort (\r
100 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,\r
101 IN OUT UINT16 *Port\r
102 );\r
103\r
104/**\r
105 Used to retrieve the list of legal port multiplier port numbers for ATA devices\r
106 on a port of an ATA controller. These can either be the list of port multiplier\r
107 ports where ATA devices are actually present on port or the list of legal port\r
108 multiplier ports on that port. Regardless, the caller of this function must probe\r
109 the port number and port multiplier port number returned to see if an ATA device\r
110 is actually present.\r
111\r
112 The GetNextDevice() function retrieves the port multiplier port number of an ATA\r
113 device present on a port of an ATA controller.\r
114\r
115 If PortMultiplierPort points to a port multiplier port number value that was\r
116 returned on a previous call to GetNextDevice(), then the port multiplier port\r
117 number of the next ATA device on the port of the ATA controller is returned in\r
118 PortMultiplierPort, and EFI_SUCCESS is returned.\r
119\r
120 If PortMultiplierPort points to 0xFFFF, then the port multiplier port number\r
121 of the first ATA device on port of the ATA controller is returned in PortMultiplierPort\r
122 and EFI_SUCCESS is returned.\r
123\r
124 If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort\r
125 was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER\r
126 is returned.\r
127\r
128 If PortMultiplierPort is the port multiplier port number of the last ATA device\r
129 on the port of the ATA controller, then EFI_NOT_FOUND is returned.\r
130\r
131 @param[in] This The PPI instance pointer.\r
132 @param[in] Port The port number present on the ATA controller.\r
133 @param[in,out] PortMultiplierPort On input, a pointer to the port multiplier\r
134 port number of an ATA device present on the\r
135 ATA controller. If on input a PortMultiplierPort\r
136 of 0xFFFF is specified, then the port multiplier\r
137 port number of the first ATA device is returned.\r
138 On output, a pointer to the port multiplier port\r
139 number of the next ATA device present on an ATA\r
140 controller.\r
141\r
142 @retval EFI_SUCCESS The port multiplier port number of the next ATA\r
143 device on the port of the ATA controller was\r
144 returned in PortMultiplierPort.\r
145 @retval EFI_NOT_FOUND There are no more ATA devices on this port of\r
146 the ATA controller.\r
147 @retval EFI_INVALID_PARAMETER PortMultiplierPort is not 0xFFFF, and PortMultiplierPort\r
148 was not returned on a previous call to GetNextDevice().\r
149\r
150**/\r
151EFI_STATUS\r
152EFIAPI\r
153AhciAtaPassThruGetNextDevice (\r
154 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,\r
155 IN UINT16 Port,\r
156 IN OUT UINT16 *PortMultiplierPort\r
157 );\r
158\r
159/**\r
160 Gets the device path information of the underlying ATA host controller.\r
161\r
162 @param[in] This The PPI instance pointer.\r
163 @param[out] DevicePathLength The length of the device path in bytes specified\r
164 by DevicePath.\r
165 @param[out] DevicePath The device path of the underlying ATA host controller.\r
166 This field re-uses EFI Device Path Protocol as\r
167 defined by Section 10.2 EFI Device Path Protocol\r
168 of UEFI 2.7 Specification.\r
169\r
170 @retval EFI_SUCCESS The device path of the ATA host controller has\r
171 been successfully returned.\r
172 @retval EFI_INVALID_PARAMETER DevicePathLength or DevicePath is NULL.\r
173 @retval EFI_OUT_OF_RESOURCES Not enough resource to return the device path.\r
174\r
175**/\r
176EFI_STATUS\r
177EFIAPI\r
178AhciAtaPassThruGetDevicePath (\r
179 IN EDKII_PEI_ATA_PASS_THRU_PPI *This,\r
180 OUT UINTN *DevicePathLength,\r
181 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
182 );\r
183\r
184#endif\r