]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 16 Jan 2009 16:41:09 +0000 (08:41 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 16 Jan 2009 16:41:09 +0000 (08:41 -0800)
* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc:
  serial: Add 16850 uart type support to OF uart driver
  hvc_console: Remove tty->low_latency
  powerpc: Get the number of SLBs from "slb-size" property
  powerpc: is_hugepage_only_range() must account for both 4kB and 64kB slices
  powerpc/ps3: printing fixups for l64 to ll64 conversion drivers/video
  powerpc/ps3: Printing fixups for l64 to ll64 conversion drivers/scsi
  powerpc/ps3: Printing fixups for l64 to ll64 conversion drivers/ps3
  powerpc/ps3: Printing fixups for l64 to ll64 conversion sound/ppc
  powerpc/ps3: Printing fixups for l64 to ll64 conversion drivers/char
  powerpc/ps3: Printing fixups for l64 to ll64 conversion drivers/block
  powerpc/ps3: Printing fixups for l64 to ll64 conversion arch/powerpc
  powerpc/ps3: ps3_repository_read_mm_info() takes u64 * arguments
  powerpc/ps3: clear_bit()/set_bit() operate on unsigned longs
  powerpc/ps3: The lv1_ routines have u64 parameters
  powerpc/ps3: Use dma_addr_t down through the stack
  powerpc/ps3: set_dabr() takes an unsigned long
  powerpc: Cleanup from l64 to ll64 change drivers/scsi

47 files changed:
drivers/ata/Kconfig
drivers/ata/Makefile
drivers/ata/libata-core.c
drivers/ata/libata-scsi.c
drivers/ata/pata_ali.c
drivers/ata/pata_atiixp.c
drivers/ata/pata_octeon_cf.c [new file with mode: 0644]
drivers/ata/sata_fsl.c
drivers/ata/sata_via.c
drivers/gpu/drm/drm_crtc_helper.c
drivers/gpu/drm/drm_irq.c
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/i915_drv.h
drivers/gpu/drm/i915/i915_gem.c
drivers/gpu/drm/i915/i915_irq.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_lvds.c
drivers/message/fusion/lsi/mpi.h
drivers/message/fusion/lsi/mpi_cnfg.h
drivers/message/fusion/lsi/mpi_fc.h
drivers/message/fusion/lsi/mpi_history.txt
drivers/message/fusion/lsi/mpi_init.h
drivers/message/fusion/lsi/mpi_ioc.h
drivers/message/fusion/lsi/mpi_lan.h
drivers/message/fusion/lsi/mpi_log_fc.h
drivers/message/fusion/lsi/mpi_log_sas.h
drivers/message/fusion/lsi/mpi_raid.h
drivers/message/fusion/lsi/mpi_sas.h
drivers/message/fusion/lsi/mpi_targ.h
drivers/message/fusion/lsi/mpi_tool.h
drivers/message/fusion/lsi/mpi_type.h
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptbase.h
drivers/message/fusion/mptscsih.c
drivers/pci/pci.c
drivers/scsi/ipr.c
drivers/scsi/libiscsi_tcp.c
drivers/scsi/libsas/sas_scsi_host.c
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_mid.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/scsi.c
drivers/scsi/scsi_devinfo.c
include/drm/drm_crtc.h
include/drm/drm_crtc_helper.h
include/linux/libata.h
include/scsi/libiscsi_tcp.h

index 1a7be96d627b3224eaf5bf34ec8da4059ef61f6d..503a908afc80f131e70538de4e525745384fca7e 100644 (file)
@@ -698,6 +698,15 @@ config PATA_IXP4XX_CF
 
          If unsure, say N.
 
+config PATA_OCTEON_CF
+       tristate "OCTEON Boot Bus Compact Flash support"
+       depends on CPU_CAVIUM_OCTEON
+       help
+         This option enables a polled compact flash driver for use with
+         compact flash cards attached to the OCTEON boot bus.
+
+         If unsure, say N.
+
 config PATA_SCC
        tristate "Toshiba's Cell Reference Set IDE support"
        depends on PCI && PPC_CELLEB
index 674965fa326dafa621311ed92dfcc91d80380296..7f1ecf99528cfa21bf2a5f8229b9d6ac57bf38c5 100644 (file)
@@ -69,6 +69,7 @@ obj-$(CONFIG_PATA_IXP4XX_CF)  += pata_ixp4xx_cf.o
 obj-$(CONFIG_PATA_SCC)         += pata_scc.o
 obj-$(CONFIG_PATA_SCH)         += pata_sch.o
 obj-$(CONFIG_PATA_BF54X)       += pata_bf54x.o
+obj-$(CONFIG_PATA_OCTEON_CF)   += pata_octeon_cf.o
 obj-$(CONFIG_PATA_PLATFORM)    += pata_platform.o
 obj-$(CONFIG_PATA_OF_PLATFORM) += pata_of_platform.o
 obj-$(CONFIG_PATA_ICSIDE)      += pata_icside.o
index 71218d76d75e482df1a3f43237b936467fb04675..88c242856dae999861f6864e9d70e064035a82b0 100644 (file)
@@ -3029,33 +3029,33 @@ int sata_set_spd(struct ata_link *link)
  */
 
 static const struct ata_timing ata_timing[] = {
-/*     { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 960,   0 }, */
-       { XFER_PIO_0,     70, 290, 240, 600, 165, 150, 600,   0 },
-       { XFER_PIO_1,     50, 290,  93, 383, 125, 100, 383,   0 },
-       { XFER_PIO_2,     30, 290,  40, 330, 100,  90, 240,   0 },
-       { XFER_PIO_3,     30,  80,  70, 180,  80,  70, 180,   0 },
-       { XFER_PIO_4,     25,  70,  25, 120,  70,  25, 120,   0 },
-       { XFER_PIO_5,     15,  65,  25, 100,  65,  25, 100,   0 },
-       { XFER_PIO_6,     10,  55,  20,  80,  55,  20,  80,   0 },
-
-       { XFER_SW_DMA_0, 120,   0,   0,   0, 480, 480, 960,   0 },
-       { XFER_SW_DMA_1,  90,   0,   0,   0, 240, 240, 480,   0 },
-       { XFER_SW_DMA_2,  60,   0,   0,   0, 120, 120, 240,   0 },
-
-       { XFER_MW_DMA_0,  60,   0,   0,   0, 215, 215, 480,   0 },
-       { XFER_MW_DMA_1,  45,   0,   0,   0,  80,  50, 150,   0 },
-       { XFER_MW_DMA_2,  25,   0,   0,   0,  70,  25, 120,   0 },
-       { XFER_MW_DMA_3,  25,   0,   0,   0,  65,  25, 100,   0 },
-       { XFER_MW_DMA_4,  25,   0,   0,   0,  55,  20,  80,   0 },
-
-/*     { XFER_UDMA_SLOW,  0,   0,   0,   0,   0,   0,   0, 150 }, */
-       { XFER_UDMA_0,     0,   0,   0,   0,   0,   0,   0, 120 },
-       { XFER_UDMA_1,     0,   0,   0,   0,   0,   0,   0,  80 },
-       { XFER_UDMA_2,     0,   0,   0,   0,   0,   0,   0,  60 },
-       { XFER_UDMA_3,     0,   0,   0,   0,   0,   0,   0,  45 },
-       { XFER_UDMA_4,     0,   0,   0,   0,   0,   0,   0,  30 },
-       { XFER_UDMA_5,     0,   0,   0,   0,   0,   0,   0,  20 },
-       { XFER_UDMA_6,     0,   0,   0,   0,   0,   0,   0,  15 },
+/*     { XFER_PIO_SLOW, 120, 290, 240, 960, 290, 240, 0,  960,   0 }, */
+       { XFER_PIO_0,     70, 290, 240, 600, 165, 150, 0,  600,   0 },
+       { XFER_PIO_1,     50, 290,  93, 383, 125, 100, 0,  383,   0 },
+       { XFER_PIO_2,     30, 290,  40, 330, 100,  90, 0,  240,   0 },
+       { XFER_PIO_3,     30,  80,  70, 180,  80,  70, 0,  180,   0 },
+       { XFER_PIO_4,     25,  70,  25, 120,  70,  25, 0,  120,   0 },
+       { XFER_PIO_5,     15,  65,  25, 100,  65,  25, 0,  100,   0 },
+       { XFER_PIO_6,     10,  55,  20,  80,  55,  20, 0,   80,   0 },
+
+       { XFER_SW_DMA_0, 120,   0,   0,   0, 480, 480, 50, 960,   0 },
+       { XFER_SW_DMA_1,  90,   0,   0,   0, 240, 240, 30, 480,   0 },
+       { XFER_SW_DMA_2,  60,   0,   0,   0, 120, 120, 20, 240,   0 },
+
+       { XFER_MW_DMA_0,  60,   0,   0,   0, 215, 215, 20, 480,   0 },
+       { XFER_MW_DMA_1,  45,   0,   0,   0,  80,  50, 5,  150,   0 },
+       { XFER_MW_DMA_2,  25,   0,   0,   0,  70,  25, 5,  120,   0 },
+       { XFER_MW_DMA_3,  25,   0,   0,   0,  65,  25, 5,  100,   0 },
+       { XFER_MW_DMA_4,  25,   0,   0,   0,  55,  20, 5,   80,   0 },
+
+/*     { XFER_UDMA_SLOW,  0,   0,   0,   0,   0,   0, 0,    0, 150 }, */
+       { XFER_UDMA_0,     0,   0,   0,   0,   0,   0, 0,    0, 120 },
+       { XFER_UDMA_1,     0,   0,   0,   0,   0,   0, 0,    0,  80 },
+       { XFER_UDMA_2,     0,   0,   0,   0,   0,   0, 0,    0,  60 },
+       { XFER_UDMA_3,     0,   0,   0,   0,   0,   0, 0,    0,  45 },
+       { XFER_UDMA_4,     0,   0,   0,   0,   0,   0, 0,    0,  30 },
+       { XFER_UDMA_5,     0,   0,   0,   0,   0,   0, 0,    0,  20 },
+       { XFER_UDMA_6,     0,   0,   0,   0,   0,   0, 0,    0,  15 },
 
        { 0xFF }
 };
@@ -3065,14 +3065,15 @@ static const struct ata_timing ata_timing[] = {
 
 static void ata_timing_quantize(const struct ata_timing *t, struct ata_timing *q, int T, int UT)
 {
-       q->setup   = EZ(t->setup   * 1000,  T);
-       q->act8b   = EZ(t->act8b   * 1000,  T);
-       q->rec8b   = EZ(t->rec8b   * 1000,  T);
-       q->cyc8b   = EZ(t->cyc8b   * 1000,  T);
-       q->active  = EZ(t->active  * 1000,  T);
-       q->recover = EZ(t->recover * 1000,  T);
-       q->cycle   = EZ(t->cycle   * 1000,  T);
-       q->udma    = EZ(t->udma    * 1000, UT);
+       q->setup        = EZ(t->setup      * 1000,  T);
+       q->act8b        = EZ(t->act8b      * 1000,  T);
+       q->rec8b        = EZ(t->rec8b      * 1000,  T);
+       q->cyc8b        = EZ(t->cyc8b      * 1000,  T);
+       q->active       = EZ(t->active     * 1000,  T);
+       q->recover      = EZ(t->recover    * 1000,  T);
+       q->dmack_hold   = EZ(t->dmack_hold * 1000,  T);
+       q->cycle        = EZ(t->cycle      * 1000,  T);
+       q->udma         = EZ(t->udma       * 1000, UT);
 }
 
 void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
@@ -3084,6 +3085,7 @@ void ata_timing_merge(const struct ata_timing *a, const struct ata_timing *b,
        if (what & ATA_TIMING_CYC8B  ) m->cyc8b   = max(a->cyc8b,   b->cyc8b);
        if (what & ATA_TIMING_ACTIVE ) m->active  = max(a->active,  b->active);
        if (what & ATA_TIMING_RECOVER) m->recover = max(a->recover, b->recover);
+       if (what & ATA_TIMING_DMACK_HOLD) m->dmack_hold = max(a->dmack_hold, b->dmack_hold);
        if (what & ATA_TIMING_CYCLE  ) m->cycle   = max(a->cycle,   b->cycle);
        if (what & ATA_TIMING_UDMA   ) m->udma    = max(a->udma,    b->udma);
 }
@@ -6638,7 +6640,6 @@ EXPORT_SYMBOL_GPL(ata_dev_pair);
 EXPORT_SYMBOL_GPL(ata_port_disable);
 EXPORT_SYMBOL_GPL(ata_ratelimit);
 EXPORT_SYMBOL_GPL(ata_wait_register);
-EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
 EXPORT_SYMBOL_GPL(ata_scsi_queuecmd);
 EXPORT_SYMBOL_GPL(ata_scsi_slave_config);
 EXPORT_SYMBOL_GPL(ata_scsi_slave_destroy);
index 9e92107691f2ff0f606e5272347d7a98afe2516b..a1a6e6298c33a4dc622a9c03aba181f70477a4e8 100644 (file)
@@ -423,9 +423,9 @@ int ata_std_bios_param(struct scsi_device *sdev, struct block_device *bdev,
  *     RETURNS:
  *     Zero on success, negative errno on error.
  */
-static int ata_get_identity(struct scsi_device *sdev, void __user *arg)
+static int ata_get_identity(struct ata_port *ap, struct scsi_device *sdev,
+                           void __user *arg)
 {
-       struct ata_port *ap = ata_shost_to_port(sdev->host);
        struct ata_device *dev = ata_scsi_find_dev(ap, sdev);
        u16 __user *dst = arg;
        char buf[40];
@@ -645,7 +645,8 @@ int ata_task_ioctl(struct scsi_device *scsidev, void __user *arg)
        return rc;
 }
 
-int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
+int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *scsidev,
+                    int cmd, void __user *arg)
 {
        int val = -EINVAL, rc = -EINVAL;
 
@@ -663,7 +664,7 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
                return 0;
 
        case HDIO_GET_IDENTITY:
-               return ata_get_identity(scsidev, arg);
+               return ata_get_identity(ap, scsidev, arg);
 
        case HDIO_DRIVE_CMD:
                if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
@@ -682,6 +683,14 @@ int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
 
        return rc;
 }
+EXPORT_SYMBOL_GPL(ata_sas_scsi_ioctl);
+
+int ata_scsi_ioctl(struct scsi_device *scsidev, int cmd, void __user *arg)
+{
+       return ata_sas_scsi_ioctl(ata_shost_to_port(scsidev->host),
+                               scsidev, cmd, arg);
+}
+EXPORT_SYMBOL_GPL(ata_scsi_ioctl);
 
 /**
  *     ata_scsi_qc_new - acquire new ata_queued_cmd reference
index a7999c19f0c92bc4185a4ae532ec5395c3eb3253..eb99dbe78081087a79f8e3d578b494b29f9dfa76 100644 (file)
@@ -41,7 +41,7 @@ static int ali_atapi_dma = 0;
 module_param_named(atapi_dma, ali_atapi_dma, int, 0644);
 MODULE_PARM_DESC(atapi_dma, "Enable ATAPI DMA (0=disable, 1=enable)");
 
-static struct pci_dev *isa_bridge;
+static struct pci_dev *ali_isa_bridge;
 
 /*
  *     Cable special cases
@@ -346,13 +346,13 @@ static void ali_c2_c3_postreset(struct ata_link *link, unsigned int *classes)
        int port_bit = 4 << link->ap->port_no;
 
        /* If our bridge is an ALI 1533 then do the extra work */
-       if (isa_bridge) {
+       if (ali_isa_bridge) {
                /* Tristate and re-enable the bus signals */
-               pci_read_config_byte(isa_bridge, 0x58, &r);
+               pci_read_config_byte(ali_isa_bridge, 0x58, &r);
                r &= ~port_bit;
-               pci_write_config_byte(isa_bridge, 0x58, r);
+               pci_write_config_byte(ali_isa_bridge, 0x58, r);
                r |= port_bit;
-               pci_write_config_byte(isa_bridge, 0x58, r);
+               pci_write_config_byte(ali_isa_bridge, 0x58, r);
        }
        ata_sff_postreset(link, classes);
 }
@@ -467,14 +467,14 @@ static void ali_init_chipset(struct pci_dev *pdev)
                pci_write_config_byte(pdev, 0x53, tmp);
        }
        north = pci_get_bus_and_slot(0, PCI_DEVFN(0,0));
-       if (north && north->vendor == PCI_VENDOR_ID_AL && isa_bridge) {
+       if (north && north->vendor == PCI_VENDOR_ID_AL && ali_isa_bridge) {
                /* Configure the ALi bridge logic. For non ALi rely on BIOS.
                   Set the south bridge enable bit */
-               pci_read_config_byte(isa_bridge, 0x79, &tmp);
+               pci_read_config_byte(ali_isa_bridge, 0x79, &tmp);
                if (pdev->revision == 0xC2)
-                       pci_write_config_byte(isa_bridge, 0x79, tmp | 0x04);
+                       pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x04);
                else if (pdev->revision > 0xC2 && pdev->revision < 0xC5)
-                       pci_write_config_byte(isa_bridge, 0x79, tmp | 0x02);
+                       pci_write_config_byte(ali_isa_bridge, 0x79, tmp | 0x02);
        }
        pci_dev_put(north);
        ata_pci_bmdma_clear_simplex(pdev);
@@ -571,9 +571,9 @@ static int ali_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
        ali_init_chipset(pdev);
 
-       if (isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
+       if (ali_isa_bridge && pdev->revision >= 0x20 && pdev->revision < 0xC2) {
                /* Are we paired with a UDMA capable chip */
-               pci_read_config_byte(isa_bridge, 0x5E, &tmp);
+               pci_read_config_byte(ali_isa_bridge, 0x5E, &tmp);
                if ((tmp & 0x1E) == 0x12)
                        ppi[0] = &info_20_udma;
        }
@@ -617,11 +617,11 @@ static struct pci_driver ali_pci_driver = {
 static int __init ali_init(void)
 {
        int ret;
-       isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
+       ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533, NULL);
 
        ret = pci_register_driver(&ali_pci_driver);
        if (ret < 0)
-               pci_dev_put(isa_bridge);
+               pci_dev_put(ali_isa_bridge);
        return ret;
 }
 
@@ -629,7 +629,7 @@ static int __init ali_init(void)
 static void __exit ali_exit(void)
 {
        pci_unregister_driver(&ali_pci_driver);
-       pci_dev_put(isa_bridge);
+       pci_dev_put(ali_isa_bridge);
 }
 
 
index 0e2cde8f9973af6d3088a5f5bef439c7d7dfec57..506adde8ebb379397f03f4d1c8467be85417fc51 100644 (file)
@@ -32,21 +32,6 @@ enum {
        ATIIXP_IDE_UDMA_MODE    = 0x56
 };
 
-static int atiixp_pre_reset(struct ata_link *link, unsigned long deadline)
-{
-       struct ata_port *ap = link->ap;
-       static const struct pci_bits atiixp_enable_bits[] = {
-               { 0x48, 1, 0x01, 0x00 },
-               { 0x48, 1, 0x08, 0x00 }
-       };
-       struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-
-       if (!pci_test_config_bits(pdev, &atiixp_enable_bits[ap->port_no]))
-               return -ENOENT;
-
-       return ata_sff_prereset(link, deadline);
-}
-
 static int atiixp_cable_detect(struct ata_port *ap)
 {
        struct pci_dev *pdev = to_pci_dev(ap->host->dev);
@@ -229,10 +214,9 @@ static struct ata_port_operations atiixp_port_ops = {
        .cable_detect   = atiixp_cable_detect,
        .set_piomode    = atiixp_set_piomode,
        .set_dmamode    = atiixp_set_dmamode,
-       .prereset       = atiixp_pre_reset,
 };
 
-static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
+static int atiixp_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
 {
        static const struct ata_port_info info = {
                .flags = ATA_FLAG_SLAVE_POSS,
@@ -241,8 +225,18 @@ static int atiixp_init_one(struct pci_dev *dev, const struct pci_device_id *id)
                .udma_mask = 0x3F,
                .port_ops = &atiixp_port_ops
        };
-       const struct ata_port_info *ppi[] = { &info, NULL };
-       return ata_pci_sff_init_one(dev, ppi, &atiixp_sht, NULL);
+       static const struct pci_bits atiixp_enable_bits[] = {
+               { 0x48, 1, 0x01, 0x00 },
+               { 0x48, 1, 0x08, 0x00 }
+       };
+       const struct ata_port_info *ppi[] = { &info, &info };
+       int i;
+
+       for (i = 0; i < 2; i++)
+               if (!pci_test_config_bits(pdev, &atiixp_enable_bits[i]))
+                       ppi[i] = &ata_dummy_port_info;
+
+       return ata_pci_sff_init_one(pdev, ppi, &atiixp_sht, NULL);
 }
 
 static const struct pci_device_id atiixp[] = {
diff --git a/drivers/ata/pata_octeon_cf.c b/drivers/ata/pata_octeon_cf.c
new file mode 100644 (file)
index 0000000..0fe4ef3
--- /dev/null
@@ -0,0 +1,965 @@
+/*
+ * Driver for the Octeon bootbus compact flash.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ *
+ * Copyright (C) 2005 - 2009 Cavium Networks
+ * Copyright (C) 2008 Wind River Systems
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/libata.h>
+#include <linux/irq.h>
+#include <linux/platform_device.h>
+#include <linux/workqueue.h>
+#include <scsi/scsi_host.h>
+
+#include <asm/octeon/octeon.h>
+
+/*
+ * The Octeon bootbus compact flash interface is connected in at least
+ * 3 different configurations on various evaluation boards:
+ *
+ * -- 8  bits no irq, no DMA
+ * -- 16 bits no irq, no DMA
+ * -- 16 bits True IDE mode with DMA, but no irq.
+ *
+ * In the last case the DMA engine can generate an interrupt when the
+ * transfer is complete.  For the first two cases only PIO is supported.
+ *
+ */
+
+#define DRV_NAME       "pata_octeon_cf"
+#define DRV_VERSION    "2.1"
+
+
+struct octeon_cf_port {
+       struct workqueue_struct *wq;
+       struct delayed_work delayed_finish;
+       struct ata_port *ap;
+       int dma_finished;
+};
+
+static struct scsi_host_template octeon_cf_sht = {
+       ATA_PIO_SHT(DRV_NAME),
+};
+
+/**
+ * Convert nanosecond based time to setting used in the
+ * boot bus timing register, based on timing multiple
+ */
+static unsigned int ns_to_tim_reg(unsigned int tim_mult, unsigned int nsecs)
+{
+       unsigned int val;
+
+       /*
+        * Compute # of eclock periods to get desired duration in
+        * nanoseconds.
+        */
+       val = DIV_ROUND_UP(nsecs * (octeon_get_clock_rate() / 1000000),
+                         1000 * tim_mult);
+
+       return val;
+}
+
+static void octeon_cf_set_boot_reg_cfg(int cs)
+{
+       union cvmx_mio_boot_reg_cfgx reg_cfg;
+       reg_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_CFGX(cs));
+       reg_cfg.s.dmack = 0;    /* Don't assert DMACK on access */
+       reg_cfg.s.tim_mult = 2; /* Timing mutiplier 2x */
+       reg_cfg.s.rd_dly = 0;   /* Sample on falling edge of BOOT_OE */
+       reg_cfg.s.sam = 0;      /* Don't combine write and output enable */
+       reg_cfg.s.we_ext = 0;   /* No write enable extension */
+       reg_cfg.s.oe_ext = 0;   /* No read enable extension */
+       reg_cfg.s.en = 1;       /* Enable this region */
+       reg_cfg.s.orbit = 0;    /* Don't combine with previous region */
+       reg_cfg.s.ale = 0;      /* Don't do address multiplexing */
+       cvmx_write_csr(CVMX_MIO_BOOT_REG_CFGX(cs), reg_cfg.u64);
+}
+
+/**
+ * Called after libata determines the needed PIO mode. This
+ * function programs the Octeon bootbus regions to support the
+ * timing requirements of the PIO mode.
+ *
+ * @ap:     ATA port information
+ * @dev:    ATA device
+ */
+static void octeon_cf_set_piomode(struct ata_port *ap, struct ata_device *dev)
+{
+       struct octeon_cf_data *ocd = ap->dev->platform_data;
+       union cvmx_mio_boot_reg_timx reg_tim;
+       int cs = ocd->base_region;
+       int T;
+       struct ata_timing timing;
+
+       int use_iordy;
+       int trh;
+       int pause;
+       /* These names are timing parameters from the ATA spec */
+       int t1;
+       int t2;
+       int t2i;
+
+       T = (int)(2000000000000LL / octeon_get_clock_rate());
+
+       if (ata_timing_compute(dev, dev->pio_mode, &timing, T, T))
+               BUG();
+
+       t1 = timing.setup;
+       if (t1)
+               t1--;
+       t2 = timing.active;
+       if (t2)
+               t2--;
+       t2i = timing.act8b;
+       if (t2i)
+               t2i--;
+
+       trh = ns_to_tim_reg(2, 20);
+       if (trh)
+               trh--;
+
+       pause = timing.cycle - timing.active - timing.setup - trh;
+       if (pause)
+               pause--;
+
+       octeon_cf_set_boot_reg_cfg(cs);
+       if (ocd->dma_engine >= 0)
+               /* True IDE mode, program both chip selects.  */
+               octeon_cf_set_boot_reg_cfg(cs + 1);
+
+
+       use_iordy = ata_pio_need_iordy(dev);
+
+       reg_tim.u64 = cvmx_read_csr(CVMX_MIO_BOOT_REG_TIMX(cs));
+       /* Disable page mode */
+       reg_tim.s.pagem = 0;
+       /* Enable dynamic timing */
+       reg_tim.s.waitm = use_iordy;
+       /* Pages are disabled */
+       reg_tim.s.pages = 0;
+       /* We don't use multiplexed address mode */
+       reg_tim.s.ale = 0;
+       /* Not used */
+       reg_tim.s.page = 0;
+       /* Time after IORDY to coninue to assert the data */
+       reg_tim.s.wait = 0;
+       /* Time to wait to complete the cycle. */
+       reg_tim.s.pause = pause;
+       /* How long to hold after a write to de-assert CE. */
+       reg_tim.s.wr_hld = trh;
+       /* How long to wait after a read to de-assert CE. */
+       reg_tim.s.rd_hld = trh;
+       /* How long write enable is asserted */
+       reg_tim.s.we = t2;
+       /* How long read enable is asserted */
+       reg_tim.s.oe = t2;
+       /* Time after CE that read/write starts */
+       reg_tim.s.ce = ns_to_tim_reg(2, 5);
+       /* Time before CE that address is valid */
+       reg_tim.s.adr = 0;
+
+       /* Program the bootbus region timing for the data port chip select. */
+       cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs), reg_tim.u64);
+       if (ocd->dma_engine >= 0)
+               /* True IDE mode, program both chip selects.  */
+               cvmx_write_csr(CVMX_MIO_BOOT_REG_TIMX(cs + 1), reg_tim.u64);
+}
+
+static void octeon_cf_set_dmamode(struct ata_port *ap, struct ata_device *dev)
+{
+       struct octeon_cf_data *ocd = dev->link->ap->dev->platform_data;
+       union cvmx_mio_boot_dma_timx dma_tim;
+       unsigned int oe_a;
+       unsigned int oe_n;
+       unsigned int dma_ackh;
+       unsigned int dma_arq;
+       unsigned int pause;
+       unsigned int T0, Tkr, Td;
+       unsigned int tim_mult;
+
+       const struct ata_timing *timing;
+
+       timing = ata_timing_find_mode(dev->dma_mode);
+       T0      = timing->cycle;
+       Td      = timing->active;
+       Tkr     = timing->recover;
+       dma_ackh = timing->dmack_hold;
+
+       dma_tim.u64 = 0;
+       /* dma_tim.s.tim_mult = 0 --> 4x */
+       tim_mult = 4;
+
+       /* not spec'ed, value in eclocks, not affected by tim_mult */
+       dma_arq = 8;
+       pause = 25 - dma_arq * 1000 /
+               (octeon_get_clock_rate() / 1000000); /* Tz */
+
+       oe_a = Td;
+       /* Tkr from cf spec, lengthened to meet T0 */
+       oe_n = max(T0 - oe_a, Tkr);
+
+       dma_tim.s.dmack_pi = 1;
+
+       dma_tim.s.oe_n = ns_to_tim_reg(tim_mult, oe_n);
+       dma_tim.s.oe_a = ns_to_tim_reg(tim_mult, oe_a);
+
+       /*
+        * This is tI, C.F. spec. says 0, but Sony CF card requires
+        * more, we use 20 nS.
+        */
+       dma_tim.s.dmack_s = ns_to_tim_reg(tim_mult, 20);;
+       dma_tim.s.dmack_h = ns_to_tim_reg(tim_mult, dma_ackh);
+
+       dma_tim.s.dmarq = dma_arq;
+       dma_tim.s.pause = ns_to_tim_reg(tim_mult, pause);
+
+       dma_tim.s.rd_dly = 0;   /* Sample right on edge */
+
+       /*  writes only */
+       dma_tim.s.we_n = ns_to_tim_reg(tim_mult, oe_n);
+       dma_tim.s.we_a = ns_to_tim_reg(tim_mult, oe_a);
+
+       pr_debug("ns to ticks (mult %d) of %d is: %d\n", tim_mult, 60,
+                ns_to_tim_reg(tim_mult, 60));
+       pr_debug("oe_n: %d, oe_a: %d, dmack_s: %d, dmack_h: "
+                "%d, dmarq: %d, pause: %d\n",
+                dma_tim.s.oe_n, dma_tim.s.oe_a, dma_tim.s.dmack_s,
+                dma_tim.s.dmack_h, dma_tim.s.dmarq, dma_tim.s.pause);
+
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_TIMX(ocd->dma_engine),
+                      dma_tim.u64);
+
+}
+
+/**
+ * Handle an 8 bit I/O request.
+ *
+ * @dev:        Device to access
+ * @buffer:     Data buffer
+ * @buflen:     Length of the buffer.
+ * @rw:         True to write.
+ */
+static unsigned int octeon_cf_data_xfer8(struct ata_device *dev,
+                                        unsigned char *buffer,
+                                        unsigned int buflen,
+                                        int rw)
+{
+       struct ata_port *ap             = dev->link->ap;
+       void __iomem *data_addr         = ap->ioaddr.data_addr;
+       unsigned long words;
+       int count;
+
+       words = buflen;
+       if (rw) {
+               count = 16;
+               while (words--) {
+                       iowrite8(*buffer, data_addr);
+                       buffer++;
+                       /*
+                        * Every 16 writes do a read so the bootbus
+                        * FIFO doesn't fill up.
+                        */
+                       if (--count == 0) {
+                               ioread8(ap->ioaddr.altstatus_addr);
+                               count = 16;
+                       }
+               }
+       } else {
+               ioread8_rep(data_addr, buffer, words);
+       }
+       return buflen;
+}
+
+/**
+ * Handle a 16 bit I/O request.
+ *
+ * @dev:        Device to access
+ * @buffer:     Data buffer
+ * @buflen:     Length of the buffer.
+ * @rw:         True to write.
+ */
+static unsigned int octeon_cf_data_xfer16(struct ata_device *dev,
+                                         unsigned char *buffer,
+                                         unsigned int buflen,
+                                         int rw)
+{
+       struct ata_port *ap             = dev->link->ap;
+       void __iomem *data_addr         = ap->ioaddr.data_addr;
+       unsigned long words;
+       int count;
+
+       words = buflen / 2;
+       if (rw) {
+               count = 16;
+               while (words--) {
+                       iowrite16(*(uint16_t *)buffer, data_addr);
+                       buffer += sizeof(uint16_t);
+                       /*
+                        * Every 16 writes do a read so the bootbus
+                        * FIFO doesn't fill up.
+                        */
+                       if (--count == 0) {
+                               ioread8(ap->ioaddr.altstatus_addr);
+                               count = 16;
+                       }
+               }
+       } else {
+               while (words--) {
+                       *(uint16_t *)buffer = ioread16(data_addr);
+                       buffer += sizeof(uint16_t);
+               }
+       }
+       /* Transfer trailing 1 byte, if any. */
+       if (unlikely(buflen & 0x01)) {
+               __le16 align_buf[1] = { 0 };
+
+               if (rw == READ) {
+                       align_buf[0] = cpu_to_le16(ioread16(data_addr));
+                       memcpy(buffer, align_buf, 1);
+               } else {
+                       memcpy(align_buf, buffer, 1);
+                       iowrite16(le16_to_cpu(align_buf[0]), data_addr);
+               }
+               words++;
+       }
+       return buflen;
+}
+
+/**
+ * Read the taskfile for 16bit non-True IDE only.
+ */
+static void octeon_cf_tf_read16(struct ata_port *ap, struct ata_taskfile *tf)
+{
+       u16 blob;
+       /* The base of the registers is at ioaddr.data_addr. */
+       void __iomem *base = ap->ioaddr.data_addr;
+
+       blob = __raw_readw(base + 0xc);
+       tf->feature = blob >> 8;
+
+       blob = __raw_readw(base + 2);
+       tf->nsect = blob & 0xff;
+       tf->lbal = blob >> 8;
+
+       blob = __raw_readw(base + 4);
+       tf->lbam = blob & 0xff;
+       tf->lbah = blob >> 8;
+
+       blob = __raw_readw(base + 6);
+       tf->device = blob & 0xff;
+       tf->command = blob >> 8;
+
+       if (tf->flags & ATA_TFLAG_LBA48) {
+               if (likely(ap->ioaddr.ctl_addr)) {
+                       iowrite8(tf->ctl | ATA_HOB, ap->ioaddr.ctl_addr);
+
+                       blob = __raw_readw(base + 0xc);
+                       tf->hob_feature = blob >> 8;
+
+                       blob = __raw_readw(base + 2);
+                       tf->hob_nsect = blob & 0xff;
+                       tf->hob_lbal = blob >> 8;
+
+                       blob = __raw_readw(base + 4);
+                       tf->hob_lbam = blob & 0xff;
+                       tf->hob_lbah = blob >> 8;
+
+                       iowrite8(tf->ctl, ap->ioaddr.ctl_addr);
+                       ap->last_ctl = tf->ctl;
+               } else {
+                       WARN_ON(1);
+               }
+       }
+}
+
+static u8 octeon_cf_check_status16(struct ata_port *ap)
+{
+       u16 blob;
+       void __iomem *base = ap->ioaddr.data_addr;
+
+       blob = __raw_readw(base + 6);
+       return blob >> 8;
+}
+
+static int octeon_cf_softreset16(struct ata_link *link, unsigned int *classes,
+                                unsigned long deadline)
+{
+       struct ata_port *ap = link->ap;
+       void __iomem *base = ap->ioaddr.data_addr;
+       int rc;
+       u8 err;
+
+       DPRINTK("about to softreset\n");
+       __raw_writew(ap->ctl, base + 0xe);
+       udelay(20);
+       __raw_writew(ap->ctl | ATA_SRST, base + 0xe);
+       udelay(20);
+       __raw_writew(ap->ctl, base + 0xe);
+
+       rc = ata_sff_wait_after_reset(link, 1, deadline);
+       if (rc) {
+               ata_link_printk(link, KERN_ERR, "SRST failed (errno=%d)\n", rc);
+               return rc;
+       }
+
+       /* determine by signature whether we have ATA or ATAPI devices */
+       classes[0] = ata_sff_dev_classify(&link->device[0], 1, &err);
+       DPRINTK("EXIT, classes[0]=%u [1]=%u\n", classes[0], classes[1]);
+       return 0;
+}
+
+/**
+ * Load the taskfile for 16bit non-True IDE only.  The device_addr is
+ * not loaded, we do this as part of octeon_cf_exec_command16.
+ */
+static void octeon_cf_tf_load16(struct ata_port *ap,
+                               const struct ata_taskfile *tf)
+{
+       unsigned int is_addr = tf->flags & ATA_TFLAG_ISADDR;
+       /* The base of the registers is at ioaddr.data_addr. */
+       void __iomem *base = ap->ioaddr.data_addr;
+
+       if (tf->ctl != ap->last_ctl) {
+               iowrite8(tf->ctl, ap->ioaddr.ctl_addr);
+               ap->last_ctl = tf->ctl;
+               ata_wait_idle(ap);
+       }
+       if (is_addr && (tf->flags & ATA_TFLAG_LBA48)) {
+               __raw_writew(tf->hob_feature << 8, base + 0xc);
+               __raw_writew(tf->hob_nsect | tf->hob_lbal << 8, base + 2);
+               __raw_writew(tf->hob_lbam | tf->hob_lbah << 8, base + 4);
+               VPRINTK("hob: feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
+                       tf->hob_feature,
+                       tf->hob_nsect,
+                       tf->hob_lbal,
+                       tf->hob_lbam,
+                       tf->hob_lbah);
+       }
+       if (is_addr) {
+               __raw_writew(tf->feature << 8, base + 0xc);
+               __raw_writew(tf->nsect | tf->lbal << 8, base + 2);
+               __raw_writew(tf->lbam | tf->lbah << 8, base + 4);
+               VPRINTK("feat 0x%X nsect 0x%X, lba 0x%X 0x%X 0x%X\n",
+                       tf->feature,
+                       tf->nsect,
+                       tf->lbal,
+                       tf->lbam,
+                       tf->lbah);
+       }
+       ata_wait_idle(ap);
+}
+
+
+static void octeon_cf_dev_select(struct ata_port *ap, unsigned int device)
+{
+/*  There is only one device, do nothing. */
+       return;
+}
+
+/*
+ * Issue ATA command to host controller.  The device_addr is also sent
+ * as it must be written in a combined write with the command.
+ */
+static void octeon_cf_exec_command16(struct ata_port *ap,
+                               const struct ata_taskfile *tf)
+{
+       /* The base of the registers is at ioaddr.data_addr. */
+       void __iomem *base = ap->ioaddr.data_addr;
+       u16 blob;
+
+       if (tf->flags & ATA_TFLAG_DEVICE) {
+               VPRINTK("device 0x%X\n", tf->device);
+               blob = tf->device;
+       } else {
+               blob = 0;
+       }
+
+       DPRINTK("ata%u: cmd 0x%X\n", ap->print_id, tf->command);
+       blob |= (tf->command << 8);
+       __raw_writew(blob, base + 6);
+
+
+       ata_wait_idle(ap);
+}
+
+static u8 octeon_cf_irq_on(struct ata_port *ap)
+{
+       return 0;
+}
+
+static void octeon_cf_irq_clear(struct ata_port *ap)
+{
+       return;
+}
+
+static void octeon_cf_dma_setup(struct ata_queued_cmd *qc)
+{
+       struct ata_port *ap = qc->ap;
+       struct octeon_cf_port *cf_port;
+
+       cf_port = (struct octeon_cf_port *)ap->private_data;
+       DPRINTK("ENTER\n");
+       /* issue r/w command */
+       qc->cursg = qc->sg;
+       cf_port->dma_finished = 0;
+       ap->ops->sff_exec_command(ap, &qc->tf);
+       DPRINTK("EXIT\n");
+}
+
+/**
+ * Start a DMA transfer that was already setup
+ *
+ * @qc:     Information about the DMA
+ */
+static void octeon_cf_dma_start(struct ata_queued_cmd *qc)
+{
+       struct octeon_cf_data *ocd = qc->ap->dev->platform_data;
+       union cvmx_mio_boot_dma_cfgx mio_boot_dma_cfg;
+       union cvmx_mio_boot_dma_intx mio_boot_dma_int;
+       struct scatterlist *sg;
+
+       VPRINTK("%d scatterlists\n", qc->n_elem);
+
+       /* Get the scatter list entry we need to DMA into */
+       sg = qc->cursg;
+       BUG_ON(!sg);
+
+       /*
+        * Clear the DMA complete status.
+        */
+       mio_boot_dma_int.u64 = 0;
+       mio_boot_dma_int.s.done = 1;
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine),
+                      mio_boot_dma_int.u64);
+
+       /* Enable the interrupt.  */
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine),
+                      mio_boot_dma_int.u64);
+
+       /* Set the direction of the DMA */
+       mio_boot_dma_cfg.u64 = 0;
+       mio_boot_dma_cfg.s.en = 1;
+       mio_boot_dma_cfg.s.rw = ((qc->tf.flags & ATA_TFLAG_WRITE) != 0);
+
+       /*
+        * Don't stop the DMA if the device deasserts DMARQ. Many
+        * compact flashes deassert DMARQ for a short time between
+        * sectors. Instead of stopping and restarting the DMA, we'll
+        * let the hardware do it. If the DMA is really stopped early
+        * due to an error condition, a later timeout will force us to
+        * stop.
+        */
+       mio_boot_dma_cfg.s.clr = 0;
+
+       /* Size is specified in 16bit words and minus one notation */
+       mio_boot_dma_cfg.s.size = sg_dma_len(sg) / 2 - 1;
+
+       /* We need to swap the high and low bytes of every 16 bits */
+       mio_boot_dma_cfg.s.swap8 = 1;
+
+       mio_boot_dma_cfg.s.adr = sg_dma_address(sg);
+
+       VPRINTK("%s %d bytes address=%p\n",
+               (mio_boot_dma_cfg.s.rw) ? "write" : "read", sg->length,
+               (void *)(unsigned long)mio_boot_dma_cfg.s.adr);
+
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine),
+                      mio_boot_dma_cfg.u64);
+}
+
+/**
+ *
+ *     LOCKING:
+ *     spin_lock_irqsave(host lock)
+ *
+ */
+static unsigned int octeon_cf_dma_finished(struct ata_port *ap,
+                                       struct ata_queued_cmd *qc)
+{
+       struct ata_eh_info *ehi = &ap->link.eh_info;
+       struct octeon_cf_data *ocd = ap->dev->platform_data;
+       union cvmx_mio_boot_dma_cfgx dma_cfg;
+       union cvmx_mio_boot_dma_intx dma_int;
+       struct octeon_cf_port *cf_port;
+       u8 status;
+
+       VPRINTK("ata%u: protocol %d task_state %d\n",
+               ap->print_id, qc->tf.protocol, ap->hsm_task_state);
+
+
+       if (ap->hsm_task_state != HSM_ST_LAST)
+               return 0;
+
+       cf_port = (struct octeon_cf_port *)ap->private_data;
+
+       dma_cfg.u64 = cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine));
+       if (dma_cfg.s.size != 0xfffff) {
+               /* Error, the transfer was not complete.  */
+               qc->err_mask |= AC_ERR_HOST_BUS;
+               ap->hsm_task_state = HSM_ST_ERR;
+       }
+
+       /* Stop and clear the dma engine.  */
+       dma_cfg.u64 = 0;
+       dma_cfg.s.size = -1;
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine), dma_cfg.u64);
+
+       /* Disable the interrupt.  */
+       dma_int.u64 = 0;
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_INT_ENX(ocd->dma_engine), dma_int.u64);
+
+       /* Clear the DMA complete status */
+       dma_int.s.done = 1;
+       cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine), dma_int.u64);
+
+       status = ap->ops->sff_check_status(ap);
+
+       ata_sff_hsm_move(ap, qc, status, 0);
+
+       if (unlikely(qc->err_mask) && (qc->tf.protocol == ATA_PROT_DMA))
+               ata_ehi_push_desc(ehi, "DMA stat 0x%x", status);
+
+       return 1;
+}
+
+/*
+ * Check if any queued commands have more DMAs, if so start the next
+ * transfer, else do end of transfer handling.
+ */
+static irqreturn_t octeon_cf_interrupt(int irq, void *dev_instance)
+{
+       struct ata_host *host = dev_instance;
+       struct octeon_cf_port *cf_port;
+       int i;
+       unsigned int handled = 0;
+       unsigned long flags;
+
+       spin_lock_irqsave(&host->lock, flags);
+
+       DPRINTK("ENTER\n");
+       for (i = 0; i < host->n_ports; i++) {
+               u8 status;
+               struct ata_port *ap;
+               struct ata_queued_cmd *qc;
+               union cvmx_mio_boot_dma_intx dma_int;
+               union cvmx_mio_boot_dma_cfgx dma_cfg;
+               struct octeon_cf_data *ocd;
+
+               ap = host->ports[i];
+               ocd = ap->dev->platform_data;
+               if (!ap || (ap->flags & ATA_FLAG_DISABLED))
+                       continue;
+
+               ocd = ap->dev->platform_data;
+               cf_port = (struct octeon_cf_port *)ap->private_data;
+               dma_int.u64 =
+                       cvmx_read_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine));
+               dma_cfg.u64 =
+                       cvmx_read_csr(CVMX_MIO_BOOT_DMA_CFGX(ocd->dma_engine));
+
+               qc = ata_qc_from_tag(ap, ap->link.active_tag);
+
+               if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
+                   (qc->flags & ATA_QCFLAG_ACTIVE)) {
+                       if (dma_int.s.done && !dma_cfg.s.en) {
+                               if (!sg_is_last(qc->cursg)) {
+                                       qc->cursg = sg_next(qc->cursg);
+                                       handled = 1;
+                                       octeon_cf_dma_start(qc);
+                                       continue;
+                               } else {
+                                       cf_port->dma_finished = 1;
+                               }
+                       }
+                       if (!cf_port->dma_finished)
+                               continue;
+                       status = ioread8(ap->ioaddr.altstatus_addr);
+                       if (status & (ATA_BUSY | ATA_DRQ)) {
+                               /*
+                                * We are busy, try to handle it
+                                * later.  This is the DMA finished
+                                * interrupt, and it could take a
+                                * little while for the card to be
+                                * ready for more commands.
+                                */
+                               /* Clear DMA irq. */
+                               dma_int.u64 = 0;
+                               dma_int.s.done = 1;
+                               cvmx_write_csr(CVMX_MIO_BOOT_DMA_INTX(ocd->dma_engine),
+                                              dma_int.u64);
+
+                               queue_delayed_work(cf_port->wq,
+                                                  &cf_port->delayed_finish, 1);
+                               handled = 1;
+                       } else {
+                               handled |= octeon_cf_dma_finished(ap, qc);
+                       }
+               }
+       }
+       spin_unlock_irqrestore(&host->lock, flags);
+       DPRINTK("EXIT\n");
+       return IRQ_RETVAL(handled);
+}
+
+static void octeon_cf_delayed_finish(struct work_struct *work)
+{
+       struct octeon_cf_port *cf_port = container_of(work,
+                                                     struct octeon_cf_port,
+                                                     delayed_finish.work);
+       struct ata_port *ap = cf_port->ap;
+       struct ata_host *host = ap->host;
+       struct ata_queued_cmd *qc;
+       unsigned long flags;
+       u8 status;
+
+       spin_lock_irqsave(&host->lock, flags);
+
+       /*
+        * If the port is not waiting for completion, it must have
+        * handled it previously.  The hsm_task_state is
+        * protected by host->lock.
+        */
+       if (ap->hsm_task_state != HSM_ST_LAST || !cf_port->dma_finished)
+               goto out;
+
+       status = ioread8(ap->ioaddr.altstatus_addr);
+       if (status & (ATA_BUSY | ATA_DRQ)) {
+               /* Still busy, try again. */
+               queue_delayed_work(cf_port->wq,
+                                  &cf_port->delayed_finish, 1);
+               goto out;
+       }
+       qc = ata_qc_from_tag(ap, ap->link.active_tag);
+       if (qc && (!(qc->tf.flags & ATA_TFLAG_POLLING)) &&
+           (qc->flags & ATA_QCFLAG_ACTIVE))
+               octeon_cf_dma_finished(ap, qc);
+out:
+       spin_unlock_irqrestore(&host->lock, flags);
+}
+
+static void octeon_cf_dev_config(struct ata_device *dev)
+{
+       /*
+        * A maximum of 2^20 - 1 16 bit transfers are possible with
+        * the bootbus DMA.  So we need to throttle max_sectors to
+        * (2^12 - 1 == 4095) to assure that this can never happen.
+        */
+       dev->max_sectors = min(dev->max_sectors, 4095U);
+}
+
+/*
+ * Trap if driver tries to do standard bmdma commands.  They are not
+ * supported.
+ */
+static void unreachable_qc(struct ata_queued_cmd *qc)
+{
+       BUG();
+}
+
+static u8 unreachable_port(struct ata_port *ap)
+{
+       BUG();
+}
+
+/*
+ * We don't do ATAPI DMA so return 0.
+ */
+static int octeon_cf_check_atapi_dma(struct ata_queued_cmd *qc)
+{
+       return 0;
+}
+
+static unsigned int octeon_cf_qc_issue(struct ata_queued_cmd *qc)
+{
+       struct ata_port *ap = qc->ap;
+
+       switch (qc->tf.protocol) {
+       case ATA_PROT_DMA:
+               WARN_ON(qc->tf.flags & ATA_TFLAG_POLLING);
+
+               ap->ops->sff_tf_load(ap, &qc->tf);  /* load tf registers */
+               octeon_cf_dma_setup(qc);            /* set up dma */
+               octeon_cf_dma_start(qc);            /* initiate dma */
+               ap->hsm_task_state = HSM_ST_LAST;
+               break;
+
+       case ATAPI_PROT_DMA:
+               dev_err(ap->dev, "Error, ATAPI not supported\n");
+               BUG();
+
+       default:
+               return ata_sff_qc_issue(qc);
+       }
+
+       return 0;
+}
+
+static struct ata_port_operations octeon_cf_ops = {
+       .inherits               = &ata_sff_port_ops,
+       .check_atapi_dma        = octeon_cf_check_atapi_dma,
+       .qc_prep                = ata_noop_qc_prep,
+       .qc_issue               = octeon_cf_qc_issue,
+       .sff_dev_select         = octeon_cf_dev_select,
+       .sff_irq_on             = octeon_cf_irq_on,
+       .sff_irq_clear          = octeon_cf_irq_clear,
+       .bmdma_setup            = unreachable_qc,
+       .bmdma_start            = unreachable_qc,
+       .bmdma_stop             = unreachable_qc,
+       .bmdma_status           = unreachable_port,
+       .cable_detect           = ata_cable_40wire,
+       .set_piomode            = octeon_cf_set_piomode,
+       .set_dmamode            = octeon_cf_set_dmamode,
+       .dev_config             = octeon_cf_dev_config,
+};
+
+static int __devinit octeon_cf_probe(struct platform_device *pdev)
+{
+       struct resource *res_cs0, *res_cs1;
+
+       void __iomem *cs0;
+       void __iomem *cs1 = NULL;
+       struct ata_host *host;
+       struct ata_port *ap;
+       struct octeon_cf_data *ocd;
+       int irq = 0;
+       irq_handler_t irq_handler = NULL;
+       void __iomem *base;
+       struct octeon_cf_port *cf_port;
+
+       res_cs0 = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+
+       if (!res_cs0)
+               return -EINVAL;
+
+       ocd = pdev->dev.platform_data;
+
+       cs0 = devm_ioremap_nocache(&pdev->dev, res_cs0->start,
+                                  res_cs0->end - res_cs0->start + 1);
+
+       if (!cs0)
+               return -ENOMEM;
+
+       /* Determine from availability of DMA if True IDE mode or not */
+       if (ocd->dma_engine >= 0) {
+               res_cs1 = platform_get_resource(pdev, IORESOURCE_MEM, 1);
+               if (!res_cs1)
+                       return -EINVAL;
+
+               cs1 = devm_ioremap_nocache(&pdev->dev, res_cs1->start,
+                                          res_cs0->end - res_cs1->start + 1);
+
+               if (!cs1)
+                       return -ENOMEM;
+       }
+
+       cf_port = kzalloc(sizeof(*cf_port), GFP_KERNEL);
+       if (!cf_port)
+               return -ENOMEM;
+
+       /* allocate host */
+       host = ata_host_alloc(&pdev->dev, 1);
+       if (!host)
+               goto free_cf_port;
+
+       ap = host->ports[0];
+       ap->private_data = cf_port;
+       cf_port->ap = ap;
+       ap->ops = &octeon_cf_ops;
+       ap->pio_mask = 0x7f; /* Support PIO 0-6 */
+       ap->flags |= ATA_FLAG_MMIO | ATA_FLAG_NO_LEGACY
+                 | ATA_FLAG_NO_ATAPI | ATA_FLAG_PIO_POLLING;
+
+       base = cs0 + ocd->base_region_bias;
+       if (!ocd->is16bit) {
+               ap->ioaddr.cmd_addr     = base;
+               ata_sff_std_ports(&ap->ioaddr);
+
+               ap->ioaddr.altstatus_addr = base + 0xe;
+               ap->ioaddr.ctl_addr     = base + 0xe;
+               octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer8;
+       } else if (cs1) {
+               /* Presence of cs1 indicates True IDE mode.  */
+               ap->ioaddr.cmd_addr     = base + (ATA_REG_CMD << 1) + 1;
+               ap->ioaddr.data_addr    = base + (ATA_REG_DATA << 1);
+               ap->ioaddr.error_addr   = base + (ATA_REG_ERR << 1) + 1;
+               ap->ioaddr.feature_addr = base + (ATA_REG_FEATURE << 1) + 1;
+               ap->ioaddr.nsect_addr   = base + (ATA_REG_NSECT << 1) + 1;
+               ap->ioaddr.lbal_addr    = base + (ATA_REG_LBAL << 1) + 1;
+               ap->ioaddr.lbam_addr    = base + (ATA_REG_LBAM << 1) + 1;
+               ap->ioaddr.lbah_addr    = base + (ATA_REG_LBAH << 1) + 1;
+               ap->ioaddr.device_addr  = base + (ATA_REG_DEVICE << 1) + 1;
+               ap->ioaddr.status_addr  = base + (ATA_REG_STATUS << 1) + 1;
+               ap->ioaddr.command_addr = base + (ATA_REG_CMD << 1) + 1;
+               ap->ioaddr.altstatus_addr = cs1 + (6 << 1) + 1;
+               ap->ioaddr.ctl_addr     = cs1 + (6 << 1) + 1;
+               octeon_cf_ops.sff_data_xfer = octeon_cf_data_xfer16;
+
+               ap->mwdma_mask  = 0x1f; /* Support MWDMA 0-4 */
+               irq = platform_get_irq(pdev, 0);
+               irq_handler = octeon_cf_interrupt;
+
+               /* True IDE mode needs delayed work to poll for not-busy.  */
+               cf_port->wq = create_singlethread_workqueue(DRV_NAME);
+               if (!cf_port->wq)
+                       goto free_cf_port;
+               INIT_DELAYED_WORK(&cf_port->delayed_finish,
+                                 octeon_cf_delayed_finish);
+
+       } else {
+               /* 16 bit but not True IDE */
+               octeon_cf_ops.sff_data_xfer     = octeon_cf_data_xfer16;
+               octeon_cf_ops.softreset         = octeon_cf_softreset16;
+               octeon_cf_ops.sff_check_status  = octeon_cf_check_status16;
+               octeon_cf_ops.sff_tf_read       = octeon_cf_tf_read16;
+               octeon_cf_ops.sff_tf_load       = octeon_cf_tf_load16;
+               octeon_cf_ops.sff_exec_command  = octeon_cf_exec_command16;
+
+               ap->ioaddr.data_addr    = base + ATA_REG_DATA;
+               ap->ioaddr.nsect_addr   = base + ATA_REG_NSECT;
+               ap->ioaddr.lbal_addr    = base + ATA_REG_LBAL;
+               ap->ioaddr.ctl_addr     = base + 0xe;
+               ap->ioaddr.altstatus_addr = base + 0xe;
+       }
+
+       ata_port_desc(ap, "cmd %p ctl %p", base, ap->ioaddr.ctl_addr);
+
+
+       dev_info(&pdev->dev, "version " DRV_VERSION" %d bit%s.\n",
+                (ocd->is16bit) ? 16 : 8,
+                (cs1) ? ", True IDE" : "");
+
+
+       return ata_host_activate(host, irq, irq_handler, 0, &octeon_cf_sht);
+
+free_cf_port:
+       kfree(cf_port);
+       return -ENOMEM;
+}
+
+static struct platform_driver octeon_cf_driver = {
+       .probe          = octeon_cf_probe,
+       .driver         = {
+               .name   = DRV_NAME,
+               .owner  = THIS_MODULE,
+       },
+};
+
+static int __init octeon_cf_init(void)
+{
+       return platform_driver_register(&octeon_cf_driver);
+}
+
+
+MODULE_AUTHOR("David Daney <ddaney@caviumnetworks.com>");
+MODULE_DESCRIPTION("low-level driver for Cavium OCTEON Compact Flash PATA");
+MODULE_LICENSE("GPL");
+MODULE_VERSION(DRV_VERSION);
+MODULE_ALIAS("platform:" DRV_NAME);
+
+module_init(octeon_cf_init);
index 1a56db92ff7ac685bfab920508d6fcc2bc0124a1..55bc88c1707bfab1fdcb7f63e961a05e004d57dc 100644 (file)
@@ -1288,7 +1288,7 @@ static const struct ata_port_info sata_fsl_port_info[] = {
 static int sata_fsl_probe(struct of_device *ofdev,
                        const struct of_device_id *match)
 {
-       int retval = 0;
+       int retval = -ENXIO;
        void __iomem *hcr_base = NULL;
        void __iomem *ssr_base = NULL;
        void __iomem *csr_base = NULL;
index c18935f0bda215d5987c4324fa8374a4f3efa1e1..5c62da9cd491e34c2c0b1034dd4783b72ec1fdb7 100644 (file)
@@ -92,6 +92,8 @@ static const struct pci_device_id svia_pci_tbl[] = {
        { PCI_VDEVICE(VIA, 0x5372), vt6420 },
        { PCI_VDEVICE(VIA, 0x7372), vt6420 },
        { PCI_VDEVICE(VIA, 0x5287), vt8251 }, /* 2 sata chnls (Master/Slave) */
+       { PCI_VDEVICE(VIA, 0x9000), vt8251 },
+       { PCI_VDEVICE(VIA, 0x9040), vt8251 },
 
        { }     /* terminate list */
 };
index d8a982b71296520fd0344e9670e1f88b4b342b7d..964c5eb1fada4266795056abbad038ac23463dd7 100644 (file)
@@ -36,7 +36,7 @@
 /*
  * Detailed mode info for 800x600@60Hz
  */
-static struct drm_display_mode std_mode[] = {
+static struct drm_display_mode std_modes[] = {
        { DRM_MODE("800x600", DRM_MODE_TYPE_DEFAULT, 40000, 800, 840,
                   968, 1056, 0, 600, 601, 605, 628, 0,
                   DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC) },
@@ -60,15 +60,18 @@ static struct drm_display_mode std_mode[] = {
  * changes have occurred.
  *
  * FIXME: take into account monitor limits
+ *
+ * RETURNS:
+ * Number of modes found on @connector.
  */
-void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
-                                            uint32_t maxX, uint32_t maxY)
+int drm_helper_probe_single_connector_modes(struct drm_connector *connector,
+                                           uint32_t maxX, uint32_t maxY)
 {
        struct drm_device *dev = connector->dev;
        struct drm_display_mode *mode, *t;
        struct drm_connector_helper_funcs *connector_funcs =
                connector->helper_private;
-       int ret;
+       int count = 0;
 
        DRM_DEBUG("%s\n", drm_get_connector_name(connector));
        /* set all modes to the unverified state */
@@ -81,14 +84,14 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
                DRM_DEBUG("%s is disconnected\n",
                          drm_get_connector_name(connector));
                /* TODO set EDID to NULL */
-               return;
+               return 0;
        }
 
-       ret = (*connector_funcs->get_modes)(connector);
+       count = (*connector_funcs->get_modes)(connector);
+       if (!count)
+               return 0;
 
-       if (ret) {
-               drm_mode_connector_list_update(connector);
-       }
+       drm_mode_connector_list_update(connector);
 
        if (maxX && maxY)
                drm_mode_validate_size(dev, &connector->modes, maxX,
@@ -102,25 +105,8 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
 
        drm_mode_prune_invalid(dev, &connector->modes, true);
 
-       if (list_empty(&connector->modes)) {
-               struct drm_display_mode *stdmode;
-
-               DRM_DEBUG("No valid modes on %s\n",
-                         drm_get_connector_name(connector));
-
-               /* Should we do this here ???
-                * When no valid EDID modes are available we end up
-                * here and bailed in the past, now we add a standard
-                * 640x480@60Hz mode and carry on.
-                */
-               stdmode = drm_mode_duplicate(dev, &std_mode[0]);
-               drm_mode_probed_add(connector, stdmode);
-               drm_mode_list_concat(&connector->probed_modes,
-                                    &connector->modes);
-
-               DRM_DEBUG("Adding standard 640x480 @ 60Hz to %s\n",
-                         drm_get_connector_name(connector));
-       }
+       if (list_empty(&connector->modes))
+               return 0;
 
        drm_mode_sort(&connector->modes);
 
@@ -131,20 +117,58 @@ void drm_helper_probe_single_connector_modes(struct drm_connector *connector,
                drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
                drm_mode_debug_printmodeline(mode);
        }
+
+       return count;
 }
 EXPORT_SYMBOL(drm_helper_probe_single_connector_modes);
 
-void drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,
+int drm_helper_probe_connector_modes(struct drm_device *dev, uint32_t maxX,
                                      uint32_t maxY)
 {
        struct drm_connector *connector;
+       int count = 0;
 
        list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-               drm_helper_probe_single_connector_modes(connector, maxX, maxY);
+               count += drm_helper_probe_single_connector_modes(connector,
+                                                                maxX, maxY);
        }
+
+       return count;
 }
 EXPORT_SYMBOL(drm_helper_probe_connector_modes);
 
+static void drm_helper_add_std_modes(struct drm_device *dev,
+                                    struct drm_connector *connector)
+{
+       struct drm_display_mode *mode, *t;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(std_modes); i++) {
+               struct drm_display_mode *stdmode;
+
+               /*
+                * When no valid EDID modes are available we end up
+                * here and bailed in the past, now we add some standard
+                * modes and move on.
+                */
+               stdmode = drm_mode_duplicate(dev, &std_modes[i]);
+               drm_mode_probed_add(connector, stdmode);
+               drm_mode_list_concat(&connector->probed_modes,
+                                    &connector->modes);
+
+               DRM_DEBUG("Adding mode %s to %s\n", stdmode->name,
+                         drm_get_connector_name(connector));
+       }
+       drm_mode_sort(&connector->modes);
+
+       DRM_DEBUG("Added std modes on %s\n", drm_get_connector_name(connector));
+       list_for_each_entry_safe(mode, t, &connector->modes, head) {
+               mode->vrefresh = drm_mode_vrefresh(mode);
+
+               drm_mode_set_crtcinfo(mode, CRTC_INTERLACE_HALVE_V);
+               drm_mode_debug_printmodeline(mode);
+       }
+}
 
 /**
  * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
@@ -237,6 +261,8 @@ static void drm_enable_connectors(struct drm_device *dev, bool *enabled)
 
        list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
                enabled[i] = drm_connector_enabled(connector, true);
+               DRM_DEBUG("connector %d enabled? %s\n", connector->base.id,
+                         enabled[i] ? "yes" : "no");
                any_enabled |= enabled[i];
                i++;
        }
@@ -265,11 +291,17 @@ static bool drm_target_preferred(struct drm_device *dev,
                        continue;
                }
 
+               DRM_DEBUG("looking for preferred mode on connector %d\n",
+                         connector->base.id);
+
                modes[i] = drm_has_preferred_mode(connector, width, height);
-               if (!modes[i]) {
+               /* No preferred modes, pick one off the list */
+               if (!modes[i] && !list_empty(&connector->modes)) {
                        list_for_each_entry(modes[i], &connector->modes, head)
                                break;
                }
+               DRM_DEBUG("found mode %s\n", modes[i] ? modes[i]->name :
+                         "none");
                i++;
        }
        return true;
@@ -369,6 +401,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
        int width, height;
        int i, ret;
 
+       DRM_DEBUG("\n");
+
        width = dev->mode_config.max_width;
        height = dev->mode_config.max_height;
 
@@ -390,6 +424,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
        if (!ret)
                DRM_ERROR("Unable to find initial modes\n");
 
+       DRM_DEBUG("picking CRTCs for %dx%d config\n", width, height);
+
        drm_pick_crtcs(dev, crtcs, modes, 0, width, height);
 
        i = 0;
@@ -403,6 +439,8 @@ static void drm_setup_crtcs(struct drm_device *dev)
                }
 
                if (mode && crtc) {
+                       DRM_DEBUG("desired mode %s set on crtc %d\n",
+                                 mode->name, crtc->base.id);
                        crtc->desired_mode = mode;
                        connector->encoder->crtc = crtc;
                } else
@@ -442,6 +480,7 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
        int saved_x, saved_y;
        struct drm_encoder *encoder;
        bool ret = true;
+       bool depth_changed, bpp_changed;
 
        adjusted_mode = drm_mode_duplicate(dev, mode);
 
@@ -450,6 +489,15 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
        if (!crtc->enabled)
                return true;
 
+       if (old_fb && crtc->fb) {
+               depth_changed = (old_fb->depth != crtc->fb->depth);
+               bpp_changed = (old_fb->bits_per_pixel !=
+                              crtc->fb->bits_per_pixel);
+       } else {
+               depth_changed = true;
+               bpp_changed = true;
+       }
+
        saved_mode = crtc->mode;
        saved_x = crtc->x;
        saved_y = crtc->y;
@@ -462,7 +510,8 @@ bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
        crtc->y = y;
 
        if (drm_mode_equal(&saved_mode, &crtc->mode)) {
-               if (saved_x != crtc->x || saved_y != crtc->y) {
+               if (saved_x != crtc->x || saved_y != crtc->y ||
+                   depth_changed || bpp_changed) {
                        crtc_funcs->mode_set_base(crtc, crtc->x, crtc->y,
                                                  old_fb);
                        goto done;
@@ -568,8 +617,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
        struct drm_encoder **save_encoders, *new_encoder;
        struct drm_framebuffer *old_fb;
        bool save_enabled;
-       bool changed = false;
-       bool flip_or_move = false;
+       bool mode_changed = false;
+       bool fb_changed = false;
        struct drm_connector *connector;
        int count = 0, ro, fail = 0;
        struct drm_crtc_helper_funcs *crtc_funcs;
@@ -597,7 +646,10 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
        /* save previous config */
        save_enabled = set->crtc->enabled;
 
-       /* this is meant to be num_connector not num_crtc */
+       /*
+        * We do mode_config.num_connectors here since we'll look at the
+        * CRTC and encoder associated with each connector later.
+        */
        save_crtcs = kzalloc(dev->mode_config.num_connector *
                             sizeof(struct drm_crtc *), GFP_KERNEL);
        if (!save_crtcs)
@@ -613,21 +665,25 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
        /* We should be able to check here if the fb has the same properties
         * and then just flip_or_move it */
        if (set->crtc->fb != set->fb) {
-               /* if we have no fb then its a change not a flip */
+               /* If we have no fb then treat it as a full mode set */
                if (set->crtc->fb == NULL)
-                       changed = true;
+                       mode_changed = true;
+               else if ((set->fb->bits_per_pixel !=
+                        set->crtc->fb->bits_per_pixel) ||
+                        set->fb->depth != set->crtc->fb->depth)
+                       fb_changed = true;
                else
-                       flip_or_move = true;
+                       fb_changed = true;
        }
 
        if (set->x != set->crtc->x || set->y != set->crtc->y)
-               flip_or_move = true;
+               fb_changed = true;
 
        if (set->mode && !drm_mode_equal(set->mode, &set->crtc->mode)) {
                DRM_DEBUG("modes are different\n");
                drm_mode_debug_printmodeline(&set->crtc->mode);
                drm_mode_debug_printmodeline(set->mode);
-               changed = true;
+               mode_changed = true;
        }
 
        /* a) traverse passed in connector list and get encoders for them */
@@ -650,7 +706,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                }
 
                if (new_encoder != connector->encoder) {
-                       changed = true;
+                       mode_changed = true;
                        connector->encoder = new_encoder;
                }
        }
@@ -677,16 +733,16 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                                new_crtc = set->crtc;
                }
                if (new_crtc != connector->encoder->crtc) {
-                       changed = true;
+                       mode_changed = true;
                        connector->encoder->crtc = new_crtc;
                }
        }
 
        /* mode_set_base is not a required function */
-       if (flip_or_move && !crtc_funcs->mode_set_base)
-               changed = true;
+       if (fb_changed && !crtc_funcs->mode_set_base)
+               mode_changed = true;
 
-       if (changed) {
+       if (mode_changed) {
                old_fb = set->crtc->fb;
                set->crtc->fb = set->fb;
                set->crtc->enabled = (set->mode != NULL);
@@ -705,7 +761,7 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set)
                        set->crtc->desired_mode = set->mode;
                }
                drm_helper_disable_unused_functions(dev);
-       } else if (flip_or_move) {
+       } else if (fb_changed) {
                old_fb = set->crtc->fb;
                if (set->crtc->fb != set->fb)
                        set->crtc->fb = set->fb;
@@ -764,10 +820,31 @@ bool drm_helper_plugged_event(struct drm_device *dev)
  */
 bool drm_helper_initial_config(struct drm_device *dev, bool can_grow)
 {
-       int ret = false;
+       struct drm_connector *connector;
+       int count = 0;
 
-       drm_helper_plugged_event(dev);
-       return ret;
+       count = drm_helper_probe_connector_modes(dev,
+                                                dev->mode_config.max_width,
+                                                dev->mode_config.max_height);
+
+       /*
+        * None of the available connectors had any modes, so add some
+        * and try to light them up anyway
+        */
+       if (!count) {
+               DRM_ERROR("connectors have no modes, using standard modes\n");
+               list_for_each_entry(connector,
+                                   &dev->mode_config.connector_list,
+                                   head)
+                       drm_helper_add_std_modes(dev, connector);
+       }
+
+       drm_setup_crtcs(dev);
+
+       /* alert the driver fb layer */
+       dev->mode_config.funcs->fb_changed(dev);
+
+       return 0;
 }
 EXPORT_SYMBOL(drm_helper_initial_config);
 
index 724e505873cf19e77c6710968a1a8ba6888cedd2..477caa1b1e4b0a77edf417d649000d6b3036d053 100644 (file)
@@ -267,7 +267,8 @@ EXPORT_SYMBOL(drm_irq_install);
  */
 int drm_irq_uninstall(struct drm_device * dev)
 {
-       int irq_enabled;
+       unsigned long irqflags;
+       int irq_enabled, i;
 
        if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
                return -EINVAL;
@@ -277,6 +278,16 @@ int drm_irq_uninstall(struct drm_device * dev)
        dev->irq_enabled = 0;
        mutex_unlock(&dev->struct_mutex);
 
+       /*
+        * Wake up any waiters so they don't hang.
+        */
+       spin_lock_irqsave(&dev->vbl_lock, irqflags);
+       for (i = 0; i < dev->num_crtcs; i++) {
+               DRM_WAKEUP(&dev->vbl_queue[i]);
+               dev->vblank_enabled[i] = 0;
+       }
+       spin_unlock_irqrestore(&dev->vbl_lock, irqflags);
+
        if (!irq_enabled)
                return -EINVAL;
 
@@ -652,8 +663,9 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
                          vblwait->request.sequence, crtc);
                dev->last_vblank_wait[crtc] = vblwait->request.sequence;
                DRM_WAIT_ON(ret, dev->vbl_queue[crtc], 3 * DRM_HZ,
-                           ((drm_vblank_count(dev, crtc)
-                             - vblwait->request.sequence) <= (1 << 23)));
+                           (((drm_vblank_count(dev, crtc) -
+                              vblwait->request.sequence) <= (1 << 23)) ||
+                            !dev->irq_enabled));
 
                if (ret != -EINTR) {
                        struct timeval now;
index 62a4bf7b49df4f637bd8c89977bcbde07178b48a..bbadf1c041426ca73e9fd1bf0e749c0050dbde92 100644 (file)
@@ -177,6 +177,14 @@ static int i915_initialize(struct drm_device * dev, drm_i915_init_t * init)
        drm_i915_private_t *dev_priv = dev->dev_private;
        struct drm_i915_master_private *master_priv = dev->primary->master->driver_priv;
 
+       master_priv->sarea = drm_getsarea(dev);
+       if (master_priv->sarea) {
+               master_priv->sarea_priv = (drm_i915_sarea_t *)
+                       ((u8 *)master_priv->sarea->handle + init->sarea_priv_offset);
+       } else {
+               DRM_DEBUG("sarea not found assuming DRI2 userspace\n");
+       }
+
        if (init->ring_size != 0) {
                if (dev_priv->ring.ring_obj != NULL) {
                        i915_dma_cleanup(dev);
@@ -1152,6 +1160,8 @@ int i915_driver_unload(struct drm_device *dev)
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
                intel_modeset_cleanup(dev);
 
+               i915_gem_free_all_phys_object(dev);
+
                mutex_lock(&dev->struct_mutex);
                i915_gem_cleanup_ringbuffer(dev);
                mutex_unlock(&dev->struct_mutex);
index 563de18063fdca4063349d32778bd772f5679c10..e1351825200712078b8fe2bf65d238d57435e7b5 100644 (file)
@@ -72,6 +72,18 @@ enum pipe {
 #define WATCH_INACTIVE 0
 #define WATCH_PWRITE   0
 
+#define I915_GEM_PHYS_CURSOR_0 1
+#define I915_GEM_PHYS_CURSOR_1 2
+#define I915_GEM_PHYS_OVERLAY_REGS 3
+#define I915_MAX_PHYS_OBJECT (I915_GEM_PHYS_OVERLAY_REGS)
+
+struct drm_i915_gem_phys_object {
+       int id;
+       struct page **page_list;
+       drm_dma_handle_t *handle;
+       struct drm_gem_object *cur_obj;
+};
+
 typedef struct _drm_i915_ring_buffer {
        int tail_mask;
        unsigned long Size;
@@ -358,6 +370,9 @@ typedef struct drm_i915_private {
                uint32_t bit_6_swizzle_x;
                /** Bit 6 swizzling required for Y tiling */
                uint32_t bit_6_swizzle_y;
+
+               /* storage for physical objects */
+               struct drm_i915_gem_phys_object *phys_objs[I915_MAX_PHYS_OBJECT];
        } mm;
 } drm_i915_private_t;
 
@@ -436,6 +451,9 @@ struct drm_i915_gem_object {
        /** User space pin count and filp owning the pin */
        uint32_t user_pin_count;
        struct drm_file *pin_filp;
+
+       /** for phy allocated objects */
+       struct drm_i915_gem_phys_object *phys_obj;
 };
 
 /**
@@ -598,6 +616,11 @@ int i915_gem_do_init(struct drm_device *dev, unsigned long start,
 int i915_gem_fault(struct vm_area_struct *vma, struct vm_fault *vmf);
 int i915_gem_object_set_to_gtt_domain(struct drm_gem_object *obj,
                                      int write);
+int i915_gem_attach_phys_object(struct drm_device *dev,
+                               struct drm_gem_object *obj, int id);
+void i915_gem_detach_phys_object(struct drm_device *dev,
+                                struct drm_gem_object *obj);
+void i915_gem_free_all_phys_object(struct drm_device *dev);
 
 /* i915_gem_tiling.c */
 void i915_gem_detect_bit_6_swizzle(struct drm_device *dev);
index 1384d6686555b4418d5e3be9a1dbf3fc41f4438f..96316fd4723322f7ac277e3747abdc806ab3a98e 100644 (file)
@@ -55,6 +55,9 @@ static int i915_gem_object_bind_to_gtt(struct drm_gem_object *obj,
 static void i915_gem_object_get_fence_reg(struct drm_gem_object *obj);
 static void i915_gem_clear_fence_reg(struct drm_gem_object *obj);
 static int i915_gem_evict_something(struct drm_device *dev);
+static int i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
+                               struct drm_i915_gem_pwrite *args,
+                               struct drm_file *file_priv);
 
 int i915_gem_do_init(struct drm_device *dev, unsigned long start,
                     unsigned long end)
@@ -386,8 +389,10 @@ i915_gem_pwrite_ioctl(struct drm_device *dev, void *data,
         * pread/pwrite currently are reading and writing from the CPU
         * perspective, requiring manual detiling by the client.
         */
-       if (obj_priv->tiling_mode == I915_TILING_NONE &&
-           dev->gtt_total != 0)
+       if (obj_priv->phys_obj)
+               ret = i915_gem_phys_pwrite(dev, obj, args, file_priv);
+       else if (obj_priv->tiling_mode == I915_TILING_NONE &&
+                dev->gtt_total != 0)
                ret = i915_gem_gtt_pwrite(dev, obj, args, file_priv);
        else
                ret = i915_gem_shmem_pwrite(dev, obj, args, file_priv);
@@ -2858,6 +2863,9 @@ void i915_gem_free_object(struct drm_gem_object *obj)
        while (obj_priv->pin_count > 0)
                i915_gem_object_unpin(obj);
 
+       if (obj_priv->phys_obj)
+               i915_gem_detach_phys_object(dev, obj);
+
        i915_gem_object_unbind(obj);
 
        list = &obj->map_list;
@@ -3293,3 +3301,180 @@ i915_gem_load(struct drm_device *dev)
 
        i915_gem_detect_bit_6_swizzle(dev);
 }
+
+/*
+ * Create a physically contiguous memory object for this object
+ * e.g. for cursor + overlay regs
+ */
+int i915_gem_init_phys_object(struct drm_device *dev,
+                             int id, int size)
+{
+       drm_i915_private_t *dev_priv = dev->dev_private;
+       struct drm_i915_gem_phys_object *phys_obj;
+       int ret;
+
+       if (dev_priv->mm.phys_objs[id - 1] || !size)
+               return 0;
+
+       phys_obj = drm_calloc(1, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER);
+       if (!phys_obj)
+               return -ENOMEM;
+
+       phys_obj->id = id;
+
+       phys_obj->handle = drm_pci_alloc(dev, size, 0, 0xffffffff);
+       if (!phys_obj->handle) {
+               ret = -ENOMEM;
+               goto kfree_obj;
+       }
+#ifdef CONFIG_X86
+       set_memory_wc((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE);
+#endif
+
+       dev_priv->mm.phys_objs[id - 1] = phys_obj;
+
+       return 0;
+kfree_obj:
+       drm_free(phys_obj, sizeof(struct drm_i915_gem_phys_object), DRM_MEM_DRIVER);
+       return ret;
+}
+
+void i915_gem_free_phys_object(struct drm_device *dev, int id)
+{
+       drm_i915_private_t *dev_priv = dev->dev_private;
+       struct drm_i915_gem_phys_object *phys_obj;
+
+       if (!dev_priv->mm.phys_objs[id - 1])
+               return;
+
+       phys_obj = dev_priv->mm.phys_objs[id - 1];
+       if (phys_obj->cur_obj) {
+               i915_gem_detach_phys_object(dev, phys_obj->cur_obj);
+       }
+
+#ifdef CONFIG_X86
+       set_memory_wb((unsigned long)phys_obj->handle->vaddr, phys_obj->handle->size / PAGE_SIZE);
+#endif
+       drm_pci_free(dev, phys_obj->handle);
+       kfree(phys_obj);
+       dev_priv->mm.phys_objs[id - 1] = NULL;
+}
+
+void i915_gem_free_all_phys_object(struct drm_device *dev)
+{
+       int i;
+
+       for (i = 0; i < I915_MAX_PHYS_OBJECT; i++)
+               i915_gem_free_phys_object(dev, i);
+}
+
+void i915_gem_detach_phys_object(struct drm_device *dev,
+                                struct drm_gem_object *obj)
+{
+       struct drm_i915_gem_object *obj_priv;
+       int i;
+       int ret;
+       int page_count;
+
+       obj_priv = obj->driver_private;
+       if (!obj_priv->phys_obj)
+               return;
+
+       ret = i915_gem_object_get_page_list(obj);
+       if (ret)
+               goto out;
+
+       page_count = obj->size / PAGE_SIZE;
+
+       for (i = 0; i < page_count; i++) {
+               char *dst = kmap_atomic(obj_priv->page_list[i], KM_USER0);
+               char *src = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
+
+               memcpy(dst, src, PAGE_SIZE);
+               kunmap_atomic(dst, KM_USER0);
+       }
+       drm_clflush_pages(obj_priv->page_list, page_count);
+       drm_agp_chipset_flush(dev);
+out:
+       obj_priv->phys_obj->cur_obj = NULL;
+       obj_priv->phys_obj = NULL;
+}
+
+int
+i915_gem_attach_phys_object(struct drm_device *dev,
+                           struct drm_gem_object *obj, int id)
+{
+       drm_i915_private_t *dev_priv = dev->dev_private;
+       struct drm_i915_gem_object *obj_priv;
+       int ret = 0;
+       int page_count;
+       int i;
+
+       if (id > I915_MAX_PHYS_OBJECT)
+               return -EINVAL;
+
+       obj_priv = obj->driver_private;
+
+       if (obj_priv->phys_obj) {
+               if (obj_priv->phys_obj->id == id)
+                       return 0;
+               i915_gem_detach_phys_object(dev, obj);
+       }
+
+
+       /* create a new object */
+       if (!dev_priv->mm.phys_objs[id - 1]) {
+               ret = i915_gem_init_phys_object(dev, id,
+                                               obj->size);
+               if (ret) {
+                       DRM_ERROR("failed to init phys object %d size: %d\n", id, obj->size);
+                       goto out;
+               }
+       }
+
+       /* bind to the object */
+       obj_priv->phys_obj = dev_priv->mm.phys_objs[id - 1];
+       obj_priv->phys_obj->cur_obj = obj;
+
+       ret = i915_gem_object_get_page_list(obj);
+       if (ret) {
+               DRM_ERROR("failed to get page list\n");
+               goto out;
+       }
+
+       page_count = obj->size / PAGE_SIZE;
+
+       for (i = 0; i < page_count; i++) {
+               char *src = kmap_atomic(obj_priv->page_list[i], KM_USER0);
+               char *dst = obj_priv->phys_obj->handle->vaddr + (i * PAGE_SIZE);
+
+               memcpy(dst, src, PAGE_SIZE);
+               kunmap_atomic(src, KM_USER0);
+       }
+
+       return 0;
+out:
+       return ret;
+}
+
+static int
+i915_gem_phys_pwrite(struct drm_device *dev, struct drm_gem_object *obj,
+                    struct drm_i915_gem_pwrite *args,
+                    struct drm_file *file_priv)
+{
+       struct drm_i915_gem_object *obj_priv = obj->driver_private;
+       void *obj_addr;
+       int ret;
+       char __user *user_data;
+
+       user_data = (char __user *) (uintptr_t) args->data_ptr;
+       obj_addr = obj_priv->phys_obj->handle->vaddr + args->offset;
+
+       DRM_ERROR("obj_addr %p, %lld\n", obj_addr, args->size);
+       ret = copy_from_user(obj_addr, user_data, args->size);
+       if (ret)
+               return -EFAULT;
+
+       drm_agp_chipset_flush(dev);
+       return 0;
+}
index 0cadafbef411ba094d020d1323f66f136ba0d1bd..6290219de6c8e832aa4209d761f7d2be0317211b 100644 (file)
@@ -411,6 +411,12 @@ int i915_enable_vblank(struct drm_device *dev, int pipe)
 {
        drm_i915_private_t *dev_priv = (drm_i915_private_t *) dev->dev_private;
        unsigned long irqflags;
+       int pipeconf_reg = (pipe == 0) ? PIPEACONF : PIPEBCONF;
+       u32 pipeconf;
+
+       pipeconf = I915_READ(pipeconf_reg);
+       if (!(pipeconf & PIPEACONF_ENABLE))
+               return -EINVAL;
 
        spin_lock_irqsave(&dev_priv->user_irq_lock, irqflags);
        if (IS_I965G(dev))
index 8ccb9c3ab86837c1af77f7ace82648bee7ec7f0b..31c3732b7a690aa7d813f4ecad46a071a7ef684f 100644 (file)
@@ -401,6 +401,8 @@ intel_pipe_set_base(struct drm_crtc *crtc, int x, int y,
        I915_WRITE(dspstride, crtc->fb->pitch);
 
        dspcntr = I915_READ(dspcntr_reg);
+       /* Mask out pixel format bits in case we change it */
+       dspcntr &= ~DISPPLANE_PIXFORMAT_MASK;
        switch (crtc->fb->bits_per_pixel) {
        case 8:
                dspcntr |= DISPPLANE_8BPP;
@@ -1014,21 +1016,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
 
        if (bo->size < width * height * 4) {
                DRM_ERROR("buffer is to small\n");
-               drm_gem_object_unreference(bo);
-               return -ENOMEM;
+               ret = -ENOMEM;
+               goto fail;
        }
 
-       if (dev_priv->cursor_needs_physical) {
-               addr = dev->agp->base + obj_priv->gtt_offset;
-       } else {
+       /* we only need to pin inside GTT if cursor is non-phy */
+       if (!dev_priv->cursor_needs_physical) {
+               ret = i915_gem_object_pin(bo, PAGE_SIZE);
+               if (ret) {
+                       DRM_ERROR("failed to pin cursor bo\n");
+                       goto fail;
+               }
                addr = obj_priv->gtt_offset;
-       }
-
-       ret = i915_gem_object_pin(bo, PAGE_SIZE);
-       if (ret) {
-               DRM_ERROR("failed to pin cursor bo\n");
-               drm_gem_object_unreference(bo);
-               return ret;
+       } else {
+               ret = i915_gem_attach_phys_object(dev, bo, (pipe == 0) ? I915_GEM_PHYS_CURSOR_0 : I915_GEM_PHYS_CURSOR_1);
+               if (ret) {
+                       DRM_ERROR("failed to attach phys object\n");
+                       goto fail;
+               }
+               addr = obj_priv->phys_obj->handle->busaddr;
        }
 
        temp = 0;
@@ -1041,14 +1047,25 @@ static int intel_crtc_cursor_set(struct drm_crtc *crtc,
        I915_WRITE(base, addr);
 
        if (intel_crtc->cursor_bo) {
-               i915_gem_object_unpin(intel_crtc->cursor_bo);
+               if (dev_priv->cursor_needs_physical) {
+                       if (intel_crtc->cursor_bo != bo)
+                               i915_gem_detach_phys_object(dev, intel_crtc->cursor_bo);
+               } else
+                       i915_gem_object_unpin(intel_crtc->cursor_bo);
+               mutex_lock(&dev->struct_mutex);
                drm_gem_object_unreference(intel_crtc->cursor_bo);
+               mutex_unlock(&dev->struct_mutex);
        }
 
        intel_crtc->cursor_addr = addr;
        intel_crtc->cursor_bo = bo;
 
        return 0;
+fail:
+       mutex_lock(&dev->struct_mutex);
+       drm_gem_object_unreference(bo);
+       mutex_unlock(&dev->struct_mutex);
+       return ret;
 }
 
 static int intel_crtc_cursor_move(struct drm_crtc *crtc, int x, int y)
index ccecfaf6307b79b97f3c7ab98817020eec804cef..2fafdcc108fe5161cef9e16862fdad2c8c6fd550 100644 (file)
@@ -456,6 +456,13 @@ void intel_lvds_init(struct drm_device *dev)
                dev_priv->panel_fixed_mode =
                        drm_mode_duplicate(dev, dev_priv->vbt_mode);
                mutex_unlock(&dev->mode_config.mutex);
+               if (dev_priv->panel_fixed_mode) {
+                       dev_priv->panel_fixed_mode->type |=
+                               DRM_MODE_TYPE_PREFERRED;
+                       drm_mode_probed_add(connector,
+                                           dev_priv->panel_fixed_mode);
+                       goto out;
+               }
        }
 
        /*
index 10b6ef7587256902ee8f7a469679fe0ed92b806e..11c0f461320eb71390026dfaaae1ceb40b42d86a 100644 (file)
@@ -6,7 +6,7 @@
  *          Title:  MPI Message independent structures and definitions
  *  Creation Date:  July 27, 2000
  *
- *    mpi.h Version:  01.05.13
+ *    mpi.h Version:  01.05.16
  *
  *  Version History
  *  ---------------
@@ -79,6 +79,9 @@
  *  03-27-06  01.05.11  Bumped MPI_HEADER_VERSION_UNIT.
  *  10-11-06  01.05.12  Bumped MPI_HEADER_VERSION_UNIT.
  *  05-24-07  01.05.13  Bumped MPI_HEADER_VERSION_UNIT.
+ *  08-07-07  01.05.14  Bumped MPI_HEADER_VERSION_UNIT.
+ *  01-15-08  01.05.15  Bumped MPI_HEADER_VERSION_UNIT.
+ *  03-28-08  01.05.16  Bumped MPI_HEADER_VERSION_UNIT.
  *  --------------------------------------------------------------------------
  */
 
 /* Note: The major versions of 0xe0 through 0xff are reserved */
 
 /* versioning for this MPI header set */
-#define MPI_HEADER_VERSION_UNIT             (0x10)
+#define MPI_HEADER_VERSION_UNIT             (0x13)
 #define MPI_HEADER_VERSION_DEV              (0x00)
 #define MPI_HEADER_VERSION_UNIT_MASK        (0xFF00)
 #define MPI_HEADER_VERSION_UNIT_SHIFT       (8)
index b2db3330c5910c9f10278da6cd6111355df85ae4..013c7d88194845e170077ea3cc4f2607f3363a4b 100644 (file)
@@ -6,7 +6,7 @@
  *          Title:  MPI Config message, structures, and Pages
  *  Creation Date:  July 27, 2000
  *
- *    mpi_cnfg.h Version:  01.05.15
+ *    mpi_cnfg.h Version:  01.05.18
  *
  *  Version History
  *  ---------------
  *                      Expander Page 0 Flags field.
  *                      Fixed define for
  *                      MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
+ *  08-07-07  01.05.16  Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
+ *                      define.
+ *                      Added BIOS Page 4 structure.
+ *                      Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
+ *                      Physcial Disk Page 1.
+ *  01-15-07  01.05.17  Added additional bit defines for ExtFlags field of
+ *                      Manufacturing Page 4.
+ *                      Added Solid State Drives Supported bit to IOC Page 6
+ *                      Capabilities Flags.
+ *                      Added new value for AccessStatus field of SAS Device
+ *                      Page 0 (_SATA_NEEDS_INITIALIZATION).
+ *  03-28-08  01.05.18  Defined new bits in Manufacturing Page 4 ExtFlags field
+ *                      to control coercion size and the mixing of SAS and SATA
+ *                      SSD drives.
  *  --------------------------------------------------------------------------
  */
 
@@ -686,6 +700,14 @@ typedef struct _CONFIG_PAGE_MANUFACTURING_4
 #define MPI_MANPAGE4_IR_NO_MIX_SAS_SATA                 (0x01)
 
 /* defines for the ExtFlags field */
+#define MPI_MANPAGE4_EXTFLAGS_MASK_COERCION_SIZE        (0x0180)
+#define MPI_MANPAGE4_EXTFLAGS_SHIFT_COERCION_SIZE       (7)
+#define MPI_MANPAGE4_EXTFLAGS_1GB_COERCION_SIZE         (0)
+#define MPI_MANPAGE4_EXTFLAGS_128MB_COERCION_SIZE       (1)
+
+#define MPI_MANPAGE4_EXTFLAGS_NO_MIX_SSD_SAS_SATA       (0x0040)
+#define MPI_MANPAGE4_EXTFLAGS_MIX_SSD_AND_NON_SSD       (0x0020)
+#define MPI_MANPAGE4_EXTFLAGS_DUAL_PORT_SUPPORT         (0x0010)
 #define MPI_MANPAGE4_EXTFLAGS_HIDE_NON_IR_METADATA      (0x0008)
 #define MPI_MANPAGE4_EXTFLAGS_SAS_CACHE_DISABLE         (0x0004)
 #define MPI_MANPAGE4_EXTFLAGS_SATA_CACHE_DISABLE        (0x0002)
@@ -1159,6 +1181,8 @@ typedef struct _CONFIG_PAGE_IOC_6
 
 /* IOC Page 6 Capabilities Flags */
 
+#define MPI_IOCPAGE6_CAP_FLAGS_SSD_SUPPORT              (0x00000020)
+#define MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT  (0x00000010)
 #define MPI_IOCPAGE6_CAP_FLAGS_DISABLE_SMART_POLLING    (0x00000008)
 
 #define MPI_IOCPAGE6_CAP_FLAGS_MASK_METADATA_SIZE       (0x00000006)
@@ -1428,6 +1452,15 @@ typedef struct _CONFIG_PAGE_BIOS_2
 #define MPI_BIOSPAGE2_FORM_SAS_WWN                      (0x05)
 #define MPI_BIOSPAGE2_FORM_ENCLOSURE_SLOT               (0x06)
 
+typedef struct _CONFIG_PAGE_BIOS_4
+{
+    CONFIG_PAGE_HEADER      Header;                     /* 00h */
+    U64                     ReassignmentBaseWWID;       /* 04h */
+} CONFIG_PAGE_BIOS_4, MPI_POINTER PTR_CONFIG_PAGE_BIOS_4,
+  BIOSPage4_t, MPI_POINTER pBIOSPage4_t;
+
+#define MPI_BIOSPAGE4_PAGEVERSION                       (0x00)
+
 
 /****************************************************************************
 *   SCSI Port Config Pages
@@ -2419,6 +2452,15 @@ typedef struct _RAID_PHYS_DISK1_PATH
 #define MPI_RAID_PHYSDISK1_FLAG_BROKEN          (0x0002)
 #define MPI_RAID_PHYSDISK1_FLAG_INVALID         (0x0001)
 
+
+/*
+ * Host code (drivers, BIOS, utilities, etc.) should leave this define set to
+ * one and check Header.PageLength or NumPhysDiskPaths at runtime.
+ */
+#ifndef MPI_RAID_PHYS_DISK1_PATH_MAX
+#define MPI_RAID_PHYS_DISK1_PATH_MAX    (1)
+#endif
+
 typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
 {
     CONFIG_PAGE_HEADER              Header;             /* 00h */
@@ -2426,7 +2468,7 @@ typedef struct _CONFIG_PAGE_RAID_PHYS_DISK_1
     U8                              PhysDiskNum;        /* 05h */
     U16                             Reserved2;          /* 06h */
     U32                             Reserved1;          /* 08h */
-    RAID_PHYS_DISK1_PATH            Path[1];            /* 0Ch */
+    RAID_PHYS_DISK1_PATH            Path[MPI_RAID_PHYS_DISK1_PATH_MAX];/* 0Ch */
 } CONFIG_PAGE_RAID_PHYS_DISK_1, MPI_POINTER PTR_CONFIG_PAGE_RAID_PHYS_DISK_1,
   RaidPhysDiskPage1_t, MPI_POINTER pRaidPhysDiskPage1_t;
 
@@ -2844,6 +2886,7 @@ typedef struct _CONFIG_PAGE_SAS_DEVICE_0
 #define MPI_SAS_DEVICE0_ASTATUS_SATA_INIT_FAILED            (0x01)
 #define MPI_SAS_DEVICE0_ASTATUS_SATA_CAPABILITY_FAILED      (0x02)
 #define MPI_SAS_DEVICE0_ASTATUS_SATA_AFFILIATION_CONFLICT   (0x03)
+#define MPI_SAS_DEVICE0_ASTATUS_SATA_NEEDS_INITIALIZATION   (0x04)
 /* specific values for SATA Init failures */
 #define MPI_SAS_DEVICE0_ASTATUS_SIF_UNKNOWN                 (0x10)
 #define MPI_SAS_DEVICE0_ASTATUS_SIF_AFFILIATION_CONFLICT    (0x11)
index 627acfbb86231fc7ea07fb6b95d2b5e83629382f..7d663ce76f8c90fdeaa193f88381e7afb37cf602 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000-2004 LSI Corporation.
+ *  Copyright (c) 2000-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_fc.h
index 3f15fcfe4a2ea96e1c4ea4bd8d08beaeb26266a7..693e4b511354fb0b227d28c1b517d428667d39f6 100644 (file)
@@ -3,28 +3,28 @@
  MPI Header File Change History
  ==============================
 
- Copyright (c) 2000-2007 LSI Corporation.
+ Copyright (c) 2000-2008 LSI Corporation.
 
  ---------------------------------------
- Header Set Release Version:    01.05.16
- Header Set Release Date:       05-24-07
+ Header Set Release Version:    01.05.19
+ Header Set Release Date:       03-28-08
  ---------------------------------------
 
  Filename               Current version     Prior version
  ----------             ---------------     -------------
- mpi.h                  01.05.13            01.05.12
- mpi_ioc.h              01.05.14            01.05.13
- mpi_cnfg.h             01.05.15            01.05.14
+ mpi.h                  01.05.16            01.05.15
+ mpi_ioc.h              01.05.16            01.05.15
+ mpi_cnfg.h             01.05.18            01.05.17
  mpi_init.h             01.05.09            01.05.09
  mpi_targ.h             01.05.06            01.05.06
  mpi_fc.h               01.05.01            01.05.01
  mpi_lan.h              01.05.01            01.05.01
- mpi_raid.h             01.05.03            01.05.03
+ mpi_raid.h             01.05.05            01.05.05
  mpi_tool.h             01.05.03            01.05.03
  mpi_inb.h              01.05.01            01.05.01
- mpi_sas.h              01.05.04            01.05.04
+ mpi_sas.h              01.05.05            01.05.05
  mpi_type.h             01.05.02            01.05.02
- mpi_history.txt        01.05.14            01.05.14
+ mpi_history.txt        01.05.19            01.05.18
 
 
  *  Date      Version   Description
@@ -96,6 +96,9 @@ mpi.h
  *  03-27-06  01.05.11  Bumped MPI_HEADER_VERSION_UNIT.
  *  10-11-06  01.05.12  Bumped MPI_HEADER_VERSION_UNIT.
  *  05-24-07  01.05.13  Bumped MPI_HEADER_VERSION_UNIT.
+ *  08-07-07  01.05.14  Bumped MPI_HEADER_VERSION_UNIT.
+ *  01-15-08  01.05.15  Bumped MPI_HEADER_VERSION_UNIT.
+ *  03-28-08  01.05.16  Bumped MPI_HEADER_VERSION_UNIT.
  *  --------------------------------------------------------------------------
 
 mpi_ioc.h
@@ -127,7 +130,7 @@ mpi_ioc.h
  *  08-08-01  01.02.01  Original release for v1.2 work.
  *                      New format for FWVersion and ProductId in
  *                      MSG_IOC_FACTS_REPLY and MPI_FW_HEADER.
- *  08-31-01  01.02.02  Added event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and
+ *  08-31-01  01.02.02  Addded event MPI_EVENT_SCSI_DEVICE_STATUS_CHANGE and
  *                      related structure and defines.
  *                      Added event MPI_EVENT_ON_BUS_TIMER_EXPIRED.
  *                      Added MPI_IOCINIT_FLAGS_DISCARD_FW_IMAGE.
@@ -187,7 +190,7 @@ mpi_ioc.h
  *  10-11-06  01.05.12  Added MPI_IOCFACTS_EXCEPT_METADATA_UNSUPPORTED.
  *                      Added MaxInitiators field to PortFacts reply.
  *                      Added SAS Device Status Change ReasonCode for
- *                      asynchronous notification.
+ *                      asynchronous notificaiton.
  *                      Added MPI_EVENT_SAS_EXPANDER_STATUS_CHANGE and event
  *                      data structure.
  *                      Added new ImageType values for FWDownload and FWUpload
@@ -199,6 +202,16 @@ mpi_ioc.h
  *                      added _MULTI_PORT_DOMAIN.
  *  05-24-07  01.05.14  Added Common Boot Block type to FWDownload Request.
  *                      Added Common Boot Block type to FWUpload Request.
+ *  08-07-07  01.05.15  Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
+ *                      Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
+ *                      MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
+ *                      Added SASAddress field to SAS Initiator Device Table
+ *                      Overflow event data structure.
+ *  03-28-08  01.05.16  Added two new ReasonCode values to SAS Device Status
+ *                      Change Event data to indicate completion of internally
+ *                      generated task management.
+ *                      Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
+ *                      Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
  *  --------------------------------------------------------------------------
 
 mpi_cnfg.h
@@ -213,7 +226,7 @@ mpi_cnfg.h
  *                      Added _RESPONSE_ID_MASK definition to SCSI_PORT_1
  *                      page and updated the page version.
  *                      Added Information field and _INFO_PARAMS_NEGOTIATED
- *                      definition to SCSI_DEVICE_0 page.
+ *                      definitionto SCSI_DEVICE_0 page.
  *  06-22-00  01.00.03  Removed batch controls from LAN_0 page and updated the
  *                      page version.
  *                      Added BucketsRemaining to LAN_1 page, redefined the
@@ -496,6 +509,20 @@ mpi_cnfg.h
  *                      Expander Page 0 Flags field.
  *                      Fixed define for
  *                      MPI_SAS_EXPANDER1_DISCINFO_BAD_PHY_DISABLED.
+ *  08-07-07  01.05.16  Added MPI_IOCPAGE6_CAP_FLAGS_MULTIPORT_DRIVE_SUPPORT
+ *                      define.
+ *                      Added BIOS Page 4 structure.
+ *                      Added MPI_RAID_PHYS_DISK1_PATH_MAX define for RAID
+ *                      Physcial Disk Page 1.
+ *  01-15-07  01.05.17  Added additional bit defines for ExtFlags field of
+ *                      Manufacturing Page 4.
+ *                      Added Solid State Drives Supported bit to IOC Page 6
+ *                      Capabilities Flags.
+ *                      Added new value for AccessStatus field of SAS Device
+ *                      Page 0 (_SATA_NEEDS_INITIALIZATION).
+ *  03-28-08  01.05.18  Defined new bits in Manufacturing Page 4 ExtFlags field
+ *                      to control coercion size and the mixing of SAS and SATA
+ *                      SSD drives.
  *  --------------------------------------------------------------------------
 
 mpi_init.h
@@ -661,6 +688,9 @@ mpi_raid.h
  *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
  *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
  *                      associated defines.
+ *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
+ *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
+ *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
  *  --------------------------------------------------------------------------
 
 mpi_tool.h
@@ -694,6 +724,10 @@ mpi_sas.h
  *                      reply.
  *  10-11-06  01.05.04  Fixed the name of a define for Operation field of SAS IO
  *                      Unit Control request.
+ *  01-15-08  01.05.05  Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
+ *                      including adding IOCParameter and IOCParameter value
+ *                      fields to SAS IO Unit Control Request.
+ *                      Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
  *  --------------------------------------------------------------------------
 
 mpi_type.h
@@ -709,20 +743,20 @@ mpi_type.h
 
 mpi_history.txt         Parts list history
 
-Filename    01.05.15   01.05.15
-----------  --------   --------
-mpi.h       01.05.12   01.05.13
-mpi_ioc.h   01.05.13   01.05.14
-mpi_cnfg.h  01.05.14   01.05.15
-mpi_init.h  01.05.09   01.05.09
-mpi_targ.h  01.05.06   01.05.06
-mpi_fc.h    01.05.01   01.05.01
-mpi_lan.h   01.05.01   01.05.01
-mpi_raid.h  01.05.03   01.05.03
-mpi_tool.h  01.05.03   01.05.03
-mpi_inb.h   01.05.01   01.05.01
-mpi_sas.h   01.05.04   01.05.04
-mpi_type.h  01.05.02   01.05.02
+Filename    01.05.19   01.05.18   01.05.17   01.05.16   01.05.15
+----------  --------   --------   --------   --------   --------
+mpi.h       01.05.16   01.05.15   01.05.14   01.05.13   01.05.12
+mpi_ioc.h   01.05.16   01.05.15   01.05.15   01.05.14   01.05.13
+mpi_cnfg.h  01.05.18   01.05.17   01.05.16   01.05.15   01.05.14
+mpi_init.h  01.05.09   01.05.09   01.05.09   01.05.09   01.05.09
+mpi_targ.h  01.05.06   01.05.06   01.05.06   01.05.06   01.05.06
+mpi_fc.h    01.05.01   01.05.01   01.05.01   01.05.01   01.05.01
+mpi_lan.h   01.05.01   01.05.01   01.05.01   01.05.01   01.05.01
+mpi_raid.h  01.05.05   01.05.05   01.05.04   01.05.03   01.05.03
+mpi_tool.h  01.05.03   01.05.03   01.05.03   01.05.03   01.05.03
+mpi_inb.h   01.05.01   01.05.01   01.05.01   01.05.01   01.05.01
+mpi_sas.h   01.05.05   01.05.05   01.05.04   01.05.04   01.05.04
+mpi_type.h  01.05.02   01.05.02   01.05.02   01.05.02   01.05.02
 
 Filename    01.05.14   01.05.13   01.05.12   01.05.11   01.05.10   01.05.09
 ----------  --------   --------   --------   --------   --------   --------
index a9e3693601a7e57daeea38128256020328490b27..4295d062caa747b3822aac1a07807bc9266d0292 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000-2007 LSI Corporation.
+ *  Copyright (c) 2000-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_init.h
index 5cbb6bd048e146ae2e508661edfe9272b82ae31c..8faa4fab7b89d89df0cacab602fd7e00d49ffdff 100644 (file)
@@ -1,12 +1,12 @@
 /*
- *  Copyright (c) 2000-2007 LSI Corporation.
+ *  Copyright (c) 2000-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_ioc.h
  *          Title:  MPI IOC, Port, Event, FW Download, and FW Upload messages
  *  Creation Date:  August 11, 2000
  *
- *    mpi_ioc.h Version:  01.05.14
+ *    mpi_ioc.h Version:  01.05.16
  *
  *  Version History
  *  ---------------
  *                      added _MULTI_PORT_DOMAIN.
  *  05-24-07  01.05.14  Added Common Boot Block type to FWDownload Request.
  *                      Added Common Boot Block type to FWUpload Request.
+ *  08-07-07  01.05.15  Added MPI_EVENT_SAS_INIT_RC_REMOVED define.
+ *                      Added MPI_EVENT_IR2_RC_DUAL_PORT_ADDED and
+ *                      MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED for IR2 event data.
+ *                      Added SASAddress field to SAS Initiator Device Table
+ *                      Overflow event data structure.
+ *  03-28-08  01.05.16  Added two new ReasonCode values to SAS Device Status
+ *                      Change Event data to indicate completion of internally
+ *                      generated task management.
+ *                      Added MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE define.
+ *                      Added MPI_EVENT_SAS_INIT_RC_INACCESSIBLE define.
  *  --------------------------------------------------------------------------
  */
 
@@ -612,6 +622,8 @@ typedef struct _EVENT_DATA_SAS_DEVICE_STATUS_CHANGE
 #define MPI_EVENT_SAS_DEV_STAT_RC_CLEAR_TASK_SET_INTERNAL   (0x0B)
 #define MPI_EVENT_SAS_DEV_STAT_RC_QUERY_TASK_INTERNAL       (0x0C)
 #define MPI_EVENT_SAS_DEV_STAT_RC_ASYNC_NOTIFICATION        (0x0D)
+#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_INTERNAL_DEV_RESET   (0x0E)
+#define MPI_EVENT_SAS_DEV_STAT_RC_CMPL_TASK_ABORT_INTERNAL  (0x0F)
 
 
 /* SCSI Event data for Queue Full event */
@@ -708,6 +720,8 @@ typedef struct _MPI_EVENT_DATA_IR2
 #define MPI_EVENT_IR2_RC_PD_REMOVED                 (0x05)
 #define MPI_EVENT_IR2_RC_FOREIGN_CFG_DETECTED       (0x06)
 #define MPI_EVENT_IR2_RC_REBUILD_MEDIUM_ERROR       (0x07)
+#define MPI_EVENT_IR2_RC_DUAL_PORT_ADDED            (0x08)
+#define MPI_EVENT_IR2_RC_DUAL_PORT_REMOVED          (0x09)
 
 /* defines for logical disk states */
 #define MPI_LD_STATE_OPTIMAL                        (0x00)
@@ -867,6 +881,7 @@ typedef struct _EVENT_DATA_DISCOVERY_ERROR
 #define MPI_EVENT_DSCVRY_ERR_DS_UNSUPPORTED_DEVICE          (0x00000800)
 #define MPI_EVENT_DSCVRY_ERR_DS_MAX_SATA_TARGETS            (0x00001000)
 #define MPI_EVENT_DSCVRY_ERR_DS_MULTI_PORT_DOMAIN           (0x00002000)
+#define MPI_EVENT_DSCVRY_ERR_DS_SATA_INIT_FAILURE           (0x00004000)
 
 /* SAS SMP Error Event data */
 
@@ -902,6 +917,8 @@ typedef struct _EVENT_DATA_SAS_INIT_DEV_STATUS_CHANGE
 
 /* defines for the ReasonCode field of the SAS Initiator Device Status Change event */
 #define MPI_EVENT_SAS_INIT_RC_ADDED                 (0x01)
+#define MPI_EVENT_SAS_INIT_RC_REMOVED               (0x02)
+#define MPI_EVENT_SAS_INIT_RC_INACCESSIBLE          (0x03)
 
 /* SAS Initiator Device Table Overflow Event data */
 
@@ -910,6 +927,7 @@ typedef struct _EVENT_DATA_SAS_INIT_TABLE_OVERFLOW
     U8                      MaxInit;                    /* 00h */
     U8                      CurrentInit;                /* 01h */
     U16                     Reserved1;                  /* 02h */
+    U64                     SASAddress;                 /* 04h */
 } EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
   MPI_POINTER PTR_EVENT_DATA_SAS_INIT_TABLE_OVERFLOW,
   MpiEventDataSasInitTableOverflow_t,
index 03253b53b7855d8b7a7d279bf677653ab5d3ab16..f41fcb69b359912e6d0e39e0aabffa0999e2a608 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000-2004 LSI Corporation.
+ *  Copyright (c) 2000-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_lan.h
index e4dafcefeecde600d951ea8e95445e875f489352..face6e7acc728109f79827d88094463d7892ce86 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000-2001 LSI Corporation. All rights reserved.
+ *  Copyright (c) 2000-2008 LSI Corporation. All rights reserved.
  *
  *  NAME:           fc_log.h
  *  SUMMARY:        MPI IocLogInfo definitions for the SYMFC9xx chips
index af9da03e95e571f7677f5092d6dd7e123eedd59a..691620dbedd20ddfbac3b75aaa3fb8f109241f41 100644 (file)
@@ -1,6 +1,6 @@
 /***************************************************************************
  *                                                                         *
- *  Copyright 2003 LSI Corporation.  All rights reserved.            *
+ *  Copyright (c) 2000-2008 LSI Corporation.  All rights reserved.         *
  *                                                                         *
  * Description                                                             *
  * ------------                                                            *
@@ -73,6 +73,8 @@
 #define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO          (0x00070004)
 #define IOP_LOGINFO_CODE_TARGET_MODE_ABORT_EXACT_IO_REQ      (0x00070005)
 
+#define IOP_LOGINFO_CODE_LOG_TIMESTAMP_EVENT                 (0x00080000)
+
 /****************************************************************************/
 /* PL LOGINFO_CODE defines, valid if IOC_LOGINFO_ORIGINATOR = PL            */
 /****************************************************************************/
@@ -92,7 +94,7 @@
 #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_OPEN_TIMEOUT_EXP       (0x0000000C)
 #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_UNUSED_0D              (0x0000000D)
 #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_DVTBLE_ACCSS_FAIL      (0x0000000E)
-#define PL_LOGINFO_SUB CODE_OPEN_FAIL_BAD_DEST               (0x00000011)
+#define PL_LOGINFO_SUB_CODE_OPEN_FAIL_BAD_DEST               (0x00000011)
 #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RATE_NOT_SUPP          (0x00000012)
 #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_PROT_NOT_SUPP          (0x00000013)
 #define PL_LOGINFO_SUB_CODE_OPEN_FAIL_RESERVED_ABANDON0      (0x00000014)
 
 #define PL_LOGINFO_SUB_CODE_INVALID_SGL                      (0x00000200)
 #define PL_LOGINFO_SUB_CODE_WRONG_REL_OFF_OR_FRAME_LENGTH    (0x00000300)
-#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR                 (0x00000400) /* Bits 0-3 encode Transport Status Register (offset 0x08) */
-                                                                          /* Bit 0 is Status Bit 0: FrameXferErr */
-                                                                          /* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
-                                                                          /* Bit 3 is Status Bit 18 WriteDataLengthGTDataLengthErr */
+#define PL_LOGINFO_SUB_CODE_FRAME_XFER_ERROR                 (0x00000400)
+/* Bits 0-3 encode Transport Status Register (offset 0x08) */
+/* Bit 0 is Status Bit 0: FrameXferErr */
+/* Bit 1 & 2 are Status Bits 16 and 17: FrameXmitErrStatus */
+/* Bit 3 is Status Bit 18 WriteDataLenghtGTDataLengthErr */
 
 #define PL_LOGINFO_SUB_CODE_TX_FM_CONNECTED_LOW              (0x00000500)
 #define PL_LOGINFO_SUB_CODE_SATA_NON_NCQ_RW_ERR_BIT_SET      (0x00000600)
 #define PL_LOGINFO_SUB_CODE_DISCOVERY_REMOTE_SEP_RESET       (0x00000E01)
 #define PL_LOGINFO_SUB_CODE_SECOND_OPEN                      (0x00000F00)
 #define PL_LOGINFO_SUB_CODE_DSCVRY_SATA_INIT_TIMEOUT         (0x00001000)
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_SATA_CONNECTION         (0x00002000)
+/* not currently used in mainline */
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK              (0x00003000)
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_STUCK_LINK_AIP          (0x00004000)
+#define PL_LOGINFO_SUB_CODE_BREAK_ON_INCOMPLETE_BREAK_RCVD   (0x00005000)
 
 #define PL_LOGINFO_CODE_ENCL_MGMT_SMP_FRAME_FAILURE          (0x00200000) /* Can't get SMP Frame */
 #define PL_LOGINFO_CODE_ENCL_MGMT_SMP_READ_ERROR             (0x00200010) /* Error occured on SMP Read */
 #define IR_LOGINFO_VOLUME_ACTIVATE_VOLUME_FAILED               (0x00010014)
 /* Activation failed trying to import the volume */
 #define IR_LOGINFO_VOLUME_ACTIVATING_IMPORT_VOLUME_FAILED      (0x00010015)
+/* Activation failed trying to import the volume */
+#define IR_LOGINFO_VOLUME_ACTIVATING_TOO_MANY_PHYS_DISKS       (0x00010016)
 
 /* Phys Disk failed, too many phys disks */
 #define IR_LOGINFO_PHYSDISK_CREATE_TOO_MANY_DISKS              (0x00010020)
 /* Compatibility Error : IME size limited to < 2TB */
 #define IR_LOGINFO_COMPAT_ERROR_IME_VOL_NOT_CURRENTLY_SUPPORTED (0x0001003D)
 
+/* Device Firmware Update: DFU can only be started once */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DFU_IN_PROGRESS            (0x00010050)
+/* Device Firmware Update: Volume must be Optimal/Active/non-Quiesced */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_DEVICE_IN_INVALID_STATE    (0x00010051)
+/* Device Firmware Update: DFU Timeout cannot be zero */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_INVALID_TIMEOUT            (0x00010052)
+/* Device Firmware Update: CREATE TIMER FAILED */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_NO_TIMERS                  (0x00010053)
+/* Device Firmware Update: Failed to read SAS_IO_UNIT_PG_1 */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_READING_CFG_PAGE           (0x00010054)
+/* Device Firmware Update: Invalid SAS_IO_UNIT_PG_1 value(s) */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_PORT_IO_TIMEOUTS_REQUIRED  (0x00010055)
+/* Device Firmware Update: Unable to allocate memory for page */
+#define IR_LOGINFO_DEV_FW_UPDATE_ERR_ALLOC_CFG_PAGE             (0x00010056)
+
 
 /****************************************************************************/
 /* Defines for convenience                                                  */
index 2856108421d71fa1b88d73a45e7f38765cf012d8..add60cc85be136148f7f2649e198026cf415d336 100644 (file)
@@ -1,12 +1,12 @@
 /*
- *  Copyright (c) 2001-2007 LSI Corporation.
+ *  Copyright (c) 2001-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_raid.h
  *          Title:  MPI RAID message and structures
  *  Creation Date:  February 27, 2001
  *
- *    mpi_raid.h Version:  01.05.03
+ *    mpi_raid.h Version:  01.05.05
  *
  *  Version History
  *  ---------------
@@ -34,6 +34,9 @@
  *                      _SET_RESYNC_RATE and _SET_DATA_SCRUB_RATE.
  *  02-28-07  01.05.03  Added new RAID Action, Device FW Update Mode, and
  *                      associated defines.
+ *  08-07-07  01.05.04  Added Disable Full Rebuild bit to the ActionDataWord
+ *                      for the RAID Action MPI_RAID_ACTION_DISABLE_VOLUME.
+ *  01-15-08  01.05.05  Added define for MPI_RAID_ACTION_SET_VOLUME_NAME.
  *  --------------------------------------------------------------------------
  */
 
@@ -93,6 +96,7 @@ typedef struct _MSG_RAID_ACTION
 #define MPI_RAID_ACTION_SET_RESYNC_RATE             (0x13)
 #define MPI_RAID_ACTION_SET_DATA_SCRUB_RATE         (0x14)
 #define MPI_RAID_ACTION_DEVICE_FW_UPDATE_MODE       (0x15)
+#define MPI_RAID_ACTION_SET_VOLUME_NAME             (0x16)
 
 /* ActionDataWord defines for use with MPI_RAID_ACTION_CREATE_VOLUME action */
 #define MPI_RAID_ACTION_ADATA_DO_NOT_SYNC           (0x00000001)
@@ -105,6 +109,9 @@ typedef struct _MSG_RAID_ACTION
 #define MPI_RAID_ACTION_ADATA_KEEP_LBA0             (0x00000000)
 #define MPI_RAID_ACTION_ADATA_ZERO_LBA0             (0x00000002)
 
+/* ActionDataWord defines for use with MPI_RAID_ACTION_DISABLE_VOLUME action */
+#define MPI_RAID_ACTION_ADATA_DISABLE_FULL_REBUILD  (0x00000001)
+
 /* ActionDataWord defines for use with MPI_RAID_ACTION_ACTIVATE_VOLUME action */
 #define MPI_RAID_ACTION_ADATA_INACTIVATE_ALL        (0x00000001)
 
index 33fca83cefc24f86286712979c4102d4ea71a3cc..ab410036bbfccc9514fad1a58b3437d26a89afb0 100644 (file)
@@ -1,12 +1,12 @@
 /*
- *  Copyright (c) 2004-2006 LSI Corporation.
+ *  Copyright (c) 2004-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_sas.h
  *          Title:  MPI Serial Attached SCSI structures and definitions
  *  Creation Date:  August 19, 2004
  *
- *    mpi_sas.h Version:  01.05.04
+ *    mpi_sas.h Version:  01.05.05
  *
  *  Version History
  *  ---------------
  *                      reply.
  *  10-11-06  01.05.04  Fixed the name of a define for Operation field of SAS IO
  *                      Unit Control request.
+ *  01-15-08  01.05.05  Added support for MPI_SAS_OP_SET_IOC_PARAMETER,
+ *                      including adding IOCParameter and IOCParameter value
+ *                      fields to SAS IO Unit Control Request.
+ *                      Added MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC define.
  *  --------------------------------------------------------------------------
  */
 
@@ -60,6 +64,8 @@
  * Values for the SAS DeviceInfo field used in SAS Device Status Change Event
  * data and SAS IO Unit Configuration pages.
  */
+#define MPI_SAS_DEVICE_INFO_PRODUCT_SPECIFIC    (0xF0000000)
+
 #define MPI_SAS_DEVICE_INFO_SEP                 (0x00004000)
 #define MPI_SAS_DEVICE_INFO_ATAPI_DEVICE        (0x00002000)
 #define MPI_SAS_DEVICE_INFO_LSI_DEVICE          (0x00001000)
@@ -216,7 +222,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
     U8                      ChainOffset;        /* 02h */
     U8                      Function;           /* 03h */
     U16                     DevHandle;          /* 04h */
-    U8                      Reserved3;          /* 06h */
+    U8                      IOCParameter;       /* 06h */
     U8                      MsgFlags;           /* 07h */
     U32                     MsgContext;         /* 08h */
     U8                      TargetID;           /* 0Ch */
@@ -225,7 +231,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
     U8                      PrimFlags;          /* 0Fh */
     U32                     Primitive;          /* 10h */
     U64                     SASAddress;         /* 14h */
-    U32                     Reserved4;          /* 1Ch */
+    U32                     IOCParameterValue;  /* 1Ch */
 } MSG_SAS_IOUNIT_CONTROL_REQUEST, MPI_POINTER PTR_MSG_SAS_IOUNIT_CONTROL_REQUEST,
   SasIoUnitControlRequest_t, MPI_POINTER pSasIoUnitControlRequest_t;
 
@@ -241,6 +247,8 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REQUEST
 #define MPI_SAS_OP_TRANSMIT_PORT_SELECT_SIGNAL  (0x0C)
 #define MPI_SAS_OP_TRANSMIT_REMOVE_DEVICE       (0x0D)  /* obsolete name */
 #define MPI_SAS_OP_REMOVE_DEVICE                (0x0D)
+#define MPI_SAS_OP_SET_IOC_PARAMETER            (0x0E)
+#define MPI_SAS_OP_PRODUCT_SPECIFIC_MIN         (0x80)
 
 /* values for the PrimFlags field */
 #define MPI_SAS_PRIMFLAGS_SINGLE                (0x08)
@@ -256,7 +264,7 @@ typedef struct _MSG_SAS_IOUNIT_CONTROL_REPLY
     U8                      MsgLength;          /* 02h */
     U8                      Function;           /* 03h */
     U16                     DevHandle;          /* 04h */
-    U8                      Reserved3;          /* 06h */
+    U8                      IOCParameter;       /* 06h */
     U8                      MsgFlags;           /* 07h */
     U32                     MsgContext;         /* 08h */
     U16                     Reserved4;          /* 0Ch */
index ff8c37d3fdcb8e6a4fd660dddcaa70942cbb5186..c3dea7f6909d8d9053cb8251fbcdef5554b65ad1 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2000-2004 LSI Corporation.
+ *  Copyright (c) 2000-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_targ.h
index 8834ae6ce0f2b7cd66691729032829c5147f0f8d..53cd715aa7e4c4933f1dc8d63e30ee4fc41b4311 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  Copyright (c) 2001-2005 LSI Corporation.
+ *  Copyright (c) 2001-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_tool.h
index 08dad9c1e4465e9bd3db4c03fe4c16bfeb0df621..888b26dbc41345dd08fd461c13b80b96f8dd7a52 100644 (file)
@@ -1,12 +1,12 @@
 /*
- *  Copyright (c) 2000-2004 LSI Corporation.
+ *  Copyright (c) 2000-2008 LSI Corporation.
  *
  *
  *           Name:  mpi_type.h
  *          Title:  MPI Basic type definitions
  *  Creation Date:  June 6, 2000
  *
- *    mpi_type.h Version:  01.05.01
+ *    mpi_type.h Version:  01.05.02
  *
  *  Version History
  *  ---------------
index c4e8b9aa3827b3c46b1c2f8cc80c9a98ba834449..96ac88317b8ecbadd702a3934c883b579e50aa49 100644 (file)
@@ -79,9 +79,22 @@ MODULE_VERSION(my_VERSION);
 /*
  *  cmd line parameters
  */
-static int mpt_msi_enable = -1;
-module_param(mpt_msi_enable, int, 0);
-MODULE_PARM_DESC(mpt_msi_enable, " MSI Support Enable (default=0)");
+
+static int mpt_msi_enable_spi;
+module_param(mpt_msi_enable_spi, int, 0);
+MODULE_PARM_DESC(mpt_msi_enable_spi, " Enable MSI Support for SPI \
+               controllers (default=0)");
+
+static int mpt_msi_enable_fc;
+module_param(mpt_msi_enable_fc, int, 0);
+MODULE_PARM_DESC(mpt_msi_enable_fc, " Enable MSI Support for FC \
+               controllers (default=0)");
+
+static int mpt_msi_enable_sas;
+module_param(mpt_msi_enable_sas, int, 1);
+MODULE_PARM_DESC(mpt_msi_enable_sas, " Enable MSI Support for SAS \
+               controllers (default=1)");
+
 
 static int mpt_channel_mapping;
 module_param(mpt_channel_mapping, int, 0);
@@ -91,7 +104,17 @@ static int mpt_debug_level;
 static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
 module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
                  &mpt_debug_level, 0600);
-MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)");
+MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h \
+       - (default=0)");
+
+int mpt_fwfault_debug;
+EXPORT_SYMBOL(mpt_fwfault_debug);
+module_param_call(mpt_fwfault_debug, param_set_int, param_get_int,
+         &mpt_fwfault_debug, 0600);
+MODULE_PARM_DESC(mpt_fwfault_debug, "Enable detection of Firmware fault"
+       " and halt Firmware on fault - (default=0)");
+
+
 
 #ifdef MFCNT
 static int mfcounter = 0;
@@ -1751,16 +1774,25 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                ioc->bus_type = SAS;
        }
 
-       if (mpt_msi_enable == -1) {
-               /* Enable on SAS, disable on FC and SPI */
-               if (ioc->bus_type == SAS)
-                       ioc->msi_enable = 1;
-               else
-                       ioc->msi_enable = 0;
-       } else
-               /* follow flag: 0 - disable; 1 - enable */
-               ioc->msi_enable = mpt_msi_enable;
 
+       switch (ioc->bus_type) {
+
+       case SAS:
+               ioc->msi_enable = mpt_msi_enable_sas;
+               break;
+
+       case SPI:
+               ioc->msi_enable = mpt_msi_enable_spi;
+               break;
+
+       case FC:
+               ioc->msi_enable = mpt_msi_enable_fc;
+               break;
+
+       default:
+               ioc->msi_enable = 0;
+               break;
+       }
        if (ioc->errata_flag_1064)
                pci_disable_io_access(pdev);
 
@@ -6313,6 +6345,33 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
        *size = y;
 }
 
+
+/**
+ *     mpt_halt_firmware - Halts the firmware if it is operational and panic
+ *     the kernel
+ *     @ioc: Pointer to MPT_ADAPTER structure
+ *
+ **/
+void
+mpt_halt_firmware(MPT_ADAPTER *ioc)
+{
+       u32      ioc_raw_state;
+
+       ioc_raw_state = mpt_GetIocState(ioc, 0);
+
+       if ((ioc_raw_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_FAULT) {
+               printk(MYIOC_s_ERR_FMT "IOC is in FAULT state (%04xh)!!!\n",
+                       ioc->name, ioc_raw_state & MPI_DOORBELL_DATA_MASK);
+               panic("%s: IOC Fault (%04xh)!!!\n", ioc->name,
+                       ioc_raw_state & MPI_DOORBELL_DATA_MASK);
+       } else {
+               CHIPREG_WRITE32(&ioc->chip->Doorbell, 0xC0FFEE00);
+               panic("%s: Firmware is halted due to command timeout\n",
+                       ioc->name);
+       }
+}
+EXPORT_SYMBOL(mpt_halt_firmware);
+
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /*
  *     Reset Handling
@@ -6345,6 +6404,8 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
        printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name);
        printk("MF count 0x%x !\n", ioc->mfcnt);
 #endif
+       if (mpt_fwfault_debug)
+               mpt_halt_firmware(ioc);
 
        /* Reset the adapter. Prevent more than 1 call to
         * mpt_do_ioc_recovery at any instant in time.
index dff048cfa101d78d09a878f1845d3480e88b5388..b3e981d2a506fd6aeabd27795e7b492eb466344a 100644 (file)
@@ -922,11 +922,14 @@ extern void        mpt_free_fw_memory(MPT_ADAPTER *ioc);
 extern int      mpt_findImVolumes(MPT_ADAPTER *ioc);
 extern int      mptbase_sas_persist_operation(MPT_ADAPTER *ioc, u8 persist_opcode);
 extern int      mpt_raid_phys_disk_pg0(MPT_ADAPTER *ioc, u8 phys_disk_num, pRaidPhysDiskPage0_t phys_disk);
+extern void     mpt_halt_firmware(MPT_ADAPTER *ioc);
+
 
 /*
  *  Public data decl's...
  */
 extern struct list_head          ioc_list;
+extern int mpt_fwfault_debug;
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 #endif         /* } __KERNEL__ */
index ee090413e598e4254cad01d211e465e46e081f48..e62c6bc4ad33ec83407a002a1549a5edd49cdc90 100644 (file)
@@ -1846,6 +1846,9 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
        if (hd->timeouts < -1)
                hd->timeouts++;
 
+       if (mpt_fwfault_debug)
+               mpt_halt_firmware(ioc);
+
        /* Most important!  Set TaskMsgContext to SCpnt's MsgContext!
         * (the IO to be ABORT'd)
         *
index c12f6c7906980fba382d4b42fcc9d02305248c18..e491fdedf705279c98898e3d647bcf12d596b596 100644 (file)
@@ -1260,15 +1260,14 @@ void pci_pm_init(struct pci_dev *dev)
        /* find PCI PM capability in list */
        pm = pci_find_capability(dev, PCI_CAP_ID_PM);
        if (!pm)
-               goto Exit;
-
+               return;
        /* Check device's ability to generate PME# */
        pci_read_config_word(dev, pm + PCI_PM_PMC, &pmc);
 
        if ((pmc & PCI_PM_CAP_VER_MASK) > 3) {
                dev_err(&dev->dev, "unsupported PM cap regs version (%u)\n",
                        pmc & PCI_PM_CAP_VER_MASK);
-               goto Exit;
+               return;
        }
 
        dev->pm_cap = pm;
@@ -1307,9 +1306,6 @@ void pci_pm_init(struct pci_dev *dev)
        } else {
                dev->pme_support = 0;
        }
-
- Exit:
-       pci_update_current_state(dev, PCI_D0);
 }
 
 /**
index 841f460edbc40f41571ac83f4db08207b04e33e4..07829009a8bec0110ff397f34ddc8dceba65f800 100644 (file)
@@ -4912,7 +4912,7 @@ static int ipr_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
        if (res && ipr_is_gata(res)) {
                if (cmd == HDIO_GET_IDENTITY)
                        return -ENOTTY;
-               return ata_scsi_ioctl(sdev, cmd, arg);
+               return ata_sas_scsi_ioctl(res->sata_port->ap, sdev, cmd, arg);
        }
 
        return -EINVAL;
index a745f91d292846ad5302bb21a500814222ca61cf..e7705d3532c99bbe703099afe0af5181ec1cd049 100644 (file)
@@ -177,7 +177,6 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
                           struct iscsi_segment *segment, int recv,
                           unsigned copied)
 {
-       static unsigned char padbuf[ISCSI_PAD_LEN];
        struct scatterlist sg;
        unsigned int pad;
 
@@ -233,7 +232,7 @@ int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn,
                        debug_tcp("consume %d pad bytes\n", pad);
                        segment->total_size += pad;
                        segment->size = pad;
-                       segment->data = padbuf;
+                       segment->data = segment->padbuf;
                        return 0;
                }
        }
index 744838780ada207964f5b8ffbc4749d6c098ae57..1c558d3bce18c4817623078944e86557eb3adb9f 100644 (file)
@@ -717,7 +717,7 @@ int sas_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
        struct domain_device *dev = sdev_to_domain_dev(sdev);
 
        if (dev_is_sata(dev))
-               return ata_scsi_ioctl(sdev, cmd, arg);
+               return ata_sas_scsi_ioctl(dev->sata_dev.ap, sdev, cmd, arg);
 
        return -EINVAL;
 }
index 2d4f32b4df5c831caccd46e0f73c8d2a8b750942..9ad4d0968e5c87b38045c60e08cd6f244aa0ff5b 100644 (file)
@@ -1258,35 +1258,48 @@ qla2x00_init_rings(scsi_qla_host_t *vha)
 {
        int     rval;
        unsigned long flags = 0;
-       int cnt;
+       int cnt, que;
        struct qla_hw_data *ha = vha->hw;
-       struct req_que *req = ha->req_q_map[0];
-       struct rsp_que *rsp = ha->rsp_q_map[0];
+       struct req_que *req;
+       struct rsp_que *rsp;
+       struct scsi_qla_host *vp;
        struct mid_init_cb_24xx *mid_init_cb =
            (struct mid_init_cb_24xx *) ha->init_cb;
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
 
        /* Clear outstanding commands array. */
-       for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
-               req->outstanding_cmds[cnt] = NULL;
+       for (que = 0; que < ha->max_queues; que++) {
+               req = ha->req_q_map[que];
+               if (!req)
+                       continue;
+               for (cnt = 0; cnt < MAX_OUTSTANDING_COMMANDS; cnt++)
+                       req->outstanding_cmds[cnt] = NULL;
 
-       req->current_outstanding_cmd = 0;
+               req->current_outstanding_cmd = 0;
 
-       /* Clear RSCN queue. */
-       vha->rscn_in_ptr = 0;
-       vha->rscn_out_ptr = 0;
+               /* Initialize firmware. */
+               req->ring_ptr  = req->ring;
+               req->ring_index    = 0;
+               req->cnt      = req->length;
+       }
 
-       /* Initialize firmware. */
-       req->ring_ptr  = req->ring;
-       req->ring_index    = 0;
-       req->cnt      = req->length;
-       rsp->ring_ptr = rsp->ring;
-       rsp->ring_index    = 0;
+       for (que = 0; que < ha->max_queues; que++) {
+               rsp = ha->rsp_q_map[que];
+               if (!rsp)
+                       continue;
+               rsp->ring_ptr = rsp->ring;
+               rsp->ring_index    = 0;
 
-       /* Initialize response queue entries */
-       qla2x00_init_response_q_entries(rsp);
+               /* Initialize response queue entries */
+               qla2x00_init_response_q_entries(rsp);
+       }
 
+       /* Clear RSCN queue. */
+       list_for_each_entry(vp, &ha->vp_list, list) {
+               vp->rscn_in_ptr = 0;
+               vp->rscn_out_ptr = 0;
+       }
        ha->isp_ops->config_rings(vha);
 
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -3212,8 +3225,8 @@ qla2x00_loop_resync(scsi_qla_host_t *vha)
        int rval = QLA_SUCCESS;
        uint32_t wait_time;
        struct qla_hw_data *ha = vha->hw;
-       struct req_que *req = ha->req_q_map[0];
-       struct rsp_que *rsp = ha->rsp_q_map[0];
+       struct req_que *req = ha->req_q_map[vha->req_ques[0]];
+       struct rsp_que *rsp = req->rsp;
 
        atomic_set(&vha->loop_state, LOOP_UPDATE);
        clear_bit(ISP_ABORT_RETRY, &vha->dpc_flags);
@@ -3492,6 +3505,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
                }
                req = ha->req_q_map[i];
                if (req) {
+               /* Clear outstanding commands array. */
                        req->options &= ~BIT_0;
                        ret = qla25xx_init_req_que(base_vha, req, req->options);
                        if (ret != QLA_SUCCESS)
@@ -3500,7 +3514,7 @@ qla25xx_init_queues(struct qla_hw_data *ha)
                                                req->id));
                        else
                                DEBUG2_17(printk(KERN_WARNING
-                                       "%s Rsp que:%d inited\n", __func__,
+                                       "%s Req que:%d inited\n", __func__,
                                                req->id));
                }
        }
@@ -4151,8 +4165,8 @@ qla24xx_configure_vhba(scsi_qla_host_t *vha)
        uint16_t mb[MAILBOX_REGISTER_COUNT];
        struct qla_hw_data *ha = vha->hw;
        struct scsi_qla_host *base_vha = pci_get_drvdata(ha->pdev);
-       struct req_que *req = ha->req_q_map[0];
-       struct rsp_que *rsp = ha->rsp_q_map[0];
+       struct req_que *req = ha->req_q_map[vha->req_ques[0]];
+       struct rsp_que *rsp = req->rsp;
 
        if (!vha->vp_idx)
                return -EINVAL;
index 886323130fcc65fa1c91fb35d4510482cfc9b2a0..f53179c46423adb449c2480aa205bcd2b868c17a 100644 (file)
@@ -629,6 +629,7 @@ qla25xx_create_req_que(struct qla_hw_data *ha, uint16_t options,
        req->ring_index = 0;
        req->cnt = req->length;
        req->id = que_id;
+       req->max_q_depth = ha->req_q_map[0]->max_q_depth;
        mutex_unlock(&ha->vport_lock);
 
        ret = qla25xx_init_req_que(base_vha, req, options);
index 4a71f522f9259308a9d3d08f3d9f54ac9fada1be..cf32653fe01a2317aee14dae3856c2aee8017953 100644 (file)
@@ -1158,8 +1158,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
        struct req_que *req;
 
        spin_lock_irqsave(&ha->hardware_lock, flags);
-       for (que = 0; que < QLA_MAX_HOST_QUES; que++) {
-               req = ha->req_q_map[vha->req_ques[que]];
+       for (que = 0; que < ha->max_queues; que++) {
+               req = ha->req_q_map[que];
                if (!req)
                        continue;
                for (cnt = 1; cnt < MAX_OUTSTANDING_COMMANDS; cnt++) {
@@ -1193,7 +1193,7 @@ qla2xxx_slave_configure(struct scsi_device *sdev)
        scsi_qla_host_t *vha = shost_priv(sdev->host);
        struct qla_hw_data *ha = vha->hw;
        struct fc_rport *rport = starget_to_rport(sdev->sdev_target);
-       struct req_que *req = ha->req_q_map[0];
+       struct req_que *req = ha->req_q_map[vha->req_ques[0]];
 
        if (sdev->tagged_supported)
                scsi_activate_tcq(sdev, req->max_q_depth);
@@ -1998,7 +1998,6 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
        return 0;
 
 probe_failed:
-       qla2x00_free_que(ha, req, rsp);
        qla2x00_free_device(base_vha);
 
        scsi_host_put(base_vha->host);
index 42e72a2c1f98b5521167a0b746a8a46a58f6e2aa..cbcd3f681b62103d3871dd5816b918f30880b7a6 100644 (file)
@@ -1095,7 +1095,8 @@ EXPORT_SYMBOL(__starget_for_each_device);
  * Description: Looks up the scsi_device with the specified @lun for a given
  * @starget.  The returned scsi_device does not have an additional
  * reference.  You must hold the host's host_lock over this call and
- * any access to the returned scsi_device.
+ * any access to the returned scsi_device. A scsi_device in state
+ * SDEV_DEL is skipped.
  *
  * Note:  The only reason why drivers should use this is because
  * they need to access the device list in irq context.  Otherwise you
@@ -1107,6 +1108,8 @@ struct scsi_device *__scsi_device_lookup_by_target(struct scsi_target *starget,
        struct scsi_device *sdev;
 
        list_for_each_entry(sdev, &starget->devices, same_target_siblings) {
+               if (sdev->sdev_state == SDEV_DEL)
+                       continue;
                if (sdev->lun ==lun)
                        return sdev;
        }
index 4969e4ec75ea9f7b985c6c979763d8eae40bcb93..099b5455bbce287f60ef888566913616f13e9908 100644 (file)
@@ -224,6 +224,7 @@ static struct {
        {"SGI", "TP9100", "*", BLIST_REPORTLUN2},
        {"SGI", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
        {"IBM", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
+       {"SUN", "Universal Xport", "*", BLIST_NO_ULD_ATTACH},
        {"SMSC", "USB 2 HS-CF", NULL, BLIST_SPARSELUN | BLIST_INQUIRY_36},
        {"SONY", "CD-ROM CDU-8001", NULL, BLIST_BORKEN},
        {"SONY", "TSL", NULL, BLIST_FORCELUN},          /* DDS3 & DDS4 autoloaders */
index 0acb07f31fa43b6559214611b866f4d8a9d3bd12..47809ac94bc38c8d19387c416e4864934e40e1d7 100644 (file)
@@ -395,7 +395,7 @@ struct drm_connector_funcs {
        void (*save)(struct drm_connector *connector);
        void (*restore)(struct drm_connector *connector);
        enum drm_connector_status (*detect)(struct drm_connector *connector);
-       void (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
+       int (*fill_modes)(struct drm_connector *connector, uint32_t max_width, uint32_t max_height);
        int (*set_property)(struct drm_connector *connector, struct drm_property *property,
                             uint64_t val);
        void (*destroy)(struct drm_connector *connector);
index 4bc04cf460a7ee597f48bb05067a1bc59c7947eb..0c6f0e11b41bcfc823d94571c3be853087440e5a 100644 (file)
@@ -88,7 +88,7 @@ struct drm_connector_helper_funcs {
        struct drm_encoder *(*best_encoder)(struct drm_connector *connector);
 };
 
-extern void drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
+extern int drm_helper_probe_single_connector_modes(struct drm_connector *connector, uint32_t maxX, uint32_t maxY);
 extern void drm_helper_disable_unused_functions(struct drm_device *dev);
 extern int drm_helper_hotplug_stage_two(struct drm_device *dev);
 extern bool drm_helper_initial_config(struct drm_device *dev, bool can_grow);
index b6b8a7f3ec66064778cf2b63b6eaa4a03dc25495..2c6bd66209ff6a076464b206662d7a6cf7730adb 100644 (file)
@@ -401,12 +401,14 @@ enum {
                                  ATA_TIMING_CYC8B,
        ATA_TIMING_ACTIVE       = (1 << 4),
        ATA_TIMING_RECOVER      = (1 << 5),
-       ATA_TIMING_CYCLE        = (1 << 6),
-       ATA_TIMING_UDMA         = (1 << 7),
+       ATA_TIMING_DMACK_HOLD   = (1 << 6),
+       ATA_TIMING_CYCLE        = (1 << 7),
+       ATA_TIMING_UDMA         = (1 << 8),
        ATA_TIMING_ALL          = ATA_TIMING_SETUP | ATA_TIMING_ACT8B |
                                  ATA_TIMING_REC8B | ATA_TIMING_CYC8B |
                                  ATA_TIMING_ACTIVE | ATA_TIMING_RECOVER |
-                                 ATA_TIMING_CYCLE | ATA_TIMING_UDMA,
+                                 ATA_TIMING_DMACK_HOLD | ATA_TIMING_CYCLE |
+                                 ATA_TIMING_UDMA,
 };
 
 enum ata_xfer_mask {
@@ -866,6 +868,7 @@ struct ata_timing {
        unsigned short cyc8b;           /* t0 for 8-bit I/O */
        unsigned short active;          /* t2 or tD */
        unsigned short recover;         /* t2i or tK */
+       unsigned short dmack_hold;      /* tj */
        unsigned short cycle;           /* t0 */
        unsigned short udma;            /* t2CYCTYP/2 */
 };
@@ -927,6 +930,8 @@ extern void ata_host_init(struct ata_host *, struct device *,
 extern int ata_scsi_detect(struct scsi_host_template *sht);
 extern int ata_scsi_ioctl(struct scsi_device *dev, int cmd, void __user *arg);
 extern int ata_scsi_queuecmd(struct scsi_cmnd *cmd, void (*done)(struct scsi_cmnd *));
+extern int ata_sas_scsi_ioctl(struct ata_port *ap, struct scsi_device *dev,
+                           int cmd, void __user *arg);
 extern void ata_sas_port_destroy(struct ata_port *);
 extern struct ata_port *ata_sas_port_alloc(struct ata_host *,
                                           struct ata_port_info *, struct Scsi_Host *);
index 83e32f6d78592d188b3e82d489e18ec723d31db8..9e3182e659dbda6f7f86237757102aa53ca00b39 100644 (file)
@@ -39,6 +39,7 @@ struct iscsi_segment {
        unsigned int            total_copied;
 
        struct hash_desc        *hash;
+       unsigned char           padbuf[ISCSI_PAD_LEN];
        unsigned char           recv_digest[ISCSI_DIGEST_SIZE];
        unsigned char           digest[ISCSI_DIGEST_SIZE];
        unsigned int            digest_len;