diff options
Diffstat (limited to 'drivers/scsi')
56 files changed, 214 insertions, 237 deletions
diff --git a/drivers/scsi/3w-9xxx.c b/drivers/scsi/3w-9xxx.c index fb14014ee16e..afb262b4be15 100644 --- a/drivers/scsi/3w-9xxx.c +++ b/drivers/scsi/3w-9xxx.c | |||
@@ -1840,7 +1840,7 @@ static int twa_scsiop_execute_scsi(TW_Device_Extension *tw_dev, int request_id, | |||
1840 | (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { | 1840 | (scsi_bufflen(srb) < TW_MIN_SGL_LENGTH)) { |
1841 | if (srb->sc_data_direction == DMA_TO_DEVICE || srb->sc_data_direction == DMA_BIDIRECTIONAL) { | 1841 | if (srb->sc_data_direction == DMA_TO_DEVICE || srb->sc_data_direction == DMA_BIDIRECTIONAL) { |
1842 | struct scatterlist *sg = scsi_sglist(srb); | 1842 | struct scatterlist *sg = scsi_sglist(srb); |
1843 | char *buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 1843 | char *buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
1844 | memcpy(tw_dev->generic_buffer_virt[request_id], buf, sg->length); | 1844 | memcpy(tw_dev->generic_buffer_virt[request_id], buf, sg->length); |
1845 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 1845 | kunmap_atomic(buf - sg->offset, KM_IRQ0); |
1846 | } | 1846 | } |
@@ -1919,7 +1919,7 @@ static void twa_scsiop_execute_scsi_complete(TW_Device_Extension *tw_dev, int re | |||
1919 | char *buf; | 1919 | char *buf; |
1920 | unsigned long flags = 0; | 1920 | unsigned long flags = 0; |
1921 | local_irq_save(flags); | 1921 | local_irq_save(flags); |
1922 | buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 1922 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
1923 | memcpy(buf, tw_dev->generic_buffer_virt[request_id], sg->length); | 1923 | memcpy(buf, tw_dev->generic_buffer_virt[request_id], sg->length); |
1924 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 1924 | kunmap_atomic(buf - sg->offset, KM_IRQ0); |
1925 | local_irq_restore(flags); | 1925 | local_irq_restore(flags); |
diff --git a/drivers/scsi/3w-xxxx.c b/drivers/scsi/3w-xxxx.c index a64153b96034..59716ebeb10c 100644 --- a/drivers/scsi/3w-xxxx.c +++ b/drivers/scsi/3w-xxxx.c | |||
@@ -1469,7 +1469,7 @@ static void tw_transfer_internal(TW_Device_Extension *tw_dev, int request_id, | |||
1469 | struct scatterlist *sg = scsi_sglist(cmd); | 1469 | struct scatterlist *sg = scsi_sglist(cmd); |
1470 | 1470 | ||
1471 | local_irq_save(flags); | 1471 | local_irq_save(flags); |
1472 | buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 1472 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
1473 | transfer_len = min(sg->length, len); | 1473 | transfer_len = min(sg->length, len); |
1474 | 1474 | ||
1475 | memcpy(buf, data, transfer_len); | 1475 | memcpy(buf, data, transfer_len); |
diff --git a/drivers/scsi/FlashPoint.c b/drivers/scsi/FlashPoint.c index a7f916c0c9cd..1c9078191d9e 100644 --- a/drivers/scsi/FlashPoint.c +++ b/drivers/scsi/FlashPoint.c | |||
@@ -25,9 +25,6 @@ | |||
25 | 25 | ||
26 | #define FAILURE 0xFFFFFFFFL | 26 | #define FAILURE 0xFFFFFFFFL |
27 | 27 | ||
28 | #define BIT(x) ((unsigned char)(1<<(x))) /* single-bit mask in bit position x */ | ||
29 | #define BITW(x) ((unsigned short)(1<<(x))) /* single-bit mask in bit position x */ | ||
30 | |||
31 | struct sccb; | 28 | struct sccb; |
32 | typedef void (*CALL_BK_FN) (struct sccb *); | 29 | typedef void (*CALL_BK_FN) (struct sccb *); |
33 | 30 | ||
@@ -374,9 +371,9 @@ typedef struct SCCBscam_info { | |||
374 | #define SCAM_ENABLED BIT(2) | 371 | #define SCAM_ENABLED BIT(2) |
375 | #define SCAM_LEVEL2 BIT(3) | 372 | #define SCAM_LEVEL2 BIT(3) |
376 | 373 | ||
377 | #define RENEGO_ENA BITW(10) | 374 | #define RENEGO_ENA BIT(10) |
378 | #define CONNIO_ENA BITW(11) | 375 | #define CONNIO_ENA BIT(11) |
379 | #define GREEN_PC_ENA BITW(12) | 376 | #define GREEN_PC_ENA BIT(12) |
380 | 377 | ||
381 | #define AUTO_RATE_00 00 | 378 | #define AUTO_RATE_00 00 |
382 | #define AUTO_RATE_05 01 | 379 | #define AUTO_RATE_05 01 |
@@ -511,23 +508,23 @@ typedef struct SCCBscam_info { | |||
511 | 508 | ||
512 | #define hp_intena 0x40 | 509 | #define hp_intena 0x40 |
513 | 510 | ||
514 | #define RESET BITW(7) | 511 | #define RESET BIT(7) |
515 | #define PROG_HLT BITW(6) | 512 | #define PROG_HLT BIT(6) |
516 | #define PARITY BITW(5) | 513 | #define PARITY BIT(5) |
517 | #define FIFO BITW(4) | 514 | #define FIFO BIT(4) |
518 | #define SEL BITW(3) | 515 | #define SEL BIT(3) |
519 | #define SCAM_SEL BITW(2) | 516 | #define SCAM_SEL BIT(2) |
520 | #define RSEL BITW(1) | 517 | #define RSEL BIT(1) |
521 | #define TIMEOUT BITW(0) | 518 | #define TIMEOUT BIT(0) |
522 | #define BUS_FREE BITW(15) | 519 | #define BUS_FREE BIT(15) |
523 | #define XFER_CNT_0 BITW(14) | 520 | #define XFER_CNT_0 BIT(14) |
524 | #define PHASE BITW(13) | 521 | #define PHASE BIT(13) |
525 | #define IUNKWN BITW(12) | 522 | #define IUNKWN BIT(12) |
526 | #define ICMD_COMP BITW(11) | 523 | #define ICMD_COMP BIT(11) |
527 | #define ITICKLE BITW(10) | 524 | #define ITICKLE BIT(10) |
528 | #define IDO_STRT BITW(9) | 525 | #define IDO_STRT BIT(9) |
529 | #define ITAR_DISC BITW(8) | 526 | #define ITAR_DISC BIT(8) |
530 | #define AUTO_INT (BITW(12)+BITW(11)+BITW(10)+BITW(9)+BITW(8)) | 527 | #define AUTO_INT (BIT(12)+BIT(11)+BIT(10)+BIT(9)+BIT(8)) |
531 | #define CLR_ALL_INT 0xFFFF | 528 | #define CLR_ALL_INT 0xFFFF |
532 | #define CLR_ALL_INT_1 0xFF00 | 529 | #define CLR_ALL_INT_1 0xFF00 |
533 | 530 | ||
@@ -674,37 +671,37 @@ typedef struct SCCBscam_info { | |||
674 | #define BIOS_DATA_OFFSET 0x60 | 671 | #define BIOS_DATA_OFFSET 0x60 |
675 | #define BIOS_RELATIVE_CARD 0x64 | 672 | #define BIOS_RELATIVE_CARD 0x64 |
676 | 673 | ||
677 | #define AR3 (BITW(9) + BITW(8)) | 674 | #define AR3 (BIT(9) + BIT(8)) |
678 | #define SDATA BITW(10) | 675 | #define SDATA BIT(10) |
679 | 676 | ||
680 | #define CRD_OP BITW(11) /* Cmp Reg. w/ Data */ | 677 | #define CRD_OP BIT(11) /* Cmp Reg. w/ Data */ |
681 | 678 | ||
682 | #define CRR_OP BITW(12) /* Cmp Reg. w. Reg. */ | 679 | #define CRR_OP BIT(12) /* Cmp Reg. w. Reg. */ |
683 | 680 | ||
684 | #define CPE_OP (BITW(14)+BITW(11)) /* Cmp SCSI phs & Branch EQ */ | 681 | #define CPE_OP (BIT(14)+BIT(11)) /* Cmp SCSI phs & Branch EQ */ |
685 | 682 | ||
686 | #define CPN_OP (BITW(14)+BITW(12)) /* Cmp SCSI phs & Branch NOT EQ */ | 683 | #define CPN_OP (BIT(14)+BIT(12)) /* Cmp SCSI phs & Branch NOT EQ */ |
687 | 684 | ||
688 | #define ADATA_OUT 0x00 | 685 | #define ADATA_OUT 0x00 |
689 | #define ADATA_IN BITW(8) | 686 | #define ADATA_IN BIT(8) |
690 | #define ACOMMAND BITW(10) | 687 | #define ACOMMAND BIT(10) |
691 | #define ASTATUS (BITW(10)+BITW(8)) | 688 | #define ASTATUS (BIT(10)+BIT(8)) |
692 | #define AMSG_OUT (BITW(10)+BITW(9)) | 689 | #define AMSG_OUT (BIT(10)+BIT(9)) |
693 | #define AMSG_IN (BITW(10)+BITW(9)+BITW(8)) | 690 | #define AMSG_IN (BIT(10)+BIT(9)+BIT(8)) |
694 | 691 | ||
695 | #define BRH_OP BITW(13) /* Branch */ | 692 | #define BRH_OP BIT(13) /* Branch */ |
696 | 693 | ||
697 | #define ALWAYS 0x00 | 694 | #define ALWAYS 0x00 |
698 | #define EQUAL BITW(8) | 695 | #define EQUAL BIT(8) |
699 | #define NOT_EQ BITW(9) | 696 | #define NOT_EQ BIT(9) |
700 | 697 | ||
701 | #define TCB_OP (BITW(13)+BITW(11)) /* Test condition & branch */ | 698 | #define TCB_OP (BIT(13)+BIT(11)) /* Test condition & branch */ |
702 | 699 | ||
703 | #define FIFO_0 BITW(10) | 700 | #define FIFO_0 BIT(10) |
704 | 701 | ||
705 | #define MPM_OP BITW(15) /* Match phase and move data */ | 702 | #define MPM_OP BIT(15) /* Match phase and move data */ |
706 | 703 | ||
707 | #define MRR_OP BITW(14) /* Move DReg. to Reg. */ | 704 | #define MRR_OP BIT(14) /* Move DReg. to Reg. */ |
708 | 705 | ||
709 | #define S_IDREG (BIT(2)+BIT(1)+BIT(0)) | 706 | #define S_IDREG (BIT(2)+BIT(1)+BIT(0)) |
710 | 707 | ||
@@ -712,9 +709,9 @@ typedef struct SCCBscam_info { | |||
712 | #define D_AR1 BIT(0) | 709 | #define D_AR1 BIT(0) |
713 | #define D_BUCKET (BIT(2) + BIT(1) + BIT(0)) | 710 | #define D_BUCKET (BIT(2) + BIT(1) + BIT(0)) |
714 | 711 | ||
715 | #define RAT_OP (BITW(14)+BITW(13)+BITW(11)) | 712 | #define RAT_OP (BIT(14)+BIT(13)+BIT(11)) |
716 | 713 | ||
717 | #define SSI_OP (BITW(15)+BITW(11)) | 714 | #define SSI_OP (BIT(15)+BIT(11)) |
718 | 715 | ||
719 | #define SSI_ITAR_DISC (ITAR_DISC >> 8) | 716 | #define SSI_ITAR_DISC (ITAR_DISC >> 8) |
720 | #define SSI_IDO_STRT (IDO_STRT >> 8) | 717 | #define SSI_IDO_STRT (IDO_STRT >> 8) |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 30905cebefbb..a5763c6e9362 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -521,7 +521,7 @@ config SCSI_DPT_I2O | |||
521 | 521 | ||
522 | config SCSI_ADVANSYS | 522 | config SCSI_ADVANSYS |
523 | tristate "AdvanSys SCSI support" | 523 | tristate "AdvanSys SCSI support" |
524 | depends on SCSI | 524 | depends on SCSI && VIRT_TO_BUS |
525 | depends on ISA || EISA || PCI | 525 | depends on ISA || EISA || PCI |
526 | help | 526 | help |
527 | This is a driver for all SCSI host adapters manufactured by | 527 | This is a driver for all SCSI host adapters manufactured by |
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c index 988f0bc5eda5..2597209183d0 100644 --- a/drivers/scsi/NCR5380.c +++ b/drivers/scsi/NCR5380.c | |||
@@ -298,8 +298,7 @@ static __inline__ void initialize_SCp(Scsi_Cmnd * cmd) | |||
298 | if (cmd->use_sg) { | 298 | if (cmd->use_sg) { |
299 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; | 299 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
300 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 300 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
301 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+ | 301 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
302 | cmd->SCp.buffer->offset; | ||
303 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 302 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
304 | } else { | 303 | } else { |
305 | cmd->SCp.buffer = NULL; | 304 | cmd->SCp.buffer = NULL; |
@@ -2143,8 +2142,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) { | |||
2143 | ++cmd->SCp.buffer; | 2142 | ++cmd->SCp.buffer; |
2144 | --cmd->SCp.buffers_residual; | 2143 | --cmd->SCp.buffers_residual; |
2145 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 2144 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
2146 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page)+ | 2145 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
2147 | cmd->SCp.buffer->offset; | ||
2148 | dprintk(NDEBUG_INFORMATION, ("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual)); | 2146 | dprintk(NDEBUG_INFORMATION, ("scsi%d : %d bytes and %d buffers left\n", instance->host_no, cmd->SCp.this_residual, cmd->SCp.buffers_residual)); |
2149 | } | 2147 | } |
2150 | /* | 2148 | /* |
diff --git a/drivers/scsi/NCR53C9x.c b/drivers/scsi/NCR53C9x.c index 96e8e29aa05d..5b0efc903918 100644 --- a/drivers/scsi/NCR53C9x.c +++ b/drivers/scsi/NCR53C9x.c | |||
@@ -927,7 +927,7 @@ static void esp_get_dmabufs(struct NCR_ESP *esp, Scsi_Cmnd *sp) | |||
927 | esp->dma_mmu_get_scsi_sgl(esp, sp); | 927 | esp->dma_mmu_get_scsi_sgl(esp, sp); |
928 | else | 928 | else |
929 | sp->SCp.ptr = | 929 | sp->SCp.ptr = |
930 | (char *) virt_to_phys((page_address(sp->SCp.buffer->page) + sp->SCp.buffer->offset)); | 930 | (char *) virt_to_phys(sg_virt(sp->SCp.buffer)); |
931 | } | 931 | } |
932 | } | 932 | } |
933 | 933 | ||
@@ -1748,7 +1748,7 @@ static inline void advance_sg(struct NCR_ESP *esp, Scsi_Cmnd *sp) | |||
1748 | if (esp->dma_advance_sg) | 1748 | if (esp->dma_advance_sg) |
1749 | esp->dma_advance_sg (sp); | 1749 | esp->dma_advance_sg (sp); |
1750 | else | 1750 | else |
1751 | sp->SCp.ptr = (char *) virt_to_phys((page_address(sp->SCp.buffer->page) + sp->SCp.buffer->offset)); | 1751 | sp->SCp.ptr = (char *) virt_to_phys(sg_virt(sp->SCp.buffer)); |
1752 | 1752 | ||
1753 | } | 1753 | } |
1754 | 1754 | ||
diff --git a/drivers/scsi/NCR53c406a.c b/drivers/scsi/NCR53c406a.c index 3168a1794849..137d065db3da 100644 --- a/drivers/scsi/NCR53c406a.c +++ b/drivers/scsi/NCR53c406a.c | |||
@@ -875,8 +875,7 @@ static void NCR53c406a_intr(void *dev_id) | |||
875 | outb(TRANSFER_INFO | DMA_OP, CMD_REG); | 875 | outb(TRANSFER_INFO | DMA_OP, CMD_REG); |
876 | #if USE_PIO | 876 | #if USE_PIO |
877 | scsi_for_each_sg(current_SC, sg, scsi_sg_count(current_SC), i) { | 877 | scsi_for_each_sg(current_SC, sg, scsi_sg_count(current_SC), i) { |
878 | NCR53c406a_pio_write(page_address(sg->page) + sg->offset, | 878 | NCR53c406a_pio_write(sg_virt(sg), sg->length); |
879 | sg->length); | ||
880 | } | 879 | } |
881 | REG0; | 880 | REG0; |
882 | #endif /* USE_PIO */ | 881 | #endif /* USE_PIO */ |
@@ -897,8 +896,7 @@ static void NCR53c406a_intr(void *dev_id) | |||
897 | outb(TRANSFER_INFO | DMA_OP, CMD_REG); | 896 | outb(TRANSFER_INFO | DMA_OP, CMD_REG); |
898 | #if USE_PIO | 897 | #if USE_PIO |
899 | scsi_for_each_sg(current_SC, sg, scsi_sg_count(current_SC), i) { | 898 | scsi_for_each_sg(current_SC, sg, scsi_sg_count(current_SC), i) { |
900 | NCR53c406a_pio_read(page_address(sg->page) + sg->offset, | 899 | NCR53c406a_pio_read(sg_virt(sg), sg->length); |
901 | sg->length); | ||
902 | } | 900 | } |
903 | REG0; | 901 | REG0; |
904 | #endif /* USE_PIO */ | 902 | #endif /* USE_PIO */ |
diff --git a/drivers/scsi/aacraid/aachba.c b/drivers/scsi/aacraid/aachba.c index 80e448d0f3db..a77ab8d693d4 100644 --- a/drivers/scsi/aacraid/aachba.c +++ b/drivers/scsi/aacraid/aachba.c | |||
@@ -356,7 +356,7 @@ static void aac_internal_transfer(struct scsi_cmnd *scsicmd, void *data, unsigne | |||
356 | int transfer_len; | 356 | int transfer_len; |
357 | struct scatterlist *sg = scsi_sglist(scsicmd); | 357 | struct scatterlist *sg = scsi_sglist(scsicmd); |
358 | 358 | ||
359 | buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 359 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
360 | transfer_len = min(sg->length, len + offset); | 360 | transfer_len = min(sg->length, len + offset); |
361 | 361 | ||
362 | transfer_len -= offset; | 362 | transfer_len -= offset; |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 03b51025a8f4..9abba8b90f70 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -1526,7 +1526,7 @@ struct aac_mntent { | |||
1526 | __le32 capacityhigh; | 1526 | __le32 capacityhigh; |
1527 | }; | 1527 | }; |
1528 | 1528 | ||
1529 | #define FSCS_NOTCLEAN 0x0001 /* fsck is neccessary before mounting */ | 1529 | #define FSCS_NOTCLEAN 0x0001 /* fsck is necessary before mounting */ |
1530 | #define FSCS_READONLY 0x0002 /* possible result of broken mirror */ | 1530 | #define FSCS_READONLY 0x0002 /* possible result of broken mirror */ |
1531 | #define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */ | 1531 | #define FSCS_HIDDEN 0x0004 /* should be ignored - set during a clear */ |
1532 | 1532 | ||
diff --git a/drivers/scsi/aha152x.c b/drivers/scsi/aha152x.c index f08e71e0205a..ea8c69947644 100644 --- a/drivers/scsi/aha152x.c +++ b/drivers/scsi/aha152x.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* aha152x.c -- Adaptec AHA-152x driver | 1 | /* aha152x.c -- Adaptec AHA-152x driver |
2 | * Author: Jürgen E. Fischer, fischer@norbit.de | 2 | * Author: Jürgen E. Fischer, fischer@norbit.de |
3 | * Copyright 1993-2004 Jürgen E. Fischer | 3 | * Copyright 1993-2004 Jürgen E. Fischer |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of the GNU General Public License as published by the | 6 | * under the terms of the GNU General Public License as published by the |
@@ -357,7 +357,7 @@ enum { | |||
357 | check_condition = 0x0800, /* requesting sense after CHECK CONDITION */ | 357 | check_condition = 0x0800, /* requesting sense after CHECK CONDITION */ |
358 | }; | 358 | }; |
359 | 359 | ||
360 | MODULE_AUTHOR("Jürgen Fischer"); | 360 | MODULE_AUTHOR("Jürgen Fischer"); |
361 | MODULE_DESCRIPTION(AHA152X_REVID); | 361 | MODULE_DESCRIPTION(AHA152X_REVID); |
362 | MODULE_LICENSE("GPL"); | 362 | MODULE_LICENSE("GPL"); |
363 | 363 | ||
@@ -613,7 +613,7 @@ struct aha152x_scdata { | |||
613 | #define SCNEXT(SCpnt) SCDATA(SCpnt)->next | 613 | #define SCNEXT(SCpnt) SCDATA(SCpnt)->next |
614 | #define SCSEM(SCpnt) SCDATA(SCpnt)->done | 614 | #define SCSEM(SCpnt) SCDATA(SCpnt)->done |
615 | 615 | ||
616 | #define SG_ADDRESS(buffer) ((char *) (page_address((buffer)->page)+(buffer)->offset)) | 616 | #define SG_ADDRESS(buffer) ((char *) sg_virt((buffer))) |
617 | 617 | ||
618 | /* state handling */ | 618 | /* state handling */ |
619 | static void seldi_run(struct Scsi_Host *shpnt); | 619 | static void seldi_run(struct Scsi_Host *shpnt); |
diff --git a/drivers/scsi/aha1542.c b/drivers/scsi/aha1542.c index 961a1882cb7e..bbcc2c52d79f 100644 --- a/drivers/scsi/aha1542.c +++ b/drivers/scsi/aha1542.c | |||
@@ -49,7 +49,7 @@ | |||
49 | #include "aha1542.h" | 49 | #include "aha1542.h" |
50 | 50 | ||
51 | #define SCSI_BUF_PA(address) isa_virt_to_bus(address) | 51 | #define SCSI_BUF_PA(address) isa_virt_to_bus(address) |
52 | #define SCSI_SG_PA(sgent) (isa_page_to_bus((sgent)->page) + (sgent)->offset) | 52 | #define SCSI_SG_PA(sgent) (isa_page_to_bus(sg_page((sgent))) + (sgent)->offset) |
53 | 53 | ||
54 | static void BAD_DMA(void *address, unsigned int length) | 54 | static void BAD_DMA(void *address, unsigned int length) |
55 | { | 55 | { |
@@ -66,8 +66,7 @@ static void BAD_SG_DMA(Scsi_Cmnd * SCpnt, | |||
66 | int badseg) | 66 | int badseg) |
67 | { | 67 | { |
68 | printk(KERN_CRIT "sgpnt[%d:%d] page %p/0x%llx length %u\n", | 68 | printk(KERN_CRIT "sgpnt[%d:%d] page %p/0x%llx length %u\n", |
69 | badseg, nseg, | 69 | badseg, nseg, sg_virt(sgp), |
70 | page_address(sgp->page) + sgp->offset, | ||
71 | (unsigned long long)SCSI_SG_PA(sgp), | 70 | (unsigned long long)SCSI_SG_PA(sgp), |
72 | sgp->length); | 71 | sgp->length); |
73 | 72 | ||
@@ -712,8 +711,7 @@ static int aha1542_queuecommand(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
712 | printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); | 711 | printk(KERN_CRIT "Bad segment list supplied to aha1542.c (%d, %d)\n", SCpnt->use_sg, i); |
713 | scsi_for_each_sg(SCpnt, sg, SCpnt->use_sg, i) { | 712 | scsi_for_each_sg(SCpnt, sg, SCpnt->use_sg, i) { |
714 | printk(KERN_CRIT "%d: %p %d\n", i, | 713 | printk(KERN_CRIT "%d: %p %d\n", i, |
715 | (page_address(sg->page) + | 714 | sg_virt(sg), sg->length); |
716 | sg->offset), sg->length); | ||
717 | }; | 715 | }; |
718 | printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); | 716 | printk(KERN_CRIT "cptr %x: ", (unsigned int) cptr); |
719 | ptr = (unsigned char *) &cptr[i]; | 717 | ptr = (unsigned char *) &cptr[i]; |
diff --git a/drivers/scsi/aic7xxx/cam.h b/drivers/scsi/aic7xxx/cam.h index 26f17e3fc45c..687aef6ef185 100644 --- a/drivers/scsi/aic7xxx/cam.h +++ b/drivers/scsi/aic7xxx/cam.h | |||
@@ -48,7 +48,7 @@ typedef enum { | |||
48 | CAM_REQ_ABORTED, /* CCB request aborted by the host */ | 48 | CAM_REQ_ABORTED, /* CCB request aborted by the host */ |
49 | CAM_UA_ABORT, /* Unable to abort CCB request */ | 49 | CAM_UA_ABORT, /* Unable to abort CCB request */ |
50 | CAM_REQ_CMP_ERR, /* CCB request completed with an error */ | 50 | CAM_REQ_CMP_ERR, /* CCB request completed with an error */ |
51 | CAM_BUSY, /* CAM subsytem is busy */ | 51 | CAM_BUSY, /* CAM subsystem is busy */ |
52 | CAM_REQ_INVALID, /* CCB request was invalid */ | 52 | CAM_REQ_INVALID, /* CCB request was invalid */ |
53 | CAM_PATH_INVALID, /* Supplied Path ID is invalid */ | 53 | CAM_PATH_INVALID, /* Supplied Path ID is invalid */ |
54 | CAM_SEL_TIMEOUT, /* Target Selection Timeout */ | 54 | CAM_SEL_TIMEOUT, /* Target Selection Timeout */ |
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c index f81777586b8f..f7a252885a5c 100644 --- a/drivers/scsi/arcmsr/arcmsr_hba.c +++ b/drivers/scsi/arcmsr/arcmsr_hba.c | |||
@@ -1343,7 +1343,7 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \ | |||
1343 | /* 4 bytes: Areca io control code */ | 1343 | /* 4 bytes: Areca io control code */ |
1344 | 1344 | ||
1345 | sg = scsi_sglist(cmd); | 1345 | sg = scsi_sglist(cmd); |
1346 | buffer = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 1346 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
1347 | if (scsi_sg_count(cmd) > 1) { | 1347 | if (scsi_sg_count(cmd) > 1) { |
1348 | retvalue = ARCMSR_MESSAGE_FAIL; | 1348 | retvalue = ARCMSR_MESSAGE_FAIL; |
1349 | goto message_out; | 1349 | goto message_out; |
@@ -1593,7 +1593,7 @@ static void arcmsr_handle_virtual_command(struct AdapterControlBlock *acb, | |||
1593 | strncpy(&inqdata[32], "R001", 4); /* Product Revision */ | 1593 | strncpy(&inqdata[32], "R001", 4); /* Product Revision */ |
1594 | 1594 | ||
1595 | sg = scsi_sglist(cmd); | 1595 | sg = scsi_sglist(cmd); |
1596 | buffer = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 1596 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
1597 | 1597 | ||
1598 | memcpy(buffer, inqdata, sizeof(inqdata)); | 1598 | memcpy(buffer, inqdata, sizeof(inqdata)); |
1599 | sg = scsi_sglist(cmd); | 1599 | sg = scsi_sglist(cmd); |
diff --git a/drivers/scsi/atari_NCR5380.c b/drivers/scsi/atari_NCR5380.c index 52d0b87e9aa4..d1780980fb20 100644 --- a/drivers/scsi/atari_NCR5380.c +++ b/drivers/scsi/atari_NCR5380.c | |||
@@ -515,8 +515,7 @@ static inline void initialize_SCp(Scsi_Cmnd *cmd) | |||
515 | if (cmd->use_sg) { | 515 | if (cmd->use_sg) { |
516 | cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer; | 516 | cmd->SCp.buffer = (struct scatterlist *)cmd->request_buffer; |
517 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 517 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
518 | cmd->SCp.ptr = (char *)page_address(cmd->SCp.buffer->page) + | 518 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
519 | cmd->SCp.buffer->offset; | ||
520 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 519 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
521 | /* ++roman: Try to merge some scatter-buffers if they are at | 520 | /* ++roman: Try to merge some scatter-buffers if they are at |
522 | * contiguous physical addresses. | 521 | * contiguous physical addresses. |
@@ -2054,8 +2053,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance) | |||
2054 | ++cmd->SCp.buffer; | 2053 | ++cmd->SCp.buffer; |
2055 | --cmd->SCp.buffers_residual; | 2054 | --cmd->SCp.buffers_residual; |
2056 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 2055 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
2057 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + | 2056 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
2058 | cmd->SCp.buffer->offset; | ||
2059 | /* ++roman: Try to merge some scatter-buffers if | 2057 | /* ++roman: Try to merge some scatter-buffers if |
2060 | * they are at contiguous physical addresses. | 2058 | * they are at contiguous physical addresses. |
2061 | */ | 2059 | */ |
diff --git a/drivers/scsi/dc395x.c b/drivers/scsi/dc395x.c index fd42d4789202..a9def6e1d30e 100644 --- a/drivers/scsi/dc395x.c +++ b/drivers/scsi/dc395x.c | |||
@@ -1808,12 +1808,12 @@ static irqreturn_t dc395x_interrupt(int irq, void *dev_id) | |||
1808 | irqreturn_t handled = IRQ_NONE; | 1808 | irqreturn_t handled = IRQ_NONE; |
1809 | 1809 | ||
1810 | /* | 1810 | /* |
1811 | * Check for pending interupt | 1811 | * Check for pending interrupt |
1812 | */ | 1812 | */ |
1813 | scsi_status = DC395x_read16(acb, TRM_S1040_SCSI_STATUS); | 1813 | scsi_status = DC395x_read16(acb, TRM_S1040_SCSI_STATUS); |
1814 | dma_status = DC395x_read8(acb, TRM_S1040_DMA_STATUS); | 1814 | dma_status = DC395x_read8(acb, TRM_S1040_DMA_STATUS); |
1815 | if (scsi_status & SCSIINTERRUPT) { | 1815 | if (scsi_status & SCSIINTERRUPT) { |
1816 | /* interupt pending - let's process it! */ | 1816 | /* interrupt pending - let's process it! */ |
1817 | dc395x_handle_interrupt(acb, scsi_status); | 1817 | dc395x_handle_interrupt(acb, scsi_status); |
1818 | handled = IRQ_HANDLED; | 1818 | handled = IRQ_HANDLED; |
1819 | } | 1819 | } |
@@ -4579,7 +4579,7 @@ static void adapter_uninit_chip(struct AdapterCtlBlk *acb) | |||
4579 | if (acb->config & HCC_SCSI_RESET) | 4579 | if (acb->config & HCC_SCSI_RESET) |
4580 | reset_scsi_bus(acb); | 4580 | reset_scsi_bus(acb); |
4581 | 4581 | ||
4582 | /* clear any pending interupt state */ | 4582 | /* clear any pending interrupt state */ |
4583 | DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); | 4583 | DC395x_read8(acb, TRM_S1040_SCSI_INTSTATUS); |
4584 | } | 4584 | } |
4585 | 4585 | ||
diff --git a/drivers/scsi/eata_pio.c b/drivers/scsi/eata_pio.c index 96180bb47e41..982c5092be11 100644 --- a/drivers/scsi/eata_pio.c +++ b/drivers/scsi/eata_pio.c | |||
@@ -172,7 +172,7 @@ static void IncStat(struct scsi_pointer *SCp, unsigned int Increment) | |||
172 | SCp->Status = 0; | 172 | SCp->Status = 0; |
173 | else { | 173 | else { |
174 | SCp->buffer++; | 174 | SCp->buffer++; |
175 | SCp->ptr = page_address(SCp->buffer->page) + SCp->buffer->offset; | 175 | SCp->ptr = sg_virt(SCp->buffer); |
176 | SCp->this_residual = SCp->buffer->length; | 176 | SCp->this_residual = SCp->buffer->length; |
177 | } | 177 | } |
178 | } | 178 | } |
@@ -410,7 +410,7 @@ static int eata_pio_queue(struct scsi_cmnd *cmd, | |||
410 | } else { | 410 | } else { |
411 | cmd->SCp.buffer = cmd->request_buffer; | 411 | cmd->SCp.buffer = cmd->request_buffer; |
412 | cmd->SCp.buffers_residual = cmd->use_sg; | 412 | cmd->SCp.buffers_residual = cmd->use_sg; |
413 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; | 413 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
414 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 414 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
415 | } | 415 | } |
416 | cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes | 416 | cmd->SCp.Status = (cmd->SCp.this_residual != 0); /* TRUE as long as bytes |
diff --git a/drivers/scsi/fd_mcs.c b/drivers/scsi/fd_mcs.c index 668569e8856b..8335b608e571 100644 --- a/drivers/scsi/fd_mcs.c +++ b/drivers/scsi/fd_mcs.c | |||
@@ -973,7 +973,7 @@ static irqreturn_t fd_mcs_intr(int irq, void *dev_id) | |||
973 | if (current_SC->SCp.buffers_residual) { | 973 | if (current_SC->SCp.buffers_residual) { |
974 | --current_SC->SCp.buffers_residual; | 974 | --current_SC->SCp.buffers_residual; |
975 | ++current_SC->SCp.buffer; | 975 | ++current_SC->SCp.buffer; |
976 | current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset; | 976 | current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer); |
977 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; | 977 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; |
978 | } else | 978 | } else |
979 | break; | 979 | break; |
@@ -1006,7 +1006,7 @@ static irqreturn_t fd_mcs_intr(int irq, void *dev_id) | |||
1006 | if (!current_SC->SCp.this_residual && current_SC->SCp.buffers_residual) { | 1006 | if (!current_SC->SCp.this_residual && current_SC->SCp.buffers_residual) { |
1007 | --current_SC->SCp.buffers_residual; | 1007 | --current_SC->SCp.buffers_residual; |
1008 | ++current_SC->SCp.buffer; | 1008 | ++current_SC->SCp.buffer; |
1009 | current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset; | 1009 | current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer); |
1010 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; | 1010 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; |
1011 | } | 1011 | } |
1012 | } | 1012 | } |
@@ -1109,7 +1109,7 @@ static int fd_mcs_queue(Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *)) | |||
1109 | 1109 | ||
1110 | if (current_SC->use_sg) { | 1110 | if (current_SC->use_sg) { |
1111 | current_SC->SCp.buffer = (struct scatterlist *) current_SC->request_buffer; | 1111 | current_SC->SCp.buffer = (struct scatterlist *) current_SC->request_buffer; |
1112 | current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset; | 1112 | current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer); |
1113 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; | 1113 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; |
1114 | current_SC->SCp.buffers_residual = current_SC->use_sg - 1; | 1114 | current_SC->SCp.buffers_residual = current_SC->use_sg - 1; |
1115 | } else { | 1115 | } else { |
diff --git a/drivers/scsi/fdomain.c b/drivers/scsi/fdomain.c index 5d282e6a6ae1..2cd6b4959eb2 100644 --- a/drivers/scsi/fdomain.c +++ b/drivers/scsi/fdomain.c | |||
@@ -1321,7 +1321,7 @@ static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id) | |||
1321 | if (current_SC->SCp.buffers_residual) { | 1321 | if (current_SC->SCp.buffers_residual) { |
1322 | --current_SC->SCp.buffers_residual; | 1322 | --current_SC->SCp.buffers_residual; |
1323 | ++current_SC->SCp.buffer; | 1323 | ++current_SC->SCp.buffer; |
1324 | current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset; | 1324 | current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer); |
1325 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; | 1325 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; |
1326 | } else | 1326 | } else |
1327 | break; | 1327 | break; |
@@ -1354,7 +1354,7 @@ static irqreturn_t do_fdomain_16x0_intr(int irq, void *dev_id) | |||
1354 | && current_SC->SCp.buffers_residual) { | 1354 | && current_SC->SCp.buffers_residual) { |
1355 | --current_SC->SCp.buffers_residual; | 1355 | --current_SC->SCp.buffers_residual; |
1356 | ++current_SC->SCp.buffer; | 1356 | ++current_SC->SCp.buffer; |
1357 | current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) + current_SC->SCp.buffer->offset; | 1357 | current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer); |
1358 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; | 1358 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; |
1359 | } | 1359 | } |
1360 | } | 1360 | } |
@@ -1439,8 +1439,7 @@ static int fdomain_16x0_queue(struct scsi_cmnd *SCpnt, | |||
1439 | 1439 | ||
1440 | if (scsi_sg_count(current_SC)) { | 1440 | if (scsi_sg_count(current_SC)) { |
1441 | current_SC->SCp.buffer = scsi_sglist(current_SC); | 1441 | current_SC->SCp.buffer = scsi_sglist(current_SC); |
1442 | current_SC->SCp.ptr = page_address(current_SC->SCp.buffer->page) | 1442 | current_SC->SCp.ptr = sg_virt(current_SC->SCp.buffer); |
1443 | + current_SC->SCp.buffer->offset; | ||
1444 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; | 1443 | current_SC->SCp.this_residual = current_SC->SCp.buffer->length; |
1445 | current_SC->SCp.buffers_residual = scsi_sg_count(current_SC) - 1; | 1444 | current_SC->SCp.buffers_residual = scsi_sg_count(current_SC) - 1; |
1446 | } else { | 1445 | } else { |
diff --git a/drivers/scsi/gdth.c b/drivers/scsi/gdth.c index 56de5a6f2817..b253b8c718d3 100644 --- a/drivers/scsi/gdth.c +++ b/drivers/scsi/gdth.c | |||
@@ -2374,18 +2374,18 @@ static void gdth_copy_internal_data(gdth_ha_str *ha, Scsi_Cmnd *scp, | |||
2374 | if (cpsum+cpnow > cpcount) | 2374 | if (cpsum+cpnow > cpcount) |
2375 | cpnow = cpcount - cpsum; | 2375 | cpnow = cpcount - cpsum; |
2376 | cpsum += cpnow; | 2376 | cpsum += cpnow; |
2377 | if (!sl->page) { | 2377 | if (!sg_page(sl)) { |
2378 | printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n", | 2378 | printk("GDT-HA %d: invalid sc/gt element in gdth_copy_internal_data()\n", |
2379 | ha->hanum); | 2379 | ha->hanum); |
2380 | return; | 2380 | return; |
2381 | } | 2381 | } |
2382 | local_irq_save(flags); | 2382 | local_irq_save(flags); |
2383 | address = kmap_atomic(sl->page, KM_BIO_SRC_IRQ) + sl->offset; | 2383 | address = kmap_atomic(sg_page(sl), KM_BIO_SRC_IRQ) + sl->offset; |
2384 | if (to_buffer) | 2384 | if (to_buffer) |
2385 | memcpy(buffer, address, cpnow); | 2385 | memcpy(buffer, address, cpnow); |
2386 | else | 2386 | else |
2387 | memcpy(address, buffer, cpnow); | 2387 | memcpy(address, buffer, cpnow); |
2388 | flush_dcache_page(sl->page); | 2388 | flush_dcache_page(sg_page(sl)); |
2389 | kunmap_atomic(address, KM_BIO_SRC_IRQ); | 2389 | kunmap_atomic(address, KM_BIO_SRC_IRQ); |
2390 | local_irq_restore(flags); | 2390 | local_irq_restore(flags); |
2391 | if (cpsum == cpcount) | 2391 | if (cpsum == cpcount) |
diff --git a/drivers/scsi/ibmmca.c b/drivers/scsi/ibmmca.c index 714e6273a70d..db004a450732 100644 --- a/drivers/scsi/ibmmca.c +++ b/drivers/scsi/ibmmca.c | |||
@@ -1828,7 +1828,7 @@ static int ibmmca_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
1828 | BUG_ON(scsi_sg_count(cmd) > 16); | 1828 | BUG_ON(scsi_sg_count(cmd) > 16); |
1829 | 1829 | ||
1830 | scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) { | 1830 | scsi_for_each_sg(cmd, sg, scsi_sg_count(cmd), i) { |
1831 | ld(shpnt)[ldn].sge[i].address = (void *) (isa_page_to_bus(sg->page) + sg->offset); | 1831 | ld(shpnt)[ldn].sge[i].address = (void *) (isa_page_to_bus(sg_page(sg)) + sg->offset); |
1832 | ld(shpnt)[ldn].sge[i].byte_length = sg->length; | 1832 | ld(shpnt)[ldn].sge[i].byte_length = sg->length; |
1833 | } | 1833 | } |
1834 | scb->enable |= IM_POINTER_TO_LIST; | 1834 | scb->enable |= IM_POINTER_TO_LIST; |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index fa7ba64483fb..8d0244c2e7d4 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -47,9 +47,9 @@ | |||
47 | #include <linux/scatterlist.h> | 47 | #include <linux/scatterlist.h> |
48 | #include <linux/delay.h> | 48 | #include <linux/delay.h> |
49 | #include <linux/mutex.h> | 49 | #include <linux/mutex.h> |
50 | #include <linux/bitops.h> | ||
50 | 51 | ||
51 | #include <asm/io.h> | 52 | #include <asm/io.h> |
52 | #include <asm/bitops.h> | ||
53 | #include <asm/uaccess.h> | 53 | #include <asm/uaccess.h> |
54 | 54 | ||
55 | #include <scsi/scsi.h> | 55 | #include <scsi/scsi.h> |
@@ -175,18 +175,18 @@ static void idescsi_input_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsigne | |||
175 | 175 | ||
176 | while (bcount) { | 176 | while (bcount) { |
177 | count = min(pc->sg->length - pc->b_count, bcount); | 177 | count = min(pc->sg->length - pc->b_count, bcount); |
178 | if (PageHighMem(pc->sg->page)) { | 178 | if (PageHighMem(sg_page(pc->sg))) { |
179 | unsigned long flags; | 179 | unsigned long flags; |
180 | 180 | ||
181 | local_irq_save(flags); | 181 | local_irq_save(flags); |
182 | buf = kmap_atomic(pc->sg->page, KM_IRQ0) + | 182 | buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + |
183 | pc->sg->offset; | 183 | pc->sg->offset; |
184 | drive->hwif->atapi_input_bytes(drive, | 184 | drive->hwif->atapi_input_bytes(drive, |
185 | buf + pc->b_count, count); | 185 | buf + pc->b_count, count); |
186 | kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); | 186 | kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); |
187 | local_irq_restore(flags); | 187 | local_irq_restore(flags); |
188 | } else { | 188 | } else { |
189 | buf = page_address(pc->sg->page) + pc->sg->offset; | 189 | buf = sg_virt(pc->sg); |
190 | drive->hwif->atapi_input_bytes(drive, | 190 | drive->hwif->atapi_input_bytes(drive, |
191 | buf + pc->b_count, count); | 191 | buf + pc->b_count, count); |
192 | } | 192 | } |
@@ -212,18 +212,18 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign | |||
212 | 212 | ||
213 | while (bcount) { | 213 | while (bcount) { |
214 | count = min(pc->sg->length - pc->b_count, bcount); | 214 | count = min(pc->sg->length - pc->b_count, bcount); |
215 | if (PageHighMem(pc->sg->page)) { | 215 | if (PageHighMem(sg_page(pc->sg))) { |
216 | unsigned long flags; | 216 | unsigned long flags; |
217 | 217 | ||
218 | local_irq_save(flags); | 218 | local_irq_save(flags); |
219 | buf = kmap_atomic(pc->sg->page, KM_IRQ0) + | 219 | buf = kmap_atomic(sg_page(pc->sg), KM_IRQ0) + |
220 | pc->sg->offset; | 220 | pc->sg->offset; |
221 | drive->hwif->atapi_output_bytes(drive, | 221 | drive->hwif->atapi_output_bytes(drive, |
222 | buf + pc->b_count, count); | 222 | buf + pc->b_count, count); |
223 | kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); | 223 | kunmap_atomic(buf - pc->sg->offset, KM_IRQ0); |
224 | local_irq_restore(flags); | 224 | local_irq_restore(flags); |
225 | } else { | 225 | } else { |
226 | buf = page_address(pc->sg->page) + pc->sg->offset; | 226 | buf = sg_virt(pc->sg); |
227 | drive->hwif->atapi_output_bytes(drive, | 227 | drive->hwif->atapi_output_bytes(drive, |
228 | buf + pc->b_count, count); | 228 | buf + pc->b_count, count); |
229 | } | 229 | } |
diff --git a/drivers/scsi/imm.c b/drivers/scsi/imm.c index 74cdc1f0a78f..a3d0c6b14958 100644 --- a/drivers/scsi/imm.c +++ b/drivers/scsi/imm.c | |||
@@ -705,9 +705,7 @@ static int imm_completion(struct scsi_cmnd *cmd) | |||
705 | cmd->SCp.buffer++; | 705 | cmd->SCp.buffer++; |
706 | cmd->SCp.this_residual = | 706 | cmd->SCp.this_residual = |
707 | cmd->SCp.buffer->length; | 707 | cmd->SCp.buffer->length; |
708 | cmd->SCp.ptr = | 708 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
709 | page_address(cmd->SCp.buffer->page) + | ||
710 | cmd->SCp.buffer->offset; | ||
711 | 709 | ||
712 | /* | 710 | /* |
713 | * Make sure that we transfer even number of bytes | 711 | * Make sure that we transfer even number of bytes |
@@ -844,9 +842,7 @@ static int imm_engine(imm_struct *dev, struct scsi_cmnd *cmd) | |||
844 | cmd->SCp.buffer = | 842 | cmd->SCp.buffer = |
845 | (struct scatterlist *) cmd->request_buffer; | 843 | (struct scatterlist *) cmd->request_buffer; |
846 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 844 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
847 | cmd->SCp.ptr = | 845 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
848 | page_address(cmd->SCp.buffer->page) + | ||
849 | cmd->SCp.buffer->offset; | ||
850 | } else { | 846 | } else { |
851 | /* else fill the only available buffer */ | 847 | /* else fill the only available buffer */ |
852 | cmd->SCp.buffer = NULL; | 848 | cmd->SCp.buffer = NULL; |
diff --git a/drivers/scsi/in2000.c b/drivers/scsi/in2000.c index ab7cbf3449ce..c8b452f2878c 100644 --- a/drivers/scsi/in2000.c +++ b/drivers/scsi/in2000.c | |||
@@ -372,7 +372,7 @@ static int in2000_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *)) | |||
372 | if (cmd->use_sg) { | 372 | if (cmd->use_sg) { |
373 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; | 373 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
374 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 374 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
375 | cmd->SCp.ptr = (char *) page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; | 375 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
376 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 376 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
377 | } else { | 377 | } else { |
378 | cmd->SCp.buffer = NULL; | 378 | cmd->SCp.buffer = NULL; |
@@ -764,7 +764,7 @@ static void transfer_bytes(Scsi_Cmnd * cmd, int data_in_dir) | |||
764 | ++cmd->SCp.buffer; | 764 | ++cmd->SCp.buffer; |
765 | --cmd->SCp.buffers_residual; | 765 | --cmd->SCp.buffers_residual; |
766 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 766 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
767 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + cmd->SCp.buffer->offset; | 767 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
768 | } | 768 | } |
769 | 769 | ||
770 | /* Set up hardware registers */ | 770 | /* Set up hardware registers */ |
diff --git a/drivers/scsi/ipr.c b/drivers/scsi/ipr.c index b41dfb539021..439b97a6a269 100644 --- a/drivers/scsi/ipr.c +++ b/drivers/scsi/ipr.c | |||
@@ -2872,6 +2872,7 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) | |||
2872 | } | 2872 | } |
2873 | 2873 | ||
2874 | scatterlist = sglist->scatterlist; | 2874 | scatterlist = sglist->scatterlist; |
2875 | sg_init_table(scatterlist, num_elem); | ||
2875 | 2876 | ||
2876 | sglist->order = order; | 2877 | sglist->order = order; |
2877 | sglist->num_sg = num_elem; | 2878 | sglist->num_sg = num_elem; |
@@ -2884,12 +2885,12 @@ static struct ipr_sglist *ipr_alloc_ucode_buffer(int buf_len) | |||
2884 | 2885 | ||
2885 | /* Free up what we already allocated */ | 2886 | /* Free up what we already allocated */ |
2886 | for (j = i - 1; j >= 0; j--) | 2887 | for (j = i - 1; j >= 0; j--) |
2887 | __free_pages(scatterlist[j].page, order); | 2888 | __free_pages(sg_page(&scatterlist[j]), order); |
2888 | kfree(sglist); | 2889 | kfree(sglist); |
2889 | return NULL; | 2890 | return NULL; |
2890 | } | 2891 | } |
2891 | 2892 | ||
2892 | scatterlist[i].page = page; | 2893 | sg_set_page(&scatterlist[i], page); |
2893 | } | 2894 | } |
2894 | 2895 | ||
2895 | return sglist; | 2896 | return sglist; |
@@ -2910,7 +2911,7 @@ static void ipr_free_ucode_buffer(struct ipr_sglist *sglist) | |||
2910 | int i; | 2911 | int i; |
2911 | 2912 | ||
2912 | for (i = 0; i < sglist->num_sg; i++) | 2913 | for (i = 0; i < sglist->num_sg; i++) |
2913 | __free_pages(sglist->scatterlist[i].page, sglist->order); | 2914 | __free_pages(sg_page(&sglist->scatterlist[i]), sglist->order); |
2914 | 2915 | ||
2915 | kfree(sglist); | 2916 | kfree(sglist); |
2916 | } | 2917 | } |
@@ -2940,9 +2941,11 @@ static int ipr_copy_ucode_buffer(struct ipr_sglist *sglist, | |||
2940 | scatterlist = sglist->scatterlist; | 2941 | scatterlist = sglist->scatterlist; |
2941 | 2942 | ||
2942 | for (i = 0; i < (len / bsize_elem); i++, buffer += bsize_elem) { | 2943 | for (i = 0; i < (len / bsize_elem); i++, buffer += bsize_elem) { |
2943 | kaddr = kmap(scatterlist[i].page); | 2944 | struct page *page = sg_page(&scatterlist[i]); |
2945 | |||
2946 | kaddr = kmap(page); | ||
2944 | memcpy(kaddr, buffer, bsize_elem); | 2947 | memcpy(kaddr, buffer, bsize_elem); |
2945 | kunmap(scatterlist[i].page); | 2948 | kunmap(page); |
2946 | 2949 | ||
2947 | scatterlist[i].length = bsize_elem; | 2950 | scatterlist[i].length = bsize_elem; |
2948 | 2951 | ||
@@ -2953,9 +2956,11 @@ static int ipr_copy_ucode_buffer(struct ipr_sglist *sglist, | |||
2953 | } | 2956 | } |
2954 | 2957 | ||
2955 | if (len % bsize_elem) { | 2958 | if (len % bsize_elem) { |
2956 | kaddr = kmap(scatterlist[i].page); | 2959 | struct page *page = sg_page(&scatterlist[i]); |
2960 | |||
2961 | kaddr = kmap(page); | ||
2957 | memcpy(kaddr, buffer, len % bsize_elem); | 2962 | memcpy(kaddr, buffer, len % bsize_elem); |
2958 | kunmap(scatterlist[i].page); | 2963 | kunmap(page); |
2959 | 2964 | ||
2960 | scatterlist[i].length = len % bsize_elem; | 2965 | scatterlist[i].length = len % bsize_elem; |
2961 | } | 2966 | } |
@@ -5134,6 +5139,7 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd, | |||
5134 | u32 ioadl_flags = 0; | 5139 | u32 ioadl_flags = 0; |
5135 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; | 5140 | struct ipr_ioarcb *ioarcb = &ipr_cmd->ioarcb; |
5136 | struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; | 5141 | struct ipr_ioadl_desc *ioadl = ipr_cmd->ioadl; |
5142 | struct ipr_ioadl_desc *last_ioadl = NULL; | ||
5137 | int len = qc->nbytes + qc->pad_len; | 5143 | int len = qc->nbytes + qc->pad_len; |
5138 | struct scatterlist *sg; | 5144 | struct scatterlist *sg; |
5139 | 5145 | ||
@@ -5156,11 +5162,13 @@ static void ipr_build_ata_ioadl(struct ipr_cmnd *ipr_cmd, | |||
5156 | ata_for_each_sg(sg, qc) { | 5162 | ata_for_each_sg(sg, qc) { |
5157 | ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg)); | 5163 | ioadl->flags_and_data_len = cpu_to_be32(ioadl_flags | sg_dma_len(sg)); |
5158 | ioadl->address = cpu_to_be32(sg_dma_address(sg)); | 5164 | ioadl->address = cpu_to_be32(sg_dma_address(sg)); |
5159 | if (ata_sg_is_last(sg, qc)) | 5165 | |
5160 | ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); | 5166 | last_ioadl = ioadl; |
5161 | else | 5167 | ioadl++; |
5162 | ioadl++; | ||
5163 | } | 5168 | } |
5169 | |||
5170 | if (likely(last_ioadl)) | ||
5171 | last_ioadl->flags_and_data_len |= cpu_to_be32(IPR_IOADL_FLAGS_LAST); | ||
5164 | } | 5172 | } |
5165 | 5173 | ||
5166 | /** | 5174 | /** |
diff --git a/drivers/scsi/ips.c b/drivers/scsi/ips.c index edaac2714c5a..5c5a9b2628fc 100644 --- a/drivers/scsi/ips.c +++ b/drivers/scsi/ips.c | |||
@@ -1515,7 +1515,7 @@ static int ips_is_passthru(struct scsi_cmnd *SC) | |||
1515 | /* kmap_atomic() ensures addressability of the user buffer.*/ | 1515 | /* kmap_atomic() ensures addressability of the user buffer.*/ |
1516 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 1516 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
1517 | local_irq_save(flags); | 1517 | local_irq_save(flags); |
1518 | buffer = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 1518 | buffer = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
1519 | if (buffer && buffer[0] == 'C' && buffer[1] == 'O' && | 1519 | if (buffer && buffer[0] == 'C' && buffer[1] == 'O' && |
1520 | buffer[2] == 'P' && buffer[3] == 'P') { | 1520 | buffer[2] == 'P' && buffer[3] == 'P') { |
1521 | kunmap_atomic(buffer - sg->offset, KM_IRQ0); | 1521 | kunmap_atomic(buffer - sg->offset, KM_IRQ0); |
@@ -3523,7 +3523,7 @@ ips_scmd_buf_write(struct scsi_cmnd *scmd, void *data, unsigned int count) | |||
3523 | /* kmap_atomic() ensures addressability of the data buffer.*/ | 3523 | /* kmap_atomic() ensures addressability of the data buffer.*/ |
3524 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 3524 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
3525 | local_irq_save(flags); | 3525 | local_irq_save(flags); |
3526 | buffer = kmap_atomic(sg[i].page, KM_IRQ0) + sg[i].offset; | 3526 | buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset; |
3527 | memcpy(buffer, &cdata[xfer_cnt], min_cnt); | 3527 | memcpy(buffer, &cdata[xfer_cnt], min_cnt); |
3528 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); | 3528 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); |
3529 | local_irq_restore(flags); | 3529 | local_irq_restore(flags); |
@@ -3556,7 +3556,7 @@ ips_scmd_buf_read(struct scsi_cmnd *scmd, void *data, unsigned int count) | |||
3556 | /* kmap_atomic() ensures addressability of the data buffer.*/ | 3556 | /* kmap_atomic() ensures addressability of the data buffer.*/ |
3557 | /* local_irq_save() protects the KM_IRQ0 address slot. */ | 3557 | /* local_irq_save() protects the KM_IRQ0 address slot. */ |
3558 | local_irq_save(flags); | 3558 | local_irq_save(flags); |
3559 | buffer = kmap_atomic(sg[i].page, KM_IRQ0) + sg[i].offset; | 3559 | buffer = kmap_atomic(sg_page(&sg[i]), KM_IRQ0) + sg[i].offset; |
3560 | memcpy(&cdata[xfer_cnt], buffer, min_cnt); | 3560 | memcpy(&cdata[xfer_cnt], buffer, min_cnt); |
3561 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); | 3561 | kunmap_atomic(buffer - sg[i].offset, KM_IRQ0); |
3562 | local_irq_restore(flags); | 3562 | local_irq_restore(flags); |
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index a21455d0274c..6ce4109efdf3 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -70,9 +70,7 @@ module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO); | |||
70 | static inline void | 70 | static inline void |
71 | iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) | 71 | iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) |
72 | { | 72 | { |
73 | ibuf->sg.page = virt_to_page(vbuf); | 73 | sg_init_one(&ibuf->sg, vbuf, size); |
74 | ibuf->sg.offset = offset_in_page(vbuf); | ||
75 | ibuf->sg.length = size; | ||
76 | ibuf->sent = 0; | 74 | ibuf->sent = 0; |
77 | ibuf->use_sendmsg = 1; | 75 | ibuf->use_sendmsg = 1; |
78 | } | 76 | } |
@@ -80,13 +78,14 @@ iscsi_buf_init_iov(struct iscsi_buf *ibuf, char *vbuf, int size) | |||
80 | static inline void | 78 | static inline void |
81 | iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg) | 79 | iscsi_buf_init_sg(struct iscsi_buf *ibuf, struct scatterlist *sg) |
82 | { | 80 | { |
83 | ibuf->sg.page = sg->page; | 81 | sg_init_table(&ibuf->sg, 1); |
82 | sg_set_page(&ibuf->sg, sg_page(sg)); | ||
84 | ibuf->sg.offset = sg->offset; | 83 | ibuf->sg.offset = sg->offset; |
85 | ibuf->sg.length = sg->length; | 84 | ibuf->sg.length = sg->length; |
86 | /* | 85 | /* |
87 | * Fastpath: sg element fits into single page | 86 | * Fastpath: sg element fits into single page |
88 | */ | 87 | */ |
89 | if (sg->length + sg->offset <= PAGE_SIZE && !PageSlab(sg->page)) | 88 | if (sg->length + sg->offset <= PAGE_SIZE && !PageSlab(sg_page(sg))) |
90 | ibuf->use_sendmsg = 0; | 89 | ibuf->use_sendmsg = 0; |
91 | else | 90 | else |
92 | ibuf->use_sendmsg = 1; | 91 | ibuf->use_sendmsg = 1; |
@@ -716,7 +715,7 @@ static int iscsi_scsi_data_in(struct iscsi_conn *conn) | |||
716 | for (i = tcp_ctask->sg_count; i < scsi_sg_count(sc); i++) { | 715 | for (i = tcp_ctask->sg_count; i < scsi_sg_count(sc); i++) { |
717 | char *dest; | 716 | char *dest; |
718 | 717 | ||
719 | dest = kmap_atomic(sg[i].page, KM_SOFTIRQ0); | 718 | dest = kmap_atomic(sg_page(&sg[i]), KM_SOFTIRQ0); |
720 | rc = iscsi_ctask_copy(tcp_conn, ctask, dest + sg[i].offset, | 719 | rc = iscsi_ctask_copy(tcp_conn, ctask, dest + sg[i].offset, |
721 | sg[i].length, offset); | 720 | sg[i].length, offset); |
722 | kunmap_atomic(dest, KM_SOFTIRQ0); | 721 | kunmap_atomic(dest, KM_SOFTIRQ0); |
@@ -1103,9 +1102,9 @@ iscsi_send(struct iscsi_conn *conn, struct iscsi_buf *buf, int size, int flags) | |||
1103 | * slab case. | 1102 | * slab case. |
1104 | */ | 1103 | */ |
1105 | if (buf->use_sendmsg) | 1104 | if (buf->use_sendmsg) |
1106 | res = sock_no_sendpage(sk, buf->sg.page, offset, size, flags); | 1105 | res = sock_no_sendpage(sk, sg_page(&buf->sg), offset, size, flags); |
1107 | else | 1106 | else |
1108 | res = tcp_conn->sendpage(sk, buf->sg.page, offset, size, flags); | 1107 | res = tcp_conn->sendpage(sk, sg_page(&buf->sg), offset, size, flags); |
1109 | 1108 | ||
1110 | if (res >= 0) { | 1109 | if (res >= 0) { |
1111 | conn->txdata_octets += res; | 1110 | conn->txdata_octets += res; |
diff --git a/drivers/scsi/libsas/sas_discover.c b/drivers/scsi/libsas/sas_discover.c index 7ef0afc3cd68..5f3a0d7b18de 100644 --- a/drivers/scsi/libsas/sas_discover.c +++ b/drivers/scsi/libsas/sas_discover.c | |||
@@ -285,7 +285,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
285 | dev = port->port_dev; | 285 | dev = port->port_dev; |
286 | 286 | ||
287 | SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, | 287 | SAS_DPRINTK("DOING DISCOVERY on port %d, pid:%d\n", port->id, |
288 | current->pid); | 288 | task_pid_nr(current)); |
289 | 289 | ||
290 | switch (dev->dev_type) { | 290 | switch (dev->dev_type) { |
291 | case SAS_END_DEV: | 291 | case SAS_END_DEV: |
@@ -320,7 +320,7 @@ static void sas_discover_domain(struct work_struct *work) | |||
320 | } | 320 | } |
321 | 321 | ||
322 | SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id, | 322 | SAS_DPRINTK("DONE DISCOVERY on port %d, pid:%d, result:%d\n", port->id, |
323 | current->pid, error); | 323 | task_pid_nr(current), error); |
324 | } | 324 | } |
325 | 325 | ||
326 | static void sas_revalidate_domain(struct work_struct *work) | 326 | static void sas_revalidate_domain(struct work_struct *work) |
@@ -334,12 +334,12 @@ static void sas_revalidate_domain(struct work_struct *work) | |||
334 | &port->disc.pending); | 334 | &port->disc.pending); |
335 | 335 | ||
336 | SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, | 336 | SAS_DPRINTK("REVALIDATING DOMAIN on port %d, pid:%d\n", port->id, |
337 | current->pid); | 337 | task_pid_nr(current)); |
338 | if (port->port_dev) | 338 | if (port->port_dev) |
339 | res = sas_ex_revalidate_domain(port->port_dev); | 339 | res = sas_ex_revalidate_domain(port->port_dev); |
340 | 340 | ||
341 | SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", | 341 | SAS_DPRINTK("done REVALIDATING DOMAIN on port %d, pid:%d, res 0x%x\n", |
342 | port->id, current->pid, res); | 342 | port->id, task_pid_nr(current), res); |
343 | } | 343 | } |
344 | 344 | ||
345 | /* ---------- Events ---------- */ | 345 | /* ---------- Events ---------- */ |
diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index e5337ad4121e..ce348c5c706c 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c | |||
@@ -1243,7 +1243,8 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba) | |||
1243 | memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); | 1243 | memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); |
1244 | memcpy(&adaptermsg[0], (uint8_t *) irsp, | 1244 | memcpy(&adaptermsg[0], (uint8_t *) irsp, |
1245 | MAX_MSG_DATA); | 1245 | MAX_MSG_DATA); |
1246 | dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", | 1246 | dev_warn(&((phba->pcidev)->dev), |
1247 | "lpfc%d: %s\n", | ||
1247 | phba->brd_no, adaptermsg); | 1248 | phba->brd_no, adaptermsg); |
1248 | } else { | 1249 | } else { |
1249 | /* Unknown IOCB command */ | 1250 | /* Unknown IOCB command */ |
@@ -1430,7 +1431,8 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba, | |||
1430 | memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); | 1431 | memset(adaptermsg, 0, LPFC_MAX_ADPTMSG); |
1431 | memcpy(&adaptermsg[0], (uint8_t *) irsp, | 1432 | memcpy(&adaptermsg[0], (uint8_t *) irsp, |
1432 | MAX_MSG_DATA); | 1433 | MAX_MSG_DATA); |
1433 | dev_warn(&((phba->pcidev)->dev), "lpfc%d: %s", | 1434 | dev_warn(&((phba->pcidev)->dev), |
1435 | "lpfc%d: %s\n", | ||
1434 | phba->brd_no, adaptermsg); | 1436 | phba->brd_no, adaptermsg); |
1435 | } else { | 1437 | } else { |
1436 | /* Unknown IOCB command */ | 1438 | /* Unknown IOCB command */ |
@@ -1681,7 +1683,7 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba, | |||
1681 | memcpy(&adaptermsg[0], (uint8_t *) irsp, | 1683 | memcpy(&adaptermsg[0], (uint8_t *) irsp, |
1682 | MAX_MSG_DATA); | 1684 | MAX_MSG_DATA); |
1683 | dev_warn(&((phba->pcidev)->dev), | 1685 | dev_warn(&((phba->pcidev)->dev), |
1684 | "lpfc%d: %s", | 1686 | "lpfc%d: %s\n", |
1685 | phba->brd_no, adaptermsg); | 1687 | phba->brd_no, adaptermsg); |
1686 | } else { | 1688 | } else { |
1687 | /* Unknown IOCB command */ | 1689 | /* Unknown IOCB command */ |
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c index 10d1aff9938a..66c652035730 100644 --- a/drivers/scsi/megaraid.c +++ b/drivers/scsi/megaraid.c | |||
@@ -658,7 +658,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_Cmnd *cmd, int *busy) | |||
658 | struct scatterlist *sg; | 658 | struct scatterlist *sg; |
659 | 659 | ||
660 | sg = scsi_sglist(cmd); | 660 | sg = scsi_sglist(cmd); |
661 | buf = kmap_atomic(sg->page, KM_IRQ0) + sg->offset; | 661 | buf = kmap_atomic(sg_page(sg), KM_IRQ0) + sg->offset; |
662 | 662 | ||
663 | memset(buf, 0, cmd->cmnd[4]); | 663 | memset(buf, 0, cmd->cmnd[4]); |
664 | kunmap_atomic(buf - sg->offset, KM_IRQ0); | 664 | kunmap_atomic(buf - sg->offset, KM_IRQ0); |
@@ -1542,10 +1542,8 @@ mega_cmd_done(adapter_t *adapter, u8 completed[], int nstatus, int status) | |||
1542 | if( cmd->cmnd[0] == INQUIRY && !islogical ) { | 1542 | if( cmd->cmnd[0] == INQUIRY && !islogical ) { |
1543 | 1543 | ||
1544 | sgl = scsi_sglist(cmd); | 1544 | sgl = scsi_sglist(cmd); |
1545 | if( sgl->page ) { | 1545 | if( sg_page(sgl) ) { |
1546 | c = *(unsigned char *) | 1546 | c = *(unsigned char *) sg_virt(&sgl[0]); |
1547 | page_address((&sgl[0])->page) + | ||
1548 | (&sgl[0])->offset; | ||
1549 | } else { | 1547 | } else { |
1550 | printk(KERN_WARNING | 1548 | printk(KERN_WARNING |
1551 | "megaraid: invalid sg.\n"); | 1549 | "megaraid: invalid sg.\n"); |
diff --git a/drivers/scsi/megaraid/megaraid_mbox.c b/drivers/scsi/megaraid/megaraid_mbox.c index e4e4c6a39ed6..c8923108183a 100644 --- a/drivers/scsi/megaraid/megaraid_mbox.c +++ b/drivers/scsi/megaraid/megaraid_mbox.c | |||
@@ -427,7 +427,7 @@ megaraid_exit(void) | |||
427 | * @id : pci device id of the class of controllers | 427 | * @id : pci device id of the class of controllers |
428 | * | 428 | * |
429 | * This routine should be called whenever a new adapter is detected by the | 429 | * This routine should be called whenever a new adapter is detected by the |
430 | * PCI hotplug susbsytem. | 430 | * PCI hotplug susbsystem. |
431 | */ | 431 | */ |
432 | static int __devinit | 432 | static int __devinit |
433 | megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) | 433 | megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id) |
@@ -1584,10 +1584,8 @@ megaraid_mbox_build_cmd(adapter_t *adapter, struct scsi_cmnd *scp, int *busy) | |||
1584 | caddr_t vaddr; | 1584 | caddr_t vaddr; |
1585 | 1585 | ||
1586 | sgl = scsi_sglist(scp); | 1586 | sgl = scsi_sglist(scp); |
1587 | if (sgl->page) { | 1587 | if (sg_page(sgl)) { |
1588 | vaddr = (caddr_t) | 1588 | vaddr = (caddr_t) sg_virt(&sgl[0]); |
1589 | (page_address((&sgl[0])->page) | ||
1590 | + (&sgl[0])->offset); | ||
1591 | 1589 | ||
1592 | memset(vaddr, 0, scp->cmnd[4]); | 1590 | memset(vaddr, 0, scp->cmnd[4]); |
1593 | } | 1591 | } |
@@ -2328,10 +2326,8 @@ megaraid_mbox_dpc(unsigned long devp) | |||
2328 | && IS_RAID_CH(raid_dev, scb->dev_channel)) { | 2326 | && IS_RAID_CH(raid_dev, scb->dev_channel)) { |
2329 | 2327 | ||
2330 | sgl = scsi_sglist(scp); | 2328 | sgl = scsi_sglist(scp); |
2331 | if (sgl->page) { | 2329 | if (sg_page(sgl)) { |
2332 | c = *(unsigned char *) | 2330 | c = *(unsigned char *) sg_virt(&sgl[0]); |
2333 | (page_address((&sgl[0])->page) + | ||
2334 | (&sgl[0])->offset); | ||
2335 | } else { | 2331 | } else { |
2336 | con_log(CL_ANN, (KERN_WARNING | 2332 | con_log(CL_ANN, (KERN_WARNING |
2337 | "megaraid mailbox: invalid sg:%d\n", | 2333 | "megaraid mailbox: invalid sg:%d\n", |
diff --git a/drivers/scsi/nsp32.h b/drivers/scsi/nsp32.h index a976e8193d16..6715ecb3bfca 100644 --- a/drivers/scsi/nsp32.h +++ b/drivers/scsi/nsp32.h | |||
@@ -69,11 +69,6 @@ typedef u32 u32_le; | |||
69 | typedef u16 u16_le; | 69 | typedef u16 u16_le; |
70 | 70 | ||
71 | /* | 71 | /* |
72 | * MACRO | ||
73 | */ | ||
74 | #define BIT(x) (1UL << (x)) | ||
75 | |||
76 | /* | ||
77 | * BASIC Definitions | 72 | * BASIC Definitions |
78 | */ | 73 | */ |
79 | #ifndef TRUE | 74 | #ifndef TRUE |
diff --git a/drivers/scsi/oktagon_esp.c b/drivers/scsi/oktagon_esp.c index 26a6d55faf3e..8e5eadbd5c51 100644 --- a/drivers/scsi/oktagon_esp.c +++ b/drivers/scsi/oktagon_esp.c | |||
@@ -550,8 +550,7 @@ void dma_mmu_get_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd *sp) | |||
550 | 550 | ||
551 | void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd *sp) | 551 | void dma_mmu_get_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd *sp) |
552 | { | 552 | { |
553 | sp->SCp.ptr = page_address(sp->SCp.buffer->page)+ | 553 | sp->SCp.ptr = sg_virt(sp->SCp.buffer); |
554 | sp->SCp.buffer->offset; | ||
555 | } | 554 | } |
556 | 555 | ||
557 | void dma_mmu_release_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd *sp) | 556 | void dma_mmu_release_scsi_one(struct NCR_ESP *esp, Scsi_Cmnd *sp) |
@@ -564,8 +563,7 @@ void dma_mmu_release_scsi_sgl(struct NCR_ESP *esp, Scsi_Cmnd *sp) | |||
564 | 563 | ||
565 | void dma_advance_sg(Scsi_Cmnd *sp) | 564 | void dma_advance_sg(Scsi_Cmnd *sp) |
566 | { | 565 | { |
567 | sp->SCp.ptr = page_address(sp->SCp.buffer->page)+ | 566 | sp->SCp.ptr = sg_virt(sp->SCp.buffer); |
568 | sp->SCp.buffer->offset; | ||
569 | } | 567 | } |
570 | 568 | ||
571 | 569 | ||
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 331b789937c4..1c5c4b68f20f 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c | |||
@@ -542,7 +542,7 @@ static int osst_verify_frame(struct osst_tape * STp, int frame_seq_number, int q | |||
542 | if (STp->raw) { | 542 | if (STp->raw) { |
543 | if (STp->buffer->syscall_result) { | 543 | if (STp->buffer->syscall_result) { |
544 | for (i=0; i < STp->buffer->sg_segs; i++) | 544 | for (i=0; i < STp->buffer->sg_segs; i++) |
545 | memset(page_address(STp->buffer->sg[i].page), | 545 | memset(page_address(sg_page(&STp->buffer->sg[i])), |
546 | 0, STp->buffer->sg[i].length); | 546 | 0, STp->buffer->sg[i].length); |
547 | strcpy(STp->buffer->b_data, "READ ERROR ON FRAME"); | 547 | strcpy(STp->buffer->b_data, "READ ERROR ON FRAME"); |
548 | } else | 548 | } else |
@@ -4437,7 +4437,7 @@ static int os_scsi_tape_open(struct inode * inode, struct file * filp) | |||
4437 | for (i = 0, b_size = 0; | 4437 | for (i = 0, b_size = 0; |
4438 | (i < STp->buffer->sg_segs) && ((b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE); | 4438 | (i < STp->buffer->sg_segs) && ((b_size + STp->buffer->sg[i].length) <= OS_DATA_SIZE); |
4439 | b_size += STp->buffer->sg[i++].length); | 4439 | b_size += STp->buffer->sg[i++].length); |
4440 | STp->buffer->aux = (os_aux_t *) (page_address(STp->buffer->sg[i].page) + OS_DATA_SIZE - b_size); | 4440 | STp->buffer->aux = (os_aux_t *) (page_address(sg_page(&STp->buffer->sg[i])) + OS_DATA_SIZE - b_size); |
4441 | #if DEBUG | 4441 | #if DEBUG |
4442 | printk(OSST_DEB_MSG "%s:D: b_data points to %p in segment 0 at %p\n", name, | 4442 | printk(OSST_DEB_MSG "%s:D: b_data points to %p in segment 0 at %p\n", name, |
4443 | STp->buffer->b_data, page_address(STp->buffer->sg[0].page)); | 4443 | STp->buffer->b_data, page_address(STp->buffer->sg[0].page)); |
@@ -5252,25 +5252,26 @@ static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) | |||
5252 | /* Try to allocate the first segment up to OS_DATA_SIZE and the others | 5252 | /* Try to allocate the first segment up to OS_DATA_SIZE and the others |
5253 | big enough to reach the goal (code assumes no segments in place) */ | 5253 | big enough to reach the goal (code assumes no segments in place) */ |
5254 | for (b_size = OS_DATA_SIZE, order = OSST_FIRST_ORDER; b_size >= PAGE_SIZE; order--, b_size /= 2) { | 5254 | for (b_size = OS_DATA_SIZE, order = OSST_FIRST_ORDER; b_size >= PAGE_SIZE; order--, b_size /= 2) { |
5255 | STbuffer->sg[0].page = alloc_pages(priority, order); | 5255 | struct page *page = alloc_pages(priority, order); |
5256 | |||
5256 | STbuffer->sg[0].offset = 0; | 5257 | STbuffer->sg[0].offset = 0; |
5257 | if (STbuffer->sg[0].page != NULL) { | 5258 | if (page != NULL) { |
5259 | sg_set_page(&STbuffer->sg[0], page); | ||
5258 | STbuffer->sg[0].length = b_size; | 5260 | STbuffer->sg[0].length = b_size; |
5259 | STbuffer->b_data = page_address(STbuffer->sg[0].page); | 5261 | STbuffer->b_data = page_address(page); |
5260 | break; | 5262 | break; |
5261 | } | 5263 | } |
5262 | } | 5264 | } |
5263 | if (STbuffer->sg[0].page == NULL) { | 5265 | if (sg_page(&STbuffer->sg[0]) == NULL) { |
5264 | printk(KERN_NOTICE "osst :I: Can't allocate tape buffer main segment.\n"); | 5266 | printk(KERN_NOTICE "osst :I: Can't allocate tape buffer main segment.\n"); |
5265 | return 0; | 5267 | return 0; |
5266 | } | 5268 | } |
5267 | /* Got initial segment of 'bsize,order', continue with same size if possible, except for AUX */ | 5269 | /* Got initial segment of 'bsize,order', continue with same size if possible, except for AUX */ |
5268 | for (segs=STbuffer->sg_segs=1, got=b_size; | 5270 | for (segs=STbuffer->sg_segs=1, got=b_size; |
5269 | segs < max_segs && got < OS_FRAME_SIZE; ) { | 5271 | segs < max_segs && got < OS_FRAME_SIZE; ) { |
5270 | STbuffer->sg[segs].page = | 5272 | struct page *page = alloc_pages(priority, (OS_FRAME_SIZE - got <= PAGE_SIZE) ? 0 : order); |
5271 | alloc_pages(priority, (OS_FRAME_SIZE - got <= PAGE_SIZE) ? 0 : order); | ||
5272 | STbuffer->sg[segs].offset = 0; | 5273 | STbuffer->sg[segs].offset = 0; |
5273 | if (STbuffer->sg[segs].page == NULL) { | 5274 | if (page == NULL) { |
5274 | if (OS_FRAME_SIZE - got <= (max_segs - segs) * b_size / 2 && order) { | 5275 | if (OS_FRAME_SIZE - got <= (max_segs - segs) * b_size / 2 && order) { |
5275 | b_size /= 2; /* Large enough for the rest of the buffers */ | 5276 | b_size /= 2; /* Large enough for the rest of the buffers */ |
5276 | order--; | 5277 | order--; |
@@ -5284,6 +5285,7 @@ static int enlarge_buffer(struct osst_buffer *STbuffer, int need_dma) | |||
5284 | normalize_buffer(STbuffer); | 5285 | normalize_buffer(STbuffer); |
5285 | return 0; | 5286 | return 0; |
5286 | } | 5287 | } |
5288 | sg_set_page(&STbuffer->sg[segs], page); | ||
5287 | STbuffer->sg[segs].length = (OS_FRAME_SIZE - got <= PAGE_SIZE / 2) ? (OS_FRAME_SIZE - got) : b_size; | 5289 | STbuffer->sg[segs].length = (OS_FRAME_SIZE - got <= PAGE_SIZE / 2) ? (OS_FRAME_SIZE - got) : b_size; |
5288 | got += STbuffer->sg[segs].length; | 5290 | got += STbuffer->sg[segs].length; |
5289 | STbuffer->buffer_size = got; | 5291 | STbuffer->buffer_size = got; |
@@ -5316,7 +5318,7 @@ static void normalize_buffer(struct osst_buffer *STbuffer) | |||
5316 | b_size < STbuffer->sg[i].length; | 5318 | b_size < STbuffer->sg[i].length; |
5317 | b_size *= 2, order++); | 5319 | b_size *= 2, order++); |
5318 | 5320 | ||
5319 | __free_pages(STbuffer->sg[i].page, order); | 5321 | __free_pages(sg_page(&STbuffer->sg[i]), order); |
5320 | STbuffer->buffer_size -= STbuffer->sg[i].length; | 5322 | STbuffer->buffer_size -= STbuffer->sg[i].length; |
5321 | } | 5323 | } |
5322 | #if DEBUG | 5324 | #if DEBUG |
@@ -5344,7 +5346,7 @@ static int append_to_buffer(const char __user *ubp, struct osst_buffer *st_bp, i | |||
5344 | for ( ; i < st_bp->sg_segs && do_count > 0; i++) { | 5346 | for ( ; i < st_bp->sg_segs && do_count > 0; i++) { |
5345 | cnt = st_bp->sg[i].length - offset < do_count ? | 5347 | cnt = st_bp->sg[i].length - offset < do_count ? |
5346 | st_bp->sg[i].length - offset : do_count; | 5348 | st_bp->sg[i].length - offset : do_count; |
5347 | res = copy_from_user(page_address(st_bp->sg[i].page) + offset, ubp, cnt); | 5349 | res = copy_from_user(page_address(sg_page(&st_bp->sg[i])) + offset, ubp, cnt); |
5348 | if (res) | 5350 | if (res) |
5349 | return (-EFAULT); | 5351 | return (-EFAULT); |
5350 | do_count -= cnt; | 5352 | do_count -= cnt; |
@@ -5377,7 +5379,7 @@ static int from_buffer(struct osst_buffer *st_bp, char __user *ubp, int do_count | |||
5377 | for ( ; i < st_bp->sg_segs && do_count > 0; i++) { | 5379 | for ( ; i < st_bp->sg_segs && do_count > 0; i++) { |
5378 | cnt = st_bp->sg[i].length - offset < do_count ? | 5380 | cnt = st_bp->sg[i].length - offset < do_count ? |
5379 | st_bp->sg[i].length - offset : do_count; | 5381 | st_bp->sg[i].length - offset : do_count; |
5380 | res = copy_to_user(ubp, page_address(st_bp->sg[i].page) + offset, cnt); | 5382 | res = copy_to_user(ubp, page_address(sg_page(&st_bp->sg[i])) + offset, cnt); |
5381 | if (res) | 5383 | if (res) |
5382 | return (-EFAULT); | 5384 | return (-EFAULT); |
5383 | do_count -= cnt; | 5385 | do_count -= cnt; |
@@ -5410,7 +5412,7 @@ static int osst_zero_buffer_tail(struct osst_buffer *st_bp) | |||
5410 | i < st_bp->sg_segs && do_count > 0; i++) { | 5412 | i < st_bp->sg_segs && do_count > 0; i++) { |
5411 | cnt = st_bp->sg[i].length - offset < do_count ? | 5413 | cnt = st_bp->sg[i].length - offset < do_count ? |
5412 | st_bp->sg[i].length - offset : do_count ; | 5414 | st_bp->sg[i].length - offset : do_count ; |
5413 | memset(page_address(st_bp->sg[i].page) + offset, 0, cnt); | 5415 | memset(page_address(sg_page(&st_bp->sg[i])) + offset, 0, cnt); |
5414 | do_count -= cnt; | 5416 | do_count -= cnt; |
5415 | offset = 0; | 5417 | offset = 0; |
5416 | } | 5418 | } |
@@ -5430,7 +5432,7 @@ static int osst_copy_to_buffer(struct osst_buffer *st_bp, unsigned char *ptr) | |||
5430 | for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { | 5432 | for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { |
5431 | cnt = st_bp->sg[i].length < do_count ? | 5433 | cnt = st_bp->sg[i].length < do_count ? |
5432 | st_bp->sg[i].length : do_count ; | 5434 | st_bp->sg[i].length : do_count ; |
5433 | memcpy(page_address(st_bp->sg[i].page), ptr, cnt); | 5435 | memcpy(page_address(sg_page(&st_bp->sg[i])), ptr, cnt); |
5434 | do_count -= cnt; | 5436 | do_count -= cnt; |
5435 | ptr += cnt; | 5437 | ptr += cnt; |
5436 | } | 5438 | } |
@@ -5451,7 +5453,7 @@ static int osst_copy_from_buffer(struct osst_buffer *st_bp, unsigned char *ptr) | |||
5451 | for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { | 5453 | for (i = 0; i < st_bp->sg_segs && do_count > 0; i++) { |
5452 | cnt = st_bp->sg[i].length < do_count ? | 5454 | cnt = st_bp->sg[i].length < do_count ? |
5453 | st_bp->sg[i].length : do_count ; | 5455 | st_bp->sg[i].length : do_count ; |
5454 | memcpy(ptr, page_address(st_bp->sg[i].page), cnt); | 5456 | memcpy(ptr, page_address(sg_page(&st_bp->sg[i])), cnt); |
5455 | do_count -= cnt; | 5457 | do_count -= cnt; |
5456 | ptr += cnt; | 5458 | ptr += cnt; |
5457 | } | 5459 | } |
diff --git a/drivers/scsi/pcmcia/nsp_cs.h b/drivers/scsi/pcmcia/nsp_cs.h index b7f0fa246413..7db28cd49446 100644 --- a/drivers/scsi/pcmcia/nsp_cs.h +++ b/drivers/scsi/pcmcia/nsp_cs.h | |||
@@ -24,7 +24,6 @@ | |||
24 | /************************************ | 24 | /************************************ |
25 | * Some useful macros... | 25 | * Some useful macros... |
26 | */ | 26 | */ |
27 | #define BIT(x) (1L << (x)) | ||
28 | 27 | ||
29 | /* SCSI initiator must be ID 7 */ | 28 | /* SCSI initiator must be ID 7 */ |
30 | #define NSP_INITIATOR_ID 7 | 29 | #define NSP_INITIATOR_ID 7 |
@@ -394,7 +393,7 @@ enum _burst_mode { | |||
394 | #define MSG_EXT_SDTR 0x01 | 393 | #define MSG_EXT_SDTR 0x01 |
395 | 394 | ||
396 | /* scatter-gather table */ | 395 | /* scatter-gather table */ |
397 | # define BUFFER_ADDR ((char *)((unsigned int)(SCpnt->SCp.buffer->page) + SCpnt->SCp.buffer->offset)) | 396 | # define BUFFER_ADDR ((char *)((sg_virt(SCpnt->SCp.buffer)))) |
398 | 397 | ||
399 | #endif /*__nsp_cs__*/ | 398 | #endif /*__nsp_cs__*/ |
400 | /* end */ | 399 | /* end */ |
diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 190e2a7d7067..969b9387a0c3 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c | |||
@@ -443,8 +443,7 @@ SYM53C500_intr(int irq, void *dev_id) | |||
443 | 443 | ||
444 | scsi_for_each_sg(curSC, sg, scsi_sg_count(curSC), i) { | 444 | scsi_for_each_sg(curSC, sg, scsi_sg_count(curSC), i) { |
445 | SYM53C500_pio_write(fast_pio, port_base, | 445 | SYM53C500_pio_write(fast_pio, port_base, |
446 | page_address(sg->page) + sg->offset, | 446 | sg_virt(sg), sg->length); |
447 | sg->length); | ||
448 | } | 447 | } |
449 | REG0(port_base); | 448 | REG0(port_base); |
450 | } | 449 | } |
@@ -463,8 +462,7 @@ SYM53C500_intr(int irq, void *dev_id) | |||
463 | 462 | ||
464 | scsi_for_each_sg(curSC, sg, scsi_sg_count(curSC), i) { | 463 | scsi_for_each_sg(curSC, sg, scsi_sg_count(curSC), i) { |
465 | SYM53C500_pio_read(fast_pio, port_base, | 464 | SYM53C500_pio_read(fast_pio, port_base, |
466 | page_address(sg->page) + sg->offset, | 465 | sg_virt(sg), sg->length); |
467 | sg->length); | ||
468 | } | 466 | } |
469 | REG0(port_base); | 467 | REG0(port_base); |
470 | } | 468 | } |
diff --git a/drivers/scsi/ppa.c b/drivers/scsi/ppa.c index 67b6d76a6c8d..67ee51a3d7e1 100644 --- a/drivers/scsi/ppa.c +++ b/drivers/scsi/ppa.c | |||
@@ -608,9 +608,7 @@ static int ppa_completion(struct scsi_cmnd *cmd) | |||
608 | cmd->SCp.buffer++; | 608 | cmd->SCp.buffer++; |
609 | cmd->SCp.this_residual = | 609 | cmd->SCp.this_residual = |
610 | cmd->SCp.buffer->length; | 610 | cmd->SCp.buffer->length; |
611 | cmd->SCp.ptr = | 611 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
612 | page_address(cmd->SCp.buffer->page) + | ||
613 | cmd->SCp.buffer->offset; | ||
614 | } | 612 | } |
615 | } | 613 | } |
616 | /* Now check to see if the drive is ready to comunicate */ | 614 | /* Now check to see if the drive is ready to comunicate */ |
@@ -756,8 +754,7 @@ static int ppa_engine(ppa_struct *dev, struct scsi_cmnd *cmd) | |||
756 | /* if many buffers are available, start filling the first */ | 754 | /* if many buffers are available, start filling the first */ |
757 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; | 755 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
758 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 756 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
759 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + | 757 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
760 | cmd->SCp.buffer->offset; | ||
761 | } else { | 758 | } else { |
762 | /* else fill the only available buffer */ | 759 | /* else fill the only available buffer */ |
763 | cmd->SCp.buffer = NULL; | 760 | cmd->SCp.buffer = NULL; |
diff --git a/drivers/scsi/ps3rom.c b/drivers/scsi/ps3rom.c index 0f43d1d046d9..17b4a7c4618c 100644 --- a/drivers/scsi/ps3rom.c +++ b/drivers/scsi/ps3rom.c | |||
@@ -111,14 +111,14 @@ static int fill_from_dev_buffer(struct scsi_cmnd *cmd, const void *buf) | |||
111 | req_len = act_len = 0; | 111 | req_len = act_len = 0; |
112 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { | 112 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { |
113 | if (active) { | 113 | if (active) { |
114 | kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); | 114 | kaddr = kmap_atomic(sg_page(sgpnt), KM_IRQ0); |
115 | len = sgpnt->length; | 115 | len = sgpnt->length; |
116 | if ((req_len + len) > buflen) { | 116 | if ((req_len + len) > buflen) { |
117 | active = 0; | 117 | active = 0; |
118 | len = buflen - req_len; | 118 | len = buflen - req_len; |
119 | } | 119 | } |
120 | memcpy(kaddr + sgpnt->offset, buf + req_len, len); | 120 | memcpy(kaddr + sgpnt->offset, buf + req_len, len); |
121 | flush_kernel_dcache_page(sgpnt->page); | 121 | flush_kernel_dcache_page(sg_page(sgpnt)); |
122 | kunmap_atomic(kaddr, KM_IRQ0); | 122 | kunmap_atomic(kaddr, KM_IRQ0); |
123 | act_len += len; | 123 | act_len += len; |
124 | } | 124 | } |
@@ -147,7 +147,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd *cmd, void *buf) | |||
147 | 147 | ||
148 | req_len = fin = 0; | 148 | req_len = fin = 0; |
149 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { | 149 | scsi_for_each_sg(cmd, sgpnt, scsi_sg_count(cmd), k) { |
150 | kaddr = kmap_atomic(sgpnt->page, KM_IRQ0); | 150 | kaddr = kmap_atomic(sg_page(sgpnt), KM_IRQ0); |
151 | len = sgpnt->length; | 151 | len = sgpnt->length; |
152 | if ((req_len + len) > buflen) { | 152 | if ((req_len + len) > buflen) { |
153 | len = buflen - req_len; | 153 | len = buflen - req_len; |
diff --git a/drivers/scsi/qla4xxx/ql4_fw.h b/drivers/scsi/qla4xxx/ql4_fw.h index 9bb3d1d2a925..fe415ec85655 100644 --- a/drivers/scsi/qla4xxx/ql4_fw.h +++ b/drivers/scsi/qla4xxx/ql4_fw.h | |||
@@ -671,7 +671,7 @@ struct continuation_t1_entry { | |||
671 | #define ET_CONTINUE ET_CONT_T1 | 671 | #define ET_CONTINUE ET_CONT_T1 |
672 | 672 | ||
673 | /* Marker entry structure*/ | 673 | /* Marker entry structure*/ |
674 | struct marker_entry { | 674 | struct qla4_marker_entry { |
675 | struct qla4_header hdr; /* 00-03 */ | 675 | struct qla4_header hdr; /* 00-03 */ |
676 | 676 | ||
677 | uint32_t system_defined; /* 04-07 */ | 677 | uint32_t system_defined; /* 04-07 */ |
diff --git a/drivers/scsi/qla4xxx/ql4_init.c b/drivers/scsi/qla4xxx/ql4_init.c index 1e29f51d596b..d692c713416a 100644 --- a/drivers/scsi/qla4xxx/ql4_init.c +++ b/drivers/scsi/qla4xxx/ql4_init.c | |||
@@ -1006,7 +1006,7 @@ int ql4xxx_lock_drvr_wait(struct scsi_qla_host *a) | |||
1006 | * qla4xxx_start_firmware - starts qla4xxx firmware | 1006 | * qla4xxx_start_firmware - starts qla4xxx firmware |
1007 | * @ha: Pointer to host adapter structure. | 1007 | * @ha: Pointer to host adapter structure. |
1008 | * | 1008 | * |
1009 | * This routine performs the neccessary steps to start the firmware for | 1009 | * This routine performs the necessary steps to start the firmware for |
1010 | * the QLA4010 adapter. | 1010 | * the QLA4010 adapter. |
1011 | **/ | 1011 | **/ |
1012 | static int qla4xxx_start_firmware(struct scsi_qla_host *ha) | 1012 | static int qla4xxx_start_firmware(struct scsi_qla_host *ha) |
diff --git a/drivers/scsi/qla4xxx/ql4_iocb.c b/drivers/scsi/qla4xxx/ql4_iocb.c index 5006ecb3ef5e..e4461b5d767a 100644 --- a/drivers/scsi/qla4xxx/ql4_iocb.c +++ b/drivers/scsi/qla4xxx/ql4_iocb.c | |||
@@ -69,7 +69,7 @@ static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha, | |||
69 | static int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, | 69 | static int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha, |
70 | struct ddb_entry *ddb_entry, int lun) | 70 | struct ddb_entry *ddb_entry, int lun) |
71 | { | 71 | { |
72 | struct marker_entry *marker_entry; | 72 | struct qla4_marker_entry *marker_entry; |
73 | unsigned long flags = 0; | 73 | unsigned long flags = 0; |
74 | uint8_t status = QLA_SUCCESS; | 74 | uint8_t status = QLA_SUCCESS; |
75 | 75 | ||
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 03b68d4f3bd0..89460d27c689 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -1286,7 +1286,7 @@ static int __devinit qla4xxx_probe_adapter(struct pci_dev *pdev, | |||
1286 | 1286 | ||
1287 | ret = scsi_init_shared_tag_map(host, MAX_SRBS); | 1287 | ret = scsi_init_shared_tag_map(host, MAX_SRBS); |
1288 | if (ret) { | 1288 | if (ret) { |
1289 | dev_warn(&ha->pdev->dev, "scsi_init_shared_tag_map failed"); | 1289 | dev_warn(&ha->pdev->dev, "scsi_init_shared_tag_map failed\n"); |
1290 | goto probe_failed; | 1290 | goto probe_failed; |
1291 | } | 1291 | } |
1292 | 1292 | ||
diff --git a/drivers/scsi/qlogicfas408.c b/drivers/scsi/qlogicfas408.c index 2bfbf26c00ed..de7b3bc2cbc9 100644 --- a/drivers/scsi/qlogicfas408.c +++ b/drivers/scsi/qlogicfas408.c | |||
@@ -317,7 +317,7 @@ static unsigned int ql_pcmd(struct scsi_cmnd *cmd) | |||
317 | return ((priv->qabort == 1 ? | 317 | return ((priv->qabort == 1 ? |
318 | DID_ABORT : DID_RESET) << 16); | 318 | DID_ABORT : DID_RESET) << 16); |
319 | } | 319 | } |
320 | buf = page_address(sg->page) + sg->offset; | 320 | buf = sg_virt(sg); |
321 | if (ql_pdma(priv, phase, buf, sg->length)) | 321 | if (ql_pdma(priv, phase, buf, sg->length)) |
322 | break; | 322 | break; |
323 | } | 323 | } |
diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c index 72ee4c9cfb1a..46cae5a212de 100644 --- a/drivers/scsi/scsi_debug.c +++ b/drivers/scsi/scsi_debug.c | |||
@@ -625,7 +625,7 @@ static int fill_from_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | |||
625 | scsi_for_each_sg(scp, sg, scp->use_sg, k) { | 625 | scsi_for_each_sg(scp, sg, scp->use_sg, k) { |
626 | if (active) { | 626 | if (active) { |
627 | kaddr = (unsigned char *) | 627 | kaddr = (unsigned char *) |
628 | kmap_atomic(sg->page, KM_USER0); | 628 | kmap_atomic(sg_page(sg), KM_USER0); |
629 | if (NULL == kaddr) | 629 | if (NULL == kaddr) |
630 | return (DID_ERROR << 16); | 630 | return (DID_ERROR << 16); |
631 | kaddr_off = (unsigned char *)kaddr + sg->offset; | 631 | kaddr_off = (unsigned char *)kaddr + sg->offset; |
@@ -672,7 +672,7 @@ static int fetch_to_dev_buffer(struct scsi_cmnd * scp, unsigned char * arr, | |||
672 | sg = scsi_sglist(scp); | 672 | sg = scsi_sglist(scp); |
673 | req_len = fin = 0; | 673 | req_len = fin = 0; |
674 | for (k = 0; k < scp->use_sg; ++k, sg = sg_next(sg)) { | 674 | for (k = 0; k < scp->use_sg; ++k, sg = sg_next(sg)) { |
675 | kaddr = (unsigned char *)kmap_atomic(sg->page, KM_USER0); | 675 | kaddr = (unsigned char *)kmap_atomic(sg_page(sg), KM_USER0); |
676 | if (NULL == kaddr) | 676 | if (NULL == kaddr) |
677 | return -1; | 677 | return -1; |
678 | kaddr_off = (unsigned char *)kaddr + sg->offset; | 678 | kaddr_off = (unsigned char *)kaddr + sg->offset; |
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index aac8a02cbe80..61fdaf02f251 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c | |||
@@ -295,7 +295,7 @@ static int scsi_req_map_sg(struct request *rq, struct scatterlist *sgl, | |||
295 | int i, err, nr_vecs = 0; | 295 | int i, err, nr_vecs = 0; |
296 | 296 | ||
297 | for_each_sg(sgl, sg, nsegs, i) { | 297 | for_each_sg(sgl, sg, nsegs, i) { |
298 | page = sg->page; | 298 | page = sg_page(sg); |
299 | off = sg->offset; | 299 | off = sg->offset; |
300 | len = sg->length; | 300 | len = sg->length; |
301 | data_len += len; | 301 | data_len += len; |
@@ -764,7 +764,7 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
764 | if (unlikely(!sgl)) | 764 | if (unlikely(!sgl)) |
765 | goto enomem; | 765 | goto enomem; |
766 | 766 | ||
767 | memset(sgl, 0, sizeof(*sgl) * sgp->size); | 767 | sg_init_table(sgl, sgp->size); |
768 | 768 | ||
769 | /* | 769 | /* |
770 | * first loop through, set initial index and return value | 770 | * first loop through, set initial index and return value |
@@ -781,6 +781,13 @@ struct scatterlist *scsi_alloc_sgtable(struct scsi_cmnd *cmd, gfp_t gfp_mask) | |||
781 | sg_chain(prev, SCSI_MAX_SG_SEGMENTS, sgl); | 781 | sg_chain(prev, SCSI_MAX_SG_SEGMENTS, sgl); |
782 | 782 | ||
783 | /* | 783 | /* |
784 | * if we have nothing left, mark the last segment as | ||
785 | * end-of-list | ||
786 | */ | ||
787 | if (!left) | ||
788 | sg_mark_end(sgl, this); | ||
789 | |||
790 | /* | ||
784 | * don't allow subsequent mempool allocs to sleep, it would | 791 | * don't allow subsequent mempool allocs to sleep, it would |
785 | * violate the mempool principle. | 792 | * violate the mempool principle. |
786 | */ | 793 | */ |
@@ -2353,7 +2360,7 @@ void *scsi_kmap_atomic_sg(struct scatterlist *sgl, int sg_count, | |||
2353 | *offset = *offset - len_complete + sg->offset; | 2360 | *offset = *offset - len_complete + sg->offset; |
2354 | 2361 | ||
2355 | /* Assumption: contiguous pages can be accessed as "page + i" */ | 2362 | /* Assumption: contiguous pages can be accessed as "page + i" */ |
2356 | page = nth_page(sg->page, (*offset >> PAGE_SHIFT)); | 2363 | page = nth_page(sg_page(sg), (*offset >> PAGE_SHIFT)); |
2357 | *offset &= ~PAGE_MASK; | 2364 | *offset &= ~PAGE_MASK; |
2358 | 2365 | ||
2359 | /* Bytes in this sg-entry from *offset to the end of the page */ | 2366 | /* Bytes in this sg-entry from *offset to the end of the page */ |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 69f542c4923c..a69b155f39a2 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -676,7 +676,7 @@ static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo) | |||
676 | * success as well). Returns a negated errno value in case of error. | 676 | * success as well). Returns a negated errno value in case of error. |
677 | * | 677 | * |
678 | * Note: most ioctls are forward onto the block subsystem or further | 678 | * Note: most ioctls are forward onto the block subsystem or further |
679 | * down in the scsi subsytem. | 679 | * down in the scsi subsystem. |
680 | **/ | 680 | **/ |
681 | static int sd_ioctl(struct inode * inode, struct file * filp, | 681 | static int sd_ioctl(struct inode * inode, struct file * filp, |
682 | unsigned int cmd, unsigned long arg) | 682 | unsigned int cmd, unsigned long arg) |
diff --git a/drivers/scsi/seagate.c b/drivers/scsi/seagate.c index ce80fa9ad815..b11324479b5b 100644 --- a/drivers/scsi/seagate.c +++ b/drivers/scsi/seagate.c | |||
@@ -999,14 +999,14 @@ connect_loop: | |||
999 | for (i = 0; i < nobuffs; ++i) | 999 | for (i = 0; i < nobuffs; ++i) |
1000 | printk("scsi%d : buffer %d address = %p length = %d\n", | 1000 | printk("scsi%d : buffer %d address = %p length = %d\n", |
1001 | hostno, i, | 1001 | hostno, i, |
1002 | page_address(buffer[i].page) + buffer[i].offset, | 1002 | sg_virt(&buffer[i]), |
1003 | buffer[i].length); | 1003 | buffer[i].length); |
1004 | } | 1004 | } |
1005 | #endif | 1005 | #endif |
1006 | 1006 | ||
1007 | buffer = (struct scatterlist *) SCint->request_buffer; | 1007 | buffer = (struct scatterlist *) SCint->request_buffer; |
1008 | len = buffer->length; | 1008 | len = buffer->length; |
1009 | data = page_address(buffer->page) + buffer->offset; | 1009 | data = sg_virt(buffer); |
1010 | } else { | 1010 | } else { |
1011 | DPRINTK (DEBUG_SG, "scsi%d : scatter gather not requested.\n", hostno); | 1011 | DPRINTK (DEBUG_SG, "scsi%d : scatter gather not requested.\n", hostno); |
1012 | buffer = NULL; | 1012 | buffer = NULL; |
@@ -1239,7 +1239,7 @@ connect_loop: | |||
1239 | --nobuffs; | 1239 | --nobuffs; |
1240 | ++buffer; | 1240 | ++buffer; |
1241 | len = buffer->length; | 1241 | len = buffer->length; |
1242 | data = page_address(buffer->page) + buffer->offset; | 1242 | data = sg_virt(buffer); |
1243 | DPRINTK (DEBUG_SG, | 1243 | DPRINTK (DEBUG_SG, |
1244 | "scsi%d : next scatter-gather buffer len = %d address = %08x\n", | 1244 | "scsi%d : next scatter-gather buffer len = %d address = %08x\n", |
1245 | hostno, len, data); | 1245 | hostno, len, data); |
@@ -1396,7 +1396,7 @@ connect_loop: | |||
1396 | --nobuffs; | 1396 | --nobuffs; |
1397 | ++buffer; | 1397 | ++buffer; |
1398 | len = buffer->length; | 1398 | len = buffer->length; |
1399 | data = page_address(buffer->page) + buffer->offset; | 1399 | data = sg_virt(buffer); |
1400 | DPRINTK (DEBUG_SG, "scsi%d : next scatter-gather buffer len = %d address = %08x\n", hostno, len, data); | 1400 | DPRINTK (DEBUG_SG, "scsi%d : next scatter-gather buffer len = %d address = %08x\n", hostno, len, data); |
1401 | } | 1401 | } |
1402 | break; | 1402 | break; |
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 7238b2dfc497..cc1971002846 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c | |||
@@ -1169,7 +1169,7 @@ sg_vma_nopage(struct vm_area_struct *vma, unsigned long addr, int *type) | |||
1169 | len = vma->vm_end - sa; | 1169 | len = vma->vm_end - sa; |
1170 | len = (len < sg->length) ? len : sg->length; | 1170 | len = (len < sg->length) ? len : sg->length; |
1171 | if (offset < len) { | 1171 | if (offset < len) { |
1172 | page = virt_to_page(page_address(sg->page) + offset); | 1172 | page = virt_to_page(page_address(sg_page(sg)) + offset); |
1173 | get_page(page); /* increment page count */ | 1173 | get_page(page); /* increment page count */ |
1174 | break; | 1174 | break; |
1175 | } | 1175 | } |
@@ -1717,13 +1717,13 @@ st_map_user_pages(struct scatterlist *sgl, const unsigned int max_pages, | |||
1717 | goto out_unlock; */ | 1717 | goto out_unlock; */ |
1718 | } | 1718 | } |
1719 | 1719 | ||
1720 | sgl[0].page = pages[0]; | 1720 | sg_set_page(sgl, pages[0]); |
1721 | sgl[0].offset = uaddr & ~PAGE_MASK; | 1721 | sgl[0].offset = uaddr & ~PAGE_MASK; |
1722 | if (nr_pages > 1) { | 1722 | if (nr_pages > 1) { |
1723 | sgl[0].length = PAGE_SIZE - sgl[0].offset; | 1723 | sgl[0].length = PAGE_SIZE - sgl[0].offset; |
1724 | count -= sgl[0].length; | 1724 | count -= sgl[0].length; |
1725 | for (i=1; i < nr_pages ; i++) { | 1725 | for (i=1; i < nr_pages ; i++) { |
1726 | sgl[i].page = pages[i]; | 1726 | sg_set_page(&sgl[i], pages[i]); |
1727 | sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE; | 1727 | sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE; |
1728 | count -= PAGE_SIZE; | 1728 | count -= PAGE_SIZE; |
1729 | } | 1729 | } |
@@ -1754,7 +1754,7 @@ st_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_pages, | |||
1754 | int i; | 1754 | int i; |
1755 | 1755 | ||
1756 | for (i=0; i < nr_pages; i++) { | 1756 | for (i=0; i < nr_pages; i++) { |
1757 | struct page *page = sgl[i].page; | 1757 | struct page *page = sg_page(&sgl[i]); |
1758 | 1758 | ||
1759 | if (dirtied) | 1759 | if (dirtied) |
1760 | SetPageDirty(page); | 1760 | SetPageDirty(page); |
@@ -1854,7 +1854,7 @@ sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) | |||
1854 | scatter_elem_sz_prev = ret_sz; | 1854 | scatter_elem_sz_prev = ret_sz; |
1855 | } | 1855 | } |
1856 | } | 1856 | } |
1857 | sg->page = p; | 1857 | sg_set_page(sg, p); |
1858 | sg->length = (ret_sz > num) ? num : ret_sz; | 1858 | sg->length = (ret_sz > num) ? num : ret_sz; |
1859 | 1859 | ||
1860 | SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, " | 1860 | SCSI_LOG_TIMEOUT(5, printk("sg_build_indirect: k=%d, num=%d, " |
@@ -1907,14 +1907,14 @@ sg_write_xfer(Sg_request * srp) | |||
1907 | onum = 1; | 1907 | onum = 1; |
1908 | 1908 | ||
1909 | ksglen = sg->length; | 1909 | ksglen = sg->length; |
1910 | p = page_address(sg->page); | 1910 | p = page_address(sg_page(sg)); |
1911 | for (j = 0, k = 0; j < onum; ++j) { | 1911 | for (j = 0, k = 0; j < onum; ++j) { |
1912 | res = sg_u_iovec(hp, iovec_count, j, 1, &usglen, &up); | 1912 | res = sg_u_iovec(hp, iovec_count, j, 1, &usglen, &up); |
1913 | if (res) | 1913 | if (res) |
1914 | return res; | 1914 | return res; |
1915 | 1915 | ||
1916 | for (; p; sg = sg_next(sg), ksglen = sg->length, | 1916 | for (; p; sg = sg_next(sg), ksglen = sg->length, |
1917 | p = page_address(sg->page)) { | 1917 | p = page_address(sg_page(sg))) { |
1918 | if (usglen <= 0) | 1918 | if (usglen <= 0) |
1919 | break; | 1919 | break; |
1920 | if (ksglen > usglen) { | 1920 | if (ksglen > usglen) { |
@@ -1991,12 +1991,12 @@ sg_remove_scat(Sg_scatter_hold * schp) | |||
1991 | } else { | 1991 | } else { |
1992 | int k; | 1992 | int k; |
1993 | 1993 | ||
1994 | for (k = 0; (k < schp->k_use_sg) && sg->page; | 1994 | for (k = 0; (k < schp->k_use_sg) && sg_page(sg); |
1995 | ++k, sg = sg_next(sg)) { | 1995 | ++k, sg = sg_next(sg)) { |
1996 | SCSI_LOG_TIMEOUT(5, printk( | 1996 | SCSI_LOG_TIMEOUT(5, printk( |
1997 | "sg_remove_scat: k=%d, pg=0x%p, len=%d\n", | 1997 | "sg_remove_scat: k=%d, pg=0x%p, len=%d\n", |
1998 | k, sg->page, sg->length)); | 1998 | k, sg_page(sg), sg->length)); |
1999 | sg_page_free(sg->page, sg->length); | 1999 | sg_page_free(sg_page(sg), sg->length); |
2000 | } | 2000 | } |
2001 | } | 2001 | } |
2002 | kfree(schp->buffer); | 2002 | kfree(schp->buffer); |
@@ -2038,7 +2038,7 @@ sg_read_xfer(Sg_request * srp) | |||
2038 | } else | 2038 | } else |
2039 | onum = 1; | 2039 | onum = 1; |
2040 | 2040 | ||
2041 | p = page_address(sg->page); | 2041 | p = page_address(sg_page(sg)); |
2042 | ksglen = sg->length; | 2042 | ksglen = sg->length; |
2043 | for (j = 0, k = 0; j < onum; ++j) { | 2043 | for (j = 0, k = 0; j < onum; ++j) { |
2044 | res = sg_u_iovec(hp, iovec_count, j, 0, &usglen, &up); | 2044 | res = sg_u_iovec(hp, iovec_count, j, 0, &usglen, &up); |
@@ -2046,7 +2046,7 @@ sg_read_xfer(Sg_request * srp) | |||
2046 | return res; | 2046 | return res; |
2047 | 2047 | ||
2048 | for (; p; sg = sg_next(sg), ksglen = sg->length, | 2048 | for (; p; sg = sg_next(sg), ksglen = sg->length, |
2049 | p = page_address(sg->page)) { | 2049 | p = page_address(sg_page(sg))) { |
2050 | if (usglen <= 0) | 2050 | if (usglen <= 0) |
2051 | break; | 2051 | break; |
2052 | if (ksglen > usglen) { | 2052 | if (ksglen > usglen) { |
@@ -2092,15 +2092,15 @@ sg_read_oxfer(Sg_request * srp, char __user *outp, int num_read_xfer) | |||
2092 | if ((!outp) || (num_read_xfer <= 0)) | 2092 | if ((!outp) || (num_read_xfer <= 0)) |
2093 | return 0; | 2093 | return 0; |
2094 | 2094 | ||
2095 | for (k = 0; (k < schp->k_use_sg) && sg->page; ++k, sg = sg_next(sg)) { | 2095 | for (k = 0; (k < schp->k_use_sg) && sg_page(sg); ++k, sg = sg_next(sg)) { |
2096 | num = sg->length; | 2096 | num = sg->length; |
2097 | if (num > num_read_xfer) { | 2097 | if (num > num_read_xfer) { |
2098 | if (__copy_to_user(outp, page_address(sg->page), | 2098 | if (__copy_to_user(outp, page_address(sg_page(sg)), |
2099 | num_read_xfer)) | 2099 | num_read_xfer)) |
2100 | return -EFAULT; | 2100 | return -EFAULT; |
2101 | break; | 2101 | break; |
2102 | } else { | 2102 | } else { |
2103 | if (__copy_to_user(outp, page_address(sg->page), | 2103 | if (__copy_to_user(outp, page_address(sg_page(sg)), |
2104 | num)) | 2104 | num)) |
2105 | return -EFAULT; | 2105 | return -EFAULT; |
2106 | num_read_xfer -= num; | 2106 | num_read_xfer -= num; |
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 73c44cbdea47..ce69b9efc102 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3797,7 +3797,7 @@ static void buf_to_sg(struct st_buffer *STbp, unsigned int length) | |||
3797 | sg = &(STbp->sg[0]); | 3797 | sg = &(STbp->sg[0]); |
3798 | frp = STbp->frp; | 3798 | frp = STbp->frp; |
3799 | for (i=count=0; count < length; i++) { | 3799 | for (i=count=0; count < length; i++) { |
3800 | sg[i].page = frp[i].page; | 3800 | sg_set_page(&sg[i], frp[i].page); |
3801 | if (length - count > frp[i].length) | 3801 | if (length - count > frp[i].length) |
3802 | sg[i].length = frp[i].length; | 3802 | sg[i].length = frp[i].length; |
3803 | else | 3803 | else |
@@ -4446,14 +4446,14 @@ static int sgl_map_user_pages(struct scatterlist *sgl, const unsigned int max_pa | |||
4446 | } | 4446 | } |
4447 | 4447 | ||
4448 | /* Populate the scatter/gather list */ | 4448 | /* Populate the scatter/gather list */ |
4449 | sgl[0].page = pages[0]; | 4449 | sg_set_page(&sgl[0], pages[0]); |
4450 | sgl[0].offset = uaddr & ~PAGE_MASK; | 4450 | sgl[0].offset = uaddr & ~PAGE_MASK; |
4451 | if (nr_pages > 1) { | 4451 | if (nr_pages > 1) { |
4452 | sgl[0].length = PAGE_SIZE - sgl[0].offset; | 4452 | sgl[0].length = PAGE_SIZE - sgl[0].offset; |
4453 | count -= sgl[0].length; | 4453 | count -= sgl[0].length; |
4454 | for (i=1; i < nr_pages ; i++) { | 4454 | for (i=1; i < nr_pages ; i++) { |
4455 | sg_set_page(&sgl[i], pages[i]);; | ||
4455 | sgl[i].offset = 0; | 4456 | sgl[i].offset = 0; |
4456 | sgl[i].page = pages[i]; | ||
4457 | sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE; | 4457 | sgl[i].length = count < PAGE_SIZE ? count : PAGE_SIZE; |
4458 | count -= PAGE_SIZE; | 4458 | count -= PAGE_SIZE; |
4459 | } | 4459 | } |
@@ -4483,7 +4483,7 @@ static int sgl_unmap_user_pages(struct scatterlist *sgl, const unsigned int nr_p | |||
4483 | int i; | 4483 | int i; |
4484 | 4484 | ||
4485 | for (i=0; i < nr_pages; i++) { | 4485 | for (i=0; i < nr_pages; i++) { |
4486 | struct page *page = sgl[i].page; | 4486 | struct page *page = sg_page(&sgl[i]); |
4487 | 4487 | ||
4488 | if (dirtied) | 4488 | if (dirtied) |
4489 | SetPageDirty(page); | 4489 | SetPageDirty(page); |
diff --git a/drivers/scsi/sun3_NCR5380.c b/drivers/scsi/sun3_NCR5380.c index dc15a22105f7..2dcde373b20e 100644 --- a/drivers/scsi/sun3_NCR5380.c +++ b/drivers/scsi/sun3_NCR5380.c | |||
@@ -272,8 +272,7 @@ static struct scsi_host_template *the_template = NULL; | |||
272 | #define HOSTNO instance->host_no | 272 | #define HOSTNO instance->host_no |
273 | #define H_NO(cmd) (cmd)->device->host->host_no | 273 | #define H_NO(cmd) (cmd)->device->host->host_no |
274 | 274 | ||
275 | #define SGADDR(buffer) (void *)(((unsigned long)page_address((buffer)->page)) + \ | 275 | #define SGADDR(buffer) (void *)(((unsigned long)sg_virt(((buffer))))) |
276 | (buffer)->offset) | ||
277 | 276 | ||
278 | #ifdef SUPPORT_TAGS | 277 | #ifdef SUPPORT_TAGS |
279 | 278 | ||
@@ -1596,7 +1595,7 @@ static int NCR5380_select(struct Scsi_Host *instance, struct scsi_cmnd *cmd, | |||
1596 | * IO while SEL is true. But again, there are some disks out the in the | 1595 | * IO while SEL is true. But again, there are some disks out the in the |
1597 | * world that do that nevertheless. (Somebody claimed that this announces | 1596 | * world that do that nevertheless. (Somebody claimed that this announces |
1598 | * reselection capability of the target.) So we better skip that test and | 1597 | * reselection capability of the target.) So we better skip that test and |
1599 | * only wait for BSY... (Famous german words: Der Klügere gibt nach :-) | 1598 | * only wait for BSY... (Famous german words: Der Klügere gibt nach :-) |
1600 | */ | 1599 | */ |
1601 | 1600 | ||
1602 | while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & | 1601 | while (time_before(jiffies, timeout) && !(NCR5380_read(STATUS_REG) & |
diff --git a/drivers/scsi/sym53c416.c b/drivers/scsi/sym53c416.c index 8befab7e9839..90cee94d9522 100644 --- a/drivers/scsi/sym53c416.c +++ b/drivers/scsi/sym53c416.c | |||
@@ -196,7 +196,7 @@ static unsigned int sym53c416_base_3[2] = {0,0}; | |||
196 | 196 | ||
197 | #define MAXHOSTS 4 | 197 | #define MAXHOSTS 4 |
198 | 198 | ||
199 | #define SG_ADDRESS(buffer) ((char *) (page_address((buffer)->page)+(buffer)->offset)) | 199 | #define SG_ADDRESS(buffer) ((char *) sg_virt((buffer))) |
200 | 200 | ||
201 | enum phases | 201 | enum phases |
202 | { | 202 | { |
diff --git a/drivers/scsi/sym53c8xx_2/sym_fw2.h b/drivers/scsi/sym53c8xx_2/sym_fw2.h index 6e5b952312e3..ae1fb179b88e 100644 --- a/drivers/scsi/sym53c8xx_2/sym_fw2.h +++ b/drivers/scsi/sym53c8xx_2/sym_fw2.h | |||
@@ -1781,7 +1781,7 @@ static struct SYM_FWB_SCR SYM_FWB_SCR = { | |||
1781 | * While testing with bogus QUANTUM drives, the C1010 | 1781 | * While testing with bogus QUANTUM drives, the C1010 |
1782 | * sometimes raised a spurious phase mismatch with | 1782 | * sometimes raised a spurious phase mismatch with |
1783 | * WSR and the CHMOV(1) triggered another PM. | 1783 | * WSR and the CHMOV(1) triggered another PM. |
1784 | * Waiting explicitely for the PHASE seemed to avoid | 1784 | * Waiting explicitly for the PHASE seemed to avoid |
1785 | * the nested phase mismatch. Btw, this didn't happen | 1785 | * the nested phase mismatch. Btw, this didn't happen |
1786 | * using my IBM drives. | 1786 | * using my IBM drives. |
1787 | */ | 1787 | */ |
diff --git a/drivers/scsi/tmscsim.c b/drivers/scsi/tmscsim.c index 5c72ca31a47a..44193049c4ae 100644 --- a/drivers/scsi/tmscsim.c +++ b/drivers/scsi/tmscsim.c | |||
@@ -430,10 +430,7 @@ static __inline__ void dc390_Going_remove (struct dc390_dcb* pDCB, struct dc390_ | |||
430 | 430 | ||
431 | static struct scatterlist* dc390_sg_build_single(struct scatterlist *sg, void *addr, unsigned int length) | 431 | static struct scatterlist* dc390_sg_build_single(struct scatterlist *sg, void *addr, unsigned int length) |
432 | { | 432 | { |
433 | memset(sg, 0, sizeof(struct scatterlist)); | 433 | sg_init_one(sg, addr, length); |
434 | sg->page = virt_to_page(addr); | ||
435 | sg->length = length; | ||
436 | sg->offset = (unsigned long)addr & ~PAGE_MASK; | ||
437 | return sg; | 434 | return sg; |
438 | } | 435 | } |
439 | 436 | ||
diff --git a/drivers/scsi/ultrastor.c b/drivers/scsi/ultrastor.c index ea72bbeb8f9d..6d1f0edd7985 100644 --- a/drivers/scsi/ultrastor.c +++ b/drivers/scsi/ultrastor.c | |||
@@ -681,7 +681,7 @@ static inline void build_sg_list(struct mscp *mscp, struct scsi_cmnd *SCpnt) | |||
681 | 681 | ||
682 | max = scsi_sg_count(SCpnt); | 682 | max = scsi_sg_count(SCpnt); |
683 | scsi_for_each_sg(SCpnt, sg, max, i) { | 683 | scsi_for_each_sg(SCpnt, sg, max, i) { |
684 | mscp->sglist[i].address = isa_page_to_bus(sg->page) + sg->offset; | 684 | mscp->sglist[i].address = isa_page_to_bus(sg_page(sg)) + sg->offset; |
685 | mscp->sglist[i].num_bytes = sg->length; | 685 | mscp->sglist[i].num_bytes = sg->length; |
686 | transfer_length += sg->length; | 686 | transfer_length += sg->length; |
687 | } | 687 | } |
diff --git a/drivers/scsi/wd33c93.c b/drivers/scsi/wd33c93.c index 0e8e642fd3b0..fdbb92d1f722 100644 --- a/drivers/scsi/wd33c93.c +++ b/drivers/scsi/wd33c93.c | |||
@@ -410,8 +410,7 @@ wd33c93_queuecommand(struct scsi_cmnd *cmd, | |||
410 | if (cmd->use_sg) { | 410 | if (cmd->use_sg) { |
411 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; | 411 | cmd->SCp.buffer = (struct scatterlist *) cmd->request_buffer; |
412 | cmd->SCp.buffers_residual = cmd->use_sg - 1; | 412 | cmd->SCp.buffers_residual = cmd->use_sg - 1; |
413 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + | 413 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
414 | cmd->SCp.buffer->offset; | ||
415 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 414 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
416 | } else { | 415 | } else { |
417 | cmd->SCp.buffer = NULL; | 416 | cmd->SCp.buffer = NULL; |
@@ -745,8 +744,7 @@ transfer_bytes(const wd33c93_regs regs, struct scsi_cmnd *cmd, | |||
745 | ++cmd->SCp.buffer; | 744 | ++cmd->SCp.buffer; |
746 | --cmd->SCp.buffers_residual; | 745 | --cmd->SCp.buffers_residual; |
747 | cmd->SCp.this_residual = cmd->SCp.buffer->length; | 746 | cmd->SCp.this_residual = cmd->SCp.buffer->length; |
748 | cmd->SCp.ptr = page_address(cmd->SCp.buffer->page) + | 747 | cmd->SCp.ptr = sg_virt(cmd->SCp.buffer); |
749 | cmd->SCp.buffer->offset; | ||
750 | } | 748 | } |
751 | if (!cmd->SCp.this_residual) /* avoid bogus setups */ | 749 | if (!cmd->SCp.this_residual) /* avoid bogus setups */ |
752 | return; | 750 | return; |
diff --git a/drivers/scsi/wd33c93.h b/drivers/scsi/wd33c93.h index 61ffb860dacc..00123f2383d7 100644 --- a/drivers/scsi/wd33c93.h +++ b/drivers/scsi/wd33c93.h | |||
@@ -155,7 +155,7 @@ | |||
155 | #define WD33C93_FS_12_15 OWNID_FS_12 | 155 | #define WD33C93_FS_12_15 OWNID_FS_12 |
156 | #define WD33C93_FS_16_20 OWNID_FS_16 | 156 | #define WD33C93_FS_16_20 OWNID_FS_16 |
157 | 157 | ||
158 | /* pass input-clock explicitely. accepted mhz values are 8-10,12-20 */ | 158 | /* pass input-clock explicitly. accepted mhz values are 8-10,12-20 */ |
159 | #define WD33C93_FS_MHZ(mhz) (mhz) | 159 | #define WD33C93_FS_MHZ(mhz) (mhz) |
160 | 160 | ||
161 | /* Control register */ | 161 | /* Control register */ |
diff --git a/drivers/scsi/wd7000.c b/drivers/scsi/wd7000.c index 255c611e78b8..03cd44f231df 100644 --- a/drivers/scsi/wd7000.c +++ b/drivers/scsi/wd7000.c | |||
@@ -1123,7 +1123,7 @@ static int wd7000_queuecommand(struct scsi_cmnd *SCpnt, | |||
1123 | any2scsi(scb->maxlen, nseg * sizeof(Sgb)); | 1123 | any2scsi(scb->maxlen, nseg * sizeof(Sgb)); |
1124 | 1124 | ||
1125 | scsi_for_each_sg(SCpnt, sg, nseg, i) { | 1125 | scsi_for_each_sg(SCpnt, sg, nseg, i) { |
1126 | any2scsi(sgb[i].ptr, isa_page_to_bus(sg->page) + sg->offset); | 1126 | any2scsi(sgb[i].ptr, isa_page_to_bus(sg_page(sg)) + sg->offset); |
1127 | any2scsi(sgb[i].len, sg->length); | 1127 | any2scsi(sgb[i].len, sg->length); |
1128 | } | 1128 | } |
1129 | } else { | 1129 | } else { |