]> git.karo-electronics.de Git - linux-beck.git/commitdiff
libata-link: make two port flags HRST_TO_RESUME and SKIP_D2H_BSY link flags
authorTejun Heo <htejun@gmail.com>
Mon, 6 Aug 2007 09:36:23 +0000 (18:36 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 12 Oct 2007 18:55:31 +0000 (14:55 -0400)
HRST_TO_RESUME and SKIP_D2H_BSY are link attributes.  Move them to
ata_link->flags.  This will allow host and PMP links to have different
attributes.  ata_port_info->link_flags is added and used by LLDs to
specify these flags during initialization.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/ahci.c
drivers/ata/libata-core.c
drivers/ata/sata_nv.c
drivers/ata/sata_sil.c
drivers/ata/sata_sil24.c
include/linux/libata.h

index e38ae12d014809bc07001648357c3ad9724a602d..483733783cf80365dabb6c0528c7a801175db5b6 100644 (file)
@@ -178,8 +178,8 @@ enum {
 
        AHCI_FLAG_COMMON                = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                          ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
-                                         ATA_FLAG_SKIP_D2H_BSY |
                                          ATA_FLAG_ACPI_SATA,
+       AHCI_LFLAG_COMMON               = ATA_LFLAG_SKIP_D2H_BSY,
 };
 
 struct ahci_cmd_hdr {
@@ -333,6 +333,7 @@ static const struct ata_port_info ahci_port_info[] = {
        /* board_ahci */
        {
                .flags          = AHCI_FLAG_COMMON,
+               .link_flags     = AHCI_LFLAG_COMMON,
                .pio_mask       = 0x1f, /* pio0-4 */
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &ahci_ops,
@@ -340,14 +341,15 @@ static const struct ata_port_info ahci_port_info[] = {
        /* board_ahci_pi */
        {
                .flags          = AHCI_FLAG_COMMON | AHCI_FLAG_HONOR_PI,
+               .link_flags     = AHCI_LFLAG_COMMON,
                .pio_mask       = 0x1f, /* pio0-4 */
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &ahci_ops,
        },
        /* board_ahci_vt8251 */
        {
-               .flags          = AHCI_FLAG_COMMON | ATA_FLAG_HRST_TO_RESUME |
-                                 AHCI_FLAG_NO_NCQ,
+               .flags          = AHCI_FLAG_COMMON | AHCI_FLAG_NO_NCQ,
+               .link_flags     = AHCI_LFLAG_COMMON | ATA_LFLAG_HRST_TO_RESUME,
                .pio_mask       = 0x1f, /* pio0-4 */
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &ahci_vt8251_ops,
@@ -355,6 +357,7 @@ static const struct ata_port_info ahci_port_info[] = {
        /* board_ahci_ign_iferr */
        {
                .flags          = AHCI_FLAG_COMMON | AHCI_FLAG_IGN_IRQ_IF_ERR,
+               .link_flags     = AHCI_LFLAG_COMMON,
                .pio_mask       = 0x1f, /* pio0-4 */
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &ahci_ops,
@@ -364,6 +367,7 @@ static const struct ata_port_info ahci_port_info[] = {
                .flags          = AHCI_FLAG_COMMON |
                                  AHCI_FLAG_IGN_SERR_INTERNAL |
                                  AHCI_FLAG_32BIT_ONLY,
+               .link_flags     = AHCI_LFLAG_COMMON,
                .pio_mask       = 0x1f, /* pio0-4 */
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &ahci_ops,
@@ -373,9 +377,9 @@ static const struct ata_port_info ahci_port_info[] = {
                .sht            = &ahci_sht,
                .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
-                                 ATA_FLAG_SKIP_D2H_BSY | AHCI_FLAG_HONOR_PI |
-                                 AHCI_FLAG_NO_NCQ | AHCI_FLAG_NO_MSI |
-                                 AHCI_FLAG_MV_PATA,
+                                 AHCI_FLAG_HONOR_PI | AHCI_FLAG_NO_NCQ |
+                                 AHCI_FLAG_NO_MSI | AHCI_FLAG_MV_PATA,
+               .link_flags     = AHCI_LFLAG_COMMON,
                .pio_mask       = 0x1f, /* pio0-4 */
                .udma_mask      = ATA_UDMA6,
                .port_ops       = &ahci_ops,
index 944f54457c8fd44c848c3ed2a55e4d9b68343508..2be30c7a222687088f85605e3d92683691720a70 100644 (file)
@@ -3332,7 +3332,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
 
        /* handle link resume */
        if ((ehc->i.flags & ATA_EHI_RESUME_LINK) &&
-           (ap->flags & ATA_FLAG_HRST_TO_RESUME))
+           (link->flags & ATA_LFLAG_HRST_TO_RESUME))
                ehc->i.action |= ATA_EH_HARDRESET;
 
        /* if we're about to do hardreset, nothing more to do */
@@ -3351,7 +3351,7 @@ int ata_std_prereset(struct ata_link *link, unsigned long deadline)
        /* Wait for !BSY if the controller can wait for the first D2H
         * Reg FIS and we don't know that no device is attached.
         */
-       if (!(ap->flags & ATA_FLAG_SKIP_D2H_BSY) && !ata_link_offline(link)) {
+       if (!(link->flags & ATA_LFLAG_SKIP_D2H_BSY) && !ata_link_offline(link)) {
                rc = ata_wait_ready(ap, deadline);
                if (rc && rc != -ENODEV) {
                        ata_link_printk(link, KERN_WARNING, "device not ready "
@@ -6269,6 +6269,7 @@ struct ata_host *ata_host_alloc_pinfo(struct device *dev,
                ap->mwdma_mask = pi->mwdma_mask;
                ap->udma_mask = pi->udma_mask;
                ap->flags |= pi->flags;
+               ap->link.flags |= pi->link_flags;
                ap->ops = pi->port_ops;
 
                if (!host->ops && (pi->port_ops != &ata_dummy_port_ops))
index 67ba0f75f1e9c1e49837c3c795800d64eb4525d8..884d9f05e6c6438a1d55317a81d2ce8a62002413 100644 (file)
@@ -455,8 +455,8 @@ static const struct ata_port_info nv_port_info[] = {
        /* generic */
        {
                .sht            = &nv_sht,
-               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_HRST_TO_RESUME,
+               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
+               .link_flags     = ATA_LFLAG_HRST_TO_RESUME,
                .pio_mask       = NV_PIO_MASK,
                .mwdma_mask     = NV_MWDMA_MASK,
                .udma_mask      = NV_UDMA_MASK,
@@ -466,8 +466,8 @@ static const struct ata_port_info nv_port_info[] = {
        /* nforce2/3 */
        {
                .sht            = &nv_sht,
-               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_HRST_TO_RESUME,
+               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
+               .link_flags     = ATA_LFLAG_HRST_TO_RESUME,
                .pio_mask       = NV_PIO_MASK,
                .mwdma_mask     = NV_MWDMA_MASK,
                .udma_mask      = NV_UDMA_MASK,
@@ -477,8 +477,8 @@ static const struct ata_port_info nv_port_info[] = {
        /* ck804 */
        {
                .sht            = &nv_sht,
-               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_HRST_TO_RESUME,
+               .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY,
+               .link_flags     = ATA_LFLAG_HRST_TO_RESUME,
                .pio_mask       = NV_PIO_MASK,
                .mwdma_mask     = NV_MWDMA_MASK,
                .udma_mask      = NV_UDMA_MASK,
@@ -489,8 +489,8 @@ static const struct ata_port_info nv_port_info[] = {
        {
                .sht            = &nv_adma_sht,
                .flags          = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_HRST_TO_RESUME |
                                  ATA_FLAG_MMIO | ATA_FLAG_NCQ,
+               .link_flags     = ATA_LFLAG_HRST_TO_RESUME,
                .pio_mask       = NV_PIO_MASK,
                .mwdma_mask     = NV_MWDMA_MASK,
                .udma_mask      = NV_UDMA_MASK,
index 5cd3eb83e4adea6558a8fe398b3876e88dbbe9da..802d679dc994654512f058f0b025586ad150bc58 100644 (file)
@@ -59,7 +59,8 @@ enum {
        SIL_FLAG_MOD15WRITE     = (1 << 30),
 
        SIL_DFL_PORT_FLAGS      = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
-                                 ATA_FLAG_MMIO | ATA_FLAG_HRST_TO_RESUME,
+                                 ATA_FLAG_MMIO,
+       SIL_DFL_LINK_FLAGS      = ATA_LFLAG_HRST_TO_RESUME,
 
        /*
         * Controller IDs
@@ -216,6 +217,7 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3112 */
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE,
+               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -225,6 +227,7 @@ static const struct ata_port_info sil_port_info[] = {
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_MOD15WRITE |
                                  SIL_FLAG_NO_SATA_IRQ,
+               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -233,6 +236,7 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3512 */
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
+               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
@@ -241,6 +245,7 @@ static const struct ata_port_info sil_port_info[] = {
        /* sil_3114 */
        {
                .flags          = SIL_DFL_PORT_FLAGS | SIL_FLAG_RERR_ON_DMA_ACT,
+               .link_flags     = SIL_DFL_LINK_FLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,
index 869e414d7ed322d820d6b24a6ae0dd5fc0febe9f..e2cccc7f4358488af43ebbc60e2496ae7ff2e291 100644 (file)
@@ -237,8 +237,8 @@ enum {
        /* host flags */
        SIL24_COMMON_FLAGS      = ATA_FLAG_SATA | ATA_FLAG_NO_LEGACY |
                                  ATA_FLAG_MMIO | ATA_FLAG_PIO_DMA |
-                                 ATA_FLAG_NCQ | ATA_FLAG_SKIP_D2H_BSY |
-                                 ATA_FLAG_ACPI_SATA,
+                                 ATA_FLAG_NCQ | ATA_FLAG_ACPI_SATA,
+       SIL24_COMMON_LFLAGS     = ATA_LFLAG_SKIP_D2H_BSY,
        SIL24_FLAG_PCIX_IRQ_WOC = (1 << 24), /* IRQ loss errata on PCI-X */
 
        IRQ_STAT_4PORTS         = 0xf,
@@ -424,6 +424,7 @@ static const struct ata_port_info sil24_port_info[] = {
        {
                .flags          = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(4) |
                                  SIL24_FLAG_PCIX_IRQ_WOC,
+               .link_flags     = SIL24_COMMON_LFLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,            /* udma0-5 */
@@ -432,6 +433,7 @@ static const struct ata_port_info sil24_port_info[] = {
        /* sil_3132 */
        {
                .flags          = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(2),
+               .link_flags     = SIL24_COMMON_LFLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,            /* udma0-5 */
@@ -440,6 +442,7 @@ static const struct ata_port_info sil24_port_info[] = {
        /* sil_3131/sil_3531 */
        {
                .flags          = SIL24_COMMON_FLAGS | SIL24_NPORTS2FLAG(1),
+               .link_flags     = SIL24_COMMON_LFLAGS,
                .pio_mask       = 0x1f,                 /* pio0-4 */
                .mwdma_mask     = 0x07,                 /* mwdma0-2 */
                .udma_mask      = ATA_UDMA5,            /* udma0-5 */
index 0f86d9be78ab6791027a578b08c6807453563724..74ced08d5989a74095ff12c1731407293f618a39 100644 (file)
@@ -156,6 +156,11 @@ enum {
        ATA_DEV_ATAPI_UNSUP     = 4,    /* ATAPI device (unsupported) */
        ATA_DEV_NONE            = 5,    /* no device */
 
+       /* struct ata_link flags */
+       ATA_LFLAG_HRST_TO_RESUME = (1 << 0), /* hardreset to resume link */
+       ATA_LFLAG_SKIP_D2H_BSY  = (1 << 1), /* can't wait for the first D2H
+                                            * Register FIS clearing BSY */
+
        /* struct ata_port flags */
        ATA_FLAG_SLAVE_POSS     = (1 << 0), /* host supports slave dev */
                                            /* (doesn't imply presence) */
@@ -170,9 +175,6 @@ enum {
        ATA_FLAG_PIO_POLLING    = (1 << 9), /* use polling PIO if LLD
                                             * doesn't handle PIO interrupts */
        ATA_FLAG_NCQ            = (1 << 10), /* host supports NCQ */
-       ATA_FLAG_HRST_TO_RESUME = (1 << 11), /* hardreset to resume phy */
-       ATA_FLAG_SKIP_D2H_BSY   = (1 << 12), /* can't wait for the first D2H
-                                             * Register FIS clearing BSY */
        ATA_FLAG_DEBUGMSG       = (1 << 13),
        ATA_FLAG_IGN_SIMPLEX    = (1 << 15), /* ignore SIMPLEX */
        ATA_FLAG_NO_IORDY       = (1 << 16), /* controller lacks iordy */
@@ -517,6 +519,8 @@ struct ata_link {
        unsigned int            active_tag;     /* active tag on this link */
        u32                     sactive;        /* active NCQ commands */
 
+       unsigned int            flags;          /* ATA_LFLAG_xxx */
+
        unsigned int            hw_sata_spd_limit;
        unsigned int            sata_spd_limit;
        unsigned int            sata_spd;       /* current SATA PHY speed */
@@ -654,6 +658,7 @@ struct ata_port_operations {
 struct ata_port_info {
        struct scsi_host_template       *sht;
        unsigned long           flags;
+       unsigned long           link_flags;
        unsigned long           pio_mask;
        unsigned long           mwdma_mask;
        unsigned long           udma_mask;