]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Ata/AtaAtapiPassThru/AhciMode.h
MdeModulePkg: ATA performance tuning.
[mirror_edk2.git] / MdeModulePkg / Bus / Ata / AtaAtapiPassThru / AhciMode.h
index 1efe0ebe7349c89d0508a8e0eb45b65aab23080a..052e7837f5bd38878d3bdd07536733d6327f1293 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Header file for AHCI mode of ATA host controller.\r
   \r
-  Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2010 - 2011, 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
@@ -17,6 +17,8 @@
 #define EFI_AHCI_BAR_INDEX                     0x05\r
 \r
 #define EFI_AHCI_CAPABILITY_OFFSET             0x0000\r
+#define   EFI_AHCI_CAP_SSS                     BIT27\r
+#define   EFI_AHCI_CAP_S64A                    BIT31\r
 #define EFI_AHCI_GHC_OFFSET                    0x0004\r
 #define   EFI_AHCI_GHC_RESET                   BIT0\r
 #define   EFI_AHCI_GHC_IE                      BIT1\r
@@ -34,6 +36,19 @@ typedef union {
   UINT64    Uint64;\r
 } DATA_64;\r
 \r
+//\r
+// Refer SATA1.0a spec section 5.2, the Phy detection time should be less than 10ms.\r
+//\r
+#define  EFI_AHCI_BUS_PHY_DETECT_TIMEOUT       10\r
+//\r
+// Refer SATA1.0a spec, the FIS enable time should be less than 500ms.\r
+//\r
+#define  EFI_AHCI_PORT_CMD_FR_CLEAR_TIMEOUT    EFI_TIMER_PERIOD_MILLISECONDS(500)\r
+//\r
+// Refer SATA1.0a spec, the bus reset time should be less than 1s.\r
+//\r
+#define  EFI_AHCI_BUS_RESET_TIMEOUT            EFI_TIMER_PERIOD_SECONDS(1)\r
+\r
 #define  EFI_AHCI_ATAPI_DEVICE_SIG             0xEB140000\r
 #define  EFI_AHCI_ATA_DEVICE_SIG               0x00000000\r
 #define  EFI_AHCI_PORT_MULTIPLIER_SIG          0x96690000\r
@@ -103,7 +118,7 @@ typedef union {
 #define   EFI_AHCI_PORT_CMD_ST                 BIT0\r
 #define   EFI_AHCI_PORT_CMD_SUD                BIT1\r
 #define   EFI_AHCI_PORT_CMD_POD                BIT2\r
-#define   EFI_AHCI_PORT_CMD_COL                BIT3\r
+#define   EFI_AHCI_PORT_CMD_CLO                BIT3\r
 #define   EFI_AHCI_PORT_CMD_CR                 BIT15\r
 #define   EFI_AHCI_PORT_CMD_FRE                BIT4\r
 #define   EFI_AHCI_PORT_CMD_FR                 BIT14\r
@@ -154,7 +169,7 @@ typedef union {
 #define   EFI_AHCI_PORT_SERR_BDE               BIT19\r
 #define   EFI_AHCI_PORT_SERR_DE                BIT20\r
 #define   EFI_AHCI_PORT_SERR_CRCE              BIT21\r
-#define   EFI_AHCI_PORT_SERR_HE                BIT22          \r
+#define   EFI_AHCI_PORT_SERR_HE                BIT22\r
 #define   EFI_AHCI_PORT_SERR_LSE               BIT23\r
 #define   EFI_AHCI_PORT_SERR_TSTE              BIT24\r
 #define   EFI_AHCI_PORT_SERR_UFT               BIT25\r
@@ -312,7 +327,7 @@ AhciPacketCommandExecute (
   @param  PciIo              The PCI IO protocol instance.\r
   @param  Port               The number of port.\r
   @param  CommandSlot        The number of CommandSlot.\r
-  @param  Timeout            The timeout value of start.\r
+  @param  Timeout            The timeout value of start, uses 100ns as a unit.\r
    \r
   @retval EFI_DEVICE_ERROR   The command start unsuccessfully.\r
   @retval EFI_TIMEOUT        The operation is time out.\r
@@ -333,7 +348,7 @@ AhciStartCommand (
     \r
   @param  PciIo              The PCI IO protocol instance.\r
   @param  Port               The number of port.\r
-  @param  Timeout            The timeout value of stop.\r
+  @param  Timeout            The timeout value of stop, uses 100ns as a unit.\r
    \r
   @retval EFI_DEVICE_ERROR   The command stop unsuccessfully.\r
   @retval EFI_TIMEOUT        The operation is time out.\r
@@ -348,117 +363,5 @@ AhciStopCommand (
   IN  UINT64                    Timeout\r
   );\r
 \r
-/**\r
-  Start a non data transfer on specific port.\r
-    \r
-  @param  PciIo               The PCI IO protocol instance.\r
-  @param  AhciRegisters       The pointer to the EFI_AHCI_REGISTERS.\r
-  @param  Port                The number of port.\r
-  @param  PortMultiplier      The timeout value of stop.\r
-  @param  AtapiCommand        The atapi command will be used for the transfer.\r
-  @param  AtapiCommandLength  The length of the atapi command.\r
-  @param  AtaCommandBlock     The EFI_ATA_COMMAND_BLOCK data.\r
-  @param  AtaStatusBlock      The EFI_ATA_STATUS_BLOCK data.\r
-  @param  Timeout             The timeout value of non data transfer.\r
-\r
-  @retval EFI_DEVICE_ERROR    The non data transfer abort with error occurs.\r
-  @retval EFI_TIMEOUT         The operation is time out.\r
-  @retval EFI_UNSUPPORTED     The device is not ready for transfer.\r
-  @retval EFI_SUCCESS         The non data transfer executes successfully.\r
-\r
-**/ \r
-EFI_STATUS\r
-EFIAPI\r
-AhciNonDataTransfer (\r
-  IN     EFI_PCI_IO_PROTOCOL           *PciIo,\r
-  IN     EFI_AHCI_REGISTERS            *AhciRegisters,\r
-  IN     UINT8                         Port,\r
-  IN     UINT8                         PortMultiplier,\r
-  IN     EFI_AHCI_ATAPI_COMMAND        *AtapiCommand OPTIONAL,\r
-  IN     UINT8                         AtapiCommandLength,\r
-  IN     EFI_ATA_COMMAND_BLOCK         *AtaCommandBlock,\r
-  IN OUT EFI_ATA_STATUS_BLOCK          *AtaStatusBlock,\r
-  IN     UINT64                        Timeout\r
-  );\r
-\r
-/**\r
-  Start a DMA data transfer on specific port\r
-\r
-  @param  PciIo               The PCI IO protocol instance.\r
-  @param  AhciRegisters       The pointer to the EFI_AHCI_REGISTERS.\r
-  @param  Port                The number of port.\r
-  @param  PortMultiplier      The timeout value of stop.\r
-  @param  AtapiCommand        The atapi command will be used for the transfer.\r
-  @param  AtapiCommandLength  The length of the atapi command.\r
-  @param  Read                The transfer direction.\r
-  @param  AtaCommandBlock     The EFI_ATA_COMMAND_BLOCK data.\r
-  @param  AtaStatusBlock      The EFI_ATA_STATUS_BLOCK data.\r
-  @param  MemoryAddr          The pointer to the data buffer.\r
-  @param  DataCount           The data count to be transferred.\r
-  @param  Timeout             The timeout value of non data transfer.\r
-\r
-  @retval EFI_DEVICE_ERROR    The DMA data transfer abort with error occurs.\r
-  @retval EFI_TIMEOUT         The operation is time out.\r
-  @retval EFI_UNSUPPORTED     The device is not ready for transfer.\r
-  @retval EFI_SUCCESS         The DMA data transfer executes successfully.\r
-   \r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-AhciDmaTransfer (\r
-  IN     EFI_PCI_IO_PROTOCOL        *PciIo,\r
-  IN     EFI_AHCI_REGISTERS         *AhciRegisters,\r
-  IN     UINT8                      Port,\r
-  IN     UINT8                      PortMultiplier,\r
-  IN     EFI_AHCI_ATAPI_COMMAND     *AtapiCommand OPTIONAL,\r
-  IN     UINT8                      AtapiCommandLength,\r
-  IN     BOOLEAN                    Read,  \r
-  IN     EFI_ATA_COMMAND_BLOCK      *AtaCommandBlock,\r
-  IN OUT EFI_ATA_STATUS_BLOCK       *AtaStatusBlock,\r
-  IN OUT VOID                       *MemoryAddr,\r
-  IN     UINTN                      DataCount,\r
-  IN     UINT64                     Timeout\r
-  );\r
-\r
-/**\r
-  Start a PIO data transfer on specific port.\r
-    \r
-  @param  PciIo               The PCI IO protocol instance.\r
-  @param  AhciRegisters       The pointer to the EFI_AHCI_REGISTERS.\r
-  @param  Port                The number of port.\r
-  @param  PortMultiplier      The timeout value of stop.\r
-  @param  AtapiCommand        The atapi command will be used for the transfer.\r
-  @param  AtapiCommandLength  The length of the atapi command.\r
-  @param  Read                The transfer direction.\r
-  @param  AtaCommandBlock     The EFI_ATA_COMMAND_BLOCK data.\r
-  @param  AtaStatusBlock      The EFI_ATA_STATUS_BLOCK data.\r
-  @param  MemoryAddr          The pointer to the data buffer.\r
-  @param  DataCount           The data count to be transferred.\r
-  @param  Timeout             The timeout value of non data transfer.\r
-\r
-  @retval EFI_DEVICE_ERROR    The PIO data transfer abort with error occurs.\r
-  @retval EFI_TIMEOUT         The operation is time out.\r
-  @retval EFI_UNSUPPORTED     The device is not ready for transfer.\r
-  @retval EFI_SUCCESS         The PIO data transfer executes successfully.\r
-\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-AhciPioTransfer (\r
-  IN     EFI_PCI_IO_PROTOCOL        *PciIo,\r
-  IN     EFI_AHCI_REGISTERS         *AhciRegisters,\r
-  IN     UINT8                      Port,\r
-  IN     UINT8                      PortMultiplier,\r
-  IN     EFI_AHCI_ATAPI_COMMAND     *AtapiCommand OPTIONAL,\r
-  IN     UINT8                      AtapiCommandLength,  \r
-  IN     BOOLEAN                    Read,  \r
-  IN     EFI_ATA_COMMAND_BLOCK      *AtaCommandBlock,\r
-  IN OUT EFI_ATA_STATUS_BLOCK       *AtaStatusBlock,\r
-  IN OUT VOID                       *MemoryAddr,\r
-  IN     UINT32                     DataCount,\r
-  IN     UINT64                     Timeout \r
-  );\r
-\r
-\r
 #endif\r
 \r