]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Include/Ppi/AtaPassThru.h
MdeModulePkg: Add definitions for EDKII PEI ATA PassThru PPI
[mirror_edk2.git] / MdeModulePkg / Include / Ppi / AtaPassThru.h
diff --git a/MdeModulePkg/Include/Ppi/AtaPassThru.h b/MdeModulePkg/Include/Ppi/AtaPassThru.h
new file mode 100644 (file)
index 0000000..78bdaef
--- /dev/null
@@ -0,0 +1,219 @@
+/** @file\r
+\r
+  Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>\r
+  This program and the accompanying materials\r
+  are licensed and made available under the terms and conditions of the BSD License\r
+  which accompanies this distribution.  The full text of the license may be found at\r
+  http://opensource.org/licenses/bsd-license.php\r
+\r
+  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+**/\r
+\r
+#ifndef _EDKII_ATA_PASS_THRU_PPI_H_\r
+#define _EDKII_ATA_PASS_THRU_PPI_H_\r
+\r
+#include <Protocol/DevicePath.h>\r
+#include <Protocol/AtaPassThru.h>\r
+\r
+///\r
+/// Global ID for the EDKII_PEI_ATA_PASS_THRU_PPI.\r
+///\r
+#define EDKII_PEI_ATA_PASS_THRU_PPI_GUID \\r
+  { \\r
+    0xa16473fd, 0xd474, 0x4c89, { 0xae, 0xc7, 0x90, 0xb8, 0x3c, 0x73, 0x86, 0x9 } \\r
+  }\r
+\r
+//\r
+// Forward declaration for the EDKII_PEI_ATA_PASS_THRU_PPI.\r
+//\r
+typedef struct _EDKII_PEI_ATA_PASS_THRU_PPI  EDKII_PEI_ATA_PASS_THRU_PPI;\r
+\r
+//\r
+// Revision The revision to which the ATA Pass Thru PPI interface adheres.\r
+//          All future revisions must be backwards compatible.\r
+//          If a future version is not back wards compatible it is not the same GUID.\r
+//\r
+#define EDKII_PEI_ATA_PASS_THRU_PPI_REVISION    0x00010000\r
+\r
+\r
+/**\r
+  Sends an ATA command to an ATA device that is attached to the ATA controller.\r
+\r
+  @param[in]     This                  The PPI instance pointer.\r
+  @param[in]     Port                  The port number of the ATA device to send\r
+                                       the command.\r
+  @param[in]     PortMultiplierPort    The port multiplier port number of the ATA\r
+                                       device to send the command.\r
+                                       If there is no port multiplier, then specify\r
+                                       0xFFFF.\r
+  @param[in,out] Packet                A pointer to the ATA command to send to\r
+                                       the ATA device specified by Port and\r
+                                       PortMultiplierPort.\r
+\r
+  @retval EFI_SUCCESS              The ATA command was sent by the host. For\r
+                                   bi-directional commands, InTransferLength bytes\r
+                                   were transferred from InDataBuffer. For write\r
+                                   and bi-directional commands, OutTransferLength\r
+                                   bytes were transferred by OutDataBuffer.\r
+  @retval EFI_NOT_FOUND            The specified ATA device is not found.\r
+  @retval EFI_INVALID_PARAMETER    The contents of Acb are invalid. The ATA command\r
+                                   was not sent, so no additional status information\r
+                                   is available.\r
+  @retval EFI_BAD_BUFFER_SIZE      The ATA command was not executed. The number\r
+                                   of bytes that could be transferred is returned\r
+                                   in InTransferLength. For write and bi-directional\r
+                                   commands, OutTransferLength bytes were transferred\r
+                                   by OutDataBuffer.\r
+  @retval EFI_NOT_READY            The ATA command could not be sent because there\r
+                                   are too many ATA commands already queued. The\r
+                                   caller may retry again later.\r
+  @retval EFI_DEVICE_ERROR         A device error occurred while attempting to\r
+                                   send the ATA command.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_ATA_PASS_THRU_PASSTHRU) (\r
+  IN     EDKII_PEI_ATA_PASS_THRU_PPI         *This,\r
+  IN     UINT16                              Port,\r
+  IN     UINT16                              PortMultiplierPort,\r
+  IN OUT EFI_ATA_PASS_THRU_COMMAND_PACKET    *Packet\r
+  );\r
+\r
+/**\r
+  Used to retrieve the list of legal port numbers for ATA devices on an ATA controller.\r
+  These can either be the list of ports where ATA devices are actually present or the\r
+  list of legal port numbers for the ATA controller. Regardless, the caller of this\r
+  function must probe the port number returned to see if an ATA device is actually\r
+  present at that location on the ATA controller.\r
+\r
+  The GetNextPort() function retrieves the port number on an ATA controller. If on\r
+  input Port is 0xFFFF, then the port number of the first port on the ATA controller\r
+  is returned in Port and EFI_SUCCESS is returned.\r
+\r
+  If Port is a port number that was returned on a previous call to GetNextPort(),\r
+  then the port number of the next port on the ATA controller is returned in Port,\r
+  and EFI_SUCCESS is returned. If Port is not 0xFFFF and Port was not returned on\r
+  a previous call to GetNextPort(), then EFI_INVALID_PARAMETER is returned.\r
+\r
+  If Port is the port number of the last port on the ATA controller, then EFI_NOT_FOUND\r
+  is returned.\r
+\r
+  @param[in]     This    The PPI instance pointer.\r
+  @param[in,out] Port    On input, a pointer to the port number on the ATA controller.\r
+                         On output, a pointer to the next port number on the ATA\r
+                         controller. An input value of 0xFFFF retrieves the first\r
+                         port number on the ATA controller.\r
+\r
+  @retval EFI_SUCCESS              The next port number on the ATA controller was\r
+                                   returned in Port.\r
+  @retval EFI_NOT_FOUND            There are no more ports on this ATA controller.\r
+  @retval EFI_INVALID_PARAMETER    Port is not 0xFFFF and Port was not returned\r
+                                   on a previous call to GetNextPort().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT) (\r
+  IN     EDKII_PEI_ATA_PASS_THRU_PPI    *This,\r
+  IN OUT UINT16                         *Port\r
+  );\r
+\r
+/**\r
+  Used to retrieve the list of legal port multiplier port numbers for ATA devices\r
+  on a port of an ATA controller. These can either be the list of port multiplier\r
+  ports where ATA devices are actually present on port or the list of legal port\r
+  multiplier ports on that port. Regardless, the caller of this function must probe\r
+  the port number and port multiplier port number returned to see if an ATA device\r
+  is actually present.\r
+\r
+  The GetNextDevice() function retrieves the port multiplier port number of an ATA\r
+  device present on a port of an ATA controller.\r
+\r
+  If PortMultiplierPort points to a port multiplier port number value that was\r
+  returned on a previous call to GetNextDevice(), then the port multiplier port\r
+  number of the next ATA device on the port of the ATA controller is returned in\r
+  PortMultiplierPort, and EFI_SUCCESS is returned.\r
+\r
+  If PortMultiplierPort points to 0xFFFF, then the port multiplier port number\r
+  of the first ATA device on port of the ATA controller is returned in PortMultiplierPort\r
+  and EFI_SUCCESS is returned.\r
+\r
+  If PortMultiplierPort is not 0xFFFF and the value pointed to by PortMultiplierPort\r
+  was not returned on a previous call to GetNextDevice(), then EFI_INVALID_PARAMETER\r
+  is returned.\r
+\r
+  If PortMultiplierPort is the port multiplier port number of the last ATA device\r
+  on the port of the ATA controller, then EFI_NOT_FOUND is returned.\r
+\r
+  @param[in]     This                  The PPI instance pointer.\r
+  @param[in]     Port                  The port number present on the ATA controller.\r
+  @param[in,out] PortMultiplierPort    On input, a pointer to the port multiplier\r
+                                       port number of an ATA device present on the\r
+                                       ATA controller. If on input a PortMultiplierPort\r
+                                       of 0xFFFF is specified, then the port multiplier\r
+                                       port number of the first ATA device is returned.\r
+                                       On output, a pointer to the port multiplier port\r
+                                       number of the next ATA device present on an ATA\r
+                                       controller.\r
+\r
+  @retval EFI_SUCCESS              The port multiplier port number of the next ATA\r
+                                   device on the port of the ATA controller was\r
+                                   returned in PortMultiplierPort.\r
+  @retval EFI_NOT_FOUND            There are no more ATA devices on this port of\r
+                                   the ATA controller.\r
+  @retval EFI_INVALID_PARAMETER    PortMultiplierPort is not 0xFFFF, and PortMultiplierPort\r
+                                   was not returned on a previous call to GetNextDevice().\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE) (\r
+  IN     EDKII_PEI_ATA_PASS_THRU_PPI    *This,\r
+  IN     UINT16                         Port,\r
+  IN OUT UINT16                         *PortMultiplierPort\r
+  );\r
+\r
+/**\r
+  Gets the device path information of the underlying ATA host controller.\r
+\r
+  @param[in]  This                The PPI instance pointer.\r
+  @param[out] DevicePathLength    The length of the device path in bytes specified\r
+                                  by DevicePath.\r
+  @param[out] DevicePath          The device path of the underlying ATA host controller.\r
+                                  This field re-uses EFI Device Path Protocol as\r
+                                  defined by Section 10.2 EFI Device Path Protocol\r
+                                  of UEFI 2.7 Specification.\r
+\r
+  @retval EFI_SUCCESS              The device path of the ATA host controller has\r
+                                   been successfully returned.\r
+  @retval EFI_INVALID_PARAMETER    DevicePathLength or DevicePath is NULL.\r
+  @retval EFI_OUT_OF_RESOURCES     Not enough resource to return the device path.\r
+\r
+**/\r
+typedef\r
+EFI_STATUS\r
+(EFIAPI *EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH) (\r
+  IN  EDKII_PEI_ATA_PASS_THRU_PPI    *This,\r
+  OUT UINTN                          *DevicePathLength,\r
+  OUT EFI_DEVICE_PATH_PROTOCOL       **DevicePath\r
+  );\r
+\r
+//\r
+// EDKII_PEI_ATA_PASS_THRU_PPI provides the services that are required to send\r
+// ATA commands to an ATA device during PEI.\r
+//\r
+struct _EDKII_PEI_ATA_PASS_THRU_PPI {\r
+  UINT64                                        Revision;\r
+  EFI_ATA_PASS_THRU_MODE                        *Mode;\r
+  EDKII_PEI_ATA_PASS_THRU_PASSTHRU              PassThru;\r
+  EDKII_PEI_ATA_PASS_THRU_THRU_GET_NEXT_PORT    GetNextPort;\r
+  EDKII_PEI_ATA_PASS_THRU_GET_NEXT_DEVICE       GetNextDevice;\r
+  EDKII_PEI_ATA_PASS_THRU_GET_DEVICE_PATH       GetDevicePath;\r
+};\r
+\r
+extern EFI_GUID gEdkiiPeiAtaPassThruPpiGuid;\r
+\r
+#endif\r