aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-10-30 01:58:18 -0500
committerJeff Garzik <jgarzik@pobox.com>2005-10-30 01:58:18 -0500
commitf0612bbc41f65f5a684f69d714a1a17a6f0f40c5 (patch)
tree8c070070bb355843cfa4635643e9da7c2c4cd44a /drivers/scsi
parentb0c4e148bd591629749d02a8fbc8d81c26d548cf (diff)
parent81cfb8864c73230eb1c37753aba517db15cf4d8f (diff)
Merge branch 'upstream'
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/ahci.c9
-rw-r--r--drivers/scsi/arm/scsi.h6
-rw-r--r--drivers/scsi/libata-core.c46
-rw-r--r--drivers/scsi/sata_mv.c18
-rw-r--r--drivers/scsi/sata_sil24.c8
-rw-r--r--drivers/scsi/sg.c17
-rw-r--r--drivers/scsi/st.c10
7 files changed, 31 insertions, 83 deletions
diff --git a/drivers/scsi/ahci.c b/drivers/scsi/ahci.c
index cbab5868ffdf..3df74a08fe22 100644
--- a/drivers/scsi/ahci.c
+++ b/drivers/scsi/ahci.c
@@ -192,7 +192,6 @@ static void ahci_port_stop(struct ata_port *ap);
192static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 192static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
193static void ahci_qc_prep(struct ata_queued_cmd *qc); 193static void ahci_qc_prep(struct ata_queued_cmd *qc);
194static u8 ahci_check_status(struct ata_port *ap); 194static u8 ahci_check_status(struct ata_port *ap);
195static u8 ahci_check_err(struct ata_port *ap);
196static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc); 195static inline int ahci_host_intr(struct ata_port *ap, struct ata_queued_cmd *qc);
197static void ahci_remove_one (struct pci_dev *pdev); 196static void ahci_remove_one (struct pci_dev *pdev);
198 197
@@ -221,7 +220,6 @@ static const struct ata_port_operations ahci_ops = {
221 220
222 .check_status = ahci_check_status, 221 .check_status = ahci_check_status,
223 .check_altstatus = ahci_check_status, 222 .check_altstatus = ahci_check_status,
224 .check_err = ahci_check_err,
225 .dev_select = ata_noop_dev_select, 223 .dev_select = ata_noop_dev_select,
226 224
227 .tf_read = ahci_tf_read, 225 .tf_read = ahci_tf_read,
@@ -466,13 +464,6 @@ static u8 ahci_check_status(struct ata_port *ap)
466 return readl(mmio + PORT_TFDATA) & 0xFF; 464 return readl(mmio + PORT_TFDATA) & 0xFF;
467} 465}
468 466
469static u8 ahci_check_err(struct ata_port *ap)
470{
471 void __iomem *mmio = (void __iomem *) ap->ioaddr.cmd_addr;
472
473 return (readl(mmio + PORT_TFDATA) >> 8) & 0xFF;
474}
475
476static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf) 467static void ahci_tf_read(struct ata_port *ap, struct ata_taskfile *tf)
477{ 468{
478 struct ahci_port_priv *pp = ap->private_data; 469 struct ahci_port_priv *pp = ap->private_data;
diff --git a/drivers/scsi/arm/scsi.h b/drivers/scsi/arm/scsi.h
index 48e1c4d9738b..19937640e2e7 100644
--- a/drivers/scsi/arm/scsi.h
+++ b/drivers/scsi/arm/scsi.h
@@ -10,6 +10,8 @@
10 * Commonly used scsi driver functions. 10 * Commonly used scsi driver functions.
11 */ 11 */
12 12
13#include <linux/scatterlist.h>
14
13#define BELT_AND_BRACES 15#define BELT_AND_BRACES
14 16
15/* 17/*
@@ -22,9 +24,7 @@ static inline int copy_SCp_to_sg(struct scatterlist *sg, Scsi_Pointer *SCp, int
22 24
23 BUG_ON(bufs + 1 > max); 25 BUG_ON(bufs + 1 > max);
24 26
25 sg->page = virt_to_page(SCp->ptr); 27 sg_set_buf(sg, SCp->ptr, SCp->this_residual);
26 sg->offset = offset_in_page(SCp->ptr);
27 sg->length = SCp->this_residual;
28 28
29 if (bufs) 29 if (bufs)
30 memcpy(sg + 1, SCp->buffer + 1, 30 memcpy(sg + 1, SCp->buffer + 1,
diff --git a/drivers/scsi/libata-core.c b/drivers/scsi/libata-core.c
index 3171e386f706..0d58f4d3e5ce 100644
--- a/drivers/scsi/libata-core.c
+++ b/drivers/scsi/libata-core.c
@@ -49,6 +49,7 @@
49#include <linux/suspend.h> 49#include <linux/suspend.h>
50#include <linux/workqueue.h> 50#include <linux/workqueue.h>
51#include <linux/jiffies.h> 51#include <linux/jiffies.h>
52#include <linux/scatterlist.h>
52#include <scsi/scsi.h> 53#include <scsi/scsi.h>
53#include "scsi.h" 54#include "scsi.h"
54#include "scsi_priv.h" 55#include "scsi_priv.h"
@@ -371,7 +372,7 @@ static void ata_tf_read_pio(struct ata_port *ap, struct ata_taskfile *tf)
371 struct ata_ioports *ioaddr = &ap->ioaddr; 372 struct ata_ioports *ioaddr = &ap->ioaddr;
372 373
373 tf->command = ata_check_status(ap); 374 tf->command = ata_check_status(ap);
374 tf->feature = ata_chk_err(ap); 375 tf->feature = inb(ioaddr->error_addr);
375 tf->nsect = inb(ioaddr->nsect_addr); 376 tf->nsect = inb(ioaddr->nsect_addr);
376 tf->lbal = inb(ioaddr->lbal_addr); 377 tf->lbal = inb(ioaddr->lbal_addr);
377 tf->lbam = inb(ioaddr->lbam_addr); 378 tf->lbam = inb(ioaddr->lbam_addr);
@@ -405,7 +406,7 @@ static void ata_tf_read_mmio(struct ata_port *ap, struct ata_taskfile *tf)
405 struct ata_ioports *ioaddr = &ap->ioaddr; 406 struct ata_ioports *ioaddr = &ap->ioaddr;
406 407
407 tf->command = ata_check_status(ap); 408 tf->command = ata_check_status(ap);
408 tf->feature = ata_chk_err(ap); 409 tf->feature = readb((void __iomem *)ioaddr->error_addr);
409 tf->nsect = readb((void __iomem *)ioaddr->nsect_addr); 410 tf->nsect = readb((void __iomem *)ioaddr->nsect_addr);
410 tf->lbal = readb((void __iomem *)ioaddr->lbal_addr); 411 tf->lbal = readb((void __iomem *)ioaddr->lbal_addr);
411 tf->lbam = readb((void __iomem *)ioaddr->lbam_addr); 412 tf->lbam = readb((void __iomem *)ioaddr->lbam_addr);
@@ -526,30 +527,6 @@ u8 ata_altstatus(struct ata_port *ap)
526 527
527 528
528/** 529/**
529 * ata_chk_err - Read device error reg
530 * @ap: port where the device is
531 *
532 * Reads ATA taskfile error register for
533 * currently-selected device and return its value.
534 *
535 * Note: may NOT be used as the check_err() entry in
536 * ata_port_operations.
537 *
538 * LOCKING:
539 * Inherited from caller.
540 */
541u8 ata_chk_err(struct ata_port *ap)
542{
543 if (ap->ops->check_err)
544 return ap->ops->check_err(ap);
545
546 if (ap->flags & ATA_FLAG_MMIO) {
547 return readb((void __iomem *) ap->ioaddr.error_addr);
548 }
549 return inb(ap->ioaddr.error_addr);
550}
551
552/**
553 * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure 530 * ata_tf_to_fis - Convert ATA taskfile to SATA FIS structure
554 * @tf: Taskfile to convert 531 * @tf: Taskfile to convert
555 * @fis: Buffer into which data will output 532 * @fis: Buffer into which data will output
@@ -901,8 +878,8 @@ static u8 ata_dev_try_classify(struct ata_port *ap, unsigned int device)
901 878
902 memset(&tf, 0, sizeof(tf)); 879 memset(&tf, 0, sizeof(tf));
903 880
904 err = ata_chk_err(ap);
905 ap->ops->tf_read(ap, &tf); 881 ap->ops->tf_read(ap, &tf);
882 err = tf.feature;
906 883
907 dev->class = ATA_DEV_NONE; 884 dev->class = ATA_DEV_NONE;
908 885
@@ -1139,7 +1116,6 @@ static void ata_dev_identify(struct ata_port *ap, unsigned int device)
1139 unsigned int major_version; 1116 unsigned int major_version;
1140 u16 tmp; 1117 u16 tmp;
1141 unsigned long xfer_modes; 1118 unsigned long xfer_modes;
1142 u8 status;
1143 unsigned int using_edd; 1119 unsigned int using_edd;
1144 DECLARE_COMPLETION(wait); 1120 DECLARE_COMPLETION(wait);
1145 struct ata_queued_cmd *qc; 1121 struct ata_queued_cmd *qc;
@@ -1193,8 +1169,11 @@ retry:
1193 else 1169 else
1194 wait_for_completion(&wait); 1170 wait_for_completion(&wait);
1195 1171
1196 status = ata_chk_status(ap); 1172 spin_lock_irqsave(&ap->host_set->lock, flags);
1197 if (status & ATA_ERR) { 1173 ap->ops->tf_read(ap, &qc->tf);
1174 spin_unlock_irqrestore(&ap->host_set->lock, flags);
1175
1176 if (qc->tf.command & ATA_ERR) {
1198 /* 1177 /*
1199 * arg! EDD works for all test cases, but seems to return 1178 * arg! EDD works for all test cases, but seems to return
1200 * the ATA signature for some ATAPI devices. Until the 1179 * the ATA signature for some ATAPI devices. Until the
@@ -1207,7 +1186,7 @@ retry:
1207 * to have this problem. 1186 * to have this problem.
1208 */ 1187 */
1209 if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) { 1188 if ((using_edd) && (qc->tf.command == ATA_CMD_ID_ATA)) {
1210 u8 err = ata_chk_err(ap); 1189 u8 err = qc->tf.feature;
1211 if (err & ATA_ABORTED) { 1190 if (err & ATA_ABORTED) {
1212 dev->class = ATA_DEV_ATAPI; 1191 dev->class = ATA_DEV_ATAPI;
1213 qc->cursg = 0; 1192 qc->cursg = 0;
@@ -2609,9 +2588,7 @@ void ata_sg_init_one(struct ata_queued_cmd *qc, void *buf, unsigned int buflen)
2609 qc->buf_virt = buf; 2588 qc->buf_virt = buf;
2610 2589
2611 sg = qc->__sg; 2590 sg = qc->__sg;
2612 sg->page = virt_to_page(buf); 2591 sg_init_one(sg, buf, buflen);
2613 sg->offset = (unsigned long) buf & ~PAGE_MASK;
2614 sg->length = buflen;
2615} 2592}
2616 2593
2617/** 2594/**
@@ -4962,7 +4939,6 @@ EXPORT_SYMBOL_GPL(ata_tf_to_fis);
4962EXPORT_SYMBOL_GPL(ata_tf_from_fis); 4939EXPORT_SYMBOL_GPL(ata_tf_from_fis);
4963EXPORT_SYMBOL_GPL(ata_check_status); 4940EXPORT_SYMBOL_GPL(ata_check_status);
4964EXPORT_SYMBOL_GPL(ata_altstatus); 4941EXPORT_SYMBOL_GPL(ata_altstatus);
4965EXPORT_SYMBOL_GPL(ata_chk_err);
4966EXPORT_SYMBOL_GPL(ata_exec_command); 4942EXPORT_SYMBOL_GPL(ata_exec_command);
4967EXPORT_SYMBOL_GPL(ata_port_start); 4943EXPORT_SYMBOL_GPL(ata_port_start);
4968EXPORT_SYMBOL_GPL(ata_port_stop); 4944EXPORT_SYMBOL_GPL(ata_port_stop);
diff --git a/drivers/scsi/sata_mv.c b/drivers/scsi/sata_mv.c
index 1d6d0c9e76f6..ad4808ef71d4 100644
--- a/drivers/scsi/sata_mv.c
+++ b/drivers/scsi/sata_mv.c
@@ -258,7 +258,6 @@ struct mv_host_priv {
258static void mv_irq_clear(struct ata_port *ap); 258static void mv_irq_clear(struct ata_port *ap);
259static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in); 259static u32 mv_scr_read(struct ata_port *ap, unsigned int sc_reg_in);
260static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val); 260static void mv_scr_write(struct ata_port *ap, unsigned int sc_reg_in, u32 val);
261static u8 mv_check_err(struct ata_port *ap);
262static void mv_phy_reset(struct ata_port *ap); 261static void mv_phy_reset(struct ata_port *ap);
263static void mv_host_stop(struct ata_host_set *host_set); 262static void mv_host_stop(struct ata_host_set *host_set);
264static int mv_port_start(struct ata_port *ap); 263static int mv_port_start(struct ata_port *ap);
@@ -296,7 +295,6 @@ static const struct ata_port_operations mv_ops = {
296 .tf_load = ata_tf_load, 295 .tf_load = ata_tf_load,
297 .tf_read = ata_tf_read, 296 .tf_read = ata_tf_read,
298 .check_status = ata_check_status, 297 .check_status = ata_check_status,
299 .check_err = mv_check_err,
300 .exec_command = ata_exec_command, 298 .exec_command = ata_exec_command,
301 .dev_select = ata_std_dev_select, 299 .dev_select = ata_std_dev_select,
302 300
@@ -1186,22 +1184,6 @@ static irqreturn_t mv_interrupt(int irq, void *dev_instance,
1186} 1184}
1187 1185
1188/** 1186/**
1189 * mv_check_err - Return the error shadow register to caller.
1190 * @ap: ATA channel to manipulate
1191 *
1192 * Marvell requires DMA to be stopped before accessing shadow
1193 * registers. So we do that, then return the needed register.
1194 *
1195 * LOCKING:
1196 * Inherited from caller. FIXME: protect mv_stop_dma with lock?
1197 */
1198static u8 mv_check_err(struct ata_port *ap)
1199{
1200 mv_stop_dma(ap); /* can't read shadow regs if DMA on */
1201 return readb((void __iomem *) ap->ioaddr.error_addr);
1202}
1203
1204/**
1205 * mv_phy_reset - Perform eDMA reset followed by COMRESET 1187 * mv_phy_reset - Perform eDMA reset followed by COMRESET
1206 * @ap: ATA channel to manipulate 1188 * @ap: ATA channel to manipulate
1207 * 1189 *
diff --git a/drivers/scsi/sata_sil24.c b/drivers/scsi/sata_sil24.c
index 423096f7fe93..7e6e5c049b7d 100644
--- a/drivers/scsi/sata_sil24.c
+++ b/drivers/scsi/sata_sil24.c
@@ -225,7 +225,6 @@ struct sil24_host_priv {
225}; 225};
226 226
227static u8 sil24_check_status(struct ata_port *ap); 227static u8 sil24_check_status(struct ata_port *ap);
228static u8 sil24_check_err(struct ata_port *ap);
229static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg); 228static u32 sil24_scr_read(struct ata_port *ap, unsigned sc_reg);
230static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val); 229static void sil24_scr_write(struct ata_port *ap, unsigned sc_reg, u32 val);
231static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf); 230static void sil24_tf_read(struct ata_port *ap, struct ata_taskfile *tf);
@@ -280,7 +279,6 @@ static const struct ata_port_operations sil24_ops = {
280 279
281 .check_status = sil24_check_status, 280 .check_status = sil24_check_status,
282 .check_altstatus = sil24_check_status, 281 .check_altstatus = sil24_check_status,
283 .check_err = sil24_check_err,
284 .dev_select = ata_noop_dev_select, 282 .dev_select = ata_noop_dev_select,
285 283
286 .tf_read = sil24_tf_read, 284 .tf_read = sil24_tf_read,
@@ -363,12 +361,6 @@ static u8 sil24_check_status(struct ata_port *ap)
363 return pp->tf.command; 361 return pp->tf.command;
364} 362}
365 363
366static u8 sil24_check_err(struct ata_port *ap)
367{
368 struct sil24_port_priv *pp = ap->private_data;
369 return pp->tf.feature;
370}
371
372static int sil24_scr_map[] = { 364static int sil24_scr_map[] = {
373 [SCR_CONTROL] = 0, 365 [SCR_CONTROL] = 0,
374 [SCR_STATUS] = 1, 366 [SCR_STATUS] = 1,
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index 861e51375d70..d86d5c26061d 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -49,6 +49,7 @@ static int sg_version_num = 30533; /* 2 digits for each component */
49#include <linux/seq_file.h> 49#include <linux/seq_file.h>
50#include <linux/blkdev.h> 50#include <linux/blkdev.h>
51#include <linux/delay.h> 51#include <linux/delay.h>
52#include <linux/scatterlist.h>
52 53
53#include "scsi.h" 54#include "scsi.h"
54#include <scsi/scsi_dbg.h> 55#include <scsi/scsi_dbg.h>
@@ -1886,13 +1887,17 @@ st_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages,
1886 int i; 1887 int i;
1887 1888
1888 for (i=0; i < nr_pages; i++) { 1889 for (i=0; i < nr_pages; i++) {
1889 if (dirtied && !PageReserved(sgl[i].page)) 1890 struct page *page = sgl[i].page;
1890 SetPageDirty(sgl[i].page); 1891
1891 /* unlock_page(sgl[i].page); */ 1892 /* XXX: just for debug. Remove when PageReserved is removed */
1893 BUG_ON(PageReserved(page));
1894 if (dirtied)
1895 SetPageDirty(page);
1896 /* unlock_page(page); */
1892 /* FIXME: cache flush missing for rw==READ 1897 /* FIXME: cache flush missing for rw==READ
1893 * FIXME: call the correct reference counting function 1898 * FIXME: call the correct reference counting function
1894 */ 1899 */
1895 page_cache_release(sgl[i].page); 1900 page_cache_release(page);
1896 } 1901 }
1897 1902
1898 return 0; 1903 return 0;
@@ -1992,9 +1997,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size)
1992 if (!p) 1997 if (!p)
1993 break; 1998 break;
1994 } 1999 }
1995 sclp->page = virt_to_page(p); 2000 sg_set_buf(sclp, p, ret_sz);
1996 sclp->offset = offset_in_page(p);
1997 sclp->length = ret_sz;
1998 2001
1999 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n", 2002 SCSI_LOG_TIMEOUT(5, printk("sg_build_build: k=%d, a=0x%p, len=%d\n",
2000 k, sg_scatg2virt(sclp), ret_sz)); 2003 k, sg_scatg2virt(sclp), ret_sz));
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 5eb54d8019b4..da9766283bd7 100644
--- a/drivers/scsi/st.c
+++ b/drivers/scsi/st.c
@@ -4526,12 +4526,16 @@ static int sgl_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_p
4526 int i; 4526 int i;
4527 4527
4528 for (i=0; i < nr_pages; i++) { 4528 for (i=0; i < nr_pages; i++) {
4529 if (dirtied && !PageReserved(sgl[i].page)) 4529 struct page *page = sgl[i].page;
4530 SetPageDirty(sgl[i].page); 4530
4531 /* XXX: just for debug. Remove when PageReserved is removed */
4532 BUG_ON(PageReserved(page));
4533 if (dirtied)
4534 SetPageDirty(page);
4531 /* FIXME: cache flush missing for rw==READ 4535 /* FIXME: cache flush missing for rw==READ
4532 * FIXME: call the correct reference counting function 4536 * FIXME: call the correct reference counting function
4533 */ 4537 */
4534 page_cache_release(sgl[i].page); 4538 page_cache_release(page);
4535 } 4539 }
4536 4540
4537 return 0; 4541 return 0;