diff options
author | Paul Mackerras <paulus@samba.org> | 2008-05-09 06:12:06 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2008-05-09 06:12:06 -0400 |
commit | 2a5f2e3e6cd1ce9fb3f8b186b6bc9aa1f1497a92 (patch) | |
tree | b2306840f227972a7c9d4a2b75e516fe81358ce8 /arch/powerpc | |
parent | 02539d71fa98d5737bb668b02286c76241e4bac9 (diff) | |
parent | 78be76476a34a77f0ea9db2f78ba46a2b0fd5ab5 (diff) |
Merge branch 'for-2.6.26' of master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx into merge
Diffstat (limited to 'arch/powerpc')
27 files changed, 268 insertions, 204 deletions
diff --git a/arch/powerpc/boot/dts/sequoia.dts b/arch/powerpc/boot/dts/sequoia.dts index a1ae4d6ec990..72d67564bdfc 100644 --- a/arch/powerpc/boot/dts/sequoia.dts +++ b/arch/powerpc/boot/dts/sequoia.dts | |||
@@ -342,9 +342,14 @@ | |||
342 | /* Outbound ranges, one memory and one IO, | 342 | /* Outbound ranges, one memory and one IO, |
343 | * later cannot be changed. Chip supports a second | 343 | * later cannot be changed. Chip supports a second |
344 | * IO range but we don't use it for now | 344 | * IO range but we don't use it for now |
345 | * From the 440EPx user manual: | ||
346 | * PCI 1 Memory 1 8000 0000 1 BFFF FFFF 1GB | ||
347 | * I/O 1 E800 0000 1 E800 FFFF 64KB | ||
348 | * I/O 1 E880 0000 1 EBFF FFFF 56MB | ||
345 | */ | 349 | */ |
346 | ranges = <02000000 0 80000000 1 80000000 0 10000000 | 350 | ranges = <02000000 0 80000000 1 80000000 0 40000000 |
347 | 01000000 0 00000000 1 e8000000 0 00100000>; | 351 | 01000000 0 00000000 1 e8000000 0 00010000 |
352 | 01000000 0 00000000 1 e8800000 0 03800000>; | ||
348 | 353 | ||
349 | /* Inbound 2GB range starting at 0 */ | 354 | /* Inbound 2GB range starting at 0 */ |
350 | dma-ranges = <42000000 0 0 0 0 0 80000000>; | 355 | dma-ranges = <42000000 0 0 0 0 0 80000000>; |
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c index af1d2c894ee1..ec9228d687b0 100644 --- a/arch/powerpc/kernel/asm-offsets.c +++ b/arch/powerpc/kernel/asm-offsets.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <linux/time.h> | 30 | #include <linux/time.h> |
31 | #include <linux/hardirq.h> | 31 | #include <linux/hardirq.h> |
32 | #endif | 32 | #endif |
33 | #include <linux/kbuild.h> | ||
33 | 34 | ||
34 | #include <asm/io.h> | 35 | #include <asm/io.h> |
35 | #include <asm/page.h> | 36 | #include <asm/page.h> |
@@ -51,11 +52,6 @@ | |||
51 | #include <asm/iseries/alpaca.h> | 52 | #include <asm/iseries/alpaca.h> |
52 | #endif | 53 | #endif |
53 | 54 | ||
54 | #define DEFINE(sym, val) \ | ||
55 | asm volatile("\n->" #sym " %0 " #val : : "i" (val)) | ||
56 | |||
57 | #define BLANK() asm volatile("\n->" : : ) | ||
58 | |||
59 | int main(void) | 55 | int main(void) |
60 | { | 56 | { |
61 | DEFINE(THREAD, offsetof(struct task_struct, thread)); | 57 | DEFINE(THREAD, offsetof(struct task_struct, thread)); |
diff --git a/arch/powerpc/kernel/head_44x.S b/arch/powerpc/kernel/head_44x.S index b84ec6a2fc94..c2b9dc4fce5d 100644 --- a/arch/powerpc/kernel/head_44x.S +++ b/arch/powerpc/kernel/head_44x.S | |||
@@ -653,7 +653,14 @@ finish_tlb_load: | |||
653 | rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */ | 653 | rlwimi r10, r11, 0, 26, 26 /* UX = HWEXEC & USER */ |
654 | 654 | ||
655 | rlwimi r12, r10, 0, 26, 31 /* Insert static perms */ | 655 | rlwimi r12, r10, 0, 26, 31 /* Insert static perms */ |
656 | rlwinm r12, r12, 0, 20, 15 /* Clear U0-U3 */ | 656 | |
657 | /* | ||
658 | * Clear U0-U3 and WL1 IL1I IL1D IL2I IL2D bits which are added | ||
659 | * on newer 440 cores like the 440x6 used on AMCC 460EX/460GT (see | ||
660 | * include/asm-powerpc/pgtable-ppc32.h for details). | ||
661 | */ | ||
662 | rlwinm r12, r12, 0, 20, 10 | ||
663 | |||
657 | tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */ | 664 | tlbwe r12, r13, PPC44x_TLB_ATTRIB /* Write ATTRIB */ |
658 | 665 | ||
659 | /* Done...restore registers and get out of here. | 666 | /* Done...restore registers and get out of here. |
diff --git a/arch/powerpc/kernel/lparcfg.c b/arch/powerpc/kernel/lparcfg.c index 1ffacc698ffb..1e656b43ad7f 100644 --- a/arch/powerpc/kernel/lparcfg.c +++ b/arch/powerpc/kernel/lparcfg.c | |||
@@ -591,10 +591,8 @@ int __init lparcfg_init(void) | |||
591 | !firmware_has_feature(FW_FEATURE_ISERIES)) | 591 | !firmware_has_feature(FW_FEATURE_ISERIES)) |
592 | mode |= S_IWUSR; | 592 | mode |= S_IWUSR; |
593 | 593 | ||
594 | ent = create_proc_entry("ppc64/lparcfg", mode, NULL); | 594 | ent = proc_create("ppc64/lparcfg", mode, NULL, &lparcfg_fops); |
595 | if (ent) { | 595 | if (!ent) { |
596 | ent->proc_fops = &lparcfg_fops; | ||
597 | } else { | ||
598 | printk(KERN_ERR "Failed to create ppc64/lparcfg\n"); | 596 | printk(KERN_ERR "Failed to create ppc64/lparcfg\n"); |
599 | return -EIO; | 597 | return -EIO; |
600 | } | 598 | } |
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c index 09fcb50c45ae..cf6b5a7d8b3f 100644 --- a/arch/powerpc/kernel/ppc_ksyms.c +++ b/arch/powerpc/kernel/ppc_ksyms.c | |||
@@ -133,9 +133,6 @@ EXPORT_SYMBOL(adb_try_handler_change); | |||
133 | EXPORT_SYMBOL(cuda_request); | 133 | EXPORT_SYMBOL(cuda_request); |
134 | EXPORT_SYMBOL(cuda_poll); | 134 | EXPORT_SYMBOL(cuda_poll); |
135 | #endif /* CONFIG_ADB_CUDA */ | 135 | #endif /* CONFIG_ADB_CUDA */ |
136 | #ifdef CONFIG_VT | ||
137 | EXPORT_SYMBOL(kd_mksound); | ||
138 | #endif | ||
139 | EXPORT_SYMBOL(to_tm); | 136 | EXPORT_SYMBOL(to_tm); |
140 | 137 | ||
141 | #ifdef CONFIG_PPC32 | 138 | #ifdef CONFIG_PPC32 |
diff --git a/arch/powerpc/kernel/proc_ppc64.c b/arch/powerpc/kernel/proc_ppc64.c index f78dfce1b771..c647ddef40dc 100644 --- a/arch/powerpc/kernel/proc_ppc64.c +++ b/arch/powerpc/kernel/proc_ppc64.c | |||
@@ -68,12 +68,11 @@ static int __init proc_ppc64_init(void) | |||
68 | { | 68 | { |
69 | struct proc_dir_entry *pde; | 69 | struct proc_dir_entry *pde; |
70 | 70 | ||
71 | pde = create_proc_entry("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL); | 71 | pde = proc_create_data("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL, |
72 | &page_map_fops, vdso_data); | ||
72 | if (!pde) | 73 | if (!pde) |
73 | return 1; | 74 | return 1; |
74 | pde->data = vdso_data; | ||
75 | pde->size = PAGE_SIZE; | 75 | pde->size = PAGE_SIZE; |
76 | pde->proc_fops = &page_map_fops; | ||
77 | 76 | ||
78 | return 0; | 77 | return 0; |
79 | } | 78 | } |
diff --git a/arch/powerpc/kernel/rtas-proc.c b/arch/powerpc/kernel/rtas-proc.c index f2e3bc714d76..f9c6abc84a94 100644 --- a/arch/powerpc/kernel/rtas-proc.c +++ b/arch/powerpc/kernel/rtas-proc.c | |||
@@ -255,8 +255,6 @@ static void check_location(struct seq_file *m, const char *c); | |||
255 | 255 | ||
256 | static int __init proc_rtas_init(void) | 256 | static int __init proc_rtas_init(void) |
257 | { | 257 | { |
258 | struct proc_dir_entry *entry; | ||
259 | |||
260 | if (!machine_is(pseries)) | 258 | if (!machine_is(pseries)) |
261 | return -ENODEV; | 259 | return -ENODEV; |
262 | 260 | ||
@@ -264,35 +262,20 @@ static int __init proc_rtas_init(void) | |||
264 | if (rtas_node == NULL) | 262 | if (rtas_node == NULL) |
265 | return -ENODEV; | 263 | return -ENODEV; |
266 | 264 | ||
267 | entry = create_proc_entry("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL); | 265 | proc_create("ppc64/rtas/progress", S_IRUGO|S_IWUSR, NULL, |
268 | if (entry) | 266 | &ppc_rtas_progress_operations); |
269 | entry->proc_fops = &ppc_rtas_progress_operations; | 267 | proc_create("ppc64/rtas/clock", S_IRUGO|S_IWUSR, NULL, |
270 | 268 | &ppc_rtas_clock_operations); | |
271 | entry = create_proc_entry("ppc64/rtas/clock", S_IRUGO|S_IWUSR, NULL); | 269 | proc_create("ppc64/rtas/poweron", S_IWUSR|S_IRUGO, NULL, |
272 | if (entry) | 270 | &ppc_rtas_poweron_operations); |
273 | entry->proc_fops = &ppc_rtas_clock_operations; | 271 | proc_create("ppc64/rtas/sensors", S_IRUGO, NULL, |
274 | 272 | &ppc_rtas_sensors_operations); | |
275 | entry = create_proc_entry("ppc64/rtas/poweron", S_IWUSR|S_IRUGO, NULL); | 273 | proc_create("ppc64/rtas/frequency", S_IWUSR|S_IRUGO, NULL, |
276 | if (entry) | 274 | &ppc_rtas_tone_freq_operations); |
277 | entry->proc_fops = &ppc_rtas_poweron_operations; | 275 | proc_create("ppc64/rtas/volume", S_IWUSR|S_IRUGO, NULL, |
278 | 276 | &ppc_rtas_tone_volume_operations); | |
279 | entry = create_proc_entry("ppc64/rtas/sensors", S_IRUGO, NULL); | 277 | proc_create("ppc64/rtas/rmo_buffer", S_IRUSR, NULL, |
280 | if (entry) | 278 | &ppc_rtas_rmo_buf_ops); |
281 | entry->proc_fops = &ppc_rtas_sensors_operations; | ||
282 | |||
283 | entry = create_proc_entry("ppc64/rtas/frequency", S_IWUSR|S_IRUGO, | ||
284 | NULL); | ||
285 | if (entry) | ||
286 | entry->proc_fops = &ppc_rtas_tone_freq_operations; | ||
287 | |||
288 | entry = create_proc_entry("ppc64/rtas/volume", S_IWUSR|S_IRUGO, NULL); | ||
289 | if (entry) | ||
290 | entry->proc_fops = &ppc_rtas_tone_volume_operations; | ||
291 | |||
292 | entry = create_proc_entry("ppc64/rtas/rmo_buffer", S_IRUSR, NULL); | ||
293 | if (entry) | ||
294 | entry->proc_fops = &ppc_rtas_rmo_buf_ops; | ||
295 | |||
296 | return 0; | 279 | return 0; |
297 | } | 280 | } |
298 | 281 | ||
diff --git a/arch/powerpc/kernel/rtas_flash.c b/arch/powerpc/kernel/rtas_flash.c index 627f126d1848..0a5e22b22729 100644 --- a/arch/powerpc/kernel/rtas_flash.c +++ b/arch/powerpc/kernel/rtas_flash.c | |||
@@ -704,18 +704,11 @@ static int initialize_flash_pde_data(const char *rtas_call_name, | |||
704 | static struct proc_dir_entry *create_flash_pde(const char *filename, | 704 | static struct proc_dir_entry *create_flash_pde(const char *filename, |
705 | const struct file_operations *fops) | 705 | const struct file_operations *fops) |
706 | { | 706 | { |
707 | struct proc_dir_entry *ent = NULL; | 707 | return proc_create(filename, S_IRUSR | S_IWUSR, NULL, fops); |
708 | |||
709 | ent = create_proc_entry(filename, S_IRUSR | S_IWUSR, NULL); | ||
710 | if (ent != NULL) { | ||
711 | ent->proc_fops = fops; | ||
712 | ent->owner = THIS_MODULE; | ||
713 | } | ||
714 | |||
715 | return ent; | ||
716 | } | 708 | } |
717 | 709 | ||
718 | static const struct file_operations rtas_flash_operations = { | 710 | static const struct file_operations rtas_flash_operations = { |
711 | .owner = THIS_MODULE, | ||
719 | .read = rtas_flash_read, | 712 | .read = rtas_flash_read, |
720 | .write = rtas_flash_write, | 713 | .write = rtas_flash_write, |
721 | .open = rtas_excl_open, | 714 | .open = rtas_excl_open, |
@@ -723,6 +716,7 @@ static const struct file_operations rtas_flash_operations = { | |||
723 | }; | 716 | }; |
724 | 717 | ||
725 | static const struct file_operations manage_flash_operations = { | 718 | static const struct file_operations manage_flash_operations = { |
719 | .owner = THIS_MODULE, | ||
726 | .read = manage_flash_read, | 720 | .read = manage_flash_read, |
727 | .write = manage_flash_write, | 721 | .write = manage_flash_write, |
728 | .open = rtas_excl_open, | 722 | .open = rtas_excl_open, |
@@ -730,6 +724,7 @@ static const struct file_operations manage_flash_operations = { | |||
730 | }; | 724 | }; |
731 | 725 | ||
732 | static const struct file_operations validate_flash_operations = { | 726 | static const struct file_operations validate_flash_operations = { |
727 | .owner = THIS_MODULE, | ||
733 | .read = validate_flash_read, | 728 | .read = validate_flash_read, |
734 | .write = validate_flash_write, | 729 | .write = validate_flash_write, |
735 | .open = rtas_excl_open, | 730 | .open = rtas_excl_open, |
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c index e722a4eeb5d0..4fe69ca24481 100644 --- a/arch/powerpc/kernel/syscalls.c +++ b/arch/powerpc/kernel/syscalls.c | |||
@@ -136,23 +136,6 @@ int sys_ipc(uint call, int first, unsigned long second, long third, | |||
136 | return ret; | 136 | return ret; |
137 | } | 137 | } |
138 | 138 | ||
139 | /* | ||
140 | * sys_pipe() is the normal C calling standard for creating | ||
141 | * a pipe. It's not the way unix traditionally does this, though. | ||
142 | */ | ||
143 | int sys_pipe(int __user *fildes) | ||
144 | { | ||
145 | int fd[2]; | ||
146 | int error; | ||
147 | |||
148 | error = do_pipe(fd); | ||
149 | if (!error) { | ||
150 | if (copy_to_user(fildes, fd, 2*sizeof(int))) | ||
151 | error = -EFAULT; | ||
152 | } | ||
153 | return error; | ||
154 | } | ||
155 | |||
156 | static inline unsigned long do_mmap2(unsigned long addr, size_t len, | 139 | static inline unsigned long do_mmap2(unsigned long addr, size_t len, |
157 | unsigned long prot, unsigned long flags, | 140 | unsigned long prot, unsigned long flags, |
158 | unsigned long fd, unsigned long off, int shift) | 141 | unsigned long fd, unsigned long off, int shift) |
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c index 3b26fbd6bec9..73401e83739a 100644 --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c | |||
@@ -149,7 +149,7 @@ EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */ | |||
149 | u64 tb_to_xs; | 149 | u64 tb_to_xs; |
150 | unsigned tb_to_us; | 150 | unsigned tb_to_us; |
151 | 151 | ||
152 | #define TICKLEN_SCALE TICK_LENGTH_SHIFT | 152 | #define TICKLEN_SCALE NTP_SCALE_SHIFT |
153 | u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ | 153 | u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */ |
154 | u64 ticklen_to_xs; /* 0.64 fraction */ | 154 | u64 ticklen_to_xs; /* 0.64 fraction */ |
155 | 155 | ||
@@ -1007,8 +1007,6 @@ void __init time_init(void) | |||
1007 | vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC; | 1007 | vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC; |
1008 | vdso_data->tb_to_xs = tb_to_xs; | 1008 | vdso_data->tb_to_xs = tb_to_xs; |
1009 | 1009 | ||
1010 | time_freq = 0; | ||
1011 | |||
1012 | write_sequnlock_irqrestore(&xtime_lock, flags); | 1010 | write_sequnlock_irqrestore(&xtime_lock, flags); |
1013 | 1011 | ||
1014 | /* Register the clocksource, if we're not running on iSeries */ | 1012 | /* Register the clocksource, if we're not running on iSeries */ |
diff --git a/arch/powerpc/kvm/booke_guest.c b/arch/powerpc/kvm/booke_guest.c index 6d9884a6884a..712d89a28c46 100644 --- a/arch/powerpc/kvm/booke_guest.c +++ b/arch/powerpc/kvm/booke_guest.c | |||
@@ -49,6 +49,7 @@ struct kvm_stats_debugfs_item debugfs_entries[] = { | |||
49 | { "inst_emu", VCPU_STAT(emulated_inst_exits) }, | 49 | { "inst_emu", VCPU_STAT(emulated_inst_exits) }, |
50 | { "dec", VCPU_STAT(dec_exits) }, | 50 | { "dec", VCPU_STAT(dec_exits) }, |
51 | { "ext_intr", VCPU_STAT(ext_intr_exits) }, | 51 | { "ext_intr", VCPU_STAT(ext_intr_exits) }, |
52 | { "halt_wakeup", VCPU_STAT(halt_wakeup) }, | ||
52 | { NULL } | 53 | { NULL } |
53 | }; | 54 | }; |
54 | 55 | ||
@@ -338,6 +339,11 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, | |||
338 | } | 339 | } |
339 | break; | 340 | break; |
340 | 341 | ||
342 | case BOOKE_INTERRUPT_FP_UNAVAIL: | ||
343 | kvmppc_queue_exception(vcpu, exit_nr); | ||
344 | r = RESUME_GUEST; | ||
345 | break; | ||
346 | |||
341 | case BOOKE_INTERRUPT_DATA_STORAGE: | 347 | case BOOKE_INTERRUPT_DATA_STORAGE: |
342 | vcpu->arch.dear = vcpu->arch.fault_dear; | 348 | vcpu->arch.dear = vcpu->arch.fault_dear; |
343 | vcpu->arch.esr = vcpu->arch.fault_esr; | 349 | vcpu->arch.esr = vcpu->arch.fault_esr; |
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index bad40bd2d3ac..777e0f34e0ea 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c | |||
@@ -36,13 +36,12 @@ gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn) | |||
36 | 36 | ||
37 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v) | 37 | int kvm_cpu_has_interrupt(struct kvm_vcpu *v) |
38 | { | 38 | { |
39 | /* XXX implement me */ | 39 | return !!(v->arch.pending_exceptions); |
40 | return 0; | ||
41 | } | 40 | } |
42 | 41 | ||
43 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) | 42 | int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) |
44 | { | 43 | { |
45 | return 1; | 44 | return !(v->arch.msr & MSR_WE); |
46 | } | 45 | } |
47 | 46 | ||
48 | 47 | ||
@@ -214,6 +213,11 @@ static void kvmppc_decrementer_func(unsigned long data) | |||
214 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; | 213 | struct kvm_vcpu *vcpu = (struct kvm_vcpu *)data; |
215 | 214 | ||
216 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); | 215 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_DECREMENTER); |
216 | |||
217 | if (waitqueue_active(&vcpu->wq)) { | ||
218 | wake_up_interruptible(&vcpu->wq); | ||
219 | vcpu->stat.halt_wakeup++; | ||
220 | } | ||
217 | } | 221 | } |
218 | 222 | ||
219 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) | 223 | int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) |
@@ -339,6 +343,8 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
339 | int r; | 343 | int r; |
340 | sigset_t sigsaved; | 344 | sigset_t sigsaved; |
341 | 345 | ||
346 | vcpu_load(vcpu); | ||
347 | |||
342 | if (vcpu->sigset_active) | 348 | if (vcpu->sigset_active) |
343 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); | 349 | sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); |
344 | 350 | ||
@@ -363,12 +369,20 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run) | |||
363 | if (vcpu->sigset_active) | 369 | if (vcpu->sigset_active) |
364 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); | 370 | sigprocmask(SIG_SETMASK, &sigsaved, NULL); |
365 | 371 | ||
372 | vcpu_put(vcpu); | ||
373 | |||
366 | return r; | 374 | return r; |
367 | } | 375 | } |
368 | 376 | ||
369 | int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) | 377 | int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu, struct kvm_interrupt *irq) |
370 | { | 378 | { |
371 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); | 379 | kvmppc_queue_exception(vcpu, BOOKE_INTERRUPT_EXTERNAL); |
380 | |||
381 | if (waitqueue_active(&vcpu->wq)) { | ||
382 | wake_up_interruptible(&vcpu->wq); | ||
383 | vcpu->stat.halt_wakeup++; | ||
384 | } | ||
385 | |||
372 | return 0; | 386 | return 0; |
373 | } | 387 | } |
374 | 388 | ||
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile index 4bb023f4c869..f1d2cdc5331b 100644 --- a/arch/powerpc/lib/Makefile +++ b/arch/powerpc/lib/Makefile | |||
@@ -23,3 +23,4 @@ obj-$(CONFIG_SMP) += locks.o | |||
23 | endif | 23 | endif |
24 | 24 | ||
25 | obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o | 25 | obj-$(CONFIG_PPC_LIB_RHEAP) += rheap.o |
26 | obj-$(CONFIG_HAS_IOMEM) += devres.o | ||
diff --git a/arch/powerpc/lib/devres.c b/arch/powerpc/lib/devres.c new file mode 100644 index 000000000000..292115d98ea9 --- /dev/null +++ b/arch/powerpc/lib/devres.c | |||
@@ -0,0 +1,42 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2008 Freescale Semiconductor, Inc. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or | ||
5 | * modify it under the terms of the GNU General Public License | ||
6 | * as published by the Free Software Foundation; either version | ||
7 | * 2 of the License, or (at your option) any later version. | ||
8 | */ | ||
9 | |||
10 | #include <linux/device.h> /* devres_*(), devm_ioremap_release() */ | ||
11 | #include <linux/io.h> /* ioremap_flags() */ | ||
12 | #include <linux/module.h> /* EXPORT_SYMBOL() */ | ||
13 | |||
14 | /** | ||
15 | * devm_ioremap_prot - Managed ioremap_flags() | ||
16 | * @dev: Generic device to remap IO address for | ||
17 | * @offset: BUS offset to map | ||
18 | * @size: Size of map | ||
19 | * @flags: Page flags | ||
20 | * | ||
21 | * Managed ioremap_prot(). Map is automatically unmapped on driver | ||
22 | * detach. | ||
23 | */ | ||
24 | void __iomem *devm_ioremap_prot(struct device *dev, resource_size_t offset, | ||
25 | size_t size, unsigned long flags) | ||
26 | { | ||
27 | void __iomem **ptr, *addr; | ||
28 | |||
29 | ptr = devres_alloc(devm_ioremap_release, sizeof(*ptr), GFP_KERNEL); | ||
30 | if (!ptr) | ||
31 | return NULL; | ||
32 | |||
33 | addr = ioremap_flags(offset, size, flags); | ||
34 | if (addr) { | ||
35 | *ptr = addr; | ||
36 | devres_add(dev, ptr); | ||
37 | } else | ||
38 | devres_free(ptr); | ||
39 | |||
40 | return addr; | ||
41 | } | ||
42 | EXPORT_SYMBOL(devm_ioremap_prot); | ||
diff --git a/arch/powerpc/platforms/cell/spufs/coredump.c b/arch/powerpc/platforms/cell/spufs/coredump.c index b962c3ab470c..af116aadba10 100644 --- a/arch/powerpc/platforms/cell/spufs/coredump.c +++ b/arch/powerpc/platforms/cell/spufs/coredump.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include <linux/elf.h> | 23 | #include <linux/elf.h> |
24 | #include <linux/file.h> | 24 | #include <linux/file.h> |
25 | #include <linux/fdtable.h> | ||
25 | #include <linux/fs.h> | 26 | #include <linux/fs.h> |
26 | #include <linux/list.h> | 27 | #include <linux/list.h> |
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
diff --git a/arch/powerpc/platforms/cell/spufs/sched.c b/arch/powerpc/platforms/cell/spufs/sched.c index 8a05ac863a27..2e411f23462b 100644 --- a/arch/powerpc/platforms/cell/spufs/sched.c +++ b/arch/powerpc/platforms/cell/spufs/sched.c | |||
@@ -1068,10 +1068,9 @@ int __init spu_sched_init(void) | |||
1068 | 1068 | ||
1069 | mod_timer(&spuloadavg_timer, 0); | 1069 | mod_timer(&spuloadavg_timer, 0); |
1070 | 1070 | ||
1071 | entry = create_proc_entry("spu_loadavg", 0, NULL); | 1071 | entry = proc_create("spu_loadavg", 0, NULL, &spu_loadavg_fops); |
1072 | if (!entry) | 1072 | if (!entry) |
1073 | goto out_stop_kthread; | 1073 | goto out_stop_kthread; |
1074 | entry->proc_fops = &spu_loadavg_fops; | ||
1075 | 1074 | ||
1076 | pr_debug("spusched: tick: %d, min ticks: %d, default ticks: %d\n", | 1075 | pr_debug("spusched: tick: %d, min ticks: %d, default ticks: %d\n", |
1077 | SPUSCHED_TICK, MIN_SPU_TIMESLICE, DEF_SPU_TIMESLICE); | 1076 | SPUSCHED_TICK, MIN_SPU_TIMESLICE, DEF_SPU_TIMESLICE); |
diff --git a/arch/powerpc/platforms/cell/spufs/sputrace.c b/arch/powerpc/platforms/cell/spufs/sputrace.c index b9c79eda3359..53202422ba72 100644 --- a/arch/powerpc/platforms/cell/spufs/sputrace.c +++ b/arch/powerpc/platforms/cell/spufs/sputrace.c | |||
@@ -201,10 +201,9 @@ static int __init sputrace_init(void) | |||
201 | if (!sputrace_log) | 201 | if (!sputrace_log) |
202 | goto out; | 202 | goto out; |
203 | 203 | ||
204 | entry = create_proc_entry("sputrace", S_IRUSR, NULL); | 204 | entry = proc_create("sputrace", S_IRUSR, NULL, &sputrace_fops); |
205 | if (!entry) | 205 | if (!entry) |
206 | goto out_free_log; | 206 | goto out_free_log; |
207 | entry->proc_fops = &sputrace_fops; | ||
208 | 207 | ||
209 | for (i = 0; i < ARRAY_SIZE(spu_probes); i++) { | 208 | for (i = 0; i < ARRAY_SIZE(spu_probes); i++) { |
210 | struct spu_probe *p = &spu_probes[i]; | 209 | struct spu_probe *p = &spu_probes[i]; |
diff --git a/arch/powerpc/platforms/iseries/lpevents.c b/arch/powerpc/platforms/iseries/lpevents.c index e5b40e3e0082..b0f8a857ec02 100644 --- a/arch/powerpc/platforms/iseries/lpevents.c +++ b/arch/powerpc/platforms/iseries/lpevents.c | |||
@@ -330,15 +330,11 @@ static const struct file_operations proc_lpevents_operations = { | |||
330 | 330 | ||
331 | static int __init proc_lpevents_init(void) | 331 | static int __init proc_lpevents_init(void) |
332 | { | 332 | { |
333 | struct proc_dir_entry *e; | ||
334 | |||
335 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) | 333 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) |
336 | return 0; | 334 | return 0; |
337 | 335 | ||
338 | e = create_proc_entry("iSeries/lpevents", S_IFREG|S_IRUGO, NULL); | 336 | proc_create("iSeries/lpevents", S_IFREG|S_IRUGO, NULL, |
339 | if (e) | 337 | &proc_lpevents_operations); |
340 | e->proc_fops = &proc_lpevents_operations; | ||
341 | |||
342 | return 0; | 338 | return 0; |
343 | } | 339 | } |
344 | __initcall(proc_lpevents_init); | 340 | __initcall(proc_lpevents_init); |
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c index c0f2433bc16e..1dc7295746da 100644 --- a/arch/powerpc/platforms/iseries/mf.c +++ b/arch/powerpc/platforms/iseries/mf.c | |||
@@ -1255,11 +1255,11 @@ static int __init mf_proc_init(void) | |||
1255 | if (i == 3) /* no vmlinux entry for 'D' */ | 1255 | if (i == 3) /* no vmlinux entry for 'D' */ |
1256 | continue; | 1256 | continue; |
1257 | 1257 | ||
1258 | ent = create_proc_entry("vmlinux", S_IFREG|S_IWUSR, mf); | 1258 | ent = proc_create_data("vmlinux", S_IFREG|S_IWUSR, mf, |
1259 | &proc_vmlinux_operations, | ||
1260 | (void *)(long)i); | ||
1259 | if (!ent) | 1261 | if (!ent) |
1260 | return 1; | 1262 | return 1; |
1261 | ent->data = (void *)(long)i; | ||
1262 | ent->proc_fops = &proc_vmlinux_operations; | ||
1263 | } | 1263 | } |
1264 | 1264 | ||
1265 | ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); | 1265 | ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); |
diff --git a/arch/powerpc/platforms/iseries/proc.c b/arch/powerpc/platforms/iseries/proc.c index f2cde4180204..91f4c6cd4b99 100644 --- a/arch/powerpc/platforms/iseries/proc.c +++ b/arch/powerpc/platforms/iseries/proc.c | |||
@@ -110,15 +110,11 @@ static const struct file_operations proc_titantod_operations = { | |||
110 | 110 | ||
111 | static int __init iseries_proc_init(void) | 111 | static int __init iseries_proc_init(void) |
112 | { | 112 | { |
113 | struct proc_dir_entry *e; | ||
114 | |||
115 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) | 113 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) |
116 | return 0; | 114 | return 0; |
117 | 115 | ||
118 | e = create_proc_entry("iSeries/titanTod", S_IFREG|S_IRUGO, NULL); | 116 | proc_create("iSeries/titanTod", S_IFREG|S_IRUGO, NULL, |
119 | if (e) | 117 | &proc_titantod_operations); |
120 | e->proc_fops = &proc_titantod_operations; | ||
121 | |||
122 | return 0; | 118 | return 0; |
123 | } | 119 | } |
124 | __initcall(iseries_proc_init); | 120 | __initcall(iseries_proc_init); |
diff --git a/arch/powerpc/platforms/iseries/viopath.c b/arch/powerpc/platforms/iseries/viopath.c index df23331eb25c..49ff4dc422b7 100644 --- a/arch/powerpc/platforms/iseries/viopath.c +++ b/arch/powerpc/platforms/iseries/viopath.c | |||
@@ -180,15 +180,10 @@ static const struct file_operations proc_viopath_operations = { | |||
180 | 180 | ||
181 | static int __init vio_proc_init(void) | 181 | static int __init vio_proc_init(void) |
182 | { | 182 | { |
183 | struct proc_dir_entry *e; | ||
184 | |||
185 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) | 183 | if (!firmware_has_feature(FW_FEATURE_ISERIES)) |
186 | return 0; | 184 | return 0; |
187 | 185 | ||
188 | e = create_proc_entry("iSeries/config", 0, NULL); | 186 | proc_create("iSeries/config", 0, NULL, &proc_viopath_operations); |
189 | if (e) | ||
190 | e->proc_fops = &proc_viopath_operations; | ||
191 | |||
192 | return 0; | 187 | return 0; |
193 | } | 188 | } |
194 | __initcall(vio_proc_init); | 189 | __initcall(vio_proc_init); |
diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c index a3fd56b186e6..6f544ba4b37f 100644 --- a/arch/powerpc/platforms/pseries/eeh.c +++ b/arch/powerpc/platforms/pseries/eeh.c | |||
@@ -1259,14 +1259,8 @@ static const struct file_operations proc_eeh_operations = { | |||
1259 | 1259 | ||
1260 | static int __init eeh_init_proc(void) | 1260 | static int __init eeh_init_proc(void) |
1261 | { | 1261 | { |
1262 | struct proc_dir_entry *e; | 1262 | if (machine_is(pseries)) |
1263 | 1263 | proc_create("ppc64/eeh", 0, NULL, &proc_eeh_operations); | |
1264 | if (machine_is(pseries)) { | ||
1265 | e = create_proc_entry("ppc64/eeh", 0, NULL); | ||
1266 | if (e) | ||
1267 | e->proc_fops = &proc_eeh_operations; | ||
1268 | } | ||
1269 | |||
1270 | return 0; | 1264 | return 0; |
1271 | } | 1265 | } |
1272 | __initcall(eeh_init_proc); | 1266 | __initcall(eeh_init_proc); |
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index ac75c10de278..75769aae41d5 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c | |||
@@ -512,12 +512,9 @@ static int proc_ppc64_create_ofdt(void) | |||
512 | if (!machine_is(pseries)) | 512 | if (!machine_is(pseries)) |
513 | return 0; | 513 | return 0; |
514 | 514 | ||
515 | ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL); | 515 | ent = proc_create("ppc64/ofdt", S_IWUSR, NULL, &ofdt_fops); |
516 | if (ent) { | 516 | if (ent) |
517 | ent->data = NULL; | ||
518 | ent->size = 0; | 517 | ent->size = 0; |
519 | ent->proc_fops = &ofdt_fops; | ||
520 | } | ||
521 | 518 | ||
522 | return 0; | 519 | return 0; |
523 | } | 520 | } |
diff --git a/arch/powerpc/platforms/pseries/rtasd.c b/arch/powerpc/platforms/pseries/rtasd.c index befadd4f9524..7d3e2b0bd4d2 100644 --- a/arch/powerpc/platforms/pseries/rtasd.c +++ b/arch/powerpc/platforms/pseries/rtasd.c | |||
@@ -468,10 +468,9 @@ static int __init rtas_init(void) | |||
468 | return -ENOMEM; | 468 | return -ENOMEM; |
469 | } | 469 | } |
470 | 470 | ||
471 | entry = create_proc_entry("ppc64/rtas/error_log", S_IRUSR, NULL); | 471 | entry = proc_create("ppc64/rtas/error_log", S_IRUSR, NULL, |
472 | if (entry) | 472 | &proc_rtas_log_operations); |
473 | entry->proc_fops = &proc_rtas_log_operations; | 473 | if (!entry) |
474 | else | ||
475 | printk(KERN_ERR "Failed to create error_log proc entry\n"); | 474 | printk(KERN_ERR "Failed to create error_log proc entry\n"); |
476 | 475 | ||
477 | if (kernel_thread(rtasd, NULL, CLONE_FS) < 0) | 476 | if (kernel_thread(rtasd, NULL, CLONE_FS) < 0) |
diff --git a/arch/powerpc/platforms/pseries/scanlog.c b/arch/powerpc/platforms/pseries/scanlog.c index bec3803f0618..417eca79df69 100644 --- a/arch/powerpc/platforms/pseries/scanlog.c +++ b/arch/powerpc/platforms/pseries/scanlog.c | |||
@@ -55,11 +55,6 @@ static ssize_t scanlog_read(struct file *file, char __user *buf, | |||
55 | dp = PDE(inode); | 55 | dp = PDE(inode); |
56 | data = (unsigned int *)dp->data; | 56 | data = (unsigned int *)dp->data; |
57 | 57 | ||
58 | if (!data) { | ||
59 | printk(KERN_ERR "scanlog: read failed no data\n"); | ||
60 | return -EIO; | ||
61 | } | ||
62 | |||
63 | if (count > RTAS_DATA_BUF_SIZE) | 58 | if (count > RTAS_DATA_BUF_SIZE) |
64 | count = RTAS_DATA_BUF_SIZE; | 59 | count = RTAS_DATA_BUF_SIZE; |
65 | 60 | ||
@@ -146,11 +141,6 @@ static int scanlog_open(struct inode * inode, struct file * file) | |||
146 | struct proc_dir_entry *dp = PDE(inode); | 141 | struct proc_dir_entry *dp = PDE(inode); |
147 | unsigned int *data = (unsigned int *)dp->data; | 142 | unsigned int *data = (unsigned int *)dp->data; |
148 | 143 | ||
149 | if (!data) { | ||
150 | printk(KERN_ERR "scanlog: open failed no data\n"); | ||
151 | return -EIO; | ||
152 | } | ||
153 | |||
154 | if (data[0] != 0) { | 144 | if (data[0] != 0) { |
155 | /* This imperfect test stops a second copy of the | 145 | /* This imperfect test stops a second copy of the |
156 | * data (or a reset while data is being copied) | 146 | * data (or a reset while data is being copied) |
@@ -168,10 +158,6 @@ static int scanlog_release(struct inode * inode, struct file * file) | |||
168 | struct proc_dir_entry *dp = PDE(inode); | 158 | struct proc_dir_entry *dp = PDE(inode); |
169 | unsigned int *data = (unsigned int *)dp->data; | 159 | unsigned int *data = (unsigned int *)dp->data; |
170 | 160 | ||
171 | if (!data) { | ||
172 | printk(KERN_ERR "scanlog: release failed no data\n"); | ||
173 | return -EIO; | ||
174 | } | ||
175 | data[0] = 0; | 161 | data[0] = 0; |
176 | 162 | ||
177 | return 0; | 163 | return 0; |
@@ -200,12 +186,11 @@ static int __init scanlog_init(void) | |||
200 | if (!data) | 186 | if (!data) |
201 | goto err; | 187 | goto err; |
202 | 188 | ||
203 | ent = proc_create("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, | 189 | ent = proc_create_data("ppc64/rtas/scan-log-dump", S_IRUSR, NULL, |
204 | &scanlog_fops); | 190 | &scanlog_fops, data); |
205 | if (!ent) | 191 | if (!ent) |
206 | goto err; | 192 | goto err; |
207 | 193 | ||
208 | ent->data = data; | ||
209 | proc_ppc64_scan_log_dump = ent; | 194 | proc_ppc64_scan_log_dump = ent; |
210 | 195 | ||
211 | return 0; | 196 | return 0; |
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index b59408798fd8..3a7054e2bb75 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -418,22 +418,21 @@ arch_initcall(gfar_of_init); | |||
418 | #include <linux/i2c.h> | 418 | #include <linux/i2c.h> |
419 | struct i2c_driver_device { | 419 | struct i2c_driver_device { |
420 | char *of_device; | 420 | char *of_device; |
421 | char *i2c_driver; | ||
422 | char *i2c_type; | 421 | char *i2c_type; |
423 | }; | 422 | }; |
424 | 423 | ||
425 | static struct i2c_driver_device i2c_devices[] __initdata = { | 424 | static struct i2c_driver_device i2c_devices[] __initdata = { |
426 | {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",}, | 425 | {"ricoh,rs5c372a", "rs5c372a"}, |
427 | {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",}, | 426 | {"ricoh,rs5c372b", "rs5c372b"}, |
428 | {"ricoh,rv5c386", "rtc-rs5c372", "rv5c386",}, | 427 | {"ricoh,rv5c386", "rv5c386"}, |
429 | {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",}, | 428 | {"ricoh,rv5c387a", "rv5c387a"}, |
430 | {"dallas,ds1307", "rtc-ds1307", "ds1307",}, | 429 | {"dallas,ds1307", "ds1307"}, |
431 | {"dallas,ds1337", "rtc-ds1307", "ds1337",}, | 430 | {"dallas,ds1337", "ds1337"}, |
432 | {"dallas,ds1338", "rtc-ds1307", "ds1338",}, | 431 | {"dallas,ds1338", "ds1338"}, |
433 | {"dallas,ds1339", "rtc-ds1307", "ds1339",}, | 432 | {"dallas,ds1339", "ds1339"}, |
434 | {"dallas,ds1340", "rtc-ds1307", "ds1340",}, | 433 | {"dallas,ds1340", "ds1340"}, |
435 | {"stm,m41t00", "rtc-ds1307", "m41t00"}, | 434 | {"stm,m41t00", "m41t00"}, |
436 | {"dallas,ds1374", "rtc-ds1374", "rtc-ds1374",}, | 435 | {"dallas,ds1374", "rtc-ds1374"}, |
437 | }; | 436 | }; |
438 | 437 | ||
439 | static int __init of_find_i2c_driver(struct device_node *node, | 438 | static int __init of_find_i2c_driver(struct device_node *node, |
@@ -444,9 +443,7 @@ static int __init of_find_i2c_driver(struct device_node *node, | |||
444 | for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { | 443 | for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) { |
445 | if (!of_device_is_compatible(node, i2c_devices[i].of_device)) | 444 | if (!of_device_is_compatible(node, i2c_devices[i].of_device)) |
446 | continue; | 445 | continue; |
447 | if (strlcpy(info->driver_name, i2c_devices[i].i2c_driver, | 446 | if (strlcpy(info->type, i2c_devices[i].i2c_type, |
448 | KOBJ_NAME_LEN) >= KOBJ_NAME_LEN || | ||
449 | strlcpy(info->type, i2c_devices[i].i2c_type, | ||
450 | I2C_NAME_SIZE) >= I2C_NAME_SIZE) | 447 | I2C_NAME_SIZE) >= I2C_NAME_SIZE) |
451 | return -ENOMEM; | 448 | return -ENOMEM; |
452 | return 0; | 449 | return 0; |
diff --git a/arch/powerpc/sysdev/ppc4xx_pci.c b/arch/powerpc/sysdev/ppc4xx_pci.c index 1814adbd2236..b4a54c52e880 100644 --- a/arch/powerpc/sysdev/ppc4xx_pci.c +++ b/arch/powerpc/sysdev/ppc4xx_pci.c | |||
@@ -1387,28 +1387,59 @@ static void __init ppc4xx_configure_pciex_PIMs(struct ppc4xx_pciex_port *port, | |||
1387 | resource_size_t size = res->end - res->start + 1; | 1387 | resource_size_t size = res->end - res->start + 1; |
1388 | u64 sa; | 1388 | u64 sa; |
1389 | 1389 | ||
1390 | /* Calculate window size */ | 1390 | if (port->endpoint) { |
1391 | sa = (0xffffffffffffffffull << ilog2(size));; | 1391 | resource_size_t ep_addr = 0; |
1392 | if (res->flags & IORESOURCE_PREFETCH) | 1392 | resource_size_t ep_size = 32 << 20; |
1393 | sa |= 0x8; | 1393 | |
1394 | /* Currently we map a fixed 64MByte window to PLB address | ||
1395 | * 0 (SDRAM). This should probably be configurable via a dts | ||
1396 | * property. | ||
1397 | */ | ||
1398 | |||
1399 | /* Calculate window size */ | ||
1400 | sa = (0xffffffffffffffffull << ilog2(ep_size));; | ||
1401 | |||
1402 | /* Setup BAR0 */ | ||
1403 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | ||
1404 | out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa) | | ||
1405 | PCI_BASE_ADDRESS_MEM_TYPE_64); | ||
1394 | 1406 | ||
1395 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | 1407 | /* Disable BAR1 & BAR2 */ |
1396 | out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa)); | 1408 | out_le32(mbase + PECFG_BAR1MPA, 0); |
1409 | out_le32(mbase + PECFG_BAR2HMPA, 0); | ||
1410 | out_le32(mbase + PECFG_BAR2LMPA, 0); | ||
1397 | 1411 | ||
1398 | /* The setup of the split looks weird to me ... let's see if it works */ | 1412 | out_le32(mbase + PECFG_PIM01SAH, RES_TO_U32_HIGH(sa)); |
1399 | out_le32(mbase + PECFG_PIM0LAL, 0x00000000); | 1413 | out_le32(mbase + PECFG_PIM01SAL, RES_TO_U32_LOW(sa)); |
1400 | out_le32(mbase + PECFG_PIM0LAH, 0x00000000); | 1414 | |
1401 | out_le32(mbase + PECFG_PIM1LAL, 0x00000000); | 1415 | out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(ep_addr)); |
1402 | out_le32(mbase + PECFG_PIM1LAH, 0x00000000); | 1416 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(ep_addr)); |
1403 | out_le32(mbase + PECFG_PIM01SAH, 0xffff0000); | 1417 | } else { |
1404 | out_le32(mbase + PECFG_PIM01SAL, 0x00000000); | 1418 | /* Calculate window size */ |
1419 | sa = (0xffffffffffffffffull << ilog2(size));; | ||
1420 | if (res->flags & IORESOURCE_PREFETCH) | ||
1421 | sa |= 0x8; | ||
1422 | |||
1423 | out_le32(mbase + PECFG_BAR0HMPA, RES_TO_U32_HIGH(sa)); | ||
1424 | out_le32(mbase + PECFG_BAR0LMPA, RES_TO_U32_LOW(sa)); | ||
1425 | |||
1426 | /* The setup of the split looks weird to me ... let's see | ||
1427 | * if it works | ||
1428 | */ | ||
1429 | out_le32(mbase + PECFG_PIM0LAL, 0x00000000); | ||
1430 | out_le32(mbase + PECFG_PIM0LAH, 0x00000000); | ||
1431 | out_le32(mbase + PECFG_PIM1LAL, 0x00000000); | ||
1432 | out_le32(mbase + PECFG_PIM1LAH, 0x00000000); | ||
1433 | out_le32(mbase + PECFG_PIM01SAH, 0xffff0000); | ||
1434 | out_le32(mbase + PECFG_PIM01SAL, 0x00000000); | ||
1435 | |||
1436 | out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(res->start)); | ||
1437 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(res->start)); | ||
1438 | } | ||
1405 | 1439 | ||
1406 | /* Enable inbound mapping */ | 1440 | /* Enable inbound mapping */ |
1407 | out_le32(mbase + PECFG_PIMEN, 0x1); | 1441 | out_le32(mbase + PECFG_PIMEN, 0x1); |
1408 | 1442 | ||
1409 | out_le32(mbase + PCI_BASE_ADDRESS_0, RES_TO_U32_LOW(res->start)); | ||
1410 | out_le32(mbase + PCI_BASE_ADDRESS_1, RES_TO_U32_HIGH(res->start)); | ||
1411 | |||
1412 | /* Enable I/O, Mem, and Busmaster cycles */ | 1443 | /* Enable I/O, Mem, and Busmaster cycles */ |
1413 | out_le16(mbase + PCI_COMMAND, | 1444 | out_le16(mbase + PCI_COMMAND, |
1414 | in_le16(mbase + PCI_COMMAND) | | 1445 | in_le16(mbase + PCI_COMMAND) | |
@@ -1422,13 +1453,8 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1422 | const int *bus_range; | 1453 | const int *bus_range; |
1423 | int primary = 0, busses; | 1454 | int primary = 0, busses; |
1424 | void __iomem *mbase = NULL, *cfg_data = NULL; | 1455 | void __iomem *mbase = NULL, *cfg_data = NULL; |
1425 | 1456 | const u32 *pval; | |
1426 | /* XXX FIXME: Handle endpoint mode properly */ | 1457 | u32 val; |
1427 | if (port->endpoint) { | ||
1428 | printk(KERN_WARNING "PCIE%d: Port in endpoint mode !\n", | ||
1429 | port->index); | ||
1430 | return; | ||
1431 | } | ||
1432 | 1458 | ||
1433 | /* Check if primary bridge */ | 1459 | /* Check if primary bridge */ |
1434 | if (of_get_property(port->node, "primary", NULL)) | 1460 | if (of_get_property(port->node, "primary", NULL)) |
@@ -1462,21 +1488,30 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1462 | hose->last_busno = hose->first_busno + busses; | 1488 | hose->last_busno = hose->first_busno + busses; |
1463 | } | 1489 | } |
1464 | 1490 | ||
1465 | /* We map the external config space in cfg_data and the host config | 1491 | if (!port->endpoint) { |
1466 | * space in cfg_addr. External space is 1M per bus, internal space | 1492 | /* Only map the external config space in cfg_data for |
1467 | * is 4K | 1493 | * PCIe root-complexes. External space is 1M per bus |
1494 | */ | ||
1495 | cfg_data = ioremap(port->cfg_space.start + | ||
1496 | (hose->first_busno + 1) * 0x100000, | ||
1497 | busses * 0x100000); | ||
1498 | if (cfg_data == NULL) { | ||
1499 | printk(KERN_ERR "%s: Can't map external config space !", | ||
1500 | port->node->full_name); | ||
1501 | goto fail; | ||
1502 | } | ||
1503 | hose->cfg_data = cfg_data; | ||
1504 | } | ||
1505 | |||
1506 | /* Always map the host config space in cfg_addr. | ||
1507 | * Internal space is 4K | ||
1468 | */ | 1508 | */ |
1469 | cfg_data = ioremap(port->cfg_space.start + | ||
1470 | (hose->first_busno + 1) * 0x100000, | ||
1471 | busses * 0x100000); | ||
1472 | mbase = ioremap(port->cfg_space.start + 0x10000000, 0x1000); | 1509 | mbase = ioremap(port->cfg_space.start + 0x10000000, 0x1000); |
1473 | if (cfg_data == NULL || mbase == NULL) { | 1510 | if (mbase == NULL) { |
1474 | printk(KERN_ERR "%s: Can't map config space !", | 1511 | printk(KERN_ERR "%s: Can't map internal config space !", |
1475 | port->node->full_name); | 1512 | port->node->full_name); |
1476 | goto fail; | 1513 | goto fail; |
1477 | } | 1514 | } |
1478 | |||
1479 | hose->cfg_data = cfg_data; | ||
1480 | hose->cfg_addr = mbase; | 1515 | hose->cfg_addr = mbase; |
1481 | 1516 | ||
1482 | pr_debug("PCIE %s, bus %d..%d\n", port->node->full_name, | 1517 | pr_debug("PCIE %s, bus %d..%d\n", port->node->full_name, |
@@ -1489,12 +1524,14 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1489 | port->hose = hose; | 1524 | port->hose = hose; |
1490 | mbase = (void __iomem *)hose->cfg_addr; | 1525 | mbase = (void __iomem *)hose->cfg_addr; |
1491 | 1526 | ||
1492 | /* | 1527 | if (!port->endpoint) { |
1493 | * Set bus numbers on our root port | 1528 | /* |
1494 | */ | 1529 | * Set bus numbers on our root port |
1495 | out_8(mbase + PCI_PRIMARY_BUS, hose->first_busno); | 1530 | */ |
1496 | out_8(mbase + PCI_SECONDARY_BUS, hose->first_busno + 1); | 1531 | out_8(mbase + PCI_PRIMARY_BUS, hose->first_busno); |
1497 | out_8(mbase + PCI_SUBORDINATE_BUS, hose->last_busno); | 1532 | out_8(mbase + PCI_SECONDARY_BUS, hose->first_busno + 1); |
1533 | out_8(mbase + PCI_SUBORDINATE_BUS, hose->last_busno); | ||
1534 | } | ||
1498 | 1535 | ||
1499 | /* | 1536 | /* |
1500 | * OMRs are already reset, also disable PIMs | 1537 | * OMRs are already reset, also disable PIMs |
@@ -1515,17 +1552,49 @@ static void __init ppc4xx_pciex_port_setup_hose(struct ppc4xx_pciex_port *port) | |||
1515 | ppc4xx_configure_pciex_PIMs(port, hose, mbase, &dma_window); | 1552 | ppc4xx_configure_pciex_PIMs(port, hose, mbase, &dma_window); |
1516 | 1553 | ||
1517 | /* The root complex doesn't show up if we don't set some vendor | 1554 | /* The root complex doesn't show up if we don't set some vendor |
1518 | * and device IDs into it. Those are the same bogus one that the | 1555 | * and device IDs into it. The defaults below are the same bogus |
1519 | * initial code in arch/ppc add. We might want to change that. | 1556 | * one that the initial code in arch/ppc had. This can be |
1557 | * overwritten by setting the "vendor-id/device-id" properties | ||
1558 | * in the pciex node. | ||
1520 | */ | 1559 | */ |
1521 | out_le16(mbase + 0x200, 0xaaa0 + port->index); | ||
1522 | out_le16(mbase + 0x202, 0xbed0 + port->index); | ||
1523 | 1560 | ||
1524 | /* Set Class Code to PCI-PCI bridge and Revision Id to 1 */ | 1561 | /* Get the (optional) vendor-/device-id from the device-tree */ |
1525 | out_le32(mbase + 0x208, 0x06040001); | 1562 | pval = of_get_property(port->node, "vendor-id", NULL); |
1563 | if (pval) { | ||
1564 | val = *pval; | ||
1565 | } else { | ||
1566 | if (!port->endpoint) | ||
1567 | val = 0xaaa0 + port->index; | ||
1568 | else | ||
1569 | val = 0xeee0 + port->index; | ||
1570 | } | ||
1571 | out_le16(mbase + 0x200, val); | ||
1572 | |||
1573 | pval = of_get_property(port->node, "device-id", NULL); | ||
1574 | if (pval) { | ||
1575 | val = *pval; | ||
1576 | } else { | ||
1577 | if (!port->endpoint) | ||
1578 | val = 0xbed0 + port->index; | ||
1579 | else | ||
1580 | val = 0xfed0 + port->index; | ||
1581 | } | ||
1582 | out_le16(mbase + 0x202, val); | ||
1583 | |||
1584 | if (!port->endpoint) { | ||
1585 | /* Set Class Code to PCI-PCI bridge and Revision Id to 1 */ | ||
1586 | out_le32(mbase + 0x208, 0x06040001); | ||
1587 | |||
1588 | printk(KERN_INFO "PCIE%d: successfully set as root-complex\n", | ||
1589 | port->index); | ||
1590 | } else { | ||
1591 | /* Set Class Code to Processor/PPC */ | ||
1592 | out_le32(mbase + 0x208, 0x0b200001); | ||
1593 | |||
1594 | printk(KERN_INFO "PCIE%d: successfully set as endpoint\n", | ||
1595 | port->index); | ||
1596 | } | ||
1526 | 1597 | ||
1527 | printk(KERN_INFO "PCIE%d: successfully set as root-complex\n", | ||
1528 | port->index); | ||
1529 | return; | 1598 | return; |
1530 | fail: | 1599 | fail: |
1531 | if (hose) | 1600 | if (hose) |
@@ -1542,6 +1611,7 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np) | |||
1542 | const u32 *pval; | 1611 | const u32 *pval; |
1543 | int portno; | 1612 | int portno; |
1544 | unsigned int dcrs; | 1613 | unsigned int dcrs; |
1614 | const char *val; | ||
1545 | 1615 | ||
1546 | /* First, proceed to core initialization as we assume there's | 1616 | /* First, proceed to core initialization as we assume there's |
1547 | * only one PCIe core in the system | 1617 | * only one PCIe core in the system |
@@ -1573,8 +1643,20 @@ static void __init ppc4xx_probe_pciex_bridge(struct device_node *np) | |||
1573 | } | 1643 | } |
1574 | port->sdr_base = *pval; | 1644 | port->sdr_base = *pval; |
1575 | 1645 | ||
1576 | /* XXX Currently, we only support root complex mode */ | 1646 | /* Check if device_type property is set to "pci" or "pci-endpoint". |
1577 | port->endpoint = 0; | 1647 | * Resulting from this setup this PCIe port will be configured |
1648 | * as root-complex or as endpoint. | ||
1649 | */ | ||
1650 | val = of_get_property(port->node, "device_type", NULL); | ||
1651 | if (!strcmp(val, "pci-endpoint")) { | ||
1652 | port->endpoint = 1; | ||
1653 | } else if (!strcmp(val, "pci")) { | ||
1654 | port->endpoint = 0; | ||
1655 | } else { | ||
1656 | printk(KERN_ERR "PCIE: missing or incorrect device_type for %s\n", | ||
1657 | np->full_name); | ||
1658 | return; | ||
1659 | } | ||
1578 | 1660 | ||
1579 | /* Fetch config space registers address */ | 1661 | /* Fetch config space registers address */ |
1580 | if (of_address_to_resource(np, 0, &port->cfg_space)) { | 1662 | if (of_address_to_resource(np, 0, &port->cfg_space)) { |