fastboot: make the libata port scan asynchronous
[safe/jmp/linux-2.6] / drivers / ata / sata_sx4.c
index 211ba8d..ec04b8d 100644 (file)
@@ -232,40 +232,30 @@ static void pdc20621_get_from_dimm(struct ata_host *host,
 static void pdc20621_put_to_dimm(struct ata_host *host,
                                 void *psource, u32 offset, u32 size);
 static void pdc20621_irq_clear(struct ata_port *ap);
-static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc);
+static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc);
 
 
 static struct scsi_host_template pdc_sata_sht = {
-       .module                 = THIS_MODULE,
-       .name                   = DRV_NAME,
-       .ioctl                  = ata_scsi_ioctl,
-       .queuecommand           = ata_scsi_queuecmd,
-       .can_queue              = ATA_DEF_QUEUE,
-       .this_id                = ATA_SHT_THIS_ID,
+       ATA_BASE_SHT(DRV_NAME),
        .sg_tablesize           = LIBATA_MAX_PRD,
-       .cmd_per_lun            = ATA_SHT_CMD_PER_LUN,
-       .emulated               = ATA_SHT_EMULATED,
-       .use_clustering         = ATA_SHT_USE_CLUSTERING,
-       .proc_name              = DRV_NAME,
        .dma_boundary           = ATA_DMA_BOUNDARY,
-       .slave_configure        = ata_scsi_slave_config,
-       .slave_destroy          = ata_scsi_slave_destroy,
-       .bios_param             = ata_std_bios_param,
 };
 
-static const struct ata_port_operations pdc_20621_ops = {
-       .tf_load                = pdc_tf_load_mmio,
-       .tf_read                = ata_tf_read,
-       .check_status           = ata_check_status,
-       .exec_command           = pdc_exec_command_mmio,
-       .dev_select             = ata_std_dev_select,
+/* TODO: inherit from base port_ops after converting to new EH */
+static struct ata_port_operations pdc_20621_ops = {
+       .sff_tf_load            = pdc_tf_load_mmio,
+       .sff_tf_read            = ata_sff_tf_read,
+       .sff_check_status       = ata_sff_check_status,
+       .sff_exec_command       = pdc_exec_command_mmio,
+       .sff_dev_select         = ata_sff_dev_select,
        .phy_reset              = pdc_20621_phy_reset,
        .qc_prep                = pdc20621_qc_prep,
-       .qc_issue               = pdc20621_qc_issue_prot,
-       .data_xfer              = ata_data_xfer,
+       .qc_issue               = pdc20621_qc_issue,
+       .qc_fill_rtf            = ata_sff_qc_fill_rtf,
+       .sff_data_xfer          = ata_sff_data_xfer,
        .eng_timeout            = pdc_eng_timeout,
-       .irq_clear              = pdc20621_irq_clear,
-       .irq_on                 = ata_irq_on,
+       .sff_irq_clear          = pdc20621_irq_clear,
+       .sff_irq_on             = ata_sff_irq_on,
        .port_start             = pdc_port_start,
 };
 
@@ -334,7 +324,7 @@ static inline void pdc20621_ata_sg(struct ata_taskfile *tf, u8 *buf,
 {
        u32 addr;
        unsigned int dw = PDC_DIMM_APKT_PRD >> 2;
-       u32 *buf32 = (u32 *) buf;
+       __le32 *buf32 = (__le32 *) buf;
 
        /* output ATA packet S/G table */
        addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
@@ -356,7 +346,7 @@ static inline void pdc20621_host_sg(struct ata_taskfile *tf, u8 *buf,
 {
        u32 addr;
        unsigned int dw = PDC_DIMM_HPKT_PRD >> 2;
-       u32 *buf32 = (u32 *) buf;
+       __le32 *buf32 = (__le32 *) buf;
 
        /* output Host DMA packet S/G table */
        addr = PDC_20621_DIMM_BASE + PDC_20621_DIMM_DATA +
@@ -377,7 +367,7 @@ static inline unsigned int pdc20621_ata_pkt(struct ata_taskfile *tf,
                                            unsigned int portno)
 {
        unsigned int i, dw;
-       u32 *buf32 = (u32 *) buf;
+       __le32 *buf32 = (__le32 *) buf;
        u8 dev_reg;
 
        unsigned int dimm_sg = PDC_20621_DIMM_BASE +
@@ -429,7 +419,8 @@ static inline void pdc20621_host_pkt(struct ata_taskfile *tf, u8 *buf,
                                     unsigned int portno)
 {
        unsigned int dw;
-       u32 tmp, *buf32 = (u32 *) buf;
+       u32 tmp;
+       __le32 *buf32 = (__le32 *) buf;
 
        unsigned int host_sg = PDC_20621_DIMM_BASE +
                               (PDC_DIMM_WINDOW_STEP * portno) +
@@ -474,7 +465,7 @@ static void pdc20621_dma_prep(struct ata_queued_cmd *qc)
        void __iomem *dimm_mmio = ap->host->iomap[PDC_DIMM_BAR];
        unsigned int portno = ap->port_no;
        unsigned int i, si, idx, total_len = 0, sgt_len;
-       u32 *buf = (u32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ];
+       __le32 *buf = (__le32 *) &pp->dimm_buf[PDC_DIMM_HEADER_SZ];
 
        WARN_ON(!(qc->flags & ATA_QCFLAG_DMAMAP));
 
@@ -692,7 +683,7 @@ static void pdc20621_packet_start(struct ata_queued_cmd *qc)
        }
 }
 
-static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc)
+static unsigned int pdc20621_qc_issue(struct ata_queued_cmd *qc)
 {
        switch (qc->tf.protocol) {
        case ATA_PROT_DMA:
@@ -708,7 +699,7 @@ static unsigned int pdc20621_qc_issue_prot(struct ata_queued_cmd *qc)
                break;
        }
 
-       return ata_qc_issue_prot(qc);
+       return ata_sff_qc_issue(qc);
 }
 
 static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
@@ -780,7 +771,7 @@ static inline unsigned int pdc20621_host_intr(struct ata_port *ap,
        /* command completion, but no data xfer */
        } else if (qc->tf.protocol == ATA_PROT_NODATA) {
 
-               status = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
+               status = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
                DPRINTK("BUS_NODATA (drv_stat 0x%X)\n", status);
                qc->err_mask |= ac_err_mask(status);
                ata_qc_complete(qc);
@@ -889,7 +880,7 @@ static void pdc_eng_timeout(struct ata_port *ap)
                break;
 
        default:
-               drv_stat = ata_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
+               drv_stat = ata_sff_busy_wait(ap, ATA_BUSY | ATA_DRQ, 1000);
 
                ata_port_printk(ap, KERN_ERR,
                                "unknown timeout, cmd 0x%x stat 0x%x\n",
@@ -908,7 +899,7 @@ static void pdc_tf_load_mmio(struct ata_port *ap, const struct ata_taskfile *tf)
 {
        WARN_ON(tf->protocol == ATA_PROT_DMA ||
                tf->protocol == ATA_PROT_NODATA);
-       ata_tf_load(ap, tf);
+       ata_sff_tf_load(ap, tf);
 }
 
 
@@ -916,7 +907,7 @@ static void pdc_exec_command_mmio(struct ata_port *ap, const struct ata_taskfile
 {
        WARN_ON(tf->protocol == ATA_PROT_DMA ||
                tf->protocol == ATA_PROT_NODATA);
-       ata_exec_command(ap, tf);
+       ata_sff_exec_command(ap, tf);
 }