aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/char/mem.c4
-rw-r--r--drivers/md/raid6algos.c4
-rw-r--r--drivers/md/raid6mmx.c2
-rw-r--r--drivers/md/raid6sse1.c2
-rw-r--r--drivers/md/raid6sse2.c4
-rw-r--r--drivers/md/raid6x86.h2
-rw-r--r--drivers/mmc/host/imxmmc.c2
-rw-r--r--drivers/pci/intel-iommu.c7
-rw-r--r--drivers/pci/intel-iommu.h2
-rw-r--r--drivers/s390/scsi/zfcp_def.h5
-rw-r--r--drivers/scsi/aacraid/commctrl.c12
-rw-r--r--drivers/scsi/aacraid/comminit.c2
-rw-r--r--drivers/scsi/aacraid/dpcsup.c2
-rw-r--r--drivers/scsi/arcmsr/arcmsr.h39
-rw-r--r--drivers/scsi/arcmsr/arcmsr_attr.c6
-rw-r--r--drivers/scsi/arcmsr/arcmsr_hba.c205
-rw-r--r--drivers/scsi/sg.c1
-rw-r--r--drivers/spi/spidev.c6
19 files changed, 163 insertions, 145 deletions
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 081e3dfb64d4..7ef515b3382d 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -4689,6 +4689,7 @@ static int ata_sg_setup(struct ata_queued_cmd *qc)
4689 * data in this function or read data in ata_sg_clean. 4689 * data in this function or read data in ata_sg_clean.
4690 */ 4690 */
4691 offset = lsg->offset + lsg->length - qc->pad_len; 4691 offset = lsg->offset + lsg->length - qc->pad_len;
4692 sg_init_table(psg, 1);
4692 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT), 4693 sg_set_page(psg, nth_page(sg_page(lsg), offset >> PAGE_SHIFT),
4693 qc->pad_len, offset_in_page(offset)); 4694 qc->pad_len, offset_in_page(offset));
4694 4695
diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index 0e937f64a789..20070b7c573d 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -41,7 +41,7 @@
41 */ 41 */
42static inline int uncached_access(struct file *file, unsigned long addr) 42static inline int uncached_access(struct file *file, unsigned long addr)
43{ 43{
44#if defined(__i386__) 44#if defined(__i386__) && !defined(__arch_um__)
45 /* 45 /*
46 * On the PPro and successors, the MTRRs are used to set 46 * On the PPro and successors, the MTRRs are used to set
47 * memory types for physical addresses outside main memory, 47 * memory types for physical addresses outside main memory,
@@ -57,7 +57,7 @@ static inline int uncached_access(struct file *file, unsigned long addr)
57 test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || 57 test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) ||
58 test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) ) 58 test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) )
59 && addr >= __pa(high_memory); 59 && addr >= __pa(high_memory);
60#elif defined(__x86_64__) 60#elif defined(__x86_64__) && !defined(__arch_um__)
61 /* 61 /*
62 * This is broken because it can generate memory type aliases, 62 * This is broken because it can generate memory type aliases,
63 * which can cause cache corruptions 63 * which can cause cache corruptions
diff --git a/drivers/md/raid6algos.c b/drivers/md/raid6algos.c
index 926576156578..77a6e4bf503d 100644
--- a/drivers/md/raid6algos.c
+++ b/drivers/md/raid6algos.c
@@ -52,7 +52,7 @@ const struct raid6_calls * const raid6_algos[] = {
52 &raid6_intx16, 52 &raid6_intx16,
53 &raid6_intx32, 53 &raid6_intx32,
54#endif 54#endif
55#if defined(__i386__) 55#if defined(__i386__) && !defined(__arch_um__)
56 &raid6_mmxx1, 56 &raid6_mmxx1,
57 &raid6_mmxx2, 57 &raid6_mmxx2,
58 &raid6_sse1x1, 58 &raid6_sse1x1,
@@ -60,7 +60,7 @@ const struct raid6_calls * const raid6_algos[] = {
60 &raid6_sse2x1, 60 &raid6_sse2x1,
61 &raid6_sse2x2, 61 &raid6_sse2x2,
62#endif 62#endif
63#if defined(__x86_64__) 63#if defined(__x86_64__) && !defined(__arch_um__)
64 &raid6_sse2x1, 64 &raid6_sse2x1,
65 &raid6_sse2x2, 65 &raid6_sse2x2,
66 &raid6_sse2x4, 66 &raid6_sse2x4,
diff --git a/drivers/md/raid6mmx.c b/drivers/md/raid6mmx.c
index 6181a5a3365a..d4e4a1bd70ad 100644
--- a/drivers/md/raid6mmx.c
+++ b/drivers/md/raid6mmx.c
@@ -16,7 +16,7 @@
16 * MMX implementation of RAID-6 syndrome functions 16 * MMX implementation of RAID-6 syndrome functions
17 */ 17 */
18 18
19#if defined(__i386__) 19#if defined(__i386__) && !defined(__arch_um__)
20 20
21#include "raid6.h" 21#include "raid6.h"
22#include "raid6x86.h" 22#include "raid6x86.h"
diff --git a/drivers/md/raid6sse1.c b/drivers/md/raid6sse1.c
index f0a1ba8f40ba..0666237276ff 100644
--- a/drivers/md/raid6sse1.c
+++ b/drivers/md/raid6sse1.c
@@ -21,7 +21,7 @@
21 * worthwhile as a separate implementation. 21 * worthwhile as a separate implementation.
22 */ 22 */
23 23
24#if defined(__i386__) 24#if defined(__i386__) && !defined(__arch_um__)
25 25
26#include "raid6.h" 26#include "raid6.h"
27#include "raid6x86.h" 27#include "raid6x86.h"
diff --git a/drivers/md/raid6sse2.c b/drivers/md/raid6sse2.c
index 0f019762a7c3..b034ad868039 100644
--- a/drivers/md/raid6sse2.c
+++ b/drivers/md/raid6sse2.c
@@ -17,7 +17,7 @@
17 * 17 *
18 */ 18 */
19 19
20#if defined(__i386__) || defined(__x86_64__) 20#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
21 21
22#include "raid6.h" 22#include "raid6.h"
23#include "raid6x86.h" 23#include "raid6x86.h"
@@ -161,7 +161,7 @@ const struct raid6_calls raid6_sse2x2 = {
161 161
162#endif 162#endif
163 163
164#ifdef __x86_64__ 164#if defined(__x86_64__) && !defined(__arch_um__)
165 165
166/* 166/*
167 * Unrolled-by-4 SSE2 implementation 167 * Unrolled-by-4 SSE2 implementation
diff --git a/drivers/md/raid6x86.h b/drivers/md/raid6x86.h
index 9111950414ff..99fea7a70ca7 100644
--- a/drivers/md/raid6x86.h
+++ b/drivers/md/raid6x86.h
@@ -19,7 +19,7 @@
19#ifndef LINUX_RAID_RAID6X86_H 19#ifndef LINUX_RAID_RAID6X86_H
20#define LINUX_RAID_RAID6X86_H 20#define LINUX_RAID_RAID6X86_H
21 21
22#if defined(__i386__) || defined(__x86_64__) 22#if (defined(__i386__) || defined(__x86_64__)) && !defined(__arch_um__)
23 23
24#ifdef __KERNEL__ /* Real code */ 24#ifdef __KERNEL__ /* Real code */
25 25
diff --git a/drivers/mmc/host/imxmmc.c b/drivers/mmc/host/imxmmc.c
index fc72e1fadb6a..f2070a19cfa7 100644
--- a/drivers/mmc/host/imxmmc.c
+++ b/drivers/mmc/host/imxmmc.c
@@ -262,7 +262,7 @@ static void imxmci_setup_data(struct imxmci_host *host, struct mmc_data *data)
262 } 262 }
263 263
264 /* Convert back to virtual address */ 264 /* Convert back to virtual address */
265 host->data_ptr = (u16*)sg_virt(sg); 265 host->data_ptr = (u16*)sg_virt(data->sg);
266 host->data_cnt = 0; 266 host->data_cnt = 0;
267 267
268 clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events); 268 clear_bit(IMXMCI_PEND_DMA_DATA_b, &host->pending_events);
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c
index 0c4ab3b07274..9b35259eecfa 100644
--- a/drivers/pci/intel-iommu.c
+++ b/drivers/pci/intel-iommu.c
@@ -745,7 +745,7 @@ static char *fault_reason_strings[] =
745 "non-zero reserved fields in PTE", 745 "non-zero reserved fields in PTE",
746 "Unknown" 746 "Unknown"
747}; 747};
748#define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) 748#define MAX_FAULT_REASON_IDX ARRAY_SIZE(fault_reason_strings) - 1
749 749
750char *dmar_get_fault_reason(u8 fault_reason) 750char *dmar_get_fault_reason(u8 fault_reason)
751{ 751{
@@ -995,7 +995,6 @@ static struct intel_iommu *alloc_iommu(struct dmar_drhd_unit *drhd)
995 return iommu; 995 return iommu;
996error_unmap: 996error_unmap:
997 iounmap(iommu->reg); 997 iounmap(iommu->reg);
998 iommu->reg = 0;
999error: 998error:
1000 kfree(iommu); 999 kfree(iommu);
1001 return NULL; 1000 return NULL;
@@ -1808,7 +1807,7 @@ get_valid_domain_for_dev(struct pci_dev *pdev)
1808 if (!domain) { 1807 if (!domain) {
1809 printk(KERN_ERR 1808 printk(KERN_ERR
1810 "Allocating domain for %s failed", pci_name(pdev)); 1809 "Allocating domain for %s failed", pci_name(pdev));
1811 return 0; 1810 return NULL;
1812 } 1811 }
1813 1812
1814 /* make sure context mapping is ok */ 1813 /* make sure context mapping is ok */
@@ -1818,7 +1817,7 @@ get_valid_domain_for_dev(struct pci_dev *pdev)
1818 printk(KERN_ERR 1817 printk(KERN_ERR
1819 "Domain context map for %s failed", 1818 "Domain context map for %s failed",
1820 pci_name(pdev)); 1819 pci_name(pdev));
1821 return 0; 1820 return NULL;
1822 } 1821 }
1823 } 1822 }
1824 1823
diff --git a/drivers/pci/intel-iommu.h b/drivers/pci/intel-iommu.h
index ee88dd2400cb..459ad1f9dc54 100644
--- a/drivers/pci/intel-iommu.h
+++ b/drivers/pci/intel-iommu.h
@@ -58,7 +58,7 @@
58 hi = readl(dmar + reg + 4); \ 58 hi = readl(dmar + reg + 4); \
59 (((u64) hi) << 32) + lo; }) 59 (((u64) hi) << 32) + lo; })
60*/ 60*/
61static inline u64 dmar_readq(void *addr) 61static inline u64 dmar_readq(void __iomem *addr)
62{ 62{
63 u32 lo, hi; 63 u32 lo, hi;
64 lo = readl(addr); 64 lo = readl(addr);
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 0754542978b6..e268f79bdbd2 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -70,11 +70,12 @@ zfcp_sg_to_address(struct scatterlist *list)
70 * zfcp_address_to_sg - set up struct scatterlist from kernel address 70 * zfcp_address_to_sg - set up struct scatterlist from kernel address
71 * @address: kernel address 71 * @address: kernel address
72 * @list: struct scatterlist 72 * @list: struct scatterlist
73 * @size: buffer size
73 */ 74 */
74static inline void 75static inline void
75zfcp_address_to_sg(void *address, struct scatterlist *list) 76zfcp_address_to_sg(void *address, struct scatterlist *list, unsigned int size)
76{ 77{
77 sg_set_buf(list, address, 0); 78 sg_set_buf(list, address, size);
78} 79}
79 80
80#define REQUEST_LIST_SIZE 128 81#define REQUEST_LIST_SIZE 128
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 72b0393b4596..1e6d7a9c75bf 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -391,7 +391,7 @@ static int close_getadapter_fib(struct aac_dev * dev, void __user *arg)
391 /* 391 /*
392 * Extract the fibctx from the input parameters 392 * Extract the fibctx from the input parameters
393 */ 393 */
394 if (fibctx->unique == (u32)(ptrdiff_t)arg) /* We found a winner */ 394 if (fibctx->unique == (u32)(uintptr_t)arg) /* We found a winner */
395 break; 395 break;
396 entry = entry->next; 396 entry = entry->next;
397 fibctx = NULL; 397 fibctx = NULL;
@@ -590,7 +590,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
590 } 590 }
591 addr = (u64)upsg->sg[i].addr[0]; 591 addr = (u64)upsg->sg[i].addr[0];
592 addr += ((u64)upsg->sg[i].addr[1]) << 32; 592 addr += ((u64)upsg->sg[i].addr[1]) << 32;
593 sg_user[i] = (void __user *)(ptrdiff_t)addr; 593 sg_user[i] = (void __user *)(uintptr_t)addr;
594 sg_list[i] = p; // save so we can clean up later 594 sg_list[i] = p; // save so we can clean up later
595 sg_indx = i; 595 sg_indx = i;
596 596
@@ -633,7 +633,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
633 rcode = -ENOMEM; 633 rcode = -ENOMEM;
634 goto cleanup; 634 goto cleanup;
635 } 635 }
636 sg_user[i] = (void __user *)(ptrdiff_t)usg->sg[i].addr; 636 sg_user[i] = (void __user *)(uintptr_t)usg->sg[i].addr;
637 sg_list[i] = p; // save so we can clean up later 637 sg_list[i] = p; // save so we can clean up later
638 sg_indx = i; 638 sg_indx = i;
639 639
@@ -664,7 +664,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
664 if (actual_fibsize64 == fibsize) { 664 if (actual_fibsize64 == fibsize) {
665 struct user_sgmap64* usg = (struct user_sgmap64 *)upsg; 665 struct user_sgmap64* usg = (struct user_sgmap64 *)upsg;
666 for (i = 0; i < upsg->count; i++) { 666 for (i = 0; i < upsg->count; i++) {
667 u64 addr; 667 uintptr_t addr;
668 void* p; 668 void* p;
669 /* Does this really need to be GFP_DMA? */ 669 /* Does this really need to be GFP_DMA? */
670 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA); 670 p = kmalloc(usg->sg[i].count,GFP_KERNEL|__GFP_DMA);
@@ -676,7 +676,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
676 } 676 }
677 addr = (u64)usg->sg[i].addr[0]; 677 addr = (u64)usg->sg[i].addr[0];
678 addr += ((u64)usg->sg[i].addr[1]) << 32; 678 addr += ((u64)usg->sg[i].addr[1]) << 32;
679 sg_user[i] = (void __user *)(ptrdiff_t)addr; 679 sg_user[i] = (void __user *)addr;
680 sg_list[i] = p; // save so we can clean up later 680 sg_list[i] = p; // save so we can clean up later
681 sg_indx = i; 681 sg_indx = i;
682 682
@@ -704,7 +704,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
704 rcode = -ENOMEM; 704 rcode = -ENOMEM;
705 goto cleanup; 705 goto cleanup;
706 } 706 }
707 sg_user[i] = (void __user *)(ptrdiff_t)upsg->sg[i].addr; 707 sg_user[i] = (void __user *)(uintptr_t)upsg->sg[i].addr;
708 sg_list[i] = p; // save so we can clean up later 708 sg_list[i] = p; // save so we can clean up later
709 sg_indx = i; 709 sg_indx = i;
710 710
diff --git a/drivers/scsi/aacraid/comminit.c b/drivers/scsi/aacraid/comminit.c
index 3009ad8c4073..8736813a0296 100644
--- a/drivers/scsi/aacraid/comminit.c
+++ b/drivers/scsi/aacraid/comminit.c
@@ -110,7 +110,7 @@ static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long co
110 /* 110 /*
111 * Align the beginning of Headers to commalign 111 * Align the beginning of Headers to commalign
112 */ 112 */
113 align = (commalign - ((ptrdiff_t)(base) & (commalign - 1))); 113 align = (commalign - ((uintptr_t)(base) & (commalign - 1)));
114 base = base + align; 114 base = base + align;
115 phys = phys + align; 115 phys = phys + align;
116 /* 116 /*
diff --git a/drivers/scsi/aacraid/dpcsup.c b/drivers/scsi/aacraid/dpcsup.c
index fcd25f7d0bc6..e6032ffc66a6 100644
--- a/drivers/scsi/aacraid/dpcsup.c
+++ b/drivers/scsi/aacraid/dpcsup.c
@@ -254,7 +254,7 @@ unsigned int aac_intr_normal(struct aac_dev * dev, u32 Index)
254 kfree (fib); 254 kfree (fib);
255 return 1; 255 return 1;
256 } 256 }
257 memcpy(hw_fib, (struct hw_fib *)(((ptrdiff_t)(dev->regs.sa)) + 257 memcpy(hw_fib, (struct hw_fib *)(((uintptr_t)(dev->regs.sa)) +
258 (index & ~0x00000002L)), sizeof(struct hw_fib)); 258 (index & ~0x00000002L)), sizeof(struct hw_fib));
259 INIT_LIST_HEAD(&fib->fiblink); 259 INIT_LIST_HEAD(&fib->fiblink);
260 fib->type = FSAFS_NTC_FIB_CONTEXT; 260 fib->type = FSAFS_NTC_FIB_CONTEXT;
diff --git a/drivers/scsi/arcmsr/arcmsr.h b/drivers/scsi/arcmsr/arcmsr.h
index ace7a15b413e..a67e29f83ae5 100644
--- a/drivers/scsi/arcmsr/arcmsr.h
+++ b/drivers/scsi/arcmsr/arcmsr.h
@@ -141,14 +141,14 @@ struct CMD_MESSAGE_FIELD
141#define IS_SG64_ADDR 0x01000000 /* bit24 */ 141#define IS_SG64_ADDR 0x01000000 /* bit24 */
142struct SG32ENTRY 142struct SG32ENTRY
143{ 143{
144 uint32_t length; 144 __le32 length;
145 uint32_t address; 145 __le32 address;
146}; 146};
147struct SG64ENTRY 147struct SG64ENTRY
148{ 148{
149 uint32_t length; 149 __le32 length;
150 uint32_t address; 150 __le32 address;
151 uint32_t addresshigh; 151 __le32 addresshigh;
152}; 152};
153struct SGENTRY_UNION 153struct SGENTRY_UNION
154{ 154{
@@ -339,23 +339,15 @@ struct MessageUnit_B
339 uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE]; 339 uint32_t done_qbuffer[ARCMSR_MAX_HBB_POSTQUEUE];
340 uint32_t postq_index; 340 uint32_t postq_index;
341 uint32_t doneq_index; 341 uint32_t doneq_index;
342 uint32_t *drv2iop_doorbell_reg; 342 uint32_t __iomem *drv2iop_doorbell_reg;
343 uint32_t *drv2iop_doorbell_mask_reg; 343 uint32_t __iomem *drv2iop_doorbell_mask_reg;
344 uint32_t *iop2drv_doorbell_reg; 344 uint32_t __iomem *iop2drv_doorbell_reg;
345 uint32_t *iop2drv_doorbell_mask_reg; 345 uint32_t __iomem *iop2drv_doorbell_mask_reg;
346 uint32_t *msgcode_rwbuffer_reg; 346 uint32_t __iomem *msgcode_rwbuffer_reg;
347 uint32_t *ioctl_wbuffer_reg; 347 uint32_t __iomem *ioctl_wbuffer_reg;
348 uint32_t *ioctl_rbuffer_reg; 348 uint32_t __iomem *ioctl_rbuffer_reg;
349}; 349};
350 350
351struct MessageUnit
352{
353 union
354 {
355 struct MessageUnit_A pmu_A;
356 struct MessageUnit_B pmu_B;
357 } u;
358};
359/* 351/*
360******************************************************************************* 352*******************************************************************************
361** Adapter Control Block 353** Adapter Control Block
@@ -374,7 +366,10 @@ struct AdapterControlBlock
374 /* Offset is used in making arc cdb physical to virtual calculations */ 366 /* Offset is used in making arc cdb physical to virtual calculations */
375 uint32_t outbound_int_enable; 367 uint32_t outbound_int_enable;
376 368
377 struct MessageUnit * pmu; 369 union {
370 struct MessageUnit_A __iomem * pmuA;
371 struct MessageUnit_B * pmuB;
372 };
378 /* message unit ATU inbound base address0 */ 373 /* message unit ATU inbound base address0 */
379 374
380 uint32_t acb_flags; 375 uint32_t acb_flags;
@@ -558,7 +553,7 @@ struct SENSE_DATA
558 553
559extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *); 554extern void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *);
560extern void arcmsr_iop_message_read(struct AdapterControlBlock *); 555extern void arcmsr_iop_message_read(struct AdapterControlBlock *);
561extern struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *); 556extern struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *);
562extern struct class_device_attribute *arcmsr_host_attrs[]; 557extern struct class_device_attribute *arcmsr_host_attrs[];
563extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *); 558extern int arcmsr_alloc_sysfs_attr(struct AdapterControlBlock *);
564void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb); 559void arcmsr_free_sysfs_attr(struct AdapterControlBlock *acb);
diff --git a/drivers/scsi/arcmsr/arcmsr_attr.c b/drivers/scsi/arcmsr/arcmsr_attr.c
index d04d1aa28fa4..7d7b0a554276 100644
--- a/drivers/scsi/arcmsr/arcmsr_attr.c
+++ b/drivers/scsi/arcmsr/arcmsr_attr.c
@@ -85,13 +85,13 @@ static ssize_t arcmsr_sysfs_iop_message_read(struct kobject *kobj,
85 allxfer_len++; 85 allxfer_len++;
86 } 86 }
87 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { 87 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
88 struct QBUFFER *prbuffer; 88 struct QBUFFER __iomem *prbuffer;
89 uint8_t *iop_data; 89 uint8_t __iomem *iop_data;
90 int32_t iop_len; 90 int32_t iop_len;
91 91
92 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; 92 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
93 prbuffer = arcmsr_get_iop_rqbuffer(acb); 93 prbuffer = arcmsr_get_iop_rqbuffer(acb);
94 iop_data = (uint8_t *)prbuffer->data; 94 iop_data = prbuffer->data;
95 iop_len = readl(&prbuffer->data_len); 95 iop_len = readl(&prbuffer->data_len);
96 while (iop_len > 0) { 96 while (iop_len > 0) {
97 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); 97 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data);
diff --git a/drivers/scsi/arcmsr/arcmsr_hba.c b/drivers/scsi/arcmsr/arcmsr_hba.c
index f7a252885a5c..d466a2dac1db 100644
--- a/drivers/scsi/arcmsr/arcmsr_hba.c
+++ b/drivers/scsi/arcmsr/arcmsr_hba.c
@@ -236,18 +236,22 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
236 uint32_t intmask_org; 236 uint32_t intmask_org;
237 int i, j; 237 int i, j;
238 238
239 acb->pmu = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0)); 239 acb->pmuA = ioremap(pci_resource_start(pdev, 0), pci_resource_len(pdev, 0));
240 if (!acb->pmu) { 240 if (!acb->pmuA) {
241 printk(KERN_NOTICE "arcmsr%d: memory mapping region fail \n", 241 printk(KERN_NOTICE "arcmsr%d: memory mapping region fail \n",
242 acb->host->host_no); 242 acb->host->host_no);
243 return -ENOMEM;
243 } 244 }
244 245
245 dma_coherent = dma_alloc_coherent(&pdev->dev, 246 dma_coherent = dma_alloc_coherent(&pdev->dev,
246 ARCMSR_MAX_FREECCB_NUM * 247 ARCMSR_MAX_FREECCB_NUM *
247 sizeof (struct CommandControlBlock) + 0x20, 248 sizeof (struct CommandControlBlock) + 0x20,
248 &dma_coherent_handle, GFP_KERNEL); 249 &dma_coherent_handle, GFP_KERNEL);
249 if (!dma_coherent) 250
251 if (!dma_coherent) {
252 iounmap(acb->pmuA);
250 return -ENOMEM; 253 return -ENOMEM;
254 }
251 255
252 acb->dma_coherent = dma_coherent; 256 acb->dma_coherent = dma_coherent;
253 acb->dma_coherent_handle = dma_coherent_handle; 257 acb->dma_coherent_handle = dma_coherent_handle;
@@ -287,7 +291,7 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
287 291
288 struct pci_dev *pdev = acb->pdev; 292 struct pci_dev *pdev = acb->pdev;
289 struct MessageUnit_B *reg; 293 struct MessageUnit_B *reg;
290 void *mem_base0, *mem_base1; 294 void __iomem *mem_base0, *mem_base1;
291 void *dma_coherent; 295 void *dma_coherent;
292 dma_addr_t dma_coherent_handle, dma_addr; 296 dma_addr_t dma_coherent_handle, dma_addr;
293 uint32_t intmask_org; 297 uint32_t intmask_org;
@@ -328,25 +332,28 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
328 332
329 reg = (struct MessageUnit_B *)(dma_coherent + 333 reg = (struct MessageUnit_B *)(dma_coherent +
330 ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock)); 334 ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock));
331 acb->pmu = (struct MessageUnit *)reg; 335 acb->pmuB = reg;
332 mem_base0 = ioremap(pci_resource_start(pdev, 0), 336 mem_base0 = ioremap(pci_resource_start(pdev, 0),
333 pci_resource_len(pdev, 0)); 337 pci_resource_len(pdev, 0));
338 if (!mem_base0)
339 goto out;
340
334 mem_base1 = ioremap(pci_resource_start(pdev, 2), 341 mem_base1 = ioremap(pci_resource_start(pdev, 2),
335 pci_resource_len(pdev, 2)); 342 pci_resource_len(pdev, 2));
336 reg->drv2iop_doorbell_reg = (uint32_t *)((char *)mem_base0 + 343 if (!mem_base1) {
337 ARCMSR_DRV2IOP_DOORBELL); 344 iounmap(mem_base0);
338 reg->drv2iop_doorbell_mask_reg = (uint32_t *)((char *)mem_base0 + 345 goto out;
339 ARCMSR_DRV2IOP_DOORBELL_MASK); 346 }
340 reg->iop2drv_doorbell_reg = (uint32_t *)((char *)mem_base0 + 347
341 ARCMSR_IOP2DRV_DOORBELL); 348 reg->drv2iop_doorbell_reg = mem_base0 + ARCMSR_DRV2IOP_DOORBELL;
342 reg->iop2drv_doorbell_mask_reg = (uint32_t *)((char *)mem_base0 + 349 reg->drv2iop_doorbell_mask_reg = mem_base0 +
343 ARCMSR_IOP2DRV_DOORBELL_MASK); 350 ARCMSR_DRV2IOP_DOORBELL_MASK;
344 reg->ioctl_wbuffer_reg = (uint32_t *)((char *)mem_base1 + 351 reg->iop2drv_doorbell_reg = mem_base0 + ARCMSR_IOP2DRV_DOORBELL;
345 ARCMSR_IOCTL_WBUFFER); 352 reg->iop2drv_doorbell_mask_reg = mem_base0 +
346 reg->ioctl_rbuffer_reg = (uint32_t *)((char *)mem_base1 + 353 ARCMSR_IOP2DRV_DOORBELL_MASK;
347 ARCMSR_IOCTL_RBUFFER); 354 reg->ioctl_wbuffer_reg = mem_base1 + ARCMSR_IOCTL_WBUFFER;
348 reg->msgcode_rwbuffer_reg = (uint32_t *)((char *)mem_base1 + 355 reg->ioctl_rbuffer_reg = mem_base1 + ARCMSR_IOCTL_RBUFFER;
349 ARCMSR_MSGCODE_RWBUFFER); 356 reg->msgcode_rwbuffer_reg = mem_base1 + ARCMSR_MSGCODE_RWBUFFER;
350 357
351 acb->vir2phy_offset = (unsigned long)ccb_tmp -(unsigned long)dma_addr; 358 acb->vir2phy_offset = (unsigned long)ccb_tmp -(unsigned long)dma_addr;
352 for (i = 0; i < ARCMSR_MAX_TARGETID; i++) 359 for (i = 0; i < ARCMSR_MAX_TARGETID; i++)
@@ -362,6 +369,12 @@ static int arcmsr_alloc_ccb_pool(struct AdapterControlBlock *acb)
362 break; 369 break;
363 } 370 }
364 return 0; 371 return 0;
372
373out:
374 dma_free_coherent(&acb->pdev->dev,
375 ARCMSR_MAX_FREECCB_NUM * sizeof(struct CommandControlBlock) + 0x20,
376 acb->dma_coherent, acb->dma_coherent_handle);
377 return -ENOMEM;
365} 378}
366 379
367static int arcmsr_probe(struct pci_dev *pdev, 380static int arcmsr_probe(struct pci_dev *pdev,
@@ -454,7 +467,6 @@ static int arcmsr_probe(struct pci_dev *pdev,
454 free_irq(pdev->irq, acb); 467 free_irq(pdev->irq, acb);
455 out_free_ccb_pool: 468 out_free_ccb_pool:
456 arcmsr_free_ccb_pool(acb); 469 arcmsr_free_ccb_pool(acb);
457 iounmap(acb->pmu);
458 out_release_regions: 470 out_release_regions:
459 pci_release_regions(pdev); 471 pci_release_regions(pdev);
460 out_host_put: 472 out_host_put:
@@ -467,7 +479,7 @@ static int arcmsr_probe(struct pci_dev *pdev,
467 479
468static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb) 480static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb)
469{ 481{
470 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 482 struct MessageUnit_A __iomem *reg = acb->pmuA;
471 uint32_t Index; 483 uint32_t Index;
472 uint8_t Retries = 0x00; 484 uint8_t Retries = 0x00;
473 485
@@ -488,7 +500,7 @@ static uint8_t arcmsr_hba_wait_msgint_ready(struct AdapterControlBlock *acb)
488 500
489static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb) 501static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb)
490{ 502{
491 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 503 struct MessageUnit_B *reg = acb->pmuB;
492 uint32_t Index; 504 uint32_t Index;
493 uint8_t Retries = 0x00; 505 uint8_t Retries = 0x00;
494 506
@@ -509,7 +521,7 @@ static uint8_t arcmsr_hbb_wait_msgint_ready(struct AdapterControlBlock *acb)
509 521
510static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb) 522static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
511{ 523{
512 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 524 struct MessageUnit_A __iomem *reg = acb->pmuA;
513 525
514 writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, &reg->inbound_msgaddr0); 526 writel(ARCMSR_INBOUND_MESG0_ABORT_CMD, &reg->inbound_msgaddr0);
515 if (arcmsr_hba_wait_msgint_ready(acb)) 527 if (arcmsr_hba_wait_msgint_ready(acb))
@@ -520,7 +532,7 @@ static void arcmsr_abort_hba_allcmd(struct AdapterControlBlock *acb)
520 532
521static void arcmsr_abort_hbb_allcmd(struct AdapterControlBlock *acb) 533static void arcmsr_abort_hbb_allcmd(struct AdapterControlBlock *acb)
522{ 534{
523 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 535 struct MessageUnit_B *reg = acb->pmuB;
524 536
525 writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell_reg); 537 writel(ARCMSR_MESSAGE_ABORT_CMD, reg->drv2iop_doorbell_reg);
526 if (arcmsr_hbb_wait_msgint_ready(acb)) 538 if (arcmsr_hbb_wait_msgint_ready(acb))
@@ -566,7 +578,7 @@ static void arcmsr_ccb_complete(struct CommandControlBlock *ccb, int stand_flag)
566 578
567static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb) 579static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb)
568{ 580{
569 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 581 struct MessageUnit_A __iomem *reg = acb->pmuA;
570 int retry_count = 30; 582 int retry_count = 30;
571 583
572 writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, &reg->inbound_msgaddr0); 584 writel(ARCMSR_INBOUND_MESG0_FLUSH_CACHE, &reg->inbound_msgaddr0);
@@ -583,7 +595,7 @@ static void arcmsr_flush_hba_cache(struct AdapterControlBlock *acb)
583 595
584static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb) 596static void arcmsr_flush_hbb_cache(struct AdapterControlBlock *acb)
585{ 597{
586 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 598 struct MessageUnit_B *reg = acb->pmuB;
587 int retry_count = 30; 599 int retry_count = 30;
588 600
589 writel(ARCMSR_MESSAGE_FLUSH_CACHE, reg->drv2iop_doorbell_reg); 601 writel(ARCMSR_MESSAGE_FLUSH_CACHE, reg->drv2iop_doorbell_reg);
@@ -637,7 +649,7 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
637 switch (acb->adapter_type) { 649 switch (acb->adapter_type) {
638 650
639 case ACB_ADAPTER_TYPE_A : { 651 case ACB_ADAPTER_TYPE_A : {
640 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 652 struct MessageUnit_A __iomem *reg = acb->pmuA;
641 orig_mask = readl(&reg->outbound_intmask)|\ 653 orig_mask = readl(&reg->outbound_intmask)|\
642 ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE; 654 ARCMSR_MU_OUTBOUND_MESSAGE0_INTMASKENABLE;
643 writel(orig_mask|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE, \ 655 writel(orig_mask|ARCMSR_MU_OUTBOUND_ALL_INTMASKENABLE, \
@@ -646,7 +658,7 @@ static u32 arcmsr_disable_outbound_ints(struct AdapterControlBlock *acb)
646 break; 658 break;
647 659
648 case ACB_ADAPTER_TYPE_B : { 660 case ACB_ADAPTER_TYPE_B : {
649 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 661 struct MessageUnit_B *reg = acb->pmuB;
650 orig_mask = readl(reg->iop2drv_doorbell_mask_reg) & \ 662 orig_mask = readl(reg->iop2drv_doorbell_mask_reg) & \
651 (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE); 663 (~ARCMSR_IOP2DRV_MESSAGE_CMD_DONE);
652 writel(0, reg->iop2drv_doorbell_mask_reg); 664 writel(0, reg->iop2drv_doorbell_mask_reg);
@@ -748,14 +760,13 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb)
748 switch (acb->adapter_type) { 760 switch (acb->adapter_type) {
749 761
750 case ACB_ADAPTER_TYPE_A: { 762 case ACB_ADAPTER_TYPE_A: {
751 struct MessageUnit_A __iomem *reg = \ 763 struct MessageUnit_A __iomem *reg = acb->pmuA;
752 (struct MessageUnit_A *)acb->pmu;
753 uint32_t outbound_intstatus; 764 uint32_t outbound_intstatus;
754 outbound_intstatus = readl(&reg->outbound_intstatus) & \ 765 outbound_intstatus = readl(&reg->outbound_intstatus) &
755 acb->outbound_int_enable; 766 acb->outbound_int_enable;
756 /*clear and abort all outbound posted Q*/ 767 /*clear and abort all outbound posted Q*/
757 writel(outbound_intstatus, &reg->outbound_intstatus);/*clear interrupt*/ 768 writel(outbound_intstatus, &reg->outbound_intstatus);/*clear interrupt*/
758 while (((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF) \ 769 while (((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF)
759 && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) { 770 && (i++ < ARCMSR_MAX_OUTSTANDING_CMD)) {
760 arcmsr_drain_donequeue(acb, flag_ccb); 771 arcmsr_drain_donequeue(acb, flag_ccb);
761 } 772 }
@@ -763,7 +774,7 @@ static void arcmsr_done4abort_postqueue(struct AdapterControlBlock *acb)
763 break; 774 break;
764 775
765 case ACB_ADAPTER_TYPE_B: { 776 case ACB_ADAPTER_TYPE_B: {
766 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 777 struct MessageUnit_B *reg = acb->pmuB;
767 /*clear all outbound posted Q*/ 778 /*clear all outbound posted Q*/
768 for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) { 779 for (i = 0; i < ARCMSR_MAX_HBB_POSTQUEUE; i++) {
769 if ((flag_ccb = readl(&reg->done_qbuffer[i])) != 0) { 780 if ((flag_ccb = readl(&reg->done_qbuffer[i])) != 0) {
@@ -816,7 +827,6 @@ static void arcmsr_remove(struct pci_dev *pdev)
816 } 827 }
817 828
818 free_irq(pdev->irq, acb); 829 free_irq(pdev->irq, acb);
819 iounmap(acb->pmu);
820 arcmsr_free_ccb_pool(acb); 830 arcmsr_free_ccb_pool(acb);
821 pci_release_regions(pdev); 831 pci_release_regions(pdev);
822 832
@@ -859,7 +869,7 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb, \
859 switch (acb->adapter_type) { 869 switch (acb->adapter_type) {
860 870
861 case ACB_ADAPTER_TYPE_A : { 871 case ACB_ADAPTER_TYPE_A : {
862 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 872 struct MessageUnit_A __iomem *reg = acb->pmuA;
863 mask = intmask_org & ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE | 873 mask = intmask_org & ~(ARCMSR_MU_OUTBOUND_POSTQUEUE_INTMASKENABLE |
864 ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE); 874 ARCMSR_MU_OUTBOUND_DOORBELL_INTMASKENABLE);
865 writel(mask, &reg->outbound_intmask); 875 writel(mask, &reg->outbound_intmask);
@@ -868,7 +878,7 @@ static void arcmsr_enable_outbound_ints(struct AdapterControlBlock *acb, \
868 break; 878 break;
869 879
870 case ACB_ADAPTER_TYPE_B : { 880 case ACB_ADAPTER_TYPE_B : {
871 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 881 struct MessageUnit_B *reg = acb->pmuB;
872 mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK | \ 882 mask = intmask_org | (ARCMSR_IOP2DRV_DATA_WRITE_OK | \
873 ARCMSR_IOP2DRV_DATA_READ_OK | ARCMSR_IOP2DRV_CDB_DONE); 883 ARCMSR_IOP2DRV_DATA_READ_OK | ARCMSR_IOP2DRV_CDB_DONE);
874 writel(mask, reg->iop2drv_doorbell_mask_reg); 884 writel(mask, reg->iop2drv_doorbell_mask_reg);
@@ -882,7 +892,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb,
882{ 892{
883 struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&ccb->arcmsr_cdb; 893 struct ARCMSR_CDB *arcmsr_cdb = (struct ARCMSR_CDB *)&ccb->arcmsr_cdb;
884 int8_t *psge = (int8_t *)&arcmsr_cdb->u; 894 int8_t *psge = (int8_t *)&arcmsr_cdb->u;
885 uint32_t address_lo, address_hi; 895 __le32 address_lo, address_hi;
886 int arccdbsize = 0x30; 896 int arccdbsize = 0x30;
887 int nseg; 897 int nseg;
888 898
@@ -900,7 +910,8 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb,
900 BUG_ON(nseg < 0); 910 BUG_ON(nseg < 0);
901 911
902 if (nseg) { 912 if (nseg) {
903 int length, i, cdb_sgcount = 0; 913 __le32 length;
914 int i, cdb_sgcount = 0;
904 struct scatterlist *sg; 915 struct scatterlist *sg;
905 916
906 /* map stor port SG list to our iop SG List. */ 917 /* map stor port SG list to our iop SG List. */
@@ -921,7 +932,7 @@ static void arcmsr_build_ccb(struct AdapterControlBlock *acb,
921 932
922 pdma_sg->addresshigh = address_hi; 933 pdma_sg->addresshigh = address_hi;
923 pdma_sg->address = address_lo; 934 pdma_sg->address = address_lo;
924 pdma_sg->length = length|IS_SG64_ADDR; 935 pdma_sg->length = length|cpu_to_le32(IS_SG64_ADDR);
925 psge += sizeof (struct SG64ENTRY); 936 psge += sizeof (struct SG64ENTRY);
926 arccdbsize += sizeof (struct SG64ENTRY); 937 arccdbsize += sizeof (struct SG64ENTRY);
927 } 938 }
@@ -947,7 +958,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
947 958
948 switch (acb->adapter_type) { 959 switch (acb->adapter_type) {
949 case ACB_ADAPTER_TYPE_A: { 960 case ACB_ADAPTER_TYPE_A: {
950 struct MessageUnit_A *reg = (struct MessageUnit_A *)acb->pmu; 961 struct MessageUnit_A __iomem *reg = acb->pmuA;
951 962
952 if (arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE) 963 if (arcmsr_cdb->Flags & ARCMSR_CDB_FLAG_SGL_BSIZE)
953 writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE, 964 writel(cdb_shifted_phyaddr | ARCMSR_CCBPOST_FLAG_SGL_BSIZE,
@@ -959,7 +970,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
959 break; 970 break;
960 971
961 case ACB_ADAPTER_TYPE_B: { 972 case ACB_ADAPTER_TYPE_B: {
962 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 973 struct MessageUnit_B *reg = acb->pmuB;
963 uint32_t ending_index, index = reg->postq_index; 974 uint32_t ending_index, index = reg->postq_index;
964 975
965 ending_index = ((index + 1) % ARCMSR_MAX_HBB_POSTQUEUE); 976 ending_index = ((index + 1) % ARCMSR_MAX_HBB_POSTQUEUE);
@@ -982,7 +993,7 @@ static void arcmsr_post_ccb(struct AdapterControlBlock *acb, struct CommandContr
982 993
983static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb) 994static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb)
984{ 995{
985 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 996 struct MessageUnit_A __iomem *reg = acb->pmuA;
986 acb->acb_flags &= ~ACB_F_MSG_START_BGRB; 997 acb->acb_flags &= ~ACB_F_MSG_START_BGRB;
987 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0); 998 writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0);
988 999
@@ -995,7 +1006,7 @@ static void arcmsr_stop_hba_bgrb(struct AdapterControlBlock *acb)
995 1006
996static void arcmsr_stop_hbb_bgrb(struct AdapterControlBlock *acb) 1007static void arcmsr_stop_hbb_bgrb(struct AdapterControlBlock *acb)
997{ 1008{
998 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1009 struct MessageUnit_B *reg = acb->pmuB;
999 acb->acb_flags &= ~ACB_F_MSG_START_BGRB; 1010 acb->acb_flags &= ~ACB_F_MSG_START_BGRB;
1000 writel(ARCMSR_MESSAGE_STOP_BGRB, reg->drv2iop_doorbell_reg); 1011 writel(ARCMSR_MESSAGE_STOP_BGRB, reg->drv2iop_doorbell_reg);
1001 1012
@@ -1023,6 +1034,17 @@ static void arcmsr_stop_adapter_bgrb(struct AdapterControlBlock *acb)
1023 1034
1024static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb) 1035static void arcmsr_free_ccb_pool(struct AdapterControlBlock *acb)
1025{ 1036{
1037 switch (acb->adapter_type) {
1038 case ACB_ADAPTER_TYPE_A: {
1039 iounmap(acb->pmuA);
1040 break;
1041 }
1042 case ACB_ADAPTER_TYPE_B: {
1043 struct MessageUnit_B *reg = acb->pmuB;
1044 iounmap(reg->drv2iop_doorbell_reg - ARCMSR_DRV2IOP_DOORBELL);
1045 iounmap(reg->ioctl_wbuffer_reg - ARCMSR_IOCTL_WBUFFER);
1046 }
1047 }
1026 dma_free_coherent(&acb->pdev->dev, 1048 dma_free_coherent(&acb->pdev->dev,
1027 ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 0x20, 1049 ARCMSR_MAX_FREECCB_NUM * sizeof (struct CommandControlBlock) + 0x20,
1028 acb->dma_coherent, 1050 acb->dma_coherent,
@@ -1033,13 +1055,13 @@ void arcmsr_iop_message_read(struct AdapterControlBlock *acb)
1033{ 1055{
1034 switch (acb->adapter_type) { 1056 switch (acb->adapter_type) {
1035 case ACB_ADAPTER_TYPE_A: { 1057 case ACB_ADAPTER_TYPE_A: {
1036 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1058 struct MessageUnit_A __iomem *reg = acb->pmuA;
1037 writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &reg->inbound_doorbell); 1059 writel(ARCMSR_INBOUND_DRIVER_DATA_READ_OK, &reg->inbound_doorbell);
1038 } 1060 }
1039 break; 1061 break;
1040 1062
1041 case ACB_ADAPTER_TYPE_B: { 1063 case ACB_ADAPTER_TYPE_B: {
1042 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1064 struct MessageUnit_B *reg = acb->pmuB;
1043 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); 1065 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg);
1044 } 1066 }
1045 break; 1067 break;
@@ -1050,7 +1072,7 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
1050{ 1072{
1051 switch (acb->adapter_type) { 1073 switch (acb->adapter_type) {
1052 case ACB_ADAPTER_TYPE_A: { 1074 case ACB_ADAPTER_TYPE_A: {
1053 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1075 struct MessageUnit_A __iomem *reg = acb->pmuA;
1054 /* 1076 /*
1055 ** push inbound doorbell tell iop, driver data write ok 1077 ** push inbound doorbell tell iop, driver data write ok
1056 ** and wait reply on next hwinterrupt for next Qbuffer post 1078 ** and wait reply on next hwinterrupt for next Qbuffer post
@@ -1060,7 +1082,7 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
1060 break; 1082 break;
1061 1083
1062 case ACB_ADAPTER_TYPE_B: { 1084 case ACB_ADAPTER_TYPE_B: {
1063 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1085 struct MessageUnit_B *reg = acb->pmuB;
1064 /* 1086 /*
1065 ** push inbound doorbell tell iop, driver data write ok 1087 ** push inbound doorbell tell iop, driver data write ok
1066 ** and wait reply on next hwinterrupt for next Qbuffer post 1088 ** and wait reply on next hwinterrupt for next Qbuffer post
@@ -1071,41 +1093,41 @@ static void arcmsr_iop_message_wrote(struct AdapterControlBlock *acb)
1071 } 1093 }
1072} 1094}
1073 1095
1074struct QBUFFER *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb) 1096struct QBUFFER __iomem *arcmsr_get_iop_rqbuffer(struct AdapterControlBlock *acb)
1075{ 1097{
1076 static struct QBUFFER *qbuffer; 1098 struct QBUFFER __iomem *qbuffer = NULL;
1077 1099
1078 switch (acb->adapter_type) { 1100 switch (acb->adapter_type) {
1079 1101
1080 case ACB_ADAPTER_TYPE_A: { 1102 case ACB_ADAPTER_TYPE_A: {
1081 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1103 struct MessageUnit_A __iomem *reg = acb->pmuA;
1082 qbuffer = (struct QBUFFER __iomem *) &reg->message_rbuffer; 1104 qbuffer = (struct QBUFFER __iomem *)&reg->message_rbuffer;
1083 } 1105 }
1084 break; 1106 break;
1085 1107
1086 case ACB_ADAPTER_TYPE_B: { 1108 case ACB_ADAPTER_TYPE_B: {
1087 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1109 struct MessageUnit_B *reg = acb->pmuB;
1088 qbuffer = (struct QBUFFER __iomem *) reg->ioctl_rbuffer_reg; 1110 qbuffer = (struct QBUFFER __iomem *)reg->ioctl_rbuffer_reg;
1089 } 1111 }
1090 break; 1112 break;
1091 } 1113 }
1092 return qbuffer; 1114 return qbuffer;
1093} 1115}
1094 1116
1095static struct QBUFFER *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb) 1117static struct QBUFFER __iomem *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb)
1096{ 1118{
1097 static struct QBUFFER *pqbuffer; 1119 struct QBUFFER __iomem *pqbuffer = NULL;
1098 1120
1099 switch (acb->adapter_type) { 1121 switch (acb->adapter_type) {
1100 1122
1101 case ACB_ADAPTER_TYPE_A: { 1123 case ACB_ADAPTER_TYPE_A: {
1102 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1124 struct MessageUnit_A __iomem *reg = acb->pmuA;
1103 pqbuffer = (struct QBUFFER *) &reg->message_wbuffer; 1125 pqbuffer = (struct QBUFFER __iomem *) &reg->message_wbuffer;
1104 } 1126 }
1105 break; 1127 break;
1106 1128
1107 case ACB_ADAPTER_TYPE_B: { 1129 case ACB_ADAPTER_TYPE_B: {
1108 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1130 struct MessageUnit_B *reg = acb->pmuB;
1109 pqbuffer = (struct QBUFFER __iomem *)reg->ioctl_wbuffer_reg; 1131 pqbuffer = (struct QBUFFER __iomem *)reg->ioctl_wbuffer_reg;
1110 } 1132 }
1111 break; 1133 break;
@@ -1115,15 +1137,15 @@ static struct QBUFFER *arcmsr_get_iop_wqbuffer(struct AdapterControlBlock *acb)
1115 1137
1116static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb) 1138static void arcmsr_iop2drv_data_wrote_handle(struct AdapterControlBlock *acb)
1117{ 1139{
1118 struct QBUFFER *prbuffer; 1140 struct QBUFFER __iomem *prbuffer;
1119 struct QBUFFER *pQbuffer; 1141 struct QBUFFER *pQbuffer;
1120 uint8_t *iop_data; 1142 uint8_t __iomem *iop_data;
1121 int32_t my_empty_len, iop_len, rqbuf_firstindex, rqbuf_lastindex; 1143 int32_t my_empty_len, iop_len, rqbuf_firstindex, rqbuf_lastindex;
1122 1144
1123 rqbuf_lastindex = acb->rqbuf_lastindex; 1145 rqbuf_lastindex = acb->rqbuf_lastindex;
1124 rqbuf_firstindex = acb->rqbuf_firstindex; 1146 rqbuf_firstindex = acb->rqbuf_firstindex;
1125 prbuffer = arcmsr_get_iop_rqbuffer(acb); 1147 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1126 iop_data = (uint8_t *)prbuffer->data; 1148 iop_data = (uint8_t __iomem *)prbuffer->data;
1127 iop_len = prbuffer->data_len; 1149 iop_len = prbuffer->data_len;
1128 my_empty_len = (rqbuf_firstindex - rqbuf_lastindex -1)&(ARCMSR_MAX_QBUFFER -1); 1150 my_empty_len = (rqbuf_firstindex - rqbuf_lastindex -1)&(ARCMSR_MAX_QBUFFER -1);
1129 1151
@@ -1151,8 +1173,8 @@ static void arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb)
1151 acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED; 1173 acb->acb_flags |= ACB_F_MESSAGE_WQBUFFER_READED;
1152 if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) { 1174 if (acb->wqbuf_firstindex != acb->wqbuf_lastindex) {
1153 uint8_t *pQbuffer; 1175 uint8_t *pQbuffer;
1154 struct QBUFFER *pwbuffer; 1176 struct QBUFFER __iomem *pwbuffer;
1155 uint8_t *iop_data; 1177 uint8_t __iomem *iop_data;
1156 int32_t allxfer_len = 0; 1178 int32_t allxfer_len = 0;
1157 1179
1158 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED); 1180 acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED);
@@ -1181,7 +1203,7 @@ static void arcmsr_iop2drv_data_read_handle(struct AdapterControlBlock *acb)
1181static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb) 1203static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb)
1182{ 1204{
1183 uint32_t outbound_doorbell; 1205 uint32_t outbound_doorbell;
1184 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1206 struct MessageUnit_A __iomem *reg = acb->pmuA;
1185 1207
1186 outbound_doorbell = readl(&reg->outbound_doorbell); 1208 outbound_doorbell = readl(&reg->outbound_doorbell);
1187 writel(outbound_doorbell, &reg->outbound_doorbell); 1209 writel(outbound_doorbell, &reg->outbound_doorbell);
@@ -1197,7 +1219,7 @@ static void arcmsr_hba_doorbell_isr(struct AdapterControlBlock *acb)
1197static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb) 1219static void arcmsr_hba_postqueue_isr(struct AdapterControlBlock *acb)
1198{ 1220{
1199 uint32_t flag_ccb; 1221 uint32_t flag_ccb;
1200 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1222 struct MessageUnit_A __iomem *reg = acb->pmuA;
1201 1223
1202 while ((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF) { 1224 while ((flag_ccb = readl(&reg->outbound_queueport)) != 0xFFFFFFFF) {
1203 arcmsr_drain_donequeue(acb, flag_ccb); 1225 arcmsr_drain_donequeue(acb, flag_ccb);
@@ -1208,7 +1230,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb)
1208{ 1230{
1209 uint32_t index; 1231 uint32_t index;
1210 uint32_t flag_ccb; 1232 uint32_t flag_ccb;
1211 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1233 struct MessageUnit_B *reg = acb->pmuB;
1212 1234
1213 index = reg->doneq_index; 1235 index = reg->doneq_index;
1214 1236
@@ -1224,7 +1246,7 @@ static void arcmsr_hbb_postqueue_isr(struct AdapterControlBlock *acb)
1224static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb) 1246static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb)
1225{ 1247{
1226 uint32_t outbound_intstatus; 1248 uint32_t outbound_intstatus;
1227 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1249 struct MessageUnit_A __iomem *reg = acb->pmuA;
1228 1250
1229 outbound_intstatus = readl(&reg->outbound_intstatus) & \ 1251 outbound_intstatus = readl(&reg->outbound_intstatus) & \
1230 acb->outbound_int_enable; 1252 acb->outbound_int_enable;
@@ -1244,7 +1266,7 @@ static int arcmsr_handle_hba_isr(struct AdapterControlBlock *acb)
1244static int arcmsr_handle_hbb_isr(struct AdapterControlBlock *acb) 1266static int arcmsr_handle_hbb_isr(struct AdapterControlBlock *acb)
1245{ 1267{
1246 uint32_t outbound_doorbell; 1268 uint32_t outbound_doorbell;
1247 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1269 struct MessageUnit_B *reg = acb->pmuB;
1248 1270
1249 outbound_doorbell = readl(reg->iop2drv_doorbell_reg) & \ 1271 outbound_doorbell = readl(reg->iop2drv_doorbell_reg) & \
1250 acb->outbound_int_enable; 1272 acb->outbound_int_enable;
@@ -1305,8 +1327,8 @@ void arcmsr_post_ioctldata2iop(struct AdapterControlBlock *acb)
1305{ 1327{
1306 int32_t wqbuf_firstindex, wqbuf_lastindex; 1328 int32_t wqbuf_firstindex, wqbuf_lastindex;
1307 uint8_t *pQbuffer; 1329 uint8_t *pQbuffer;
1308 struct QBUFFER *pwbuffer; 1330 struct QBUFFER __iomem *pwbuffer;
1309 uint8_t *iop_data; 1331 uint8_t __iomem *iop_data;
1310 int32_t allxfer_len = 0; 1332 int32_t allxfer_len = 0;
1311 1333
1312 pwbuffer = arcmsr_get_iop_wqbuffer(acb); 1334 pwbuffer = arcmsr_get_iop_wqbuffer(acb);
@@ -1380,13 +1402,13 @@ static int arcmsr_iop_message_xfer(struct AdapterControlBlock *acb, \
1380 } 1402 }
1381 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) { 1403 if (acb->acb_flags & ACB_F_IOPDATA_OVERFLOW) {
1382 1404
1383 struct QBUFFER *prbuffer; 1405 struct QBUFFER __iomem *prbuffer;
1384 uint8_t *iop_data; 1406 uint8_t __iomem *iop_data;
1385 int32_t iop_len; 1407 int32_t iop_len;
1386 1408
1387 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW; 1409 acb->acb_flags &= ~ACB_F_IOPDATA_OVERFLOW;
1388 prbuffer = arcmsr_get_iop_rqbuffer(acb); 1410 prbuffer = arcmsr_get_iop_rqbuffer(acb);
1389 iop_data = (uint8_t *)prbuffer->data; 1411 iop_data = prbuffer->data;
1390 iop_len = readl(&prbuffer->data_len); 1412 iop_len = readl(&prbuffer->data_len);
1391 while (iop_len > 0) { 1413 while (iop_len > 0) {
1392 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data); 1414 acb->rqbuffer[acb->rqbuf_lastindex] = readb(iop_data);
@@ -1669,11 +1691,11 @@ static int arcmsr_queue_command(struct scsi_cmnd *cmd,
1669 1691
1670static void arcmsr_get_hba_config(struct AdapterControlBlock *acb) 1692static void arcmsr_get_hba_config(struct AdapterControlBlock *acb)
1671{ 1693{
1672 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1694 struct MessageUnit_A __iomem *reg = acb->pmuA;
1673 char *acb_firm_model = acb->firm_model; 1695 char *acb_firm_model = acb->firm_model;
1674 char *acb_firm_version = acb->firm_version; 1696 char *acb_firm_version = acb->firm_version;
1675 char *iop_firm_model = (char *) (&reg->message_rwbuffer[15]); 1697 char __iomem *iop_firm_model = (char __iomem *)(&reg->message_rwbuffer[15]);
1676 char *iop_firm_version = (char *) (&reg->message_rwbuffer[17]); 1698 char __iomem *iop_firm_version = (char __iomem *)(&reg->message_rwbuffer[17]);
1677 int count; 1699 int count;
1678 1700
1679 writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, &reg->inbound_msgaddr0); 1701 writel(ARCMSR_INBOUND_MESG0_GET_CONFIG, &reg->inbound_msgaddr0);
@@ -1710,13 +1732,13 @@ static void arcmsr_get_hba_config(struct AdapterControlBlock *acb)
1710 1732
1711static void arcmsr_get_hbb_config(struct AdapterControlBlock *acb) 1733static void arcmsr_get_hbb_config(struct AdapterControlBlock *acb)
1712{ 1734{
1713 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1735 struct MessageUnit_B *reg = acb->pmuB;
1714 uint32_t *lrwbuffer = reg->msgcode_rwbuffer_reg; 1736 uint32_t __iomem *lrwbuffer = reg->msgcode_rwbuffer_reg;
1715 char *acb_firm_model = acb->firm_model; 1737 char *acb_firm_model = acb->firm_model;
1716 char *acb_firm_version = acb->firm_version; 1738 char *acb_firm_version = acb->firm_version;
1717 char *iop_firm_model = (char *) (&lrwbuffer[15]); 1739 char __iomem *iop_firm_model = (char __iomem *)(&lrwbuffer[15]);
1718 /*firm_model,15,60-67*/ 1740 /*firm_model,15,60-67*/
1719 char *iop_firm_version = (char *) (&lrwbuffer[17]); 1741 char __iomem *iop_firm_version = (char __iomem *)(&lrwbuffer[17]);
1720 /*firm_version,17,68-83*/ 1742 /*firm_version,17,68-83*/
1721 int count; 1743 int count;
1722 1744
@@ -1777,7 +1799,7 @@ static void arcmsr_get_firmware_spec(struct AdapterControlBlock *acb)
1777static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb, 1799static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,
1778 struct CommandControlBlock *poll_ccb) 1800 struct CommandControlBlock *poll_ccb)
1779{ 1801{
1780 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 1802 struct MessageUnit_A __iomem *reg = acb->pmuA;
1781 struct CommandControlBlock *ccb; 1803 struct CommandControlBlock *ccb;
1782 uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count = 0; 1804 uint32_t flag_ccb, outbound_intstatus, poll_ccb_done = 0, poll_count = 0;
1783 1805
@@ -1826,7 +1848,7 @@ static void arcmsr_polling_hba_ccbdone(struct AdapterControlBlock *acb,
1826static void arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, \ 1848static void arcmsr_polling_hbb_ccbdone(struct AdapterControlBlock *acb, \
1827 struct CommandControlBlock *poll_ccb) 1849 struct CommandControlBlock *poll_ccb)
1828{ 1850{
1829 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1851 struct MessageUnit_B *reg = acb->pmuB;
1830 struct CommandControlBlock *ccb; 1852 struct CommandControlBlock *ccb;
1831 uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0; 1853 uint32_t flag_ccb, poll_ccb_done = 0, poll_count = 0;
1832 int index; 1854 int index;
@@ -1918,8 +1940,7 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
1918 1940
1919 case ACB_ADAPTER_TYPE_A: { 1941 case ACB_ADAPTER_TYPE_A: {
1920 if (ccb_phyaddr_hi32 != 0) { 1942 if (ccb_phyaddr_hi32 != 0) {
1921 struct MessageUnit_A __iomem *reg = \ 1943 struct MessageUnit_A __iomem *reg = acb->pmuA;
1922 (struct MessageUnit_A *)acb->pmu;
1923 uint32_t intmask_org; 1944 uint32_t intmask_org;
1924 intmask_org = arcmsr_disable_outbound_ints(acb); 1945 intmask_org = arcmsr_disable_outbound_ints(acb);
1925 writel(ARCMSR_SIGNATURE_SET_CONFIG, \ 1946 writel(ARCMSR_SIGNATURE_SET_CONFIG, \
@@ -1940,9 +1961,9 @@ static int arcmsr_iop_confirm(struct AdapterControlBlock *acb)
1940 1961
1941 case ACB_ADAPTER_TYPE_B: { 1962 case ACB_ADAPTER_TYPE_B: {
1942 unsigned long post_queue_phyaddr; 1963 unsigned long post_queue_phyaddr;
1943 uint32_t *rwbuffer; 1964 uint32_t __iomem *rwbuffer;
1944 1965
1945 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 1966 struct MessageUnit_B *reg = acb->pmuB;
1946 uint32_t intmask_org; 1967 uint32_t intmask_org;
1947 intmask_org = arcmsr_disable_outbound_ints(acb); 1968 intmask_org = arcmsr_disable_outbound_ints(acb);
1948 reg->postq_index = 0; 1969 reg->postq_index = 0;
@@ -1994,7 +2015,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
1994 switch (acb->adapter_type) { 2015 switch (acb->adapter_type) {
1995 2016
1996 case ACB_ADAPTER_TYPE_A: { 2017 case ACB_ADAPTER_TYPE_A: {
1997 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 2018 struct MessageUnit_A __iomem *reg = acb->pmuA;
1998 do { 2019 do {
1999 firmware_state = readl(&reg->outbound_msgaddr1); 2020 firmware_state = readl(&reg->outbound_msgaddr1);
2000 } while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0); 2021 } while ((firmware_state & ARCMSR_OUTBOUND_MESG1_FIRMWARE_OK) == 0);
@@ -2002,7 +2023,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
2002 break; 2023 break;
2003 2024
2004 case ACB_ADAPTER_TYPE_B: { 2025 case ACB_ADAPTER_TYPE_B: {
2005 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 2026 struct MessageUnit_B *reg = acb->pmuB;
2006 do { 2027 do {
2007 firmware_state = readl(reg->iop2drv_doorbell_reg); 2028 firmware_state = readl(reg->iop2drv_doorbell_reg);
2008 } while ((firmware_state & ARCMSR_MESSAGE_FIRMWARE_OK) == 0); 2029 } while ((firmware_state & ARCMSR_MESSAGE_FIRMWARE_OK) == 0);
@@ -2013,7 +2034,7 @@ static void arcmsr_wait_firmware_ready(struct AdapterControlBlock *acb)
2013 2034
2014static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb) 2035static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb)
2015{ 2036{
2016 struct MessageUnit_A __iomem *reg = (struct MessageUnit_A *)acb->pmu; 2037 struct MessageUnit_A __iomem *reg = acb->pmuA;
2017 acb->acb_flags |= ACB_F_MSG_START_BGRB; 2038 acb->acb_flags |= ACB_F_MSG_START_BGRB;
2018 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0); 2039 writel(ARCMSR_INBOUND_MESG0_START_BGRB, &reg->inbound_msgaddr0);
2019 if (arcmsr_hba_wait_msgint_ready(acb)) { 2040 if (arcmsr_hba_wait_msgint_ready(acb)) {
@@ -2024,7 +2045,7 @@ static void arcmsr_start_hba_bgrb(struct AdapterControlBlock *acb)
2024 2045
2025static void arcmsr_start_hbb_bgrb(struct AdapterControlBlock *acb) 2046static void arcmsr_start_hbb_bgrb(struct AdapterControlBlock *acb)
2026{ 2047{
2027 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 2048 struct MessageUnit_B *reg = acb->pmuB;
2028 acb->acb_flags |= ACB_F_MSG_START_BGRB; 2049 acb->acb_flags |= ACB_F_MSG_START_BGRB;
2029 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell_reg); 2050 writel(ARCMSR_MESSAGE_START_BGRB, reg->drv2iop_doorbell_reg);
2030 if (arcmsr_hbb_wait_msgint_ready(acb)) { 2051 if (arcmsr_hbb_wait_msgint_ready(acb)) {
@@ -2049,7 +2070,7 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb)
2049{ 2070{
2050 switch (acb->adapter_type) { 2071 switch (acb->adapter_type) {
2051 case ACB_ADAPTER_TYPE_A: { 2072 case ACB_ADAPTER_TYPE_A: {
2052 struct MessageUnit_A *reg = (struct MessageUnit_A *)acb->pmu; 2073 struct MessageUnit_A __iomem *reg = acb->pmuA;
2053 uint32_t outbound_doorbell; 2074 uint32_t outbound_doorbell;
2054 /* empty doorbell Qbuffer if door bell ringed */ 2075 /* empty doorbell Qbuffer if door bell ringed */
2055 outbound_doorbell = readl(&reg->outbound_doorbell); 2076 outbound_doorbell = readl(&reg->outbound_doorbell);
@@ -2060,7 +2081,7 @@ static void arcmsr_clear_doorbell_queue_buffer(struct AdapterControlBlock *acb)
2060 break; 2081 break;
2061 2082
2062 case ACB_ADAPTER_TYPE_B: { 2083 case ACB_ADAPTER_TYPE_B: {
2063 struct MessageUnit_B *reg = (struct MessageUnit_B *)acb->pmu; 2084 struct MessageUnit_B *reg = acb->pmuB;
2064 /*clear interrupt and message state*/ 2085 /*clear interrupt and message state*/
2065 writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN, reg->iop2drv_doorbell_reg); 2086 writel(ARCMSR_MESSAGE_INT_CLEAR_PATTERN, reg->iop2drv_doorbell_reg);
2066 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg); 2087 writel(ARCMSR_DRV2IOP_DATA_READ_OK, reg->drv2iop_doorbell_reg);
diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c
index b5fa4f091387..f1871ea04045 100644
--- a/drivers/scsi/sg.c
+++ b/drivers/scsi/sg.c
@@ -1652,6 +1652,7 @@ sg_build_sgat(Sg_scatter_hold * schp, const Sg_fd * sfp, int tablesize)
1652 schp->buffer = kzalloc(sg_bufflen, gfp_flags); 1652 schp->buffer = kzalloc(sg_bufflen, gfp_flags);
1653 if (!schp->buffer) 1653 if (!schp->buffer)
1654 return -ENOMEM; 1654 return -ENOMEM;
1655 sg_init_table(schp->buffer, tablesize);
1655 schp->sglist_len = sg_bufflen; 1656 schp->sglist_len = sg_bufflen;
1656 return tablesize; /* number of scat_gath elements allocated */ 1657 return tablesize; /* number of scat_gath elements allocated */
1657} 1658}
diff --git a/drivers/spi/spidev.c b/drivers/spi/spidev.c
index c55459c592b8..b3518ca9f04e 100644
--- a/drivers/spi/spidev.c
+++ b/drivers/spi/spidev.c
@@ -184,14 +184,14 @@ static int spidev_message(struct spidev_data *spidev,
184 if (u_tmp->rx_buf) { 184 if (u_tmp->rx_buf) {
185 k_tmp->rx_buf = buf; 185 k_tmp->rx_buf = buf;
186 if (!access_ok(VERIFY_WRITE, (u8 __user *) 186 if (!access_ok(VERIFY_WRITE, (u8 __user *)
187 (ptrdiff_t) u_tmp->rx_buf, 187 (uintptr_t) u_tmp->rx_buf,
188 u_tmp->len)) 188 u_tmp->len))
189 goto done; 189 goto done;
190 } 190 }
191 if (u_tmp->tx_buf) { 191 if (u_tmp->tx_buf) {
192 k_tmp->tx_buf = buf; 192 k_tmp->tx_buf = buf;
193 if (copy_from_user(buf, (const u8 __user *) 193 if (copy_from_user(buf, (const u8 __user *)
194 (ptrdiff_t) u_tmp->tx_buf, 194 (uintptr_t) u_tmp->tx_buf,
195 u_tmp->len)) 195 u_tmp->len))
196 goto done; 196 goto done;
197 } 197 }
@@ -224,7 +224,7 @@ static int spidev_message(struct spidev_data *spidev,
224 for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) { 224 for (n = n_xfers, u_tmp = u_xfers; n; n--, u_tmp++) {
225 if (u_tmp->rx_buf) { 225 if (u_tmp->rx_buf) {
226 if (__copy_to_user((u8 __user *) 226 if (__copy_to_user((u8 __user *)
227 (ptrdiff_t) u_tmp->rx_buf, buf, 227 (uintptr_t) u_tmp->rx_buf, buf,
228 u_tmp->len)) { 228 u_tmp->len)) {
229 status = -EFAULT; 229 status = -EFAULT;
230 goto done; 230 goto done;