aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/Kconfig.i3862
-rw-r--r--arch/um/Makefile-i3865
-rw-r--r--arch/um/Makefile-x86_645
-rw-r--r--arch/um/kernel/mem.c2
-rw-r--r--arch/um/sys-i386/ptrace.c8
-rw-r--r--arch/um/sys-x86_64/ptrace.c4
-rw-r--r--arch/x86/kernel/pci-gart_64.c2
-rw-r--r--block/cfq-iosched.c7
-rw-r--r--block/compat_ioctl.c2
-rw-r--r--block/ll_rw_blk.c41
-rw-r--r--drivers/ata/libata-core.c1
-rw-r--r--drivers/block/cciss.c14
-rw-r--r--drivers/block/cciss_scsi.c14
-rw-r--r--drivers/block/cciss_scsi.h14
-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
-rw-r--r--include/asm-um/unistd.h1
-rw-r--r--include/linux/blkdev.h2
-rw-r--r--include/linux/eventpoll.h7
-rw-r--r--include/linux/scatterlist.h10
-rw-r--r--include/linux/sunrpc/rpc_rdma.h32
-rw-r--r--include/linux/types.h2
-rw-r--r--include/net/sctp/auth.h2
-rw-r--r--kernel/hrtimer.c2
-rw-r--r--kernel/signal.c2
-rw-r--r--kernel/time/tick-sched.c2
-rw-r--r--kernel/time/timer_list.c6
-rw-r--r--mm/filemap.c1
-rw-r--r--mm/nommu.c1
-rw-r--r--mm/slub.c2
-rw-r--r--net/sctp/auth.c4
-rw-r--r--net/sunrpc/xprtrdma/rpc_rdma.c24
48 files changed, 272 insertions, 256 deletions
diff --git a/arch/um/Kconfig.i386 b/arch/um/Kconfig.i386
index 9876d80d85dd..e0ac74e5d4c4 100644
--- a/arch/um/Kconfig.i386
+++ b/arch/um/Kconfig.i386
@@ -1,6 +1,6 @@
1menu "Host processor type and features" 1menu "Host processor type and features"
2 2
3source "arch/i386/Kconfig.cpu" 3source "arch/x86/Kconfig.cpu"
4 4
5endmenu 5endmenu
6 6
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 0178df306939..b01dfb00e5f8 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -9,6 +9,7 @@ ELF_ARCH := $(SUBARCH)
9ELF_FORMAT := elf32-$(SUBARCH) 9ELF_FORMAT := elf32-$(SUBARCH)
10OBJCOPYFLAGS := -O binary -R .note -R .comment -S 10OBJCOPYFLAGS := -O binary -R .note -R .comment -S
11HEADER_ARCH := x86 11HEADER_ARCH := x86
12CHECKFLAGS += -D__i386__
12 13
13ifeq ("$(origin SUBARCH)", "command line") 14ifeq ("$(origin SUBARCH)", "command line")
14ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)") 15ifneq ("$(shell uname -m | sed -e s/i.86/i386/)", "$(SUBARCH)")
@@ -26,10 +27,8 @@ AFLAGS += -DCONFIG_X86_32
26CONFIG_X86_32 := y 27CONFIG_X86_32 := y
27export CONFIG_X86_32 28export CONFIG_X86_32
28 29
29ARCH_KERNEL_DEFINES += -U__$(SUBARCH)__ -U$(SUBARCH)
30
31# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y. 30# First of all, tune CFLAGS for the specific CPU. This actually sets cflags-y.
32include $(srctree)/arch/i386/Makefile.cpu 31include $(srctree)/arch/x86/Makefile_32.cpu
33 32
34# prevent gcc from keeping the stack 16 byte aligned. Taken from i386. 33# prevent gcc from keeping the stack 16 byte aligned. Taken from i386.
35cflags-y += $(call cc-option,-mpreferred-stack-boundary=2) 34cflags-y += $(call cc-option,-mpreferred-stack-boundary=2)
diff --git a/arch/um/Makefile-x86_64 b/arch/um/Makefile-x86_64
index fe5316f0c6a5..8ed362f93582 100644
--- a/arch/um/Makefile-x86_64
+++ b/arch/um/Makefile-x86_64
@@ -6,12 +6,9 @@ START := 0x60000000
6 6
7_extra_flags_ = -fno-builtin -m64 7_extra_flags_ = -fno-builtin -m64
8 8
9#We #undef __x86_64__ for kernelspace, not for userspace where
10#it's needed for headers to work!
11ARCH_KERNEL_DEFINES = -U__$(SUBARCH)__
12KBUILD_CFLAGS += $(_extra_flags_) 9KBUILD_CFLAGS += $(_extra_flags_)
13 10
14CHECKFLAGS += -m64 11CHECKFLAGS += -m64 -D__x86_64__
15KBUILD_AFLAGS += -m64 12KBUILD_AFLAGS += -m64
16LDFLAGS += -m elf_x86_64 13LDFLAGS += -m elf_x86_64
17KBUILD_CPPFLAGS += -m64 14KBUILD_CPPFLAGS += -m64
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 8456397f5f4d..59822dee438a 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -165,7 +165,7 @@ static void __init kmap_init(void)
165 kmap_prot = PAGE_KERNEL; 165 kmap_prot = PAGE_KERNEL;
166} 166}
167 167
168static void init_highmem(void) 168static void __init init_highmem(void)
169{ 169{
170 pgd_t *pgd; 170 pgd_t *pgd;
171 pud_t *pud; 171 pud_t *pud;
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index 9657c89fdf31..bd3da8a61f64 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -155,7 +155,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
155 if (err) 155 if (err)
156 return err; 156 return err;
157 157
158 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs)); 158 n = copy_to_user(buf, fpregs, sizeof(fpregs));
159 if(n > 0) 159 if(n > 0)
160 return -EFAULT; 160 return -EFAULT;
161 161
@@ -168,7 +168,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
168 long fpregs[HOST_FP_SIZE]; 168 long fpregs[HOST_FP_SIZE];
169 169
170 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 170 BUG_ON(sizeof(*buf) != sizeof(fpregs));
171 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs)); 171 n = copy_from_user(fpregs, buf, sizeof(fpregs));
172 if (n > 0) 172 if (n > 0)
173 return -EFAULT; 173 return -EFAULT;
174 174
@@ -185,7 +185,7 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
185 if (err) 185 if (err)
186 return err; 186 return err;
187 187
188 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs)); 188 n = copy_to_user(buf, fpregs, sizeof(fpregs));
189 if(n > 0) 189 if(n > 0)
190 return -EFAULT; 190 return -EFAULT;
191 191
@@ -198,7 +198,7 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
198 long fpregs[HOST_XFP_SIZE]; 198 long fpregs[HOST_XFP_SIZE];
199 199
200 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 200 BUG_ON(sizeof(*buf) != sizeof(fpregs));
201 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs)); 201 n = copy_from_user(fpregs, buf, sizeof(fpregs));
202 if (n > 0) 202 if (n > 0)
203 return -EFAULT; 203 return -EFAULT;
204 204
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index a3cfeed17af4..b7631b0e9ddc 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -154,7 +154,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
154 if (err) 154 if (err)
155 return err; 155 return err;
156 156
157 n = copy_to_user((void *) buf, fpregs, sizeof(fpregs)); 157 n = copy_to_user(buf, fpregs, sizeof(fpregs));
158 if(n > 0) 158 if(n > 0)
159 return -EFAULT; 159 return -EFAULT;
160 160
@@ -167,7 +167,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
167 long fpregs[HOST_FP_SIZE]; 167 long fpregs[HOST_FP_SIZE];
168 168
169 BUG_ON(sizeof(*buf) != sizeof(fpregs)); 169 BUG_ON(sizeof(*buf) != sizeof(fpregs));
170 n = copy_from_user(fpregs, (void *) buf, sizeof(fpregs)); 170 n = copy_from_user(fpregs, buf, sizeof(fpregs));
171 if (n > 0) 171 if (n > 0)
172 return -EFAULT; 172 return -EFAULT;
173 173
diff --git a/arch/x86/kernel/pci-gart_64.c b/arch/x86/kernel/pci-gart_64.c
index ae7e0161ce46..79b514b381b1 100644
--- a/arch/x86/kernel/pci-gart_64.c
+++ b/arch/x86/kernel/pci-gart_64.c
@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
435 435
436error: 436error:
437 flush_gart(); 437 flush_gart();
438 gart_unmap_sg(dev, sg, nents, dir); 438 gart_unmap_sg(dev, sg, out, dir);
439 /* When it was forced or merged try again in a dumb way */ 439 /* When it was forced or merged try again in a dumb way */
440 if (force_iommu || iommu_merge) { 440 if (force_iommu || iommu_merge) {
441 out = dma_map_sg_nonforce(dev, sg, nents, dir); 441 out = dma_map_sg_nonforce(dev, sg, nents, dir);
diff --git a/block/cfq-iosched.c b/block/cfq-iosched.c
index 54dc05439009..e47a9309eb48 100644
--- a/block/cfq-iosched.c
+++ b/block/cfq-iosched.c
@@ -1443,8 +1443,11 @@ cfq_get_queue(struct cfq_data *cfqd, int is_sync, struct task_struct *tsk,
1443 cfqq = *async_cfqq; 1443 cfqq = *async_cfqq;
1444 } 1444 }
1445 1445
1446 if (!cfqq) 1446 if (!cfqq) {
1447 cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask); 1447 cfqq = cfq_find_alloc_queue(cfqd, is_sync, tsk, gfp_mask);
1448 if (!cfqq)
1449 return NULL;
1450 }
1448 1451
1449 /* 1452 /*
1450 * pin the queue now that it's allocated, scheduler exit will prune it 1453 * pin the queue now that it's allocated, scheduler exit will prune it
@@ -2053,7 +2056,7 @@ static void cfq_shutdown_timer_wq(struct cfq_data *cfqd)
2053{ 2056{
2054 del_timer_sync(&cfqd->idle_slice_timer); 2057 del_timer_sync(&cfqd->idle_slice_timer);
2055 del_timer_sync(&cfqd->idle_class_timer); 2058 del_timer_sync(&cfqd->idle_class_timer);
2056 blk_sync_queue(cfqd->queue); 2059 kblockd_flush_work(&cfqd->unplug_work);
2057} 2060}
2058 2061
2059static void cfq_put_async_queues(struct cfq_data *cfqd) 2062static void cfq_put_async_queues(struct cfq_data *cfqd)
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index f84093b97f70..cae0a852619e 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -581,7 +581,7 @@ static int compat_blkdev_driver_ioctl(struct inode *inode, struct file *file,
581{ 581{
582 int ret; 582 int ret;
583 583
584 switch (arg) { 584 switch (cmd) {
585 case HDIO_GET_UNMASKINTR: 585 case HDIO_GET_UNMASKINTR:
586 case HDIO_GET_MULTCOUNT: 586 case HDIO_GET_MULTCOUNT:
587 case HDIO_GET_KEEPSETTINGS: 587 case HDIO_GET_KEEPSETTINGS:
diff --git a/block/ll_rw_blk.c b/block/ll_rw_blk.c
index b01dee3ae7f3..56f2646612e6 100644
--- a/block/ll_rw_blk.c
+++ b/block/ll_rw_blk.c
@@ -39,7 +39,7 @@
39 39
40static void blk_unplug_work(struct work_struct *work); 40static void blk_unplug_work(struct work_struct *work);
41static void blk_unplug_timeout(unsigned long data); 41static void blk_unplug_timeout(unsigned long data);
42static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io); 42static void drive_stat_acct(struct request *rq, int new_io);
43static void init_request_from_bio(struct request *req, struct bio *bio); 43static void init_request_from_bio(struct request *req, struct bio *bio);
44static int __make_request(struct request_queue *q, struct bio *bio); 44static int __make_request(struct request_queue *q, struct bio *bio);
45static struct io_context *current_io_context(gfp_t gfp_flags, int node); 45static struct io_context *current_io_context(gfp_t gfp_flags, int node);
@@ -791,7 +791,6 @@ static int __blk_free_tags(struct blk_queue_tag *bqt)
791 retval = atomic_dec_and_test(&bqt->refcnt); 791 retval = atomic_dec_and_test(&bqt->refcnt);
792 if (retval) { 792 if (retval) {
793 BUG_ON(bqt->busy); 793 BUG_ON(bqt->busy);
794 BUG_ON(!list_empty(&bqt->busy_list));
795 794
796 kfree(bqt->tag_index); 795 kfree(bqt->tag_index);
797 bqt->tag_index = NULL; 796 bqt->tag_index = NULL;
@@ -903,7 +902,6 @@ static struct blk_queue_tag *__blk_queue_init_tags(struct request_queue *q,
903 if (init_tag_map(q, tags, depth)) 902 if (init_tag_map(q, tags, depth))
904 goto fail; 903 goto fail;
905 904
906 INIT_LIST_HEAD(&tags->busy_list);
907 tags->busy = 0; 905 tags->busy = 0;
908 atomic_set(&tags->refcnt, 1); 906 atomic_set(&tags->refcnt, 1);
909 return tags; 907 return tags;
@@ -954,6 +952,7 @@ int blk_queue_init_tags(struct request_queue *q, int depth,
954 */ 952 */
955 q->queue_tags = tags; 953 q->queue_tags = tags;
956 q->queue_flags |= (1 << QUEUE_FLAG_QUEUED); 954 q->queue_flags |= (1 << QUEUE_FLAG_QUEUED);
955 INIT_LIST_HEAD(&q->tag_busy_list);
957 return 0; 956 return 0;
958fail: 957fail:
959 kfree(tags); 958 kfree(tags);
@@ -1057,18 +1056,16 @@ void blk_queue_end_tag(struct request_queue *q, struct request *rq)
1057 1056
1058 bqt->tag_index[tag] = NULL; 1057 bqt->tag_index[tag] = NULL;
1059 1058
1060 /* 1059 if (unlikely(!test_bit(tag, bqt->tag_map))) {
1061 * We use test_and_clear_bit's memory ordering properties here.
1062 * The tag_map bit acts as a lock for tag_index[bit], so we need
1063 * a barrer before clearing the bit (precisely: release semantics).
1064 * Could use clear_bit_unlock when it is merged.
1065 */
1066 if (unlikely(!test_and_clear_bit(tag, bqt->tag_map))) {
1067 printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n", 1060 printk(KERN_ERR "%s: attempt to clear non-busy tag (%d)\n",
1068 __FUNCTION__, tag); 1061 __FUNCTION__, tag);
1069 return; 1062 return;
1070 } 1063 }
1071 1064 /*
1065 * The tag_map bit acts as a lock for tag_index[bit], so we need
1066 * unlock memory barrier semantics.
1067 */
1068 clear_bit_unlock(tag, bqt->tag_map);
1072 bqt->busy--; 1069 bqt->busy--;
1073} 1070}
1074 1071
@@ -1114,17 +1111,17 @@ int blk_queue_start_tag(struct request_queue *q, struct request *rq)
1114 if (tag >= bqt->max_depth) 1111 if (tag >= bqt->max_depth)
1115 return 1; 1112 return 1;
1116 1113
1117 } while (test_and_set_bit(tag, bqt->tag_map)); 1114 } while (test_and_set_bit_lock(tag, bqt->tag_map));
1118 /* 1115 /*
1119 * We rely on test_and_set_bit providing lock memory ordering semantics 1116 * We need lock ordering semantics given by test_and_set_bit_lock.
1120 * (could use test_and_set_bit_lock when it is merged). 1117 * See blk_queue_end_tag for details.
1121 */ 1118 */
1122 1119
1123 rq->cmd_flags |= REQ_QUEUED; 1120 rq->cmd_flags |= REQ_QUEUED;
1124 rq->tag = tag; 1121 rq->tag = tag;
1125 bqt->tag_index[tag] = rq; 1122 bqt->tag_index[tag] = rq;
1126 blkdev_dequeue_request(rq); 1123 blkdev_dequeue_request(rq);
1127 list_add(&rq->queuelist, &bqt->busy_list); 1124 list_add(&rq->queuelist, &q->tag_busy_list);
1128 bqt->busy++; 1125 bqt->busy++;
1129 return 0; 1126 return 0;
1130} 1127}
@@ -1145,11 +1142,10 @@ EXPORT_SYMBOL(blk_queue_start_tag);
1145 **/ 1142 **/
1146void blk_queue_invalidate_tags(struct request_queue *q) 1143void blk_queue_invalidate_tags(struct request_queue *q)
1147{ 1144{
1148 struct blk_queue_tag *bqt = q->queue_tags;
1149 struct list_head *tmp, *n; 1145 struct list_head *tmp, *n;
1150 struct request *rq; 1146 struct request *rq;
1151 1147
1152 list_for_each_safe(tmp, n, &bqt->busy_list) { 1148 list_for_each_safe(tmp, n, &q->tag_busy_list) {
1153 rq = list_entry_rq(tmp); 1149 rq = list_entry_rq(tmp);
1154 1150
1155 if (rq->tag == -1) { 1151 if (rq->tag == -1) {
@@ -1738,6 +1734,7 @@ EXPORT_SYMBOL(blk_stop_queue);
1738void blk_sync_queue(struct request_queue *q) 1734void blk_sync_queue(struct request_queue *q)
1739{ 1735{
1740 del_timer_sync(&q->unplug_timer); 1736 del_timer_sync(&q->unplug_timer);
1737 kblockd_flush_work(&q->unplug_work);
1741} 1738}
1742EXPORT_SYMBOL(blk_sync_queue); 1739EXPORT_SYMBOL(blk_sync_queue);
1743 1740
@@ -2341,7 +2338,7 @@ void blk_insert_request(struct request_queue *q, struct request *rq,
2341 if (blk_rq_tagged(rq)) 2338 if (blk_rq_tagged(rq))
2342 blk_queue_end_tag(q, rq); 2339 blk_queue_end_tag(q, rq);
2343 2340
2344 drive_stat_acct(rq, rq->nr_sectors, 1); 2341 drive_stat_acct(rq, 1);
2345 __elv_add_request(q, rq, where, 0); 2342 __elv_add_request(q, rq, where, 0);
2346 blk_start_queueing(q); 2343 blk_start_queueing(q);
2347 spin_unlock_irqrestore(q->queue_lock, flags); 2344 spin_unlock_irqrestore(q->queue_lock, flags);
@@ -2736,7 +2733,7 @@ int blkdev_issue_flush(struct block_device *bdev, sector_t *error_sector)
2736 2733
2737EXPORT_SYMBOL(blkdev_issue_flush); 2734EXPORT_SYMBOL(blkdev_issue_flush);
2738 2735
2739static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io) 2736static void drive_stat_acct(struct request *rq, int new_io)
2740{ 2737{
2741 int rw = rq_data_dir(rq); 2738 int rw = rq_data_dir(rq);
2742 2739
@@ -2758,7 +2755,7 @@ static void drive_stat_acct(struct request *rq, int nr_sectors, int new_io)
2758 */ 2755 */
2759static inline void add_request(struct request_queue * q, struct request * req) 2756static inline void add_request(struct request_queue * q, struct request * req)
2760{ 2757{
2761 drive_stat_acct(req, req->nr_sectors, 1); 2758 drive_stat_acct(req, 1);
2762 2759
2763 /* 2760 /*
2764 * elevator indicated where it wants this request to be 2761 * elevator indicated where it wants this request to be
@@ -3015,7 +3012,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
3015 req->biotail = bio; 3012 req->biotail = bio;
3016 req->nr_sectors = req->hard_nr_sectors += nr_sectors; 3013 req->nr_sectors = req->hard_nr_sectors += nr_sectors;
3017 req->ioprio = ioprio_best(req->ioprio, prio); 3014 req->ioprio = ioprio_best(req->ioprio, prio);
3018 drive_stat_acct(req, nr_sectors, 0); 3015 drive_stat_acct(req, 0);
3019 if (!attempt_back_merge(q, req)) 3016 if (!attempt_back_merge(q, req))
3020 elv_merged_request(q, req, el_ret); 3017 elv_merged_request(q, req, el_ret);
3021 goto out; 3018 goto out;
@@ -3042,7 +3039,7 @@ static int __make_request(struct request_queue *q, struct bio *bio)
3042 req->sector = req->hard_sector = bio->bi_sector; 3039 req->sector = req->hard_sector = bio->bi_sector;
3043 req->nr_sectors = req->hard_nr_sectors += nr_sectors; 3040 req->nr_sectors = req->hard_nr_sectors += nr_sectors;
3044 req->ioprio = ioprio_best(req->ioprio, prio); 3041 req->ioprio = ioprio_best(req->ioprio, prio);
3045 drive_stat_acct(req, nr_sectors, 0); 3042 drive_stat_acct(req, 0);
3046 if (!attempt_front_merge(q, req)) 3043 if (!attempt_front_merge(q, req))
3047 elv_merged_request(q, req, el_ret); 3044 elv_merged_request(q, req, el_ret);
3048 goto out; 3045 goto out;
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/block/cciss.c b/drivers/block/cciss.c
index 5a6fe17fc638..7d704968765f 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for HP SA 5xxx and 6xxx Controllers 2 * Disk Array driver for HP Smart Array controllers.
3 * Copyright 2000, 2006 Hewlett-Packard Development Company, L.P. 3 * (C) Copyright 2000, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cciss_scsi.c b/drivers/block/cciss_scsi.c
index 4aca7ddfdddf..63ee6c076cb3 100644
--- a/drivers/block/cciss_scsi.c
+++ b/drivers/block/cciss_scsi.c
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module 2 * Disk Array driver for HP Smart Array controllers, SCSI Tape module.
3 * Copyright 2001 Compaq Computer Corporation 3 * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
diff --git a/drivers/block/cciss_scsi.h b/drivers/block/cciss_scsi.h
index 5e7e06c07d6c..d9c2c586502f 100644
--- a/drivers/block/cciss_scsi.h
+++ b/drivers/block/cciss_scsi.h
@@ -1,20 +1,20 @@
1/* 1/*
2 * Disk Array driver for Compaq SA53xx Controllers, SCSI Tape module 2 * Disk Array driver for HP Smart Array controllers, SCSI Tape module.
3 * Copyright 2001 Compaq Computer Corporation 3 * (C) Copyright 2001, 2007 Hewlett-Packard Development Company, L.P.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or 7 * the Free Software Foundation; version 2 of the License.
8 * (at your option) any later version.
9 * 8 *
10 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * NON INFRINGEMENT. See the GNU General Public License for more details. 12 * General Public License for more details.
14 * 13 *
15 * You should have received a copy of the GNU General Public License 14 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software 15 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Foundation, Inc., 59 Temple Place, Suite 300, Boston, MA
17 * 02111-1307, USA.
18 * 18 *
19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com 19 * Questions/Comments/Bugfixes to iss_storagedev@hp.com
20 * 20 *
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;
diff --git a/include/asm-um/unistd.h b/include/asm-um/unistd.h
index 732c83f04c3d..38bd9d94ee46 100644
--- a/include/asm-um/unistd.h
+++ b/include/asm-um/unistd.h
@@ -14,7 +14,6 @@ extern int um_execve(const char *file, char *const argv[], char *const env[]);
14 14
15#ifdef __KERNEL__ 15#ifdef __KERNEL__
16/* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */ 16/* We get __ARCH_WANT_OLD_STAT and __ARCH_WANT_STAT64 from the base arch */
17#define __ARCH_WANT_IPC_PARSE_VERSION
18#define __ARCH_WANT_OLD_READDIR 17#define __ARCH_WANT_OLD_READDIR
19#define __ARCH_WANT_SYS_ALARM 18#define __ARCH_WANT_SYS_ALARM
20#define __ARCH_WANT_SYS_GETHOSTNAME 19#define __ARCH_WANT_SYS_GETHOSTNAME
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h
index bbf906a0b419..8396db24d019 100644
--- a/include/linux/blkdev.h
+++ b/include/linux/blkdev.h
@@ -341,7 +341,6 @@ enum blk_queue_state {
341struct blk_queue_tag { 341struct blk_queue_tag {
342 struct request **tag_index; /* map of busy tags */ 342 struct request **tag_index; /* map of busy tags */
343 unsigned long *tag_map; /* bit map of free/busy tags */ 343 unsigned long *tag_map; /* bit map of free/busy tags */
344 struct list_head busy_list; /* fifo list of busy tags */
345 int busy; /* current depth */ 344 int busy; /* current depth */
346 int max_depth; /* what we will send to device */ 345 int max_depth; /* what we will send to device */
347 int real_max_depth; /* what the array can hold */ 346 int real_max_depth; /* what the array can hold */
@@ -435,6 +434,7 @@ struct request_queue
435 unsigned int dma_alignment; 434 unsigned int dma_alignment;
436 435
437 struct blk_queue_tag *queue_tags; 436 struct blk_queue_tag *queue_tags;
437 struct list_head tag_busy_list;
438 438
439 unsigned int nr_sorted; 439 unsigned int nr_sorted;
440 unsigned int in_flight; 440 unsigned int in_flight;
diff --git a/include/linux/eventpoll.h b/include/linux/eventpoll.h
index d2a96cbf4f0e..cf79853967ff 100644
--- a/include/linux/eventpoll.h
+++ b/include/linux/eventpoll.h
@@ -32,18 +32,13 @@
32 * On x86-64 make the 64bit structure have the same alignment as the 32 * On x86-64 make the 64bit structure have the same alignment as the
33 * 32bit structure. This makes 32bit emulation easier. 33 * 32bit structure. This makes 32bit emulation easier.
34 * 34 *
35 * UML/x86_64 needs the same packing as x86_64 - UML + UML_X86 + 35 * UML/x86_64 needs the same packing as x86_64
36 * 64_BIT adds up to UML/x86_64.
37 */ 36 */
38#ifdef __x86_64__ 37#ifdef __x86_64__
39#define EPOLL_PACKED __attribute__((packed)) 38#define EPOLL_PACKED __attribute__((packed))
40#else 39#else
41#if defined(CONFIG_UML) && defined(CONFIG_UML_X86) && defined(CONFIG_64BIT)
42#define EPOLL_PACKED __attribute__((packed))
43#else
44#define EPOLL_PACKED 40#define EPOLL_PACKED
45#endif 41#endif
46#endif
47 42
48struct epoll_event { 43struct epoll_event {
49 __u32 events; 44 __u32 events;
diff --git a/include/linux/scatterlist.h b/include/linux/scatterlist.h
index 457123171389..32326c293d7b 100644
--- a/include/linux/scatterlist.h
+++ b/include/linux/scatterlist.h
@@ -150,7 +150,7 @@ static inline struct scatterlist *sg_last(struct scatterlist *sgl,
150 struct scatterlist *ret = &sgl[nents - 1]; 150 struct scatterlist *ret = &sgl[nents - 1];
151#else 151#else
152 struct scatterlist *sg, *ret = NULL; 152 struct scatterlist *sg, *ret = NULL;
153 int i; 153 unsigned int i;
154 154
155 for_each_sg(sgl, sg, nents, i) 155 for_each_sg(sgl, sg, nents, i)
156 ret = sg; 156 ret = sg;
@@ -179,7 +179,11 @@ static inline void sg_chain(struct scatterlist *prv, unsigned int prv_nents,
179#ifndef ARCH_HAS_SG_CHAIN 179#ifndef ARCH_HAS_SG_CHAIN
180 BUG(); 180 BUG();
181#endif 181#endif
182 prv[prv_nents - 1].page_link = (unsigned long) sgl | 0x01; 182 /*
183 * Set lowest bit to indicate a link pointer, and make sure to clear
184 * the termination bit if it happens to be set.
185 */
186 prv[prv_nents - 1].page_link = ((unsigned long) sgl | 0x01) & ~0x02;
183} 187}
184 188
185/** 189/**
@@ -239,7 +243,7 @@ static inline void sg_init_table(struct scatterlist *sgl, unsigned int nents)
239 sg_mark_end(sgl, nents); 243 sg_mark_end(sgl, nents);
240#ifdef CONFIG_DEBUG_SG 244#ifdef CONFIG_DEBUG_SG
241 { 245 {
242 int i; 246 unsigned int i;
243 for (i = 0; i < nents; i++) 247 for (i = 0; i < nents; i++)
244 sgl[i].sg_magic = SG_MAGIC; 248 sgl[i].sg_magic = SG_MAGIC;
245 } 249 }
diff --git a/include/linux/sunrpc/rpc_rdma.h b/include/linux/sunrpc/rpc_rdma.h
index 0013a0d8dc6b..87b895d5c786 100644
--- a/include/linux/sunrpc/rpc_rdma.h
+++ b/include/linux/sunrpc/rpc_rdma.h
@@ -41,17 +41,17 @@
41#define _LINUX_SUNRPC_RPC_RDMA_H 41#define _LINUX_SUNRPC_RPC_RDMA_H
42 42
43struct rpcrdma_segment { 43struct rpcrdma_segment {
44 uint32_t rs_handle; /* Registered memory handle */ 44 __be32 rs_handle; /* Registered memory handle */
45 uint32_t rs_length; /* Length of the chunk in bytes */ 45 __be32 rs_length; /* Length of the chunk in bytes */
46 uint64_t rs_offset; /* Chunk virtual address or offset */ 46 __be64 rs_offset; /* Chunk virtual address or offset */
47}; 47};
48 48
49/* 49/*
50 * read chunk(s), encoded as a linked list. 50 * read chunk(s), encoded as a linked list.
51 */ 51 */
52struct rpcrdma_read_chunk { 52struct rpcrdma_read_chunk {
53 uint32_t rc_discrim; /* 1 indicates presence */ 53 __be32 rc_discrim; /* 1 indicates presence */
54 uint32_t rc_position; /* Position in XDR stream */ 54 __be32 rc_position; /* Position in XDR stream */
55 struct rpcrdma_segment rc_target; 55 struct rpcrdma_segment rc_target;
56}; 56};
57 57
@@ -66,29 +66,29 @@ struct rpcrdma_write_chunk {
66 * write chunk(s), encoded as a counted array. 66 * write chunk(s), encoded as a counted array.
67 */ 67 */
68struct rpcrdma_write_array { 68struct rpcrdma_write_array {
69 uint32_t wc_discrim; /* 1 indicates presence */ 69 __be32 wc_discrim; /* 1 indicates presence */
70 uint32_t wc_nchunks; /* Array count */ 70 __be32 wc_nchunks; /* Array count */
71 struct rpcrdma_write_chunk wc_array[0]; 71 struct rpcrdma_write_chunk wc_array[0];
72}; 72};
73 73
74struct rpcrdma_msg { 74struct rpcrdma_msg {
75 uint32_t rm_xid; /* Mirrors the RPC header xid */ 75 __be32 rm_xid; /* Mirrors the RPC header xid */
76 uint32_t rm_vers; /* Version of this protocol */ 76 __be32 rm_vers; /* Version of this protocol */
77 uint32_t rm_credit; /* Buffers requested/granted */ 77 __be32 rm_credit; /* Buffers requested/granted */
78 uint32_t rm_type; /* Type of message (enum rpcrdma_proc) */ 78 __be32 rm_type; /* Type of message (enum rpcrdma_proc) */
79 union { 79 union {
80 80
81 struct { /* no chunks */ 81 struct { /* no chunks */
82 uint32_t rm_empty[3]; /* 3 empty chunk lists */ 82 __be32 rm_empty[3]; /* 3 empty chunk lists */
83 } rm_nochunks; 83 } rm_nochunks;
84 84
85 struct { /* no chunks and padded */ 85 struct { /* no chunks and padded */
86 uint32_t rm_align; /* Padding alignment */ 86 __be32 rm_align; /* Padding alignment */
87 uint32_t rm_thresh; /* Padding threshold */ 87 __be32 rm_thresh; /* Padding threshold */
88 uint32_t rm_pempty[3]; /* 3 empty chunk lists */ 88 __be32 rm_pempty[3]; /* 3 empty chunk lists */
89 } rm_padded; 89 } rm_padded;
90 90
91 uint32_t rm_chunks[0]; /* read, write and reply chunks */ 91 __be32 rm_chunks[0]; /* read, write and reply chunks */
92 92
93 } rm_body; 93 } rm_body;
94}; 94};
diff --git a/include/linux/types.h b/include/linux/types.h
index 4f0dad21c917..f4f8d19158e4 100644
--- a/include/linux/types.h
+++ b/include/linux/types.h
@@ -37,6 +37,8 @@ typedef __kernel_gid32_t gid_t;
37typedef __kernel_uid16_t uid16_t; 37typedef __kernel_uid16_t uid16_t;
38typedef __kernel_gid16_t gid16_t; 38typedef __kernel_gid16_t gid16_t;
39 39
40typedef unsigned long uintptr_t;
41
40#ifdef CONFIG_UID16 42#ifdef CONFIG_UID16
41/* This is defined by include/asm-{arch}/posix_types.h */ 43/* This is defined by include/asm-{arch}/posix_types.h */
42typedef __kernel_old_uid_t old_uid_t; 44typedef __kernel_old_uid_t old_uid_t;
diff --git a/include/net/sctp/auth.h b/include/net/sctp/auth.h
index 9e8f13b7da5a..5db261a1e85e 100644
--- a/include/net/sctp/auth.h
+++ b/include/net/sctp/auth.h
@@ -103,7 +103,7 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc);
103void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc, 103void sctp_auth_asoc_set_default_hmac(struct sctp_association *asoc,
104 struct sctp_hmac_algo_param *hmacs); 104 struct sctp_hmac_algo_param *hmacs);
105int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, 105int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
106 __u16 hmac_id); 106 __be16 hmac_id);
107int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc); 107int sctp_auth_send_cid(sctp_cid_t chunk, const struct sctp_association *asoc);
108int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc); 108int sctp_auth_recv_cid(sctp_cid_t chunk, const struct sctp_association *asoc);
109void sctp_auth_calculate_hmac(const struct sctp_association *asoc, 109void sctp_auth_calculate_hmac(const struct sctp_association *asoc,
diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c
index b6d2ff7e37ee..22a25142e4cf 100644
--- a/kernel/hrtimer.c
+++ b/kernel/hrtimer.c
@@ -602,7 +602,7 @@ static int hrtimer_switch_to_hres(void)
602 /* "Retrigger" the interrupt to get things going */ 602 /* "Retrigger" the interrupt to get things going */
603 retrigger_next_event(NULL); 603 retrigger_next_event(NULL);
604 local_irq_restore(flags); 604 local_irq_restore(flags);
605 printk(KERN_INFO "Switched to high resolution mode on CPU %d\n", 605 printk(KERN_DEBUG "Switched to high resolution mode on CPU %d\n",
606 smp_processor_id()); 606 smp_processor_id());
607 return 1; 607 return 1;
608} 608}
diff --git a/kernel/signal.c b/kernel/signal.c
index 12006308c7eb..4537bdda1ebf 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -732,7 +732,7 @@ static void print_fatal_signal(struct pt_regs *regs, int signr)
732 printk("%s/%d: potentially unexpected fatal signal %d.\n", 732 printk("%s/%d: potentially unexpected fatal signal %d.\n",
733 current->comm, task_pid_nr(current), signr); 733 current->comm, task_pid_nr(current), signr);
734 734
735#ifdef __i386__ 735#if defined(__i386__) && !defined(__arch_um__)
736 printk("code at %08lx: ", regs->eip); 736 printk("code at %08lx: ", regs->eip);
737 { 737 {
738 int i; 738 int i;
diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c
index 10a1347597fd..5997456ebbc9 100644
--- a/kernel/time/tick-sched.c
+++ b/kernel/time/tick-sched.c
@@ -320,8 +320,6 @@ ktime_t tick_nohz_get_sleep_length(void)
320 return ts->sleep_length; 320 return ts->sleep_length;
321} 321}
322 322
323EXPORT_SYMBOL_GPL(tick_nohz_get_sleep_length);
324
325/** 323/**
326 * nohz_restart_sched_tick - restart the idle tick from the idle task 324 * nohz_restart_sched_tick - restart the idle tick from the idle task
327 * 325 *
diff --git a/kernel/time/timer_list.c b/kernel/time/timer_list.c
index fdb2e03d4fe0..12c5f4cb6b8c 100644
--- a/kernel/time/timer_list.c
+++ b/kernel/time/timer_list.c
@@ -129,7 +129,8 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
129 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu); 129 struct hrtimer_cpu_base *cpu_base = &per_cpu(hrtimer_bases, cpu);
130 int i; 130 int i;
131 131
132 SEQ_printf(m, "\ncpu: %d\n", cpu); 132 SEQ_printf(m, "\n");
133 SEQ_printf(m, "cpu: %d\n", cpu);
133 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) { 134 for (i = 0; i < HRTIMER_MAX_CLOCK_BASES; i++) {
134 SEQ_printf(m, " clock %d:\n", i); 135 SEQ_printf(m, " clock %d:\n", i);
135 print_base(m, cpu_base->clock_base + i, now); 136 print_base(m, cpu_base->clock_base + i, now);
@@ -184,7 +185,8 @@ print_tickdevice(struct seq_file *m, struct tick_device *td)
184{ 185{
185 struct clock_event_device *dev = td->evtdev; 186 struct clock_event_device *dev = td->evtdev;
186 187
187 SEQ_printf(m, "\nTick Device: mode: %d\n", td->mode); 188 SEQ_printf(m, "\n");
189 SEQ_printf(m, "Tick Device: mode: %d\n", td->mode);
188 190
189 SEQ_printf(m, "Clock Event Device: "); 191 SEQ_printf(m, "Clock Event Device: ");
190 if (!dev) { 192 if (!dev) {
diff --git a/mm/filemap.c b/mm/filemap.c
index 5209e47b7fe3..7c8643630023 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -28,6 +28,7 @@
28#include <linux/backing-dev.h> 28#include <linux/backing-dev.h>
29#include <linux/pagevec.h> 29#include <linux/pagevec.h>
30#include <linux/blkdev.h> 30#include <linux/blkdev.h>
31#include <linux/backing-dev.h>
31#include <linux/security.h> 32#include <linux/security.h>
32#include <linux/syscalls.h> 33#include <linux/syscalls.h>
33#include <linux/cpuset.h> 34#include <linux/cpuset.h>
diff --git a/mm/nommu.c b/mm/nommu.c
index 8f09333f78e1..35622c590925 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -12,6 +12,7 @@
12 * Copyright (c) 2002 Greg Ungerer <gerg@snapgear.com> 12 * Copyright (c) 2002 Greg Ungerer <gerg@snapgear.com>
13 */ 13 */
14 14
15#include <linux/module.h>
15#include <linux/mm.h> 16#include <linux/mm.h>
16#include <linux/mman.h> 17#include <linux/mman.h>
17#include <linux/swap.h> 18#include <linux/swap.h>
diff --git a/mm/slub.c b/mm/slub.c
index aac1dd3c657d..bcdb2c8941a5 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2734,7 +2734,7 @@ static void slab_mem_offline_callback(void *arg)
2734 * and offline_pages() function shoudn't call this 2734 * and offline_pages() function shoudn't call this
2735 * callback. So, we must fail. 2735 * callback. So, we must fail.
2736 */ 2736 */
2737 BUG_ON(atomic_read(&n->nr_slabs)); 2737 BUG_ON(atomic_long_read(&n->nr_slabs));
2738 2738
2739 s->node[offline_node] = NULL; 2739 s->node[offline_node] = NULL;
2740 kmem_cache_free(kmalloc_caches, n); 2740 kmem_cache_free(kmalloc_caches, n);
diff --git a/net/sctp/auth.c b/net/sctp/auth.c
index 8af1004abefe..6d5fa6bb371b 100644
--- a/net/sctp/auth.c
+++ b/net/sctp/auth.c
@@ -556,7 +556,7 @@ struct sctp_hmac *sctp_auth_asoc_get_hmac(const struct sctp_association *asoc)
556 return &sctp_hmac_list[id]; 556 return &sctp_hmac_list[id];
557} 557}
558 558
559static int __sctp_auth_find_hmacid(__u16 *hmacs, int n_elts, __u16 hmac_id) 559static int __sctp_auth_find_hmacid(__be16 *hmacs, int n_elts, __be16 hmac_id)
560{ 560{
561 int found = 0; 561 int found = 0;
562 int i; 562 int i;
@@ -573,7 +573,7 @@ static int __sctp_auth_find_hmacid(__u16 *hmacs, int n_elts, __u16 hmac_id)
573 573
574/* See if the HMAC_ID is one that we claim as supported */ 574/* See if the HMAC_ID is one that we claim as supported */
575int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc, 575int sctp_auth_asoc_verify_hmac_id(const struct sctp_association *asoc,
576 __u16 hmac_id) 576 __be16 hmac_id)
577{ 577{
578 struct sctp_hmac_algo_param *hmacs; 578 struct sctp_hmac_algo_param *hmacs;
579 __u16 n_elt; 579 __u16 n_elt;
diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
index 12db63580427..f877b88091ce 100644
--- a/net/sunrpc/xprtrdma/rpc_rdma.c
+++ b/net/sunrpc/xprtrdma/rpc_rdma.c
@@ -181,7 +181,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
181 struct rpcrdma_read_chunk *cur_rchunk = NULL; 181 struct rpcrdma_read_chunk *cur_rchunk = NULL;
182 struct rpcrdma_write_array *warray = NULL; 182 struct rpcrdma_write_array *warray = NULL;
183 struct rpcrdma_write_chunk *cur_wchunk = NULL; 183 struct rpcrdma_write_chunk *cur_wchunk = NULL;
184 u32 *iptr = headerp->rm_body.rm_chunks; 184 __be32 *iptr = headerp->rm_body.rm_chunks;
185 185
186 if (type == rpcrdma_readch || type == rpcrdma_areadch) { 186 if (type == rpcrdma_readch || type == rpcrdma_areadch) {
187 /* a read chunk - server will RDMA Read our memory */ 187 /* a read chunk - server will RDMA Read our memory */
@@ -217,7 +217,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
217 cur_rchunk->rc_target.rs_handle = htonl(seg->mr_rkey); 217 cur_rchunk->rc_target.rs_handle = htonl(seg->mr_rkey);
218 cur_rchunk->rc_target.rs_length = htonl(seg->mr_len); 218 cur_rchunk->rc_target.rs_length = htonl(seg->mr_len);
219 xdr_encode_hyper( 219 xdr_encode_hyper(
220 (u32 *)&cur_rchunk->rc_target.rs_offset, 220 (__be32 *)&cur_rchunk->rc_target.rs_offset,
221 seg->mr_base); 221 seg->mr_base);
222 dprintk("RPC: %s: read chunk " 222 dprintk("RPC: %s: read chunk "
223 "elem %d@0x%llx:0x%x pos %d (%s)\n", __func__, 223 "elem %d@0x%llx:0x%x pos %d (%s)\n", __func__,
@@ -229,7 +229,7 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
229 cur_wchunk->wc_target.rs_handle = htonl(seg->mr_rkey); 229 cur_wchunk->wc_target.rs_handle = htonl(seg->mr_rkey);
230 cur_wchunk->wc_target.rs_length = htonl(seg->mr_len); 230 cur_wchunk->wc_target.rs_length = htonl(seg->mr_len);
231 xdr_encode_hyper( 231 xdr_encode_hyper(
232 (u32 *)&cur_wchunk->wc_target.rs_offset, 232 (__be32 *)&cur_wchunk->wc_target.rs_offset,
233 seg->mr_base); 233 seg->mr_base);
234 dprintk("RPC: %s: %s chunk " 234 dprintk("RPC: %s: %s chunk "
235 "elem %d@0x%llx:0x%x (%s)\n", __func__, 235 "elem %d@0x%llx:0x%x (%s)\n", __func__,
@@ -257,14 +257,14 @@ rpcrdma_create_chunks(struct rpc_rqst *rqst, struct xdr_buf *target,
257 * finish off header. If write, marshal discrim and nchunks. 257 * finish off header. If write, marshal discrim and nchunks.
258 */ 258 */
259 if (cur_rchunk) { 259 if (cur_rchunk) {
260 iptr = (u32 *) cur_rchunk; 260 iptr = (__be32 *) cur_rchunk;
261 *iptr++ = xdr_zero; /* finish the read chunk list */ 261 *iptr++ = xdr_zero; /* finish the read chunk list */
262 *iptr++ = xdr_zero; /* encode a NULL write chunk list */ 262 *iptr++ = xdr_zero; /* encode a NULL write chunk list */
263 *iptr++ = xdr_zero; /* encode a NULL reply chunk */ 263 *iptr++ = xdr_zero; /* encode a NULL reply chunk */
264 } else { 264 } else {
265 warray->wc_discrim = xdr_one; 265 warray->wc_discrim = xdr_one;
266 warray->wc_nchunks = htonl(nchunks); 266 warray->wc_nchunks = htonl(nchunks);
267 iptr = (u32 *) cur_wchunk; 267 iptr = (__be32 *) cur_wchunk;
268 if (type == rpcrdma_writech) { 268 if (type == rpcrdma_writech) {
269 *iptr++ = xdr_zero; /* finish the write chunk list */ 269 *iptr++ = xdr_zero; /* finish the write chunk list */
270 *iptr++ = xdr_zero; /* encode a NULL reply chunk */ 270 *iptr++ = xdr_zero; /* encode a NULL reply chunk */
@@ -559,7 +559,7 @@ rpcrdma_marshal_req(struct rpc_rqst *rqst)
559 * RDMA'd by server. See map at rpcrdma_create_chunks()! :-) 559 * RDMA'd by server. See map at rpcrdma_create_chunks()! :-)
560 */ 560 */
561static int 561static int
562rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp) 562rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, __be32 **iptrp)
563{ 563{
564 unsigned int i, total_len; 564 unsigned int i, total_len;
565 struct rpcrdma_write_chunk *cur_wchunk; 565 struct rpcrdma_write_chunk *cur_wchunk;
@@ -573,7 +573,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
573 struct rpcrdma_segment *seg = &cur_wchunk->wc_target; 573 struct rpcrdma_segment *seg = &cur_wchunk->wc_target;
574 ifdebug(FACILITY) { 574 ifdebug(FACILITY) {
575 u64 off; 575 u64 off;
576 xdr_decode_hyper((u32 *)&seg->rs_offset, &off); 576 xdr_decode_hyper((__be32 *)&seg->rs_offset, &off);
577 dprintk("RPC: %s: chunk %d@0x%llx:0x%x\n", 577 dprintk("RPC: %s: chunk %d@0x%llx:0x%x\n",
578 __func__, 578 __func__,
579 ntohl(seg->rs_length), 579 ntohl(seg->rs_length),
@@ -585,7 +585,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
585 } 585 }
586 /* check and adjust for properly terminated write chunk */ 586 /* check and adjust for properly terminated write chunk */
587 if (wrchunk) { 587 if (wrchunk) {
588 u32 *w = (u32 *) cur_wchunk; 588 __be32 *w = (__be32 *) cur_wchunk;
589 if (*w++ != xdr_zero) 589 if (*w++ != xdr_zero)
590 return -1; 590 return -1;
591 cur_wchunk = (struct rpcrdma_write_chunk *) w; 591 cur_wchunk = (struct rpcrdma_write_chunk *) w;
@@ -593,7 +593,7 @@ rpcrdma_count_chunks(struct rpcrdma_rep *rep, int max, int wrchunk, u32 **iptrp)
593 if ((char *) cur_wchunk > rep->rr_base + rep->rr_len) 593 if ((char *) cur_wchunk > rep->rr_base + rep->rr_len)
594 return -1; 594 return -1;
595 595
596 *iptrp = (u32 *) cur_wchunk; 596 *iptrp = (__be32 *) cur_wchunk;
597 return total_len; 597 return total_len;
598} 598}
599 599
@@ -721,7 +721,7 @@ rpcrdma_reply_handler(struct rpcrdma_rep *rep)
721 struct rpc_rqst *rqst; 721 struct rpc_rqst *rqst;
722 struct rpc_xprt *xprt = rep->rr_xprt; 722 struct rpc_xprt *xprt = rep->rr_xprt;
723 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt); 723 struct rpcrdma_xprt *r_xprt = rpcx_to_rdmax(xprt);
724 u32 *iptr; 724 __be32 *iptr;
725 int i, rdmalen, status; 725 int i, rdmalen, status;
726 726
727 /* Check status. If bad, signal disconnect and return rep to pool */ 727 /* Check status. If bad, signal disconnect and return rep to pool */
@@ -801,7 +801,7 @@ repost:
801 r_xprt->rx_stats.total_rdma_reply += rdmalen; 801 r_xprt->rx_stats.total_rdma_reply += rdmalen;
802 } else { 802 } else {
803 /* else ordinary inline */ 803 /* else ordinary inline */
804 iptr = (u32 *)((unsigned char *)headerp + 28); 804 iptr = (__be32 *)((unsigned char *)headerp + 28);
805 rep->rr_len -= 28; /*sizeof *headerp;*/ 805 rep->rr_len -= 28; /*sizeof *headerp;*/
806 status = rep->rr_len; 806 status = rep->rr_len;
807 } 807 }
@@ -816,7 +816,7 @@ repost:
816 headerp->rm_body.rm_chunks[2] != xdr_one || 816 headerp->rm_body.rm_chunks[2] != xdr_one ||
817 req->rl_nchunks == 0) 817 req->rl_nchunks == 0)
818 goto badheader; 818 goto badheader;
819 iptr = (u32 *)((unsigned char *)headerp + 28); 819 iptr = (__be32 *)((unsigned char *)headerp + 28);
820 rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr); 820 rdmalen = rpcrdma_count_chunks(rep, req->rl_nchunks, 0, &iptr);
821 if (rdmalen < 0) 821 if (rdmalen < 0)
822 goto badheader; 822 goto badheader;