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