aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/kernel/process.c3
-rw-r--r--arch/alpha/kernel/systbls.S5
-rw-r--r--arch/arm/boot/compressed/head-shark.S42
-rw-r--r--arch/arm/configs/bast_defconfig1
-rw-r--r--arch/arm/configs/s3c2410_defconfig1
-rw-r--r--arch/arm/kernel/process.c4
-rw-r--r--arch/arm/kernel/smp.c7
-rw-r--r--arch/arm/lib/bitops.h8
-rw-r--r--arch/arm/mach-integrator/platsmp.c10
-rw-r--r--arch/arm/mach-s3c2410/Makefile2
-rw-r--r--arch/arm/mach-s3c2410/clock.c57
-rw-r--r--arch/arm/mach-s3c2410/dma.c2
-rw-r--r--arch/arm/mach-s3c2410/irq.c260
-rw-r--r--arch/arm/mach-s3c2410/irq.h99
-rw-r--r--arch/arm/mach-s3c2410/mach-bast.c48
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-clock.c116
-rw-r--r--arch/arm/mach-s3c2410/s3c2440-irq.c207
-rw-r--r--arch/arm/mm/mm-armv.c3
-rw-r--r--arch/arm/nwfpe/fpa11.h4
-rw-r--r--arch/arm/nwfpe/fpmodule.c2
-rw-r--r--arch/arm/nwfpe/fpmodule.inl14
-rw-r--r--arch/arm26/kernel/process.c5
-rw-r--r--arch/cris/Kconfig.debug5
-rw-r--r--arch/cris/Makefile66
-rw-r--r--arch/cris/arch-v10/Kconfig31
-rw-r--r--arch/cris/arch-v10/boot/Makefile9
-rw-r--r--arch/cris/arch-v10/boot/compressed/Makefile43
-rw-r--r--arch/cris/arch-v10/boot/compressed/head.S22
-rw-r--r--arch/cris/arch-v10/boot/rescue/Makefile45
-rw-r--r--arch/cris/arch-v10/boot/rescue/head.S33
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig250
-rw-r--r--arch/cris/arch-v10/drivers/axisflashmap.c5
-rw-r--r--arch/cris/arch-v10/drivers/ds1302.c71
-rw-r--r--arch/cris/arch-v10/drivers/eeprom.c29
-rw-r--r--arch/cris/arch-v10/drivers/gpio.c201
-rw-r--r--arch/cris/arch-v10/drivers/i2c.c62
-rw-r--r--arch/cris/arch-v10/drivers/pcf8563.c20
-rw-r--r--arch/cris/arch-v10/kernel/Makefile5
-rw-r--r--arch/cris/arch-v10/kernel/debugport.c273
-rw-r--r--arch/cris/arch-v10/kernel/dma.c287
-rw-r--r--arch/cris/arch-v10/kernel/entry.S54
-rw-r--r--arch/cris/arch-v10/kernel/fasttimer.c55
-rw-r--r--arch/cris/arch-v10/kernel/head.S126
-rw-r--r--arch/cris/arch-v10/kernel/io_interface_mux.c879
-rw-r--r--arch/cris/arch-v10/kernel/irq.c76
-rw-r--r--arch/cris/arch-v10/kernel/kgdb.c17
-rw-r--r--arch/cris/arch-v10/kernel/process.c3
-rw-r--r--arch/cris/arch-v10/kernel/ptrace.c9
-rw-r--r--arch/cris/arch-v10/kernel/shadows.c3
-rw-r--r--arch/cris/arch-v10/kernel/traps.c37
-rw-r--r--arch/cris/arch-v10/mm/fault.c26
-rw-r--r--arch/cris/arch-v10/mm/init.c2
-rw-r--r--arch/cris/arch-v10/mm/tlb.c49
-rw-r--r--arch/cris/arch-v32/Kconfig296
-rw-r--r--arch/cris/arch-v32/boot/Makefile14
-rw-r--r--arch/cris/arch-v32/boot/compressed/Makefile41
-rw-r--r--arch/cris/arch-v32/boot/compressed/README25
-rw-r--r--arch/cris/arch-v32/boot/compressed/decompress.ld30
-rw-r--r--arch/cris/arch-v32/boot/compressed/head.S193
-rw-r--r--arch/cris/arch-v32/boot/compressed/misc.c318
-rw-r--r--arch/cris/arch-v32/boot/rescue/Makefile36
-rw-r--r--arch/cris/arch-v32/boot/rescue/head.S39
-rw-r--r--arch/cris/arch-v32/boot/rescue/rescue.ld20
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig625
-rw-r--r--arch/cris/arch-v32/drivers/Makefile13
-rw-r--r--arch/cris/arch-v32/drivers/axisflashmap.c455
-rw-r--r--arch/cris/arch-v32/drivers/cryptocop.c3522
-rw-r--r--arch/cris/arch-v32/drivers/gpio.c766
-rw-r--r--arch/cris/arch-v32/drivers/i2c.c611
-rw-r--r--arch/cris/arch-v32/drivers/i2c.h15
-rw-r--r--arch/cris/arch-v32/drivers/iop_fw_load.c219
-rw-r--r--arch/cris/arch-v32/drivers/nandflash.c157
-rw-r--r--arch/cris/arch-v32/drivers/pcf8563.c341
-rw-r--r--arch/cris/arch-v32/drivers/pci/Makefile5
-rw-r--r--arch/cris/arch-v32/drivers/pci/bios.c131
-rw-r--r--arch/cris/arch-v32/drivers/pci/dma.c149
-rw-r--r--arch/cris/arch-v32/drivers/sync_serial.c1283
-rw-r--r--arch/cris/arch-v32/kernel/Makefile21
-rw-r--r--arch/cris/arch-v32/kernel/arbiter.c297
-rw-r--r--arch/cris/arch-v32/kernel/asm-offsets.c49
-rw-r--r--arch/cris/arch-v32/kernel/crisksyms.c24
-rw-r--r--arch/cris/arch-v32/kernel/debugport.c461
-rw-r--r--arch/cris/arch-v32/kernel/dma.c224
-rw-r--r--arch/cris/arch-v32/kernel/entry.S820
-rw-r--r--arch/cris/arch-v32/kernel/fasttimer.c996
-rw-r--r--arch/cris/arch-v32/kernel/head.S448
-rw-r--r--arch/cris/arch-v32/kernel/io.c154
-rw-r--r--arch/cris/arch-v32/kernel/irq.c413
-rw-r--r--arch/cris/arch-v32/kernel/kgdb.c1660
-rw-r--r--arch/cris/arch-v32/kernel/kgdb_asm.S552
-rw-r--r--arch/cris/arch-v32/kernel/pinmux.c229
-rw-r--r--arch/cris/arch-v32/kernel/process.c270
-rw-r--r--arch/cris/arch-v32/kernel/ptrace.c597
-rw-r--r--arch/cris/arch-v32/kernel/setup.c118
-rw-r--r--arch/cris/arch-v32/kernel/signal.c708
-rw-r--r--arch/cris/arch-v32/kernel/smp.c348
-rw-r--r--arch/cris/arch-v32/kernel/time.c341
-rw-r--r--arch/cris/arch-v32/kernel/traps.c160
-rw-r--r--arch/cris/arch-v32/kernel/vcs_hook.c96
-rw-r--r--arch/cris/arch-v32/kernel/vcs_hook.h42
-rw-r--r--arch/cris/arch-v32/lib/Makefile6
-rw-r--r--arch/cris/arch-v32/lib/checksum.S111
-rw-r--r--arch/cris/arch-v32/lib/checksumcopy.S120
-rw-r--r--arch/cris/arch-v32/lib/csumcpfruser.S69
-rw-r--r--arch/cris/arch-v32/lib/dram_init.S120
-rw-r--r--arch/cris/arch-v32/lib/hw_settings.S73
-rw-r--r--arch/cris/arch-v32/lib/memset.c253
-rw-r--r--arch/cris/arch-v32/lib/nand_init.S179
-rw-r--r--arch/cris/arch-v32/lib/spinlock.S33
-rw-r--r--arch/cris/arch-v32/lib/string.c219
-rw-r--r--arch/cris/arch-v32/lib/usercopy.c470
-rw-r--r--arch/cris/arch-v32/mm/Makefile3
-rw-r--r--arch/cris/arch-v32/mm/init.c174
-rw-r--r--arch/cris/arch-v32/mm/intmem.c139
-rw-r--r--arch/cris/arch-v32/mm/mmu.S141
-rw-r--r--arch/cris/arch-v32/mm/tlb.c208
-rw-r--r--arch/cris/arch-v32/output_arch.ld2
-rw-r--r--arch/cris/arch-v32/vmlinux.lds.S134
-rw-r--r--arch/cris/defconfig376
-rw-r--r--arch/cris/kernel/Makefile3
-rw-r--r--arch/cris/kernel/crisksyms.c21
-rw-r--r--arch/cris/kernel/irq.c263
-rw-r--r--arch/cris/kernel/module.c39
-rw-r--r--arch/cris/kernel/process.c40
-rw-r--r--arch/cris/kernel/profile.c73
-rw-r--r--arch/cris/kernel/ptrace.c37
-rw-r--r--arch/cris/kernel/setup.c26
-rw-r--r--arch/cris/kernel/time.c18
-rw-r--r--arch/cris/kernel/traps.c64
-rw-r--r--arch/cris/mm/fault.c95
-rw-r--r--arch/cris/mm/ioremap.c58
-rw-r--r--arch/cris/mm/tlb.c25
-rw-r--r--arch/h8300/kernel/process.c6
-rw-r--r--arch/i386/Kconfig.debug3
-rw-r--r--arch/i386/kernel/apm.c7
-rw-r--r--arch/i386/kernel/cpu/intel_cacheinfo.c20
-rw-r--r--arch/i386/kernel/numaq.c9
-rw-r--r--arch/i386/kernel/process.c2
-rw-r--r--arch/i386/kernel/reboot.c19
-rw-r--r--arch/i386/mach-visws/reboot.c5
-rw-r--r--arch/i386/mach-voyager/voyager_basic.c5
-rw-r--r--arch/i386/pci/irq.c7
-rw-r--r--arch/ia64/kernel/entry.S6
-rw-r--r--arch/ia64/kernel/process.c5
-rw-r--r--arch/ia64/kernel/unwind.c12
-rw-r--r--arch/ia64/sn/kernel/xpc_main.c2
-rw-r--r--arch/m32r/Kconfig.debug3
-rw-r--r--arch/m32r/kernel/process.c6
-rw-r--r--arch/m68k/kernel/process.c6
-rw-r--r--arch/m68knommu/kernel/process.c6
-rw-r--r--arch/mips/Kconfig35
-rw-r--r--arch/mips/kernel/irixsig.c2
-rw-r--r--arch/mips/kernel/reset.c5
-rw-r--r--arch/mips/kernel/signal32.c2
-rw-r--r--arch/mips/vr41xx/common/Makefile2
-rw-r--r--arch/mips/vr41xx/common/giu.c455
-rw-r--r--arch/parisc/kernel/pci.c18
-rw-r--r--arch/parisc/kernel/process.c6
-rw-r--r--arch/ppc/Kconfig20
-rw-r--r--arch/ppc/configs/common_defconfig781
-rw-r--r--arch/ppc/configs/pmac_defconfig542
-rw-r--r--arch/ppc/configs/radstone_ppc7d_defconfig234
-rw-r--r--arch/ppc/configs/sandpoint_defconfig2
-rw-r--r--arch/ppc/kernel/head_8xx.S12
-rw-r--r--arch/ppc/kernel/setup.c6
-rw-r--r--arch/ppc/mm/init.c3
-rw-r--r--arch/ppc/platforms/4xx/ibm440sp.c4
-rw-r--r--arch/ppc/platforms/85xx/mpc8560_ads.c1
-rw-r--r--arch/ppc/platforms/85xx/mpc85xx_cds_common.c2
-rw-r--r--arch/ppc/platforms/85xx/stx_gp3.c3
-rw-r--r--arch/ppc/platforms/pmac_setup.c16
-rw-r--r--arch/ppc/platforms/prpmc750.c1
-rw-r--r--arch/ppc/platforms/sandpoint.c17
-rw-r--r--arch/ppc/platforms/tqm8260_setup.c2
-rw-r--r--arch/ppc/syslib/cpm2_common.c1
-rw-r--r--arch/ppc/syslib/m8260_setup.c3
-rw-r--r--arch/ppc/syslib/m82xx_pci.c6
-rw-r--r--arch/ppc/syslib/mpc10x_common.c53
-rw-r--r--arch/ppc/syslib/ppc85xx_setup.c4
-rw-r--r--arch/ppc64/Kconfig1
-rw-r--r--arch/ppc64/configs/g5_defconfig371
-rw-r--r--arch/ppc64/configs/iSeries_defconfig322
-rw-r--r--arch/ppc64/configs/maple_defconfig220
-rw-r--r--arch/ppc64/configs/pSeries_defconfig379
-rw-r--r--arch/ppc64/defconfig382
-rw-r--r--arch/ppc64/kernel/LparData.c88
-rw-r--r--arch/ppc64/kernel/head.S40
-rw-r--r--arch/ppc64/kernel/pmac_setup.c12
-rw-r--r--arch/ppc64/kernel/setup.c5
-rw-r--r--arch/ppc64/kernel/smp.c15
-rw-r--r--arch/ppc64/kernel/udbg.c2
-rw-r--r--arch/ppc64/mm/stab.c35
-rw-r--r--arch/s390/kernel/entry.S6
-rw-r--r--arch/s390/kernel/entry64.S6
-rw-r--r--arch/s390/kernel/head.S9
-rw-r--r--arch/s390/kernel/head64.S5
-rw-r--r--arch/s390/kernel/s390_ext.c16
-rw-r--r--arch/s390/kernel/setup.c12
-rw-r--r--arch/s390/kernel/smp.c10
-rw-r--r--arch/s390/lib/Makefile4
-rw-r--r--arch/s390/lib/spinlock.c133
-rw-r--r--arch/sh/kernel/process.c6
-rw-r--r--arch/sh/kernel/signal.c2
-rw-r--r--arch/sh64/kernel/signal.c2
-rw-r--r--arch/sparc/kernel/process.c6
-rw-r--r--arch/sparc/kernel/systbls.S4
-rw-r--r--arch/sparc64/kernel/entry.S17
-rw-r--r--arch/sparc64/kernel/irq.c20
-rw-r--r--arch/sparc64/kernel/power.c2
-rw-r--r--arch/sparc64/kernel/process.c6
-rw-r--r--arch/sparc64/kernel/smp.c2
-rw-r--r--arch/sparc64/kernel/systbls.S8
-rw-r--r--arch/sparc64/kernel/traps.c2
-rw-r--r--arch/sparc64/mm/init.c23
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/Makefile-i3861
-rw-r--r--arch/um/drivers/Makefile4
-rw-r--r--arch/um/drivers/cow.h4
-rw-r--r--arch/um/drivers/hostaudio_kern.c4
-rw-r--r--arch/um/drivers/mconsole_kern.c2
-rw-r--r--arch/um/kernel/exitcode.c2
-rw-r--r--arch/um/kernel/helper.c14
-rw-r--r--arch/um/kernel/process.c83
-rw-r--r--arch/um/kernel/process_kern.c2
-rw-r--r--arch/um/kernel/reboot.c6
-rw-r--r--arch/um/kernel/skas/process.c2
-rw-r--r--arch/um/kernel/skas/syscall_user.c4
-rw-r--r--arch/um/kernel/skas/trap_user.c1
-rw-r--r--arch/um/kernel/time_kern.c5
-rw-r--r--arch/um/kernel/um_arch.c19
-rw-r--r--arch/um/os-Linux/elf_aux.c1
-rw-r--r--arch/um/os-Linux/user_syms.c3
-rw-r--r--arch/um/sys-i386/stub_segv.c6
-rw-r--r--arch/v850/Makefile7
-rw-r--r--arch/v850/README64
-rw-r--r--arch/v850/configs/rte-ma1-cb_defconfig605
-rw-r--r--arch/v850/configs/rte-me2-cb_defconfig453
-rw-r--r--arch/v850/configs/sim_defconfig442
-rw-r--r--arch/v850/kernel/anna.c6
-rw-r--r--arch/v850/kernel/as85ep1.c6
-rw-r--r--arch/v850/kernel/fpga85e2c.c6
-rw-r--r--arch/v850/kernel/rte_cb.c6
-rw-r--r--arch/v850/kernel/rte_mb_a_pci.c37
-rw-r--r--arch/v850/kernel/sim.c6
-rw-r--r--arch/v850/kernel/sim85e2.c5
-rw-r--r--arch/v850/kernel/vmlinux.lds.S14
-rw-r--r--arch/x86_64/Kconfig5
-rw-r--r--arch/x86_64/Makefile12
-rw-r--r--arch/x86_64/defconfig224
-rw-r--r--arch/x86_64/ia32/Makefile4
-rw-r--r--arch/x86_64/ia32/ia32_aout.c6
-rw-r--r--arch/x86_64/ia32/ia32entry.S8
-rw-r--r--arch/x86_64/ia32/sys_ia32.c5
-rw-r--r--arch/x86_64/ia32/syscall32.c10
-rw-r--r--arch/x86_64/ia32/syscall32_syscall.S17
-rw-r--r--arch/x86_64/kernel/entry.S22
-rw-r--r--arch/x86_64/kernel/genapic.c33
-rw-r--r--arch/x86_64/kernel/genapic_flat.c142
-rw-r--r--arch/x86_64/kernel/head.S16
-rw-r--r--arch/x86_64/kernel/irq.c19
-rw-r--r--arch/x86_64/kernel/mce.c93
-rw-r--r--arch/x86_64/kernel/mpparse.c17
-rw-r--r--arch/x86_64/kernel/reboot.c31
-rw-r--r--arch/x86_64/kernel/setup.c5
-rw-r--r--arch/x86_64/kernel/setup64.c18
-rw-r--r--arch/x86_64/kernel/smp.c3
-rw-r--r--arch/x86_64/kernel/smpboot.c75
-rw-r--r--arch/x86_64/kernel/traps.c3
-rw-r--r--arch/x86_64/lib/delay.c2
-rw-r--r--arch/x86_64/mm/fault.c1
-rw-r--r--arch/x86_64/mm/numa.c50
-rw-r--r--arch/x86_64/mm/srat.c22
-rw-r--r--arch/x86_64/pci/k8-bus.c2
273 files changed, 28589 insertions, 4235 deletions
diff --git a/arch/alpha/kernel/process.c b/arch/alpha/kernel/process.c
index 4933f3ce5833..fa98dae3cd98 100644
--- a/arch/alpha/kernel/process.c
+++ b/arch/alpha/kernel/process.c
@@ -165,7 +165,6 @@ machine_restart(char *restart_cmd)
165 common_shutdown(LINUX_REBOOT_CMD_RESTART, restart_cmd); 165 common_shutdown(LINUX_REBOOT_CMD_RESTART, restart_cmd);
166} 166}
167 167
168EXPORT_SYMBOL(machine_restart);
169 168
170void 169void
171machine_halt(void) 170machine_halt(void)
@@ -173,7 +172,6 @@ machine_halt(void)
173 common_shutdown(LINUX_REBOOT_CMD_HALT, NULL); 172 common_shutdown(LINUX_REBOOT_CMD_HALT, NULL);
174} 173}
175 174
176EXPORT_SYMBOL(machine_halt);
177 175
178void 176void
179machine_power_off(void) 177machine_power_off(void)
@@ -181,7 +179,6 @@ machine_power_off(void)
181 common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL); 179 common_shutdown(LINUX_REBOOT_CMD_POWER_OFF, NULL);
182} 180}
183 181
184EXPORT_SYMBOL(machine_power_off);
185 182
186/* Used by sysrq-p, among others. I don't believe r9-r15 are ever 183/* Used by sysrq-p, among others. I don't believe r9-r15 are ever
187 saved in the context it's used. */ 184 saved in the context it's used. */
diff --git a/arch/alpha/kernel/systbls.S b/arch/alpha/kernel/systbls.S
index 052120882876..4342cea1a926 100644
--- a/arch/alpha/kernel/systbls.S
+++ b/arch/alpha/kernel/systbls.S
@@ -461,6 +461,11 @@ sys_call_table:
461 .quad sys_add_key 461 .quad sys_add_key
462 .quad sys_request_key /* 440 */ 462 .quad sys_request_key /* 440 */
463 .quad sys_keyctl 463 .quad sys_keyctl
464 .quad sys_ioprio_set
465 .quad sys_ioprio_get
466 .quad sys_inotify_init
467 .quad sys_inotify_add_watch /* 445 */
468 .quad sys_inotify_rm_watch
464 469
465 .size sys_call_table, . - sys_call_table 470 .size sys_call_table, . - sys_call_table
466 .type sys_call_table, @object 471 .type sys_call_table, @object
diff --git a/arch/arm/boot/compressed/head-shark.S b/arch/arm/boot/compressed/head-shark.S
index 848f60e5429b..089c560e07f1 100644
--- a/arch/arm/boot/compressed/head-shark.S
+++ b/arch/arm/boot/compressed/head-shark.S
@@ -63,8 +63,8 @@ __beginning: mov r4, r0 @ save the entry to the firmware
63 63
64 mov pc, r2 64 mov pc, r2
65 65
66__copy_target: .long 0x08508000 66__copy_target: .long 0x08507FFC
67__copy_end: .long 0x08608000 67__copy_end: .long 0x08607FFC
68 68
69 .word _start 69 .word _start
70 .word __bss_start 70 .word __bss_start
@@ -73,9 +73,10 @@ __copy_end: .long 0x08608000
73__temp_stack: .space 128 73__temp_stack: .space 128
74 74
75__mmu_off: 75__mmu_off:
76 adr r0, __ofw_data 76 adr r0, __ofw_data @ read the 1. entry of the memory map
77 ldr r0, [r0, #4] 77 ldr r0, [r0, #4]
78 orr r0, r0, #0x00600000 78 orr r0, r0, #0x00600000
79 sub r0, r0, #4
79 80
80 ldr r1, __copy_end 81 ldr r1, __copy_end
81 ldr r3, __copy_target 82 ldr r3, __copy_target
@@ -89,20 +90,43 @@ __mmu_off:
89 * from 0x08500000 to 0x08508000 if we have only 8MB 90 * from 0x08500000 to 0x08508000 if we have only 8MB
90 */ 91 */
91 92
93/* As we get more 2.6-kernels it gets more and more
94 * uncomfortable to be bound to kernel images of 1MB only.
95 * So we add a loop here, to be able to copy some more.
96 * Alexander Schulz 2005-07-17
97 */
98
99 mov r4, #3 @ How many megabytes to copy
100
101
102__MoveCode: sub r4, r4, #1
92 103
93__Copy: ldr r2, [r0], #-4 104__Copy: ldr r2, [r0], #-4
94 str r2, [r1], #-4 105 str r2, [r1], #-4
95 teq r1, r3 106 teq r1, r3
96 bne __Copy 107 bne __Copy
108
109 /* The firmware maps us in blocks of 1 MB, the next block is
110 _below_ the last one. So our decrementing source pointer
111 ist right here, but the destination pointer must be increased
112 by 2 MB */
113 add r1, r1, #0x00200000
114 add r3, r3, #0x00100000
115
116 teq r4, #0
117 bne __MoveCode
118
119
97 /* and jump to it */ 120 /* and jump to it */
98 adr r2, __go_on 121 adr r2, __go_on @ where we want to jump
99 adr r0, __ofw_data 122 adr r0, __ofw_data @ read the 1. entry of the memory map
100 ldr r0, [r0, #4] 123 ldr r0, [r0, #4]
101 sub r2, r2, r0 124 sub r2, r2, r0 @ we are mapped add 0e50 now, sub that (-0e00)
102 sub r2, r2, #0x00500000 125 sub r2, r2, #0x00500000 @ -0050
103 ldr r0, __copy_target 126 ldr r0, __copy_target @ and add 0850 8000 instead
127 add r0, r0, #4
104 add r2, r2, r0 128 add r2, r2, r0
105 mov pc, r2 129 mov pc, r2 @ and jump there
106 130
107__go_on: 131__go_on:
108 adr sp, __temp_stack 132 adr sp, __temp_stack
diff --git a/arch/arm/configs/bast_defconfig b/arch/arm/configs/bast_defconfig
index 2d985e9611cd..35e3a99bcbb6 100644
--- a/arch/arm/configs/bast_defconfig
+++ b/arch/arm/configs/bast_defconfig
@@ -561,7 +561,6 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
561# 561#
562CONFIG_SERIAL_S3C2410=y 562CONFIG_SERIAL_S3C2410=y
563CONFIG_SERIAL_S3C2410_CONSOLE=y 563CONFIG_SERIAL_S3C2410_CONSOLE=y
564CONFIG_SERIAL_BAST_SIO=y
565CONFIG_SERIAL_CORE=y 564CONFIG_SERIAL_CORE=y
566CONFIG_SERIAL_CORE_CONSOLE=y 565CONFIG_SERIAL_CORE_CONSOLE=y
567CONFIG_UNIX98_PTYS=y 566CONFIG_UNIX98_PTYS=y
diff --git a/arch/arm/configs/s3c2410_defconfig b/arch/arm/configs/s3c2410_defconfig
index 98b72ff38832..96a794d8de84 100644
--- a/arch/arm/configs/s3c2410_defconfig
+++ b/arch/arm/configs/s3c2410_defconfig
@@ -570,7 +570,6 @@ CONFIG_SERIAL_8250_SHARE_IRQ=y
570# 570#
571CONFIG_SERIAL_S3C2410=y 571CONFIG_SERIAL_S3C2410=y
572CONFIG_SERIAL_S3C2410_CONSOLE=y 572CONFIG_SERIAL_S3C2410_CONSOLE=y
573CONFIG_SERIAL_BAST_SIO=y
574CONFIG_SERIAL_CORE=y 573CONFIG_SERIAL_CORE=y
575CONFIG_SERIAL_CORE_CONSOLE=y 574CONFIG_SERIAL_CORE_CONSOLE=y
576CONFIG_UNIX98_PTYS=y 575CONFIG_UNIX98_PTYS=y
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index bbea636ff687..409db6d5ec99 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -131,7 +131,6 @@ void machine_halt(void)
131{ 131{
132} 132}
133 133
134EXPORT_SYMBOL(machine_halt);
135 134
136void machine_power_off(void) 135void machine_power_off(void)
137{ 136{
@@ -139,7 +138,6 @@ void machine_power_off(void)
139 pm_power_off(); 138 pm_power_off();
140} 139}
141 140
142EXPORT_SYMBOL(machine_power_off);
143 141
144void machine_restart(char * __unused) 142void machine_restart(char * __unused)
145{ 143{
@@ -169,8 +167,6 @@ void machine_restart(char * __unused)
169 while (1); 167 while (1);
170} 168}
171 169
172EXPORT_SYMBOL(machine_restart);
173
174void __show_regs(struct pt_regs *regs) 170void __show_regs(struct pt_regs *regs)
175{ 171{
176 unsigned long flags = condition_codes(regs); 172 unsigned long flags = condition_codes(regs);
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index 7ae45c3fc834..b2085735a2ba 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -78,7 +78,7 @@ struct smp_call_struct {
78static struct smp_call_struct * volatile smp_call_function_data; 78static struct smp_call_struct * volatile smp_call_function_data;
79static DEFINE_SPINLOCK(smp_call_function_lock); 79static DEFINE_SPINLOCK(smp_call_function_lock);
80 80
81int __init __cpu_up(unsigned int cpu) 81int __cpuinit __cpu_up(unsigned int cpu)
82{ 82{
83 struct task_struct *idle; 83 struct task_struct *idle;
84 pgd_t *pgd; 84 pgd_t *pgd;
@@ -159,7 +159,7 @@ int __init __cpu_up(unsigned int cpu)
159 * This is the secondary CPU boot entry. We're using this CPUs 159 * This is the secondary CPU boot entry. We're using this CPUs
160 * idle thread stack, but a set of temporary page tables. 160 * idle thread stack, but a set of temporary page tables.
161 */ 161 */
162asmlinkage void __init secondary_start_kernel(void) 162asmlinkage void __cpuinit secondary_start_kernel(void)
163{ 163{
164 struct mm_struct *mm = &init_mm; 164 struct mm_struct *mm = &init_mm;
165 unsigned int cpu = smp_processor_id(); 165 unsigned int cpu = smp_processor_id();
@@ -176,6 +176,7 @@ asmlinkage void __init secondary_start_kernel(void)
176 cpu_set(cpu, mm->cpu_vm_mask); 176 cpu_set(cpu, mm->cpu_vm_mask);
177 cpu_switch_mm(mm->pgd, mm); 177 cpu_switch_mm(mm->pgd, mm);
178 enter_lazy_tlb(mm, current); 178 enter_lazy_tlb(mm, current);
179 local_flush_tlb_all();
179 180
180 cpu_init(); 181 cpu_init();
181 182
@@ -209,7 +210,7 @@ asmlinkage void __init secondary_start_kernel(void)
209 * Called by both boot and secondaries to move global data into 210 * Called by both boot and secondaries to move global data into
210 * per-processor storage. 211 * per-processor storage.
211 */ 212 */
212void __init smp_store_cpu_info(unsigned int cpuid) 213void __cpuinit smp_store_cpu_info(unsigned int cpuid)
213{ 214{
214 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid); 215 struct cpuinfo_arm *cpu_info = &per_cpu(cpu_data, cpuid);
215 216
diff --git a/arch/arm/lib/bitops.h b/arch/arm/lib/bitops.h
index 6976e60e47cb..2036ff15bda9 100644
--- a/arch/arm/lib/bitops.h
+++ b/arch/arm/lib/bitops.h
@@ -7,7 +7,7 @@
71: ldrexb r2, [r1] 71: ldrexb r2, [r1]
8 \instr r2, r2, r3 8 \instr r2, r2, r3
9 strexb r0, r2, [r1] 9 strexb r0, r2, [r1]
10 cmpne r0, #0 10 cmp r0, #0
11 bne 1b 11 bne 1b
12 mov pc, lr 12 mov pc, lr
13 .endm 13 .endm
@@ -19,9 +19,9 @@
19 mov r3, r2, lsl r3 @ create mask 19 mov r3, r2, lsl r3 @ create mask
201: ldrexb r2, [r1] 201: ldrexb r2, [r1]
21 ands r0, r2, r3 @ save old value of bit 21 ands r0, r2, r3 @ save old value of bit
22 \instr ip, r2, r3 @ toggle bit 22 \instr r2, r2, r3 @ toggle bit
23 strexb r2, ip, [r1] 23 strexb ip, r2, [r1]
24 cmp r2, #0 24 cmp ip, #0
25 bne 1b 25 bne 1b
26 cmp r0, #0 26 cmp r0, #0
27 movne r0, #1 27 movne r0, #1
diff --git a/arch/arm/mach-integrator/platsmp.c b/arch/arm/mach-integrator/platsmp.c
index 2ba025777098..ea10bd8c972c 100644
--- a/arch/arm/mach-integrator/platsmp.c
+++ b/arch/arm/mach-integrator/platsmp.c
@@ -15,6 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16 16
17#include <asm/atomic.h> 17#include <asm/atomic.h>
18#include <asm/cacheflush.h>
18#include <asm/delay.h> 19#include <asm/delay.h>
19#include <asm/mmu_context.h> 20#include <asm/mmu_context.h>
20#include <asm/procinfo.h> 21#include <asm/procinfo.h>
@@ -27,12 +28,12 @@ extern void integrator_secondary_startup(void);
27 * control for which core is the next to come out of the secondary 28 * control for which core is the next to come out of the secondary
28 * boot "holding pen" 29 * boot "holding pen"
29 */ 30 */
30volatile int __initdata pen_release = -1; 31volatile int __cpuinitdata pen_release = -1;
31unsigned long __initdata phys_pen_release = 0; 32unsigned long __cpuinitdata phys_pen_release = 0;
32 33
33static DEFINE_SPINLOCK(boot_lock); 34static DEFINE_SPINLOCK(boot_lock);
34 35
35void __init platform_secondary_init(unsigned int cpu) 36void __cpuinit platform_secondary_init(unsigned int cpu)
36{ 37{
37 /* 38 /*
38 * the primary core may have used a "cross call" soft interrupt 39 * the primary core may have used a "cross call" soft interrupt
@@ -61,7 +62,7 @@ void __init platform_secondary_init(unsigned int cpu)
61 spin_unlock(&boot_lock); 62 spin_unlock(&boot_lock);
62} 63}
63 64
64int __init boot_secondary(unsigned int cpu, struct task_struct *idle) 65int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
65{ 66{
66 unsigned long timeout; 67 unsigned long timeout;
67 68
@@ -80,6 +81,7 @@ int __init boot_secondary(unsigned int cpu, struct task_struct *idle)
80 * "cpu" is Linux's internal ID. 81 * "cpu" is Linux's internal ID.
81 */ 82 */
82 pen_release = cpu; 83 pen_release = cpu;
84 flush_cache_all();
83 85
84 /* 86 /*
85 * XXX 87 * XXX
diff --git a/arch/arm/mach-s3c2410/Makefile b/arch/arm/mach-s3c2410/Makefile
index f99b689e4392..55ed7c7e57da 100644
--- a/arch/arm/mach-s3c2410/Makefile
+++ b/arch/arm/mach-s3c2410/Makefile
@@ -23,6 +23,8 @@ obj-$(CONFIG_PM_SIMTEC) += pm-simtec.o
23# S3C2440 support 23# S3C2440 support
24 24
25obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o 25obj-$(CONFIG_CPU_S3C2440) += s3c2440.o s3c2440-dsc.o
26obj-$(CONFIG_CPU_S3C2440) += s3c2440-irq.o
27obj-$(CONFIG_CPU_S3C2440) += s3c2440-clock.o
26 28
27# machine specific support 29# machine specific support
28 30
diff --git a/arch/arm/mach-s3c2410/clock.c b/arch/arm/mach-s3c2410/clock.c
index 8d986b8401c2..9a66050e887d 100644
--- a/arch/arm/mach-s3c2410/clock.c
+++ b/arch/arm/mach-s3c2410/clock.c
@@ -448,60 +448,3 @@ int __init s3c24xx_setup_clocks(unsigned long xtal,
448 448
449 return 0; 449 return 0;
450} 450}
451
452/* S3C2440 extended clock support */
453
454#ifdef CONFIG_CPU_S3C2440
455
456static struct clk s3c2440_clk_upll = {
457 .name = "upll",
458 .id = -1,
459};
460
461static struct clk s3c2440_clk_cam = {
462 .name = "camif",
463 .parent = &clk_h,
464 .id = -1,
465 .enable = s3c24xx_clkcon_enable,
466 .ctrlbit = S3C2440_CLKCON_CAMERA,
467};
468
469static struct clk s3c2440_clk_ac97 = {
470 .name = "ac97",
471 .parent = &clk_p,
472 .id = -1,
473 .enable = s3c24xx_clkcon_enable,
474 .ctrlbit = S3C2440_CLKCON_CAMERA,
475};
476
477static int s3c2440_clk_add(struct sys_device *sysdev)
478{
479 unsigned long upllcon = __raw_readl(S3C2410_UPLLCON);
480
481 s3c2440_clk_upll.rate = s3c2410_get_pll(upllcon, clk_xtal.rate);
482
483 printk("S3C2440: Clock Support, UPLL %ld.%03ld MHz\n",
484 print_mhz(s3c2440_clk_upll.rate));
485
486 s3c24xx_register_clock(&s3c2440_clk_ac97);
487 s3c24xx_register_clock(&s3c2440_clk_cam);
488 s3c24xx_register_clock(&s3c2440_clk_upll);
489
490 clk_disable(&s3c2440_clk_ac97);
491 clk_disable(&s3c2440_clk_cam);
492
493 return 0;
494}
495
496static struct sysdev_driver s3c2440_clk_driver = {
497 .add = s3c2440_clk_add,
498};
499
500static int s3c24xx_clk_driver(void)
501{
502 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver);
503}
504
505arch_initcall(s3c24xx_clk_driver);
506
507#endif /* CONFIG_CPU_S3C2440 */
diff --git a/arch/arm/mach-s3c2410/dma.c b/arch/arm/mach-s3c2410/dma.c
index c7c28890d406..65feaf20d23e 100644
--- a/arch/arm/mach-s3c2410/dma.c
+++ b/arch/arm/mach-s3c2410/dma.c
@@ -436,7 +436,7 @@ int s3c2410_dma_enqueue(unsigned int channel, void *id,
436 436
437 buf = kmem_cache_alloc(dma_kmem, GFP_ATOMIC); 437 buf = kmem_cache_alloc(dma_kmem, GFP_ATOMIC);
438 if (buf == NULL) { 438 if (buf == NULL) {
439 pr_debug("%s: out of memory (%d alloc)\n", 439 pr_debug("%s: out of memory (%ld alloc)\n",
440 __FUNCTION__, sizeof(*buf)); 440 __FUNCTION__, sizeof(*buf));
441 return -ENOMEM; 441 return -ENOMEM;
442 } 442 }
diff --git a/arch/arm/mach-s3c2410/irq.c b/arch/arm/mach-s3c2410/irq.c
index cf9f46d88061..973a5fe6769c 100644
--- a/arch/arm/mach-s3c2410/irq.c
+++ b/arch/arm/mach-s3c2410/irq.c
@@ -45,6 +45,9 @@
45 * 45 *
46 * 28-Jun-2005 Ben Dooks 46 * 28-Jun-2005 Ben Dooks
47 * Mark IRQ_LCD valid 47 * Mark IRQ_LCD valid
48 *
49 * 25-Jul-2005 Ben Dooks
50 * Split the S3C2440 IRQ code to seperate file
48*/ 51*/
49 52
50#include <linux/init.h> 53#include <linux/init.h>
@@ -65,11 +68,7 @@
65 68
66#include "cpu.h" 69#include "cpu.h"
67#include "pm.h" 70#include "pm.h"
68 71#include "irq.h"
69#define irqdbf(x...)
70#define irqdbf2(x...)
71
72#define EXTINT_OFF (IRQ_EINT4 - 4)
73 72
74/* wakeup irq control */ 73/* wakeup irq control */
75 74
@@ -181,7 +180,7 @@ s3c_irq_unmask(unsigned int irqno)
181 __raw_writel(mask, S3C2410_INTMSK); 180 __raw_writel(mask, S3C2410_INTMSK);
182} 181}
183 182
184static struct irqchip s3c_irq_level_chip = { 183struct irqchip s3c_irq_level_chip = {
185 .ack = s3c_irq_maskack, 184 .ack = s3c_irq_maskack,
186 .mask = s3c_irq_mask, 185 .mask = s3c_irq_mask,
187 .unmask = s3c_irq_unmask, 186 .unmask = s3c_irq_unmask,
@@ -370,84 +369,6 @@ static struct irqchip s3c_irq_eint0t4 = {
370#define INTMSK_UART2 (1UL << (IRQ_UART2 - IRQ_EINT0)) 369#define INTMSK_UART2 (1UL << (IRQ_UART2 - IRQ_EINT0))
371#define INTMSK_ADCPARENT (1UL << (IRQ_ADCPARENT - IRQ_EINT0)) 370#define INTMSK_ADCPARENT (1UL << (IRQ_ADCPARENT - IRQ_EINT0))
372 371
373static inline void
374s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
375 int subcheck)
376{
377 unsigned long mask;
378 unsigned long submask;
379
380 submask = __raw_readl(S3C2410_INTSUBMSK);
381 mask = __raw_readl(S3C2410_INTMSK);
382
383 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
384
385 /* check to see if we need to mask the parent IRQ */
386
387 if ((submask & subcheck) == subcheck) {
388 __raw_writel(mask | parentbit, S3C2410_INTMSK);
389 }
390
391 /* write back masks */
392 __raw_writel(submask, S3C2410_INTSUBMSK);
393
394}
395
396static inline void
397s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
398{
399 unsigned long mask;
400 unsigned long submask;
401
402 submask = __raw_readl(S3C2410_INTSUBMSK);
403 mask = __raw_readl(S3C2410_INTMSK);
404
405 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
406 mask &= ~parentbit;
407
408 /* write back masks */
409 __raw_writel(submask, S3C2410_INTSUBMSK);
410 __raw_writel(mask, S3C2410_INTMSK);
411}
412
413
414static inline void
415s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
416{
417 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
418
419 s3c_irqsub_mask(irqno, parentmask, group);
420
421 __raw_writel(bit, S3C2410_SUBSRCPND);
422
423 /* only ack parent if we've got all the irqs (seems we must
424 * ack, all and hope that the irq system retriggers ok when
425 * the interrupt goes off again)
426 */
427
428 if (1) {
429 __raw_writel(parentmask, S3C2410_SRCPND);
430 __raw_writel(parentmask, S3C2410_INTPND);
431 }
432}
433
434static inline void
435s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
436{
437 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
438
439 __raw_writel(bit, S3C2410_SUBSRCPND);
440
441 /* only ack parent if we've got all the irqs (seems we must
442 * ack, all and hope that the irq system retriggers ok when
443 * the interrupt goes off again)
444 */
445
446 if (1) {
447 __raw_writel(parentmask, S3C2410_SRCPND);
448 __raw_writel(parentmask, S3C2410_INTPND);
449 }
450}
451 372
452/* UART0 */ 373/* UART0 */
453 374
@@ -794,174 +715,3 @@ void __init s3c24xx_init_irq(void)
794 715
795 irqdbf("s3c2410: registered interrupt handlers\n"); 716 irqdbf("s3c2410: registered interrupt handlers\n");
796} 717}
797
798/* s3c2440 irq code
799*/
800
801#ifdef CONFIG_CPU_S3C2440
802
803/* WDT/AC97 */
804
805static void s3c_irq_demux_wdtac97(unsigned int irq,
806 struct irqdesc *desc,
807 struct pt_regs *regs)
808{
809 unsigned int subsrc, submsk;
810 struct irqdesc *mydesc;
811
812 /* read the current pending interrupts, and the mask
813 * for what it is available */
814
815 subsrc = __raw_readl(S3C2410_SUBSRCPND);
816 submsk = __raw_readl(S3C2410_INTSUBMSK);
817
818 subsrc &= ~submsk;
819 subsrc >>= 13;
820 subsrc &= 3;
821
822 if (subsrc != 0) {
823 if (subsrc & 1) {
824 mydesc = irq_desc + IRQ_S3C2440_WDT;
825 mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
826 }
827 if (subsrc & 2) {
828 mydesc = irq_desc + IRQ_S3C2440_AC97;
829 mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
830 }
831 }
832}
833
834
835#define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0))
836
837static void
838s3c_irq_wdtac97_mask(unsigned int irqno)
839{
840 s3c_irqsub_mask(irqno, INTMSK_WDT, 3<<13);
841}
842
843static void
844s3c_irq_wdtac97_unmask(unsigned int irqno)
845{
846 s3c_irqsub_unmask(irqno, INTMSK_WDT);
847}
848
849static void
850s3c_irq_wdtac97_ack(unsigned int irqno)
851{
852 s3c_irqsub_maskack(irqno, INTMSK_WDT, 3<<13);
853}
854
855static struct irqchip s3c_irq_wdtac97 = {
856 .mask = s3c_irq_wdtac97_mask,
857 .unmask = s3c_irq_wdtac97_unmask,
858 .ack = s3c_irq_wdtac97_ack,
859};
860
861/* camera irq */
862
863static void s3c_irq_demux_cam(unsigned int irq,
864 struct irqdesc *desc,
865 struct pt_regs *regs)
866{
867 unsigned int subsrc, submsk;
868 struct irqdesc *mydesc;
869
870 /* read the current pending interrupts, and the mask
871 * for what it is available */
872
873 subsrc = __raw_readl(S3C2410_SUBSRCPND);
874 submsk = __raw_readl(S3C2410_INTSUBMSK);
875
876 subsrc &= ~submsk;
877 subsrc >>= 11;
878 subsrc &= 3;
879
880 if (subsrc != 0) {
881 if (subsrc & 1) {
882 mydesc = irq_desc + IRQ_S3C2440_CAM_C;
883 mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
884 }
885 if (subsrc & 2) {
886 mydesc = irq_desc + IRQ_S3C2440_CAM_P;
887 mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
888 }
889 }
890}
891
892#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
893
894static void
895s3c_irq_cam_mask(unsigned int irqno)
896{
897 s3c_irqsub_mask(irqno, INTMSK_CAM, 3<<11);
898}
899
900static void
901s3c_irq_cam_unmask(unsigned int irqno)
902{
903 s3c_irqsub_unmask(irqno, INTMSK_CAM);
904}
905
906static void
907s3c_irq_cam_ack(unsigned int irqno)
908{
909 s3c_irqsub_maskack(irqno, INTMSK_CAM, 3<<11);
910}
911
912static struct irqchip s3c_irq_cam = {
913 .mask = s3c_irq_cam_mask,
914 .unmask = s3c_irq_cam_unmask,
915 .ack = s3c_irq_cam_ack,
916};
917
918static int s3c2440_irq_add(struct sys_device *sysdev)
919{
920 unsigned int irqno;
921
922 printk("S3C2440: IRQ Support\n");
923
924 set_irq_chip(IRQ_NFCON, &s3c_irq_level_chip);
925 set_irq_handler(IRQ_NFCON, do_level_IRQ);
926 set_irq_flags(IRQ_NFCON, IRQF_VALID);
927
928 /* add new chained handler for wdt, ac7 */
929
930 set_irq_chip(IRQ_WDT, &s3c_irq_level_chip);
931 set_irq_handler(IRQ_WDT, do_level_IRQ);
932 set_irq_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
933
934 for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
935 set_irq_chip(irqno, &s3c_irq_wdtac97);
936 set_irq_handler(irqno, do_level_IRQ);
937 set_irq_flags(irqno, IRQF_VALID);
938 }
939
940 /* add chained handler for camera */
941
942 set_irq_chip(IRQ_CAM, &s3c_irq_level_chip);
943 set_irq_handler(IRQ_CAM, do_level_IRQ);
944 set_irq_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
945
946 for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
947 set_irq_chip(irqno, &s3c_irq_cam);
948 set_irq_handler(irqno, do_level_IRQ);
949 set_irq_flags(irqno, IRQF_VALID);
950 }
951
952 return 0;
953}
954
955static struct sysdev_driver s3c2440_irq_driver = {
956 .add = s3c2440_irq_add,
957};
958
959static int s3c24xx_irq_driver(void)
960{
961 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver);
962}
963
964arch_initcall(s3c24xx_irq_driver);
965
966#endif /* CONFIG_CPU_S3C2440 */
967
diff --git a/arch/arm/mach-s3c2410/irq.h b/arch/arm/mach-s3c2410/irq.h
new file mode 100644
index 000000000000..4abf0ca14e00
--- /dev/null
+++ b/arch/arm/mach-s3c2410/irq.h
@@ -0,0 +1,99 @@
1/* arch/arm/mach-s3c2410/irq.h
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * Header file for S3C24XX CPU IRQ support
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * Modifications:
13*/
14
15#define irqdbf(x...)
16#define irqdbf2(x...)
17
18#define EXTINT_OFF (IRQ_EINT4 - 4)
19
20extern struct irqchip s3c_irq_level_chip;
21
22static inline void
23s3c_irqsub_mask(unsigned int irqno, unsigned int parentbit,
24 int subcheck)
25{
26 unsigned long mask;
27 unsigned long submask;
28
29 submask = __raw_readl(S3C2410_INTSUBMSK);
30 mask = __raw_readl(S3C2410_INTMSK);
31
32 submask |= (1UL << (irqno - IRQ_S3CUART_RX0));
33
34 /* check to see if we need to mask the parent IRQ */
35
36 if ((submask & subcheck) == subcheck) {
37 __raw_writel(mask | parentbit, S3C2410_INTMSK);
38 }
39
40 /* write back masks */
41 __raw_writel(submask, S3C2410_INTSUBMSK);
42
43}
44
45static inline void
46s3c_irqsub_unmask(unsigned int irqno, unsigned int parentbit)
47{
48 unsigned long mask;
49 unsigned long submask;
50
51 submask = __raw_readl(S3C2410_INTSUBMSK);
52 mask = __raw_readl(S3C2410_INTMSK);
53
54 submask &= ~(1UL << (irqno - IRQ_S3CUART_RX0));
55 mask &= ~parentbit;
56
57 /* write back masks */
58 __raw_writel(submask, S3C2410_INTSUBMSK);
59 __raw_writel(mask, S3C2410_INTMSK);
60}
61
62
63static inline void
64s3c_irqsub_maskack(unsigned int irqno, unsigned int parentmask, unsigned int group)
65{
66 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
67
68 s3c_irqsub_mask(irqno, parentmask, group);
69
70 __raw_writel(bit, S3C2410_SUBSRCPND);
71
72 /* only ack parent if we've got all the irqs (seems we must
73 * ack, all and hope that the irq system retriggers ok when
74 * the interrupt goes off again)
75 */
76
77 if (1) {
78 __raw_writel(parentmask, S3C2410_SRCPND);
79 __raw_writel(parentmask, S3C2410_INTPND);
80 }
81}
82
83static inline void
84s3c_irqsub_ack(unsigned int irqno, unsigned int parentmask, unsigned int group)
85{
86 unsigned int bit = 1UL << (irqno - IRQ_S3CUART_RX0);
87
88 __raw_writel(bit, S3C2410_SUBSRCPND);
89
90 /* only ack parent if we've got all the irqs (seems we must
91 * ack, all and hope that the irq system retriggers ok when
92 * the interrupt goes off again)
93 */
94
95 if (1) {
96 __raw_writel(parentmask, S3C2410_SRCPND);
97 __raw_writel(parentmask, S3C2410_INTPND);
98 }
99}
diff --git a/arch/arm/mach-s3c2410/mach-bast.c b/arch/arm/mach-s3c2410/mach-bast.c
index ccb6bcefa46c..1e7f343822d0 100644
--- a/arch/arm/mach-s3c2410/mach-bast.c
+++ b/arch/arm/mach-s3c2410/mach-bast.c
@@ -25,9 +25,11 @@
25 * 14-Jan-2005 BJD Add support for muitlple NAND devices 25 * 14-Jan-2005 BJD Add support for muitlple NAND devices
26 * 03-Mar-2005 BJD Ensured that bast-cpld.h is included 26 * 03-Mar-2005 BJD Ensured that bast-cpld.h is included
27 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA 27 * 10-Mar-2005 LCVR Changed S3C2410_VA to S3C24XX_VA
28 * 14-Mar-2006 BJD Updated for __iomem changes 28 * 14-Mar-2005 BJD Updated for __iomem changes
29 * 22-Jun-2006 BJD Added DM9000 platform information 29 * 22-Jun-2005 BJD Added DM9000 platform information
30 * 28-Jun-2006 BJD Moved pm functionality out to common code 30 * 28-Jun-2005 BJD Moved pm functionality out to common code
31 * 17-Jul-2005 BJD Changed to platform device for SuperIO 16550s
32 * 25-Jul-2005 BJD Removed ASIX static mappings
31*/ 33*/
32 34
33#include <linux/kernel.h> 35#include <linux/kernel.h>
@@ -64,6 +66,8 @@
64#include <linux/mtd/nand_ecc.h> 66#include <linux/mtd/nand_ecc.h>
65#include <linux/mtd/partitions.h> 67#include <linux/mtd/partitions.h>
66 68
69#include <linux/serial_8250.h>
70
67#include "clock.h" 71#include "clock.h"
68#include "devs.h" 72#include "devs.h"
69#include "cpu.h" 73#include "cpu.h"
@@ -113,7 +117,6 @@ static struct map_desc bast_iodesc[] __initdata = {
113 /* slow, byte */ 117 /* slow, byte */
114 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 118 { VA_C2(BAST_VA_ISAIO), PA_CS2(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
115 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 119 { VA_C2(BAST_VA_ISAMEM), PA_CS2(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
116 { VA_C2(BAST_VA_ASIXNET), PA_CS3(BAST_PA_ASIXNET), SZ_1M, MT_DEVICE },
117 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 120 { VA_C2(BAST_VA_SUPERIO), PA_CS2(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
118 { VA_C2(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE }, 121 { VA_C2(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
119 { VA_C2(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE }, 122 { VA_C2(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
@@ -123,7 +126,6 @@ static struct map_desc bast_iodesc[] __initdata = {
123 /* slow, word */ 126 /* slow, word */
124 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 127 { VA_C3(BAST_VA_ISAIO), PA_CS3(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
125 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 128 { VA_C3(BAST_VA_ISAMEM), PA_CS3(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
126 { VA_C3(BAST_VA_ASIXNET), PA_CS3(BAST_PA_ASIXNET), SZ_1M, MT_DEVICE },
127 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 129 { VA_C3(BAST_VA_SUPERIO), PA_CS3(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
128 { VA_C3(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE }, 130 { VA_C3(BAST_VA_IDEPRI), PA_CS3(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
129 { VA_C3(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE }, 131 { VA_C3(BAST_VA_IDESEC), PA_CS3(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
@@ -133,7 +135,6 @@ static struct map_desc bast_iodesc[] __initdata = {
133 /* fast, byte */ 135 /* fast, byte */
134 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 136 { VA_C4(BAST_VA_ISAIO), PA_CS4(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
135 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 137 { VA_C4(BAST_VA_ISAMEM), PA_CS4(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
136 { VA_C4(BAST_VA_ASIXNET), PA_CS5(BAST_PA_ASIXNET), SZ_1M, MT_DEVICE },
137 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 138 { VA_C4(BAST_VA_SUPERIO), PA_CS4(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
138 { VA_C4(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE }, 139 { VA_C4(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
139 { VA_C4(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE }, 140 { VA_C4(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
@@ -143,7 +144,6 @@ static struct map_desc bast_iodesc[] __initdata = {
143 /* fast, word */ 144 /* fast, word */
144 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE }, 145 { VA_C5(BAST_VA_ISAIO), PA_CS5(BAST_PA_ISAIO), SZ_16M, MT_DEVICE },
145 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE }, 146 { VA_C5(BAST_VA_ISAMEM), PA_CS5(BAST_PA_ISAMEM), SZ_16M, MT_DEVICE },
146 { VA_C5(BAST_VA_ASIXNET), PA_CS5(BAST_PA_ASIXNET), SZ_1M, MT_DEVICE },
147 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE }, 147 { VA_C5(BAST_VA_SUPERIO), PA_CS5(BAST_PA_SUPERIO), SZ_1M, MT_DEVICE },
148 { VA_C5(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE }, 148 { VA_C5(BAST_VA_IDEPRI), PA_CS5(BAST_PA_IDEPRI), SZ_1M, MT_DEVICE },
149 { VA_C5(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE }, 149 { VA_C5(BAST_VA_IDESEC), PA_CS5(BAST_PA_IDESEC), SZ_1M, MT_DEVICE },
@@ -351,6 +351,39 @@ static struct platform_device bast_device_dm9k = {
351 } 351 }
352}; 352};
353 353
354/* serial devices */
355
356#define SERIAL_BASE (S3C2410_CS2 + BAST_PA_SUPERIO)
357#define SERIAL_FLAGS (UPF_BOOT_AUTOCONF | UPF_IOREMAP | UPF_SHARE_IRQ)
358#define SERIAL_CLK (1843200)
359
360static struct plat_serial8250_port bast_sio_data[] = {
361 [0] = {
362 .mapbase = SERIAL_BASE + 0x2f8,
363 .irq = IRQ_PCSERIAL1,
364 .flags = SERIAL_FLAGS,
365 .iotype = UPIO_MEM,
366 .regshift = 0,
367 .uartclk = SERIAL_CLK,
368 },
369 [1] = {
370 .mapbase = SERIAL_BASE + 0x3f8,
371 .irq = IRQ_PCSERIAL2,
372 .flags = SERIAL_FLAGS,
373 .iotype = UPIO_MEM,
374 .regshift = 0,
375 .uartclk = SERIAL_CLK,
376 },
377 { }
378};
379
380static struct platform_device bast_sio = {
381 .name = "serial8250",
382 .id = 0,
383 .dev = {
384 .platform_data = &bast_sio_data,
385 },
386};
354 387
355/* Standard BAST devices */ 388/* Standard BAST devices */
356 389
@@ -364,6 +397,7 @@ static struct platform_device *bast_devices[] __initdata = {
364 &s3c_device_nand, 397 &s3c_device_nand,
365 &bast_device_nor, 398 &bast_device_nor,
366 &bast_device_dm9k, 399 &bast_device_dm9k,
400 &bast_sio,
367}; 401};
368 402
369static struct clk *bast_clocks[] = { 403static struct clk *bast_clocks[] = {
diff --git a/arch/arm/mach-s3c2410/s3c2440-clock.c b/arch/arm/mach-s3c2410/s3c2440-clock.c
new file mode 100644
index 000000000000..b018a1f680ce
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2440-clock.c
@@ -0,0 +1,116 @@
1/* linux/arch/arm/mach-s3c2410/s3c2440-clock.c
2 *
3 * Copyright (c) 2004-2005 Simtec Electronics
4 * http://armlinux.simtec.co.uk/
5 * Ben Dooks <ben@simtec.co.uk>
6 *
7 * S3C2440 Clock support
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22*/
23
24#include <linux/init.h>
25#include <linux/module.h>
26#include <linux/kernel.h>
27#include <linux/list.h>
28#include <linux/errno.h>
29#include <linux/err.h>
30#include <linux/device.h>
31#include <linux/sysdev.h>
32
33#include <linux/interrupt.h>
34#include <linux/ioport.h>
35
36#include <asm/hardware.h>
37#include <asm/atomic.h>
38#include <asm/irq.h>
39#include <asm/io.h>
40
41#include <asm/hardware/clock.h>
42#include <asm/arch/regs-clock.h>
43
44#include "clock.h"
45#include "cpu.h"
46
47/* S3C2440 extended clock support */
48
49static struct clk s3c2440_clk_upll = {
50 .name = "upll",
51 .id = -1,
52};
53
54static struct clk s3c2440_clk_cam = {
55 .name = "camif",
56 .id = -1,
57 .enable = s3c24xx_clkcon_enable,
58 .ctrlbit = S3C2440_CLKCON_CAMERA,
59};
60
61static struct clk s3c2440_clk_ac97 = {
62 .name = "ac97",
63 .id = -1,
64 .enable = s3c24xx_clkcon_enable,
65 .ctrlbit = S3C2440_CLKCON_CAMERA,
66};
67
68static int s3c2440_clk_add(struct sys_device *sysdev)
69{
70 unsigned long upllcon = __raw_readl(S3C2410_UPLLCON);
71 struct clk *clk_h;
72 struct clk *clk_p;
73 struct clk *clk_xtal;
74
75 clk_xtal = clk_get(NULL, "xtal");
76 if (IS_ERR(clk_xtal)) {
77 printk(KERN_ERR "S3C2440: Failed to get clk_xtal\n");
78 return -EINVAL;
79 }
80
81 s3c2440_clk_upll.rate = s3c2410_get_pll(upllcon, clk_xtal->rate);
82
83 printk("S3C2440: Clock Support, UPLL %ld.%03ld MHz\n",
84 print_mhz(s3c2440_clk_upll.rate));
85
86 clk_p = clk_get(NULL, "pclk");
87 clk_h = clk_get(NULL, "hclk");
88
89 if (IS_ERR(clk_p) || IS_ERR(clk_h)) {
90 printk(KERN_ERR "S3C2440: Failed to get parent clocks\n");
91 return -EINVAL;
92 }
93
94 s3c2440_clk_cam.parent = clk_h;
95 s3c2440_clk_ac97.parent = clk_p;
96
97 s3c24xx_register_clock(&s3c2440_clk_ac97);
98 s3c24xx_register_clock(&s3c2440_clk_cam);
99 s3c24xx_register_clock(&s3c2440_clk_upll);
100
101 clk_disable(&s3c2440_clk_ac97);
102 clk_disable(&s3c2440_clk_cam);
103
104 return 0;
105}
106
107static struct sysdev_driver s3c2440_clk_driver = {
108 .add = s3c2440_clk_add,
109};
110
111static __init int s3c24xx_clk_driver(void)
112{
113 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_clk_driver);
114}
115
116arch_initcall(s3c24xx_clk_driver);
diff --git a/arch/arm/mach-s3c2410/s3c2440-irq.c b/arch/arm/mach-s3c2410/s3c2440-irq.c
new file mode 100644
index 000000000000..7cb9912242a3
--- /dev/null
+++ b/arch/arm/mach-s3c2410/s3c2440-irq.c
@@ -0,0 +1,207 @@
1/* linux/arch/arm/mach-s3c2410/s3c2440-irq.c
2 *
3 * Copyright (c) 2003,2004 Simtec Electronics
4 * Ben Dooks <ben@simtec.co.uk>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 *
20 * Changelog:
21 * 25-Jul-2005 BJD Split from irq.c
22 *
23*/
24
25#include <linux/init.h>
26#include <linux/module.h>
27#include <linux/interrupt.h>
28#include <linux/ioport.h>
29#include <linux/ptrace.h>
30#include <linux/sysdev.h>
31
32#include <asm/hardware.h>
33#include <asm/irq.h>
34#include <asm/io.h>
35
36#include <asm/mach/irq.h>
37
38#include <asm/arch/regs-irq.h>
39#include <asm/arch/regs-gpio.h>
40
41#include "cpu.h"
42#include "pm.h"
43#include "irq.h"
44
45/* WDT/AC97 */
46
47static void s3c_irq_demux_wdtac97(unsigned int irq,
48 struct irqdesc *desc,
49 struct pt_regs *regs)
50{
51 unsigned int subsrc, submsk;
52 struct irqdesc *mydesc;
53
54 /* read the current pending interrupts, and the mask
55 * for what it is available */
56
57 subsrc = __raw_readl(S3C2410_SUBSRCPND);
58 submsk = __raw_readl(S3C2410_INTSUBMSK);
59
60 subsrc &= ~submsk;
61 subsrc >>= 13;
62 subsrc &= 3;
63
64 if (subsrc != 0) {
65 if (subsrc & 1) {
66 mydesc = irq_desc + IRQ_S3C2440_WDT;
67 mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
68 }
69 if (subsrc & 2) {
70 mydesc = irq_desc + IRQ_S3C2440_AC97;
71 mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
72 }
73 }
74}
75
76
77#define INTMSK_WDT (1UL << (IRQ_WDT - IRQ_EINT0))
78
79static void
80s3c_irq_wdtac97_mask(unsigned int irqno)
81{
82 s3c_irqsub_mask(irqno, INTMSK_WDT, 3<<13);
83}
84
85static void
86s3c_irq_wdtac97_unmask(unsigned int irqno)
87{
88 s3c_irqsub_unmask(irqno, INTMSK_WDT);
89}
90
91static void
92s3c_irq_wdtac97_ack(unsigned int irqno)
93{
94 s3c_irqsub_maskack(irqno, INTMSK_WDT, 3<<13);
95}
96
97static struct irqchip s3c_irq_wdtac97 = {
98 .mask = s3c_irq_wdtac97_mask,
99 .unmask = s3c_irq_wdtac97_unmask,
100 .ack = s3c_irq_wdtac97_ack,
101};
102
103/* camera irq */
104
105static void s3c_irq_demux_cam(unsigned int irq,
106 struct irqdesc *desc,
107 struct pt_regs *regs)
108{
109 unsigned int subsrc, submsk;
110 struct irqdesc *mydesc;
111
112 /* read the current pending interrupts, and the mask
113 * for what it is available */
114
115 subsrc = __raw_readl(S3C2410_SUBSRCPND);
116 submsk = __raw_readl(S3C2410_INTSUBMSK);
117
118 subsrc &= ~submsk;
119 subsrc >>= 11;
120 subsrc &= 3;
121
122 if (subsrc != 0) {
123 if (subsrc & 1) {
124 mydesc = irq_desc + IRQ_S3C2440_CAM_C;
125 mydesc->handle( IRQ_S3C2440_WDT, mydesc, regs);
126 }
127 if (subsrc & 2) {
128 mydesc = irq_desc + IRQ_S3C2440_CAM_P;
129 mydesc->handle(IRQ_S3C2440_AC97, mydesc, regs);
130 }
131 }
132}
133
134#define INTMSK_CAM (1UL << (IRQ_CAM - IRQ_EINT0))
135
136static void
137s3c_irq_cam_mask(unsigned int irqno)
138{
139 s3c_irqsub_mask(irqno, INTMSK_CAM, 3<<11);
140}
141
142static void
143s3c_irq_cam_unmask(unsigned int irqno)
144{
145 s3c_irqsub_unmask(irqno, INTMSK_CAM);
146}
147
148static void
149s3c_irq_cam_ack(unsigned int irqno)
150{
151 s3c_irqsub_maskack(irqno, INTMSK_CAM, 3<<11);
152}
153
154static struct irqchip s3c_irq_cam = {
155 .mask = s3c_irq_cam_mask,
156 .unmask = s3c_irq_cam_unmask,
157 .ack = s3c_irq_cam_ack,
158};
159
160static int s3c2440_irq_add(struct sys_device *sysdev)
161{
162 unsigned int irqno;
163
164 printk("S3C2440: IRQ Support\n");
165
166 set_irq_chip(IRQ_NFCON, &s3c_irq_level_chip);
167 set_irq_handler(IRQ_NFCON, do_level_IRQ);
168 set_irq_flags(IRQ_NFCON, IRQF_VALID);
169
170 /* add new chained handler for wdt, ac7 */
171
172 set_irq_chip(IRQ_WDT, &s3c_irq_level_chip);
173 set_irq_handler(IRQ_WDT, do_level_IRQ);
174 set_irq_chained_handler(IRQ_WDT, s3c_irq_demux_wdtac97);
175
176 for (irqno = IRQ_S3C2440_WDT; irqno <= IRQ_S3C2440_AC97; irqno++) {
177 set_irq_chip(irqno, &s3c_irq_wdtac97);
178 set_irq_handler(irqno, do_level_IRQ);
179 set_irq_flags(irqno, IRQF_VALID);
180 }
181
182 /* add chained handler for camera */
183
184 set_irq_chip(IRQ_CAM, &s3c_irq_level_chip);
185 set_irq_handler(IRQ_CAM, do_level_IRQ);
186 set_irq_chained_handler(IRQ_CAM, s3c_irq_demux_cam);
187
188 for (irqno = IRQ_S3C2440_CAM_C; irqno <= IRQ_S3C2440_CAM_P; irqno++) {
189 set_irq_chip(irqno, &s3c_irq_cam);
190 set_irq_handler(irqno, do_level_IRQ);
191 set_irq_flags(irqno, IRQF_VALID);
192 }
193
194 return 0;
195}
196
197static struct sysdev_driver s3c2440_irq_driver = {
198 .add = s3c2440_irq_add,
199};
200
201static int s3c24xx_irq_driver(void)
202{
203 return sysdev_driver_register(&s3c2440_sysclass, &s3c2440_irq_driver);
204}
205
206arch_initcall(s3c24xx_irq_driver);
207
diff --git a/arch/arm/mm/mm-armv.c b/arch/arm/mm/mm-armv.c
index b19f00e99a21..e33fe4229d05 100644
--- a/arch/arm/mm/mm-armv.c
+++ b/arch/arm/mm/mm-armv.c
@@ -425,6 +425,9 @@ static void __init build_mem_type_table(void)
425 mem_types[MT_ROM].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE; 425 mem_types[MT_ROM].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
426 mem_types[MT_MINICLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE; 426 mem_types[MT_MINICLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
427 mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE; 427 mem_types[MT_CACHECLEAN].prot_sect |= PMD_SECT_APX|PMD_SECT_AP_WRITE;
428
429 mem_types[MT_DEVICE].prot_pte |= L_PTE_BUFFERABLE;
430 mem_types[MT_DEVICE].prot_sect |= PMD_SECT_BUFFERED;
428 } 431 }
429 432
430 cp = &cache_policies[cachepolicy]; 433 cp = &cache_policies[cachepolicy];
diff --git a/arch/arm/nwfpe/fpa11.h b/arch/arm/nwfpe/fpa11.h
index 45cc65426a22..e4a61aea534b 100644
--- a/arch/arm/nwfpe/fpa11.h
+++ b/arch/arm/nwfpe/fpa11.h
@@ -29,9 +29,7 @@
29 * stack+task struct. Use the same method as 'current' uses to 29 * stack+task struct. Use the same method as 'current' uses to
30 * reach them. 30 * reach them.
31 */ 31 */
32register unsigned long *user_registers asm("sl"); 32#define GET_USERREG() ((struct pt_regs *)(THREAD_START_SP + (unsigned long)current_thread_info()) - 1)
33
34#define GET_USERREG() (user_registers)
35 33
36#include <linux/config.h> 34#include <linux/config.h>
37#include <linux/thread_info.h> 35#include <linux/thread_info.h>
diff --git a/arch/arm/nwfpe/fpmodule.c b/arch/arm/nwfpe/fpmodule.c
index a8efcf34888e..12885f31d347 100644
--- a/arch/arm/nwfpe/fpmodule.c
+++ b/arch/arm/nwfpe/fpmodule.c
@@ -132,7 +132,7 @@ void float_raise(signed char flags)
132 printk(KERN_DEBUG 132 printk(KERN_DEBUG
133 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n", 133 "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
134 current->comm, current->pid, flags, 134 current->comm, current->pid, flags,
135 __builtin_return_address(0), GET_USERREG()[15]); 135 __builtin_return_address(0), GET_USERREG()->ARM_pc);
136#endif 136#endif
137 137
138 /* Keep SoftFloat exception flags up to date. */ 138 /* Keep SoftFloat exception flags up to date. */
diff --git a/arch/arm/nwfpe/fpmodule.inl b/arch/arm/nwfpe/fpmodule.inl
index e5f59e9a3022..2c39ad408f22 100644
--- a/arch/arm/nwfpe/fpmodule.inl
+++ b/arch/arm/nwfpe/fpmodule.inl
@@ -28,8 +28,8 @@ static inline unsigned long readRegister(const unsigned int nReg)
28 for this in this routine. LDF/STF instructions with Rn = PC 28 for this in this routine. LDF/STF instructions with Rn = PC
29 depend on the PC being correct, as they use PC+8 in their 29 depend on the PC being correct, as they use PC+8 in their
30 address calculations. */ 30 address calculations. */
31 unsigned long *userRegisters = GET_USERREG(); 31 struct pt_regs *regs = GET_USERREG();
32 unsigned int val = userRegisters[nReg]; 32 unsigned int val = regs->uregs[nReg];
33 if (REG_PC == nReg) 33 if (REG_PC == nReg)
34 val -= 4; 34 val -= 4;
35 return val; 35 return val;
@@ -38,8 +38,8 @@ static inline unsigned long readRegister(const unsigned int nReg)
38static inline void 38static inline void
39writeRegister(const unsigned int nReg, const unsigned long val) 39writeRegister(const unsigned int nReg, const unsigned long val)
40{ 40{
41 unsigned long *userRegisters = GET_USERREG(); 41 struct pt_regs *regs = GET_USERREG();
42 userRegisters[nReg] = val; 42 regs->uregs[nReg] = val;
43} 43}
44 44
45static inline unsigned long readCPSR(void) 45static inline unsigned long readCPSR(void)
@@ -63,12 +63,12 @@ static inline unsigned long readConditionCodes(void)
63 63
64static inline void writeConditionCodes(const unsigned long val) 64static inline void writeConditionCodes(const unsigned long val)
65{ 65{
66 unsigned long *userRegisters = GET_USERREG(); 66 struct pt_regs *regs = GET_USERREG();
67 unsigned long rval; 67 unsigned long rval;
68 /* 68 /*
69 * Operate directly on userRegisters since 69 * Operate directly on userRegisters since
70 * the CPSR may be the PC register itself. 70 * the CPSR may be the PC register itself.
71 */ 71 */
72 rval = userRegisters[REG_CPSR] & ~CC_MASK; 72 rval = regs->ARM_cpsr & ~CC_MASK;
73 userRegisters[REG_CPSR] = rval | (val & CC_MASK); 73 regs->ARM_cpsr = rval | (val & CC_MASK);
74} 74}
diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c
index 46aea6ac194d..9eb9964d32a7 100644
--- a/arch/arm26/kernel/process.c
+++ b/arch/arm26/kernel/process.c
@@ -103,9 +103,6 @@ void machine_power_off(void)
103{ 103{
104} 104}
105 105
106EXPORT_SYMBOL(machine_halt);
107EXPORT_SYMBOL(machine_power_off);
108
109void machine_restart(char * __unused) 106void machine_restart(char * __unused)
110{ 107{
111 /* 108 /*
@@ -136,8 +133,6 @@ void machine_restart(char * __unused)
136 while (1); 133 while (1);
137} 134}
138 135
139EXPORT_SYMBOL(machine_restart);
140
141void show_regs(struct pt_regs * regs) 136void show_regs(struct pt_regs * regs)
142{ 137{
143 unsigned long flags; 138 unsigned long flags;
diff --git a/arch/cris/Kconfig.debug b/arch/cris/Kconfig.debug
index f42918bf22a9..cd72324935c4 100644
--- a/arch/cris/Kconfig.debug
+++ b/arch/cris/Kconfig.debug
@@ -38,4 +38,9 @@ config FRAME_POINTER
38 If you don't debug the kernel, you can say N, but we may not be able 38 If you don't debug the kernel, you can say N, but we may not be able
39 to solve problems without frame pointers. 39 to solve problems without frame pointers.
40 40
41config DEBUG_NMI_OOPS
42 bool "NMI causes oops printout"
43 help
44 If the system locks up without any debug information you can say Y
45 here to make it possible to dump an OOPS with an external NMI.
41endmenu 46endmenu
diff --git a/arch/cris/Makefile b/arch/cris/Makefile
index 9d28fa8563cc..90ca8730b120 100644
--- a/arch/cris/Makefile
+++ b/arch/cris/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.23 2004/10/19 13:07:34 starvik Exp $ 1# $Id: Makefile,v 1.28 2005/03/17 10:44:37 larsv Exp $
2# cris/Makefile 2# cris/Makefile
3# 3#
4# This file is included by the global makefile so that you can add your own 4# This file is included by the global makefile so that you can add your own
@@ -15,6 +15,7 @@
15 15
16arch-y := v10 16arch-y := v10
17arch-$(CONFIG_ETRAX_ARCH_V10) := v10 17arch-$(CONFIG_ETRAX_ARCH_V10) := v10
18arch-$(CONFIG_ETRAX_ARCH_V32) := v32
18 19
19# No config avaiable for make clean etc 20# No config avaiable for make clean etc
20ifneq ($(arch-y),) 21ifneq ($(arch-y),)
@@ -46,6 +47,21 @@ core-y += arch/$(ARCH)/$(SARCH)/kernel/ arch/$(ARCH)/$(SARCH)/mm/
46drivers-y += arch/$(ARCH)/$(SARCH)/drivers/ 47drivers-y += arch/$(ARCH)/$(SARCH)/drivers/
47libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC) 48libs-y += arch/$(ARCH)/$(SARCH)/lib/ $(LIBGCC)
48 49
50# cris source path
51SRC_ARCH = $(srctree)/arch/$(ARCH)
52# cris object files path
53OBJ_ARCH = $(objtree)/arch/$(ARCH)
54
55target_boot_arch_dir = $(OBJ_ARCH)/$(SARCH)/boot
56target_boot_dir = $(OBJ_ARCH)/boot
57src_boot_dir = $(SRC_ARCH)/boot
58target_compressed_dir = $(OBJ_ARCH)/boot/compressed
59src_compressed_dir = $(SRC_ARCH)/boot/compressed
60target_rescue_dir = $(OBJ_ARCH)/boot/rescue
61src_rescue_dir = $(SRC_ARCH)/boot/rescue
62
63export target_boot_arch_dir target_boot_dir src_boot_dir target_compressed_dir src_compressed_dir target_rescue_dir src_rescue_dir
64
49vmlinux.bin: vmlinux 65vmlinux.bin: vmlinux
50 $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin 66 $(OBJCOPY) $(OBJCOPYFLAGS) vmlinux vmlinux.bin
51 67
@@ -65,44 +81,52 @@ cramfs:
65 81
66clinux: vmlinux.bin decompress.bin rescue.bin 82clinux: vmlinux.bin decompress.bin rescue.bin
67 83
68decompress.bin: FORCE 84decompress.bin: $(target_boot_dir)
69 @make -C arch/$(ARCH)/boot/compressed decompress.bin 85 @$(MAKE) -f $(src_compressed_dir)/Makefile $(target_compressed_dir)/decompress.bin
70 86
71rescue.bin: FORCE 87$(target_rescue_dir)/rescue.bin: $(target_boot_dir)
72 @make -C arch/$(ARCH)/boot/rescue rescue.bin 88 @$(MAKE) -f $(src_rescue_dir)/Makefile $(target_rescue_dir)/rescue.bin
73 89
74zImage: vmlinux.bin rescue.bin 90zImage: $(target_boot_dir) vmlinux.bin $(target_rescue_dir)/rescue.bin
75## zImage - Compressed kernel (gzip) 91## zImage - Compressed kernel (gzip)
76 @make -C arch/$(ARCH)/boot/ zImage 92 @$(MAKE) -f $(src_boot_dir)/Makefile zImage
93
94$(target_boot_dir): $(target_boot_arch_dir)
95 ln -sfn $< $@
96
97$(target_boot_arch_dir):
98 mkdir -p $@
77 99
78compressed: zImage 100compressed: zImage
79 101
80archmrproper: 102archmrproper:
81archclean: 103archclean:
82 $(Q)$(MAKE) $(clean)=arch/$(ARCH)/boot 104 @if [ -d arch/$(ARCH)/boot ]; then \
105 $(MAKE) $(clean)=arch/$(ARCH)/boot ; \
106 fi
83 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img 107 rm -f timage vmlinux.bin decompress.bin rescue.bin cramfs.img
84 rm -rf $(LD_SCRIPT).tmp 108 rm -rf $(LD_SCRIPT).tmp
85 109
86prepare: arch/$(ARCH)/.links include/asm-$(ARCH)/.arch \ 110prepare: $(SRC_ARCH)/.links $(srctree)/include/asm-$(ARCH)/.arch \
87 include/asm-$(ARCH)/$(SARCH)/offset.h 111 include/asm-$(ARCH)/$(SARCH)/offset.h
88 112
89# Create some links to make all tools happy 113# Create some links to make all tools happy
90arch/$(ARCH)/.links: 114$(SRC_ARCH)/.links:
91 @rm -rf arch/$(ARCH)/drivers 115 @rm -rf $(SRC_ARCH)/drivers
92 @ln -sfn $(SARCH)/drivers arch/$(ARCH)/drivers 116 @ln -sfn $(SRC_ARCH)/$(SARCH)/drivers $(SRC_ARCH)/drivers
93 @rm -rf arch/$(ARCH)/boot 117 @rm -rf $(SRC_ARCH)/boot
94 @ln -sfn $(SARCH)/boot arch/$(ARCH)/boot 118 @ln -sfn $(SRC_ARCH)/$(SARCH)/boot $(SRC_ARCH)/boot
95 @rm -rf arch/$(ARCH)/lib 119 @rm -rf $(SRC_ARCH)/lib
96 @ln -sfn $(SARCH)/lib arch/$(ARCH)/lib 120 @ln -sfn $(SRC_ARCH)/$(SARCH)/lib $(SRC_ARCH)/lib
97 @ln -sfn $(SARCH) arch/$(ARCH)/arch 121 @ln -sfn $(SRC_ARCH)/$(SARCH) $(SRC_ARCH)/arch
98 @ln -sfn ../$(SARCH)/vmlinux.lds.S arch/$(ARCH)/kernel/vmlinux.lds.S 122 @ln -sfn $(SRC_ARCH)/$(SARCH)/vmlinux.lds.S $(SRC_ARCH)/kernel/vmlinux.lds.S
99 @touch $@ 123 @touch $@
100 124
101# Create link to sub arch includes 125# Create link to sub arch includes
102include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h) 126$(srctree)/include/asm-$(ARCH)/.arch: $(wildcard include/config/arch/*.h)
103 @echo ' Making asm-$(ARCH)/arch -> asm-$(ARCH)/$(SARCH) symlink' 127 @echo ' Making $(srctree)/include/asm-$(ARCH)/arch -> $(srctree)/include/asm-$(ARCH)/$(SARCH) symlink'
104 @rm -f include/asm-$(ARCH)/arch 128 @rm -f include/asm-$(ARCH)/arch
105 @ln -sf $(SARCH) include/asm-$(ARCH)/arch 129 @ln -sf $(srctree)/include/asm-$(ARCH)/$(SARCH) $(srctree)/include/asm-$(ARCH)/arch
106 @touch $@ 130 @touch $@
107 131
108arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \ 132arch/$(ARCH)/$(SARCH)/kernel/asm-offsets.s: include/asm include/linux/version.h \
diff --git a/arch/cris/arch-v10/Kconfig b/arch/cris/arch-v10/Kconfig
index 2ca64cc40c63..44eb1b9accb3 100644
--- a/arch/cris/arch-v10/Kconfig
+++ b/arch/cris/arch-v10/Kconfig
@@ -260,6 +260,37 @@ config ETRAX_DEBUG_PORT_NULL
260endchoice 260endchoice
261 261
262choice 262choice
263 prompt "Kernel GDB port"
264 depends on ETRAX_KGDB
265 default ETRAX_KGDB_PORT0
266 help
267 Choose a serial port for kernel debugging. NOTE: This port should
268 not be enabled under Drivers for built-in interfaces (as it has its
269 own initialization code) and should not be the same as the debug port.
270
271config ETRAX_KGDB_PORT0
272 bool "Serial-0"
273 help
274 Use serial port 0 for kernel debugging.
275
276config ETRAX_KGDB_PORT1
277 bool "Serial-1"
278 help
279 Use serial port 1 for kernel debugging.
280
281config ETRAX_KGDB_PORT2
282 bool "Serial-2"
283 help
284 Use serial port 2 for kernel debugging.
285
286config ETRAX_KGDB_PORT3
287 bool "Serial-3"
288 help
289 Use serial port 3 for kernel debugging.
290
291endchoice
292
293choice
263 prompt "Product rescue-port" 294 prompt "Product rescue-port"
264 depends on ETRAX_ARCH_V10 295 depends on ETRAX_ARCH_V10
265 default ETRAX_RESCUE_SER0 296 default ETRAX_RESCUE_SER0
diff --git a/arch/cris/arch-v10/boot/Makefile b/arch/cris/arch-v10/boot/Makefile
index fe6650368e6a..e5b105851108 100644
--- a/arch/cris/arch-v10/boot/Makefile
+++ b/arch/cris/arch-v10/boot/Makefile
@@ -1,12 +1,13 @@
1# 1#
2# arch/cris/boot/Makefile 2# arch/cris/boot/Makefile
3# 3#
4target = $(target_boot_dir)
5src = $(src_boot_dir)
4 6
5zImage: compressed/vmlinuz 7zImage: compressed/vmlinuz
6 8
7compressed/vmlinuz: $(TOPDIR)/vmlinux 9compressed/vmlinuz:
8 @$(MAKE) -C compressed vmlinuz 10 @$(MAKE) -f $(src)/compressed/Makefile $(target_compressed_dir)/vmlinuz
9 11
10clean: 12clean:
11 rm -f zImage tools/build compressed/vmlinux.out 13 @$(MAKE) -f $(src)/compressed/Makefile clean
12 @$(MAKE) -C compressed clean
diff --git a/arch/cris/arch-v10/boot/compressed/Makefile b/arch/cris/arch-v10/boot/compressed/Makefile
index 5f71c2c819e6..6584a44820f4 100644
--- a/arch/cris/arch-v10/boot/compressed/Makefile
+++ b/arch/cris/arch-v10/boot/compressed/Makefile
@@ -1,40 +1,45 @@
1# 1#
2# linux/arch/etrax100/boot/compressed/Makefile 2# create a compressed vmlinuz image from the binary vmlinux.bin file
3#
4# create a compressed vmlinux image from the original vmlinux files and romfs
5# 3#
4target = $(target_compressed_dir)
5src = $(src_compressed_dir)
6 6
7CC = gcc-cris -melf -I $(TOPDIR)/include 7CC = gcc-cris -melf $(LINUXINCLUDE)
8CFLAGS = -O2 8CFLAGS = -O2
9LD = ld-cris 9LD = ld-cris
10OBJCOPY = objcopy-cris 10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 11OBJCOPYFLAGS = -O binary --remove-section=.bss
12OBJECTS = head.o misc.o 12OBJECTS = $(target)/head.o $(target)/misc.o
13 13
14# files to compress 14# files to compress
15SYSTEM = $(TOPDIR)/vmlinux.bin 15SYSTEM = $(objtree)/vmlinux.bin
16 16
17all: vmlinuz 17all: $(target_compressed_dir)/vmlinuz
18 18
19decompress.bin: $(OBJECTS) 19$(target)/decompress.bin: $(OBJECTS)
20 $(LD) -T decompress.ld -o decompress.o $(OBJECTS) 20 $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
21 $(OBJCOPY) $(OBJCOPYFLAGS) decompress.o decompress.bin 21 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
22# save it for mkprod in the topdir.
23 cp decompress.bin $(TOPDIR)
24 22
23# Create vmlinuz image in top-level build directory
24$(target_compressed_dir)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
25 @echo " COMPR vmlinux.bin --> vmlinuz"
26 @cat $(target)/decompress.bin piggy.img > $(target_compressed_dir)/vmlinuz
27 @rm -f piggy.img
25 28
26vmlinuz: piggy.img decompress.bin 29$(target)/head.o: $(src)/head.S
27 cat decompress.bin piggy.img > vmlinuz 30 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $@
28 rm -f piggy.img
29 31
30head.o: head.S 32$(target)/misc.o: $(src)/misc.c
31 $(CC) -D__ASSEMBLY__ -traditional -c head.S -o head.o 33 $(CC) -D__KERNEL__ -c $< -o $@
32 34
33# gzip the kernel image 35# gzip the kernel image
34 36
35piggy.img: $(SYSTEM) 37piggy.img: $(SYSTEM)
36 cat $(SYSTEM) | gzip -f -9 > piggy.img 38 @cat $(SYSTEM) | gzip -f -9 > piggy.img
39
40$(target):
41 mkdir -p $(target)
37 42
38clean: 43clean:
39 rm -f piggy.img vmlinuz vmlinuz.o 44 rm -f piggy.img $(objtree)/vmlinuz
40 45
diff --git a/arch/cris/arch-v10/boot/compressed/head.S b/arch/cris/arch-v10/boot/compressed/head.S
index 4cbdd4b1d9d6..e73f44c998d9 100644
--- a/arch/cris/arch-v10/boot/compressed/head.S
+++ b/arch/cris/arch-v10/boot/compressed/head.S
@@ -13,7 +13,8 @@
13#include <asm/arch/sv_addr_ag.h> 13#include <asm/arch/sv_addr_ag.h>
14 14
15#define RAM_INIT_MAGIC 0x56902387 15#define RAM_INIT_MAGIC 0x56902387
16 16#define COMMAND_LINE_MAGIC 0x87109563
17
17 ;; Exported symbols 18 ;; Exported symbols
18 19
19 .globl _input_data 20 .globl _input_data
@@ -88,6 +89,12 @@ basse: move.d pc, r5
88 cmp.d r2, r1 89 cmp.d r2, r1
89 bcs 1b 90 bcs 1b
90 nop 91 nop
92
93 ;; Save command line magic and address.
94 move.d _cmd_line_magic, $r12
95 move.d $r10, [$r12]
96 move.d _cmd_line_addr, $r12
97 move.d $r11, [$r12]
91 98
92 ;; Do the decompression and save compressed size in _inptr 99 ;; Do the decompression and save compressed size in _inptr
93 100
@@ -98,7 +105,13 @@ basse: move.d pc, r5
98 105
99 move.d [_input_data], r9 ; flash address of compressed kernel 106 move.d [_input_data], r9 ; flash address of compressed kernel
100 add.d [_inptr], r9 ; size of compressed kernel 107 add.d [_inptr], r9 ; size of compressed kernel
101 108
109 ;; Restore command line magic and address.
110 move.d _cmd_line_magic, $r10
111 move.d [$r10], $r10
112 move.d _cmd_line_addr, $r11
113 move.d [$r11], $r11
114
102 ;; Enter the decompressed kernel 115 ;; Enter the decompressed kernel
103 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized 116 move.d RAM_INIT_MAGIC, r8 ; Tell kernel that DRAM is initialized
104 jump 0x40004000 ; kernel is linked to this address 117 jump 0x40004000 ; kernel is linked to this address
@@ -107,5 +120,8 @@ basse: move.d pc, r5
107 120
108_input_data: 121_input_data:
109 .dword 0 ; used by the decompressor 122 .dword 0 ; used by the decompressor
110 123_cmd_line_magic:
124 .dword 0
125_cmd_line_addr:
126 .dword 0
111#include "../../lib/hw_settings.S" 127#include "../../lib/hw_settings.S"
diff --git a/arch/cris/arch-v10/boot/rescue/Makefile b/arch/cris/arch-v10/boot/rescue/Makefile
index e9f2ba2ad02c..8be9b3130312 100644
--- a/arch/cris/arch-v10/boot/rescue/Makefile
+++ b/arch/cris/arch-v10/boot/rescue/Makefile
@@ -1,52 +1,53 @@
1# 1#
2# Makefile for rescue code 2# Makefile for rescue code
3# 3#
4ifndef TOPDIR 4target = $(target_rescue_dir)
5TOPDIR = ../../../.. 5src = $(src_rescue_dir)
6endif 6
7CC = gcc-cris -mlinux -I $(TOPDIR)/include 7CC = gcc-cris -mlinux $(LINUXINCLUDE)
8CFLAGS = -O2 8CFLAGS = -O2
9LD = gcc-cris -mlinux -nostdlib 9LD = gcc-cris -mlinux -nostdlib
10OBJCOPY = objcopy-cris 10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss 11OBJCOPYFLAGS = -O binary --remove-section=.bss
12 12
13all: rescue.bin testrescue.bin kimagerescue.bin 13all: $(target)/rescue.bin $(target)/testrescue.bin $(target)/kimagerescue.bin
14
15rescue: rescue.bin
16 # do nothing
17 14
18rescue.bin: head.o 15$(target)/rescue.bin: $(target) $(target)/head.o
19 $(LD) -T rescue.ld -o rescue.o head.o 16 $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
20 $(OBJCOPY) $(OBJCOPYFLAGS) rescue.o rescue.bin 17 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
21 cp rescue.bin $(TOPDIR) 18# Place a copy in top-level build directory
19 cp -p $(target)/rescue.bin $(objtree)
22 20
23testrescue.bin: testrescue.o 21$(target)/testrescue.bin: $(target) $(target)/testrescue.o
24 $(OBJCOPY) $(OBJCOPYFLAGS) testrescue.o tr.bin 22 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/testrescue.o tr.bin
25# Pad it to 784 bytes 23# Pad it to 784 bytes
26 dd if=/dev/zero of=tmp2423 bs=1 count=784 24 dd if=/dev/zero of=tmp2423 bs=1 count=784
27 cat tr.bin tmp2423 >testrescue_tmp.bin 25 cat tr.bin tmp2423 >testrescue_tmp.bin
28 dd if=testrescue_tmp.bin of=testrescue.bin bs=1 count=784 26 dd if=testrescue_tmp.bin of=$(target)/testrescue.bin bs=1 count=784
29 rm tr.bin tmp2423 testrescue_tmp.bin 27 rm tr.bin tmp2423 testrescue_tmp.bin
30 28
31kimagerescue.bin: kimagerescue.o 29$(target)/kimagerescue.bin: $(target) $(target)/kimagerescue.o
32 $(OBJCOPY) $(OBJCOPYFLAGS) kimagerescue.o ktr.bin 30 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/kimagerescue.o ktr.bin
33# Pad it to 784 bytes, that's what the rescue loader expects 31# Pad it to 784 bytes, that's what the rescue loader expects
34 dd if=/dev/zero of=tmp2423 bs=1 count=784 32 dd if=/dev/zero of=tmp2423 bs=1 count=784
35 cat ktr.bin tmp2423 >kimagerescue_tmp.bin 33 cat ktr.bin tmp2423 >kimagerescue_tmp.bin
36 dd if=kimagerescue_tmp.bin of=kimagerescue.bin bs=1 count=784 34 dd if=kimagerescue_tmp.bin of=$(target)/kimagerescue.bin bs=1 count=784
37 rm ktr.bin tmp2423 kimagerescue_tmp.bin 35 rm ktr.bin tmp2423 kimagerescue_tmp.bin
38 36
39head.o: head.S 37$(target):
38 mkdir -p $(target)
39
40$(target)/head.o: $(src)/head.S
40 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o 41 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
41 42
42testrescue.o: testrescue.S 43$(target)/testrescue.o: $(src)/testrescue.S
43 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o 44 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
44 45
45kimagerescue.o: kimagerescue.S 46$(target)/kimagerescue.o: $(src)/kimagerescue.S
46 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o 47 $(CC) -D__ASSEMBLY__ -traditional -c $< -o $*.o
47 48
48clean: 49clean:
49 rm -f *.o *.bin 50 rm -f $(target)/*.o $(target)/*.bin
50 51
51fastdep: 52fastdep:
52 53
diff --git a/arch/cris/arch-v10/boot/rescue/head.S b/arch/cris/arch-v10/boot/rescue/head.S
index 8689ea972c46..addb2194de0f 100644
--- a/arch/cris/arch-v10/boot/rescue/head.S
+++ b/arch/cris/arch-v10/boot/rescue/head.S
@@ -1,4 +1,4 @@
1/* $Id: head.S,v 1.6 2003/04/09 08:12:43 pkj Exp $ 1/* $Id: head.S,v 1.7 2005/03/07 12:11:06 starvik Exp $
2 * 2 *
3 * Rescue code, made to reside at the beginning of the 3 * Rescue code, made to reside at the beginning of the
4 * flash-memory. when it starts, it checks a partition 4 * flash-memory. when it starts, it checks a partition
@@ -121,12 +121,13 @@
121 ;; 0x80000000 if loaded in flash (as it should be) 121 ;; 0x80000000 if loaded in flash (as it should be)
122 ;; since etrax actually starts at address 2 when booting from flash, we 122 ;; since etrax actually starts at address 2 when booting from flash, we
123 ;; put a nop (2 bytes) here first so we dont accidentally skip the di 123 ;; put a nop (2 bytes) here first so we dont accidentally skip the di
124 124
125 nop 125 nop
126 di 126 di
127 127
128 jump in_cache ; enter cached area instead 128 jump in_cache ; enter cached area instead
129in_cache: 129in_cache:
130
130 131
131 ;; first put a jump test to give a possibility of upgrading the rescue code 132 ;; first put a jump test to give a possibility of upgrading the rescue code
132 ;; without erasing/reflashing the sector. we put a longword of -1 here and if 133 ;; without erasing/reflashing the sector. we put a longword of -1 here and if
@@ -325,9 +326,29 @@ flash_ok:
325 ;; result will be in r0 326 ;; result will be in r0
326checksum: 327checksum:
327 moveq 0, $r0 328 moveq 0, $r0
3281: addu.b [$r1+], $r0 329 moveq CONFIG_ETRAX_FLASH1_SIZE, $r6
329 subq 1, $r2 330
330 bne 1b 331 ;; If the first physical flash memory is exceeded wrap to the second one.
332 btstq 26, $r1 ; Are we addressing first flash?
333 bpl 1f
334 nop
335 clear.d $r6
336
3371: test.d $r6 ; 0 = no wrapping
338 beq 2f
339 nop
340 lslq 20, $r6 ; Convert MB to bytes
341 sub.d $r1, $r6
342
3432: addu.b [$r1+], $r0
344 subq 1, $r6 ; Flash memory left
345 beq 3f
346 subq 1, $r2 ; Length left
347 bne 2b
331 nop 348 nop
332 ret 349 ret
333 nop 350 nop
351
3523: move.d MEM_CSE1_START, $r1 ; wrap to second flash
353 ba 2b
354 nop
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 748374f25b87..8b50e8402954 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -1,17 +1,11 @@
1config ETRAX_ETHERNET 1config ETRAX_ETHERNET
2 bool "Ethernet support" 2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V10 3 depends on ETRAX_ARCH_V10
4 select NET_ETHERNET
4 help 5 help
5 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 6 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
6 controller. 7 controller.
7 8
8# this is just so that the user does not have to go into the
9# normal ethernet driver section just to enable ethernetworking
10config NET_ETHERNET
11 bool
12 depends on ETRAX_ETHERNET
13 default y
14
15choice 9choice
16 prompt "Network LED behavior" 10 prompt "Network LED behavior"
17 depends on ETRAX_ETHERNET 11 depends on ETRAX_ETHERNET
@@ -20,26 +14,26 @@ choice
20config ETRAX_NETWORK_LED_ON_WHEN_LINK 14config ETRAX_NETWORK_LED_ON_WHEN_LINK
21 bool "LED_on_when_link" 15 bool "LED_on_when_link"
22 help 16 help
23 Selecting LED_on_when_link will light the LED when there is a 17 Selecting LED_on_when_link will light the LED when there is a
24 connection and will flash off when there is activity. 18 connection and will flash off when there is activity.
25 19
26 Selecting LED_on_when_activity will light the LED only when 20 Selecting LED_on_when_activity will light the LED only when
27 there is activity. 21 there is activity.
28 22
29 This setting will also affect the behaviour of other activity LEDs 23 This setting will also affect the behaviour of other activity LEDs
30 e.g. Bluetooth. 24 e.g. Bluetooth.
31 25
32config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY 26config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
33 bool "LED_on_when_activity" 27 bool "LED_on_when_activity"
34 help 28 help
35 Selecting LED_on_when_link will light the LED when there is a 29 Selecting LED_on_when_link will light the LED when there is a
36 connection and will flash off when there is activity. 30 connection and will flash off when there is activity.
37 31
38 Selecting LED_on_when_activity will light the LED only when 32 Selecting LED_on_when_activity will light the LED only when
39 there is activity. 33 there is activity.
40 34
41 This setting will also affect the behaviour of other activity LEDs 35 This setting will also affect the behaviour of other activity LEDs
42 e.g. Bluetooth. 36 e.g. Bluetooth.
43 37
44endchoice 38endchoice
45 39
@@ -91,11 +85,11 @@ choice
91 depends on ETRAX_SERIAL_PORT0 85 depends on ETRAX_SERIAL_PORT0
92 default ETRAX_SERIAL_PORT0_DMA6_OUT 86 default ETRAX_SERIAL_PORT0_DMA6_OUT
93 87
94config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT 88config ETRAX_SERIAL_PORT0_NO_DMA_OUT
95 bool "No DMA out" 89 bool "No DMA out"
96 90
97config CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT 91config ETRAX_SERIAL_PORT0_DMA6_OUT
98 bool "DMA 6" 92 bool "DMA 6"
99 93
100endchoice 94endchoice
101 95
@@ -104,11 +98,11 @@ choice
104 depends on ETRAX_SERIAL_PORT0 98 depends on ETRAX_SERIAL_PORT0
105 default ETRAX_SERIAL_PORT0_DMA7_IN 99 default ETRAX_SERIAL_PORT0_DMA7_IN
106 100
107config CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN 101config ETRAX_SERIAL_PORT0_NO_DMA_IN
108 bool "No DMA in" 102 bool "No DMA in"
109 103
110config CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN 104config ETRAX_SERIAL_PORT0_DMA7_IN
111 bool "DMA 7" 105 bool "DMA 7"
112 106
113endchoice 107endchoice
114 108
@@ -205,11 +199,11 @@ choice
205 depends on ETRAX_SERIAL_PORT1 199 depends on ETRAX_SERIAL_PORT1
206 default ETRAX_SERIAL_PORT1_DMA8_OUT 200 default ETRAX_SERIAL_PORT1_DMA8_OUT
207 201
208config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_OUT 202config ETRAX_SERIAL_PORT1_NO_DMA_OUT
209 bool "No DMA out" 203 bool "No DMA out"
210 204
211config CONFIG_ETRAX_SERIAL_PORT1_DMA8_OUT 205config ETRAX_SERIAL_PORT1_DMA8_OUT
212 bool "DMA 8" 206 bool "DMA 8"
213 207
214endchoice 208endchoice
215 209
@@ -218,11 +212,11 @@ choice
218 depends on ETRAX_SERIAL_PORT1 212 depends on ETRAX_SERIAL_PORT1
219 default ETRAX_SERIAL_PORT1_DMA9_IN 213 default ETRAX_SERIAL_PORT1_DMA9_IN
220 214
221config CONFIG_ETRAX_SERIAL_PORT1_NO_DMA_IN 215config ETRAX_SERIAL_PORT1_NO_DMA_IN
222 bool "No DMA in" 216 bool "No DMA in"
223 217
224config CONFIG_ETRAX_SERIAL_PORT1_DMA9_IN 218config ETRAX_SERIAL_PORT1_DMA9_IN
225 bool "DMA 9" 219 bool "DMA 9"
226 220
227endchoice 221endchoice
228 222
@@ -308,7 +302,7 @@ config ETRAX_SER1_CD_ON_PB_BIT
308 Specify the pin of the PB port to carry the CD signal for serial 302 Specify the pin of the PB port to carry the CD signal for serial
309 port 1. 303 port 1.
310 304
311comment "Make sure you dont have the same PB bits more than once!" 305comment "Make sure you do not have the same PB bits more than once!"
312 depends on ETRAX_SERIAL && ETRAX_SER0_DTR_RI_DSR_CD_ON_PB && ETRAX_SER1_DTR_RI_DSR_CD_ON_PB 306 depends on ETRAX_SERIAL && ETRAX_SER0_DTR_RI_DSR_CD_ON_PB && ETRAX_SER1_DTR_RI_DSR_CD_ON_PB
313 307
314config ETRAX_SERIAL_PORT2 308config ETRAX_SERIAL_PORT2
@@ -322,11 +316,11 @@ choice
322 depends on ETRAX_SERIAL_PORT2 316 depends on ETRAX_SERIAL_PORT2
323 default ETRAX_SERIAL_PORT2_DMA2_OUT 317 default ETRAX_SERIAL_PORT2_DMA2_OUT
324 318
325config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT 319config ETRAX_SERIAL_PORT2_NO_DMA_OUT
326 bool "No DMA out" 320 bool "No DMA out"
327 321
328config CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT 322config ETRAX_SERIAL_PORT2_DMA2_OUT
329 bool "DMA 2" 323 bool "DMA 2"
330 324
331endchoice 325endchoice
332 326
@@ -335,11 +329,11 @@ choice
335 depends on ETRAX_SERIAL_PORT2 329 depends on ETRAX_SERIAL_PORT2
336 default ETRAX_SERIAL_PORT2_DMA3_IN 330 default ETRAX_SERIAL_PORT2_DMA3_IN
337 331
338config CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN 332config ETRAX_SERIAL_PORT2_NO_DMA_IN
339 bool "No DMA in" 333 bool "No DMA in"
340 334
341config CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN 335config ETRAX_SERIAL_PORT2_DMA3_IN
342 bool "DMA 3" 336 bool "DMA 3"
343 337
344endchoice 338endchoice
345 339
@@ -436,11 +430,11 @@ choice
436 depends on ETRAX_SERIAL_PORT3 430 depends on ETRAX_SERIAL_PORT3
437 default ETRAX_SERIAL_PORT3_DMA4_OUT 431 default ETRAX_SERIAL_PORT3_DMA4_OUT
438 432
439config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_OUT 433config ETRAX_SERIAL_PORT3_NO_DMA_OUT
440 bool "No DMA out" 434 bool "No DMA out"
441 435
442config CONFIG_ETRAX_SERIAL_PORT3_DMA4_OUT 436config ETRAX_SERIAL_PORT3_DMA4_OUT
443 bool "DMA 4" 437 bool "DMA 4"
444 438
445endchoice 439endchoice
446 440
@@ -449,11 +443,11 @@ choice
449 depends on ETRAX_SERIAL_PORT3 443 depends on ETRAX_SERIAL_PORT3
450 default ETRAX_SERIAL_PORT3_DMA5_IN 444 default ETRAX_SERIAL_PORT3_DMA5_IN
451 445
452config CONFIG_ETRAX_SERIAL_PORT3_NO_DMA_IN 446config ETRAX_SERIAL_PORT3_NO_DMA_IN
453 bool "No DMA in" 447 bool "No DMA in"
454 448
455config CONFIG_ETRAX_SERIAL_PORT3_DMA5_IN 449config ETRAX_SERIAL_PORT3_DMA5_IN
456 bool "DMA 5" 450 bool "DMA 5"
457 451
458endchoice 452endchoice
459 453
@@ -554,7 +548,6 @@ config ETRAX_IDE
554 select BLK_DEV_IDEDISK 548 select BLK_DEV_IDEDISK
555 select BLK_DEV_IDECD 549 select BLK_DEV_IDECD
556 select BLK_DEV_IDEDMA 550 select BLK_DEV_IDEDMA
557 select DMA_NONPCI
558 help 551 help
559 Enable this to get support for ATA/IDE. 552 Enable this to get support for ATA/IDE.
560 You can't use paralell ports or SCSI ports 553 You can't use paralell ports or SCSI ports
@@ -579,7 +572,7 @@ config ETRAX_IDE_PB7_RESET
579 IDE reset on pin 7 on port B 572 IDE reset on pin 7 on port B
580 573
581config ETRAX_IDE_G27_RESET 574config ETRAX_IDE_G27_RESET
582 bool "Port_G_Bit_27" 575 bool "Port_G_Bit_27"
583 help 576 help
584 IDE reset on pin 27 on port G 577 IDE reset on pin 27 on port G
585 578
@@ -588,30 +581,36 @@ endchoice
588 581
589config ETRAX_USB_HOST 582config ETRAX_USB_HOST
590 bool "USB host" 583 bool "USB host"
584 select USB
591 help 585 help
592 This option enables the host functionality of the ETRAX 100LX 586 This option enables the host functionality of the ETRAX 100LX
593 built-in USB controller. In host mode the controller is designed 587 built-in USB controller. In host mode the controller is designed
594 for CTRL and BULK traffic only, INTR traffic may work as well 588 for CTRL and BULK traffic only, INTR traffic may work as well
595 however (depending on the requirements of timeliness). 589 however (depending on the requirements of timeliness).
596 590
597config USB
598 tristate
599 depends on ETRAX_USB_HOST
600 default y
601
602config ETRAX_USB_HOST_PORT1 591config ETRAX_USB_HOST_PORT1
603 bool " USB port 1 enabled" 592 bool "USB port 1 enabled"
604 depends on ETRAX_USB_HOST 593 depends on ETRAX_USB_HOST
605 default n 594 default n
606 595
607config ETRAX_USB_HOST_PORT2 596config ETRAX_USB_HOST_PORT2
608 bool " USB port 2 enabled" 597 bool "USB port 2 enabled"
609 depends on ETRAX_USB_HOST 598 depends on ETRAX_USB_HOST
610 default n 599 default n
611 600
612config ETRAX_AXISFLASHMAP 601config ETRAX_AXISFLASHMAP
613 bool "Axis flash-map support" 602 bool "Axis flash-map support"
614 depends on ETRAX_ARCH_V10 603 depends on ETRAX_ARCH_V10
604 select MTD
605 select MTD_CFI
606 select MTD_CFI_AMDSTD
607 select MTD_OBSOLETE_CHIPS
608 select MTD_AMDSTD
609 select MTD_CHAR
610 select MTD_BLOCK
611 select MTD_PARTITIONS
612 select MTD_CONCAT
613 select MTD_COMPLEX_MAPPINGS
615 help 614 help
616 This option enables MTD mapping of flash devices. Needed to use 615 This option enables MTD mapping of flash devices. Needed to use
617 flash memories. If unsure, say Y. 616 flash memories. If unsure, say Y.
@@ -627,119 +626,6 @@ config ETRAX_PTABLE_SECTOR
627 for changing this is when the flash block size is bigger 626 for changing this is when the flash block size is bigger
628 than 64kB (e.g. when using two parallel 16 bit flashes). 627 than 64kB (e.g. when using two parallel 16 bit flashes).
629 628
630# here we define the CONFIG_'s necessary to enable MTD support
631# for the flash
632config MTD
633 tristate
634 depends on ETRAX_AXISFLASHMAP
635 default y
636 help
637 Memory Technology Devices are flash, RAM and similar chips, often
638 used for solid state file systems on embedded devices. This option
639 will provide the generic support for MTD drivers to register
640 themselves with the kernel and for potential users of MTD devices
641 to enumerate the devices which are present and obtain a handle on
642 them. It will also allow you to select individual drivers for
643 particular hardware and users of MTD devices. If unsure, say N.
644
645config MTD_CFI
646 tristate
647 depends on ETRAX_AXISFLASHMAP
648 default y
649 help
650 The Common Flash Interface specification was developed by Intel,
651 AMD and other flash manufactures that provides a universal method
652 for probing the capabilities of flash devices. If you wish to
653 support any device that is CFI-compliant, you need to enable this
654 option. Visit <http://www.amd.com/products/nvd/overview/cfi.html>
655 for more information on CFI.
656
657config MTD_CFI_AMDSTD
658 tristate
659 depends on ETRAX_AXISFLASHMAP
660 default y
661 help
662 The Common Flash Interface defines a number of different command
663 sets which a CFI-compliant chip may claim to implement. This code
664 provides support for one of those command sets, used on chips
665 chips including the AMD Am29LV320.
666
667config MTD_OBSOLETE_CHIPS
668 bool
669 depends on ETRAX_AXISFLASHMAP
670 default y
671 help
672 This option does not enable any code directly, but will allow you to
673 select some other chip drivers which are now considered obsolete,
674 because the generic CONFIG_JEDEC_PROBE code above should now detect
675 the chips which are supported by these drivers, and allow the generic
676 CFI-compatible drivers to drive the chips. Say 'N' here unless you have
677 already tried the CONFIG_JEDEC_PROBE method and reported its failure
678 to the MTD mailing list at <linux-mtd@lists.infradead.org>
679
680config MTD_AMDSTD
681 tristate
682 depends on ETRAX_AXISFLASHMAP
683 default y
684 help
685 This option enables support for flash chips using AMD-compatible
686 commands, including some which are not CFI-compatible and hence
687 cannot be used with the CONFIG_MTD_CFI_AMDSTD option.
688
689 It also works on AMD compatible chips that do conform to CFI.
690
691config MTD_CHAR
692 tristate
693 depends on ETRAX_AXISFLASHMAP
694 default y
695 help
696 This provides a character device for each MTD device present in
697 the system, allowing the user to read and write directly to the
698 memory chips, and also use ioctl() to obtain information about
699 the device, or to erase parts of it.
700
701config MTD_BLOCK
702 tristate
703 depends on ETRAX_AXISFLASHMAP
704 default y
705 ---help---
706 Although most flash chips have an erase size too large to be useful
707 as block devices, it is possible to use MTD devices which are based
708 on RAM chips in this manner. This block device is a user of MTD
709 devices performing that function.
710
711 At the moment, it is also required for the Journalling Flash File
712 System(s) to obtain a handle on the MTD device when it's mounted
713 (although JFFS and JFFS2 don't actually use any of the functionality
714 of the mtdblock device).
715
716 Later, it may be extended to perform read/erase/modify/write cycles
717 on flash chips to emulate a smaller block size. Needless to say,
718 this is very unsafe, but could be useful for file systems which are
719 almost never written to.
720
721 You do not need this option for use with the DiskOnChip devices. For
722 those, enable NFTL support (CONFIG_NFTL) instead.
723
724config MTD_PARTITIONS
725 tristate
726 depends on ETRAX_AXISFLASHMAP
727 default y
728 help
729 If you have a device which needs to divide its flash chip(s) up
730 into multiple 'partitions', each of which appears to the user as
731 a separate MTD device, you require this option to be enabled. If
732 unsure, say 'Y'.
733
734 Note, however, that you don't need this option for the DiskOnChip
735 devices. Partitioning on NFTL 'devices' is a different - that's the
736 'normal' form of partitioning used on a block device.
737
738config MTD_CONCAT
739 tristate
740 depends on ETRAX_AXISFLASHMAP
741 default y
742
743config ETRAX_I2C 629config ETRAX_I2C
744 bool "I2C support" 630 bool "I2C support"
745 depends on ETRAX_ARCH_V10 631 depends on ETRAX_ARCH_V10
@@ -752,7 +638,7 @@ config ETRAX_I2C
752 val = ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_READREG), i2c_arg); 638 val = ioctl(fd, _IO(ETRAXI2C_IOCTYPE, I2C_READREG), i2c_arg);
753 639
754# this is true for most products since PB-I2C seems to be somewhat 640# this is true for most products since PB-I2C seems to be somewhat
755# flawed.. 641# flawed..
756config ETRAX_I2C_USES_PB_NOT_PB_I2C 642config ETRAX_I2C_USES_PB_NOT_PB_I2C
757 bool "I2C uses PB not PB-I2C" 643 bool "I2C uses PB not PB-I2C"
758 depends on ETRAX_I2C 644 depends on ETRAX_I2C
@@ -886,7 +772,7 @@ config ETRAX_RTC
886 bool "Real Time Clock support" 772 bool "Real Time Clock support"
887 depends on ETRAX_ARCH_V10 773 depends on ETRAX_ARCH_V10
888 help 774 help
889 Enables drivers for the Real-Time Clock battery-backed chips on 775 Enables drivers for the Real-Time Clock battery-backed chips on
890 some products. The kernel reads the time when booting, and 776 some products. The kernel reads the time when booting, and
891 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a 777 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a
892 rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc 778 rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc
@@ -903,13 +789,13 @@ config ETRAX_DS1302
903 bool "DS1302" 789 bool "DS1302"
904 help 790 help
905 Enables the driver for the DS1302 Real-Time Clock battery-backed 791 Enables the driver for the DS1302 Real-Time Clock battery-backed
906 chip on some products. 792 chip on some products.
907 793
908config ETRAX_PCF8563 794config ETRAX_PCF8563
909 bool "PCF8563" 795 bool "PCF8563"
910 help 796 help
911 Enables the driver for the PCF8563 Real-Time Clock battery-backed 797 Enables the driver for the PCF8563 Real-Time Clock battery-backed
912 chip on some products. 798 chip on some products.
913 799
914endchoice 800endchoice
915 801
@@ -954,10 +840,8 @@ config ETRAX_DS1302_TRICKLE_CHARGE
954 help 840 help
955 This controls the initial value of the trickle charge register. 841 This controls the initial value of the trickle charge register.
956 0 = disabled (use this if you are unsure or have a non rechargable battery) 842 0 = disabled (use this if you are unsure or have a non rechargable battery)
957 Otherwise the following values can be OR:ed together to control the 843 Otherwise the following values can be OR:ed together to control the
958 charge current: 844 charge current:
959 1 = 2kohm, 2 = 4kohm, 3 = 4kohm 845 1 = 2kohm, 2 = 4kohm, 3 = 4kohm
960 4 = 1 diode, 8 = 2 diodes 846 4 = 1 diode, 8 = 2 diodes
961 Allowed values are (increasing current): 0, 11, 10, 9, 7, 6, 5 847 Allowed values are (increasing current): 0, 11, 10, 9, 7, 6, 5
962
963
diff --git a/arch/cris/arch-v10/drivers/axisflashmap.c b/arch/cris/arch-v10/drivers/axisflashmap.c
index fb7d4855ea62..11ab3836aac6 100644
--- a/arch/cris/arch-v10/drivers/axisflashmap.c
+++ b/arch/cris/arch-v10/drivers/axisflashmap.c
@@ -11,6 +11,9 @@
11 * partition split defined below. 11 * partition split defined below.
12 * 12 *
13 * $Log: axisflashmap.c,v $ 13 * $Log: axisflashmap.c,v $
14 * Revision 1.11 2004/11/15 10:27:14 starvik
15 * Corrected typo (Thanks to Milton Miller <miltonm@bga.com>).
16 *
14 * Revision 1.10 2004/08/16 12:37:22 starvik 17 * Revision 1.10 2004/08/16 12:37:22 starvik
15 * Merge of Linux 2.6.8 18 * Merge of Linux 2.6.8
16 * 19 *
@@ -161,7 +164,7 @@
161#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2 164#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2
162#define flash_data __u16 165#define flash_data __u16
163#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4 166#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4
164#define flash_data __u16 167#define flash_data __u32
165#endif 168#endif
166 169
167/* From head.S */ 170/* From head.S */
diff --git a/arch/cris/arch-v10/drivers/ds1302.c b/arch/cris/arch-v10/drivers/ds1302.c
index fba530fcfaeb..10795f67f687 100644
--- a/arch/cris/arch-v10/drivers/ds1302.c
+++ b/arch/cris/arch-v10/drivers/ds1302.c
@@ -7,6 +7,15 @@
7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init 7*! Functions exported: ds1302_readreg, ds1302_writereg, ds1302_init
8*! 8*!
9*! $Log: ds1302.c,v $ 9*! $Log: ds1302.c,v $
10*! Revision 1.18 2005/01/24 09:11:26 mikaelam
11*! Minor changes to get DS1302 RTC chip driver to work
12*!
13*! Revision 1.17 2005/01/05 06:11:22 starvik
14*! No need to do local_irq_disable after local_irq_save.
15*!
16*! Revision 1.16 2004/12/13 12:21:52 starvik
17*! Added I/O and DMA allocators from Linux 2.4
18*!
10*! Revision 1.14 2004/08/24 06:48:43 starvik 19*! Revision 1.14 2004/08/24 06:48:43 starvik
11*! Whitespace cleanup 20*! Whitespace cleanup
12*! 21*!
@@ -124,9 +133,9 @@
124*! 133*!
125*! --------------------------------------------------------------------------- 134*! ---------------------------------------------------------------------------
126*! 135*!
127*! (C) Copyright 1999, 2000, 2001 Axis Communications AB, LUND, SWEDEN 136*! (C) Copyright 1999, 2000, 2001, 2002, 2003, 2004 Axis Communications AB, LUND, SWEDEN
128*! 137*!
129*! $Id: ds1302.c,v 1.14 2004/08/24 06:48:43 starvik Exp $ 138*! $Id: ds1302.c,v 1.18 2005/01/24 09:11:26 mikaelam Exp $
130*! 139*!
131*!***************************************************************************/ 140*!***************************************************************************/
132 141
@@ -145,6 +154,7 @@
145#include <asm/arch/svinto.h> 154#include <asm/arch/svinto.h>
146#include <asm/io.h> 155#include <asm/io.h>
147#include <asm/rtc.h> 156#include <asm/rtc.h>
157#include <asm/arch/io_interface_mux.h>
148 158
149#define RTC_MAJOR_NR 121 /* local major, change later */ 159#define RTC_MAJOR_NR 121 /* local major, change later */
150 160
@@ -320,7 +330,6 @@ get_rtc_time(struct rtc_time *rtc_tm)
320 unsigned long flags; 330 unsigned long flags;
321 331
322 local_irq_save(flags); 332 local_irq_save(flags);
323 local_irq_disable();
324 333
325 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS); 334 rtc_tm->tm_sec = CMOS_READ(RTC_SECONDS);
326 rtc_tm->tm_min = CMOS_READ(RTC_MINUTES); 335 rtc_tm->tm_min = CMOS_READ(RTC_MINUTES);
@@ -358,7 +367,7 @@ static int
358rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 367rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
359 unsigned long arg) 368 unsigned long arg)
360{ 369{
361 unsigned long flags; 370 unsigned long flags;
362 371
363 switch(cmd) { 372 switch(cmd) {
364 case RTC_RD_TIME: /* read the time/date from RTC */ 373 case RTC_RD_TIME: /* read the time/date from RTC */
@@ -382,7 +391,7 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
382 return -EPERM; 391 return -EPERM;
383 392
384 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time))) 393 if (copy_from_user(&rtc_tm, (struct rtc_time*)arg, sizeof(struct rtc_time)))
385 return -EFAULT; 394 return -EFAULT;
386 395
387 yrs = rtc_tm.tm_year + 1900; 396 yrs = rtc_tm.tm_year + 1900;
388 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */ 397 mon = rtc_tm.tm_mon + 1; /* tm_mon starts at zero */
@@ -419,7 +428,6 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
419 BIN_TO_BCD(yrs); 428 BIN_TO_BCD(yrs);
420 429
421 local_irq_save(flags); 430 local_irq_save(flags);
422 local_irq_disable();
423 CMOS_WRITE(yrs, RTC_YEAR); 431 CMOS_WRITE(yrs, RTC_YEAR);
424 CMOS_WRITE(mon, RTC_MONTH); 432 CMOS_WRITE(mon, RTC_MONTH);
425 CMOS_WRITE(day, RTC_DAY_OF_MONTH); 433 CMOS_WRITE(day, RTC_DAY_OF_MONTH);
@@ -438,7 +446,7 @@ rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
438 446
439 case RTC_SET_CHARGE: /* set the RTC TRICKLE CHARGE register */ 447 case RTC_SET_CHARGE: /* set the RTC TRICKLE CHARGE register */
440 { 448 {
441 int tcs_val; 449 int tcs_val;
442 450
443 if (!capable(CAP_SYS_TIME)) 451 if (!capable(CAP_SYS_TIME))
444 return -EPERM; 452 return -EPERM;
@@ -492,8 +500,8 @@ print_rtc_status(void)
492/* The various file operations we support. */ 500/* The various file operations we support. */
493 501
494static struct file_operations rtc_fops = { 502static struct file_operations rtc_fops = {
495 .owner = THIS_MODULE, 503 .owner = THIS_MODULE,
496 .ioctl = rtc_ioctl, 504 .ioctl = rtc_ioctl,
497}; 505};
498 506
499/* Probe for the chip by writing something to its RAM and try reading it back. */ 507/* Probe for the chip by writing something to its RAM and try reading it back. */
@@ -532,7 +540,7 @@ ds1302_probe(void)
532 "PB", 540 "PB",
533#endif 541#endif
534 CONFIG_ETRAX_DS1302_RSTBIT); 542 CONFIG_ETRAX_DS1302_RSTBIT);
535 print_rtc_status(); 543 print_rtc_status();
536 retval = 1; 544 retval = 1;
537 } else { 545 } else {
538 stop(); 546 stop();
@@ -548,7 +556,9 @@ ds1302_probe(void)
548int __init 556int __init
549ds1302_init(void) 557ds1302_init(void)
550{ 558{
559#ifdef CONFIG_ETRAX_I2C
551 i2c_init(); 560 i2c_init();
561#endif
552 562
553 if (!ds1302_probe()) { 563 if (!ds1302_probe()) {
554#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT 564#ifdef CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT
@@ -558,25 +568,42 @@ ds1302_init(void)
558 * 568 *
559 * Make sure that R_GEN_CONFIG is setup correct. 569 * Make sure that R_GEN_CONFIG is setup correct.
560 */ 570 */
561 genconfig_shadow = ((genconfig_shadow & 571 /* Allocating the ATA interface will grab almost all
562 ~IO_MASK(R_GEN_CONFIG, ata)) | 572 * pins in I/O groups a, b, c and d. A consequence of
563 (IO_STATE(R_GEN_CONFIG, ata, select))); 573 * allocating the ATA interface is that the fixed
564 *R_GEN_CONFIG = genconfig_shadow; 574 * interfaces shared RAM, parallel port 0, parallel
575 * port 1, parallel port W, SCSI-8 port 0, SCSI-8 port
576 * 1, SCSI-W, serial port 2, serial port 3,
577 * synchronous serial port 3 and USB port 2 and almost
578 * all GPIO pins on port g cannot be used.
579 */
580 if (cris_request_io_interface(if_ata, "ds1302/ATA")) {
581 printk(KERN_WARNING "ds1302: Failed to get IO interface\n");
582 return -1;
583 }
584
565#elif CONFIG_ETRAX_DS1302_RSTBIT == 0 585#elif CONFIG_ETRAX_DS1302_RSTBIT == 0
566 586 if (cris_io_interface_allocate_pins(if_gpio_grp_a,
567 /* Set the direction of this bit to out. */ 587 'g',
568 genconfig_shadow = ((genconfig_shadow & 588 CONFIG_ETRAX_DS1302_RSTBIT,
569 ~IO_MASK(R_GEN_CONFIG, g0dir)) | 589 CONFIG_ETRAX_DS1302_RSTBIT)) {
570 (IO_STATE(R_GEN_CONFIG, g0dir, out))); 590 printk(KERN_WARNING "ds1302: Failed to get IO interface\n");
571 *R_GEN_CONFIG = genconfig_shadow; 591 return -1;
592 }
593
594 /* Set the direction of this bit to out. */
595 genconfig_shadow = ((genconfig_shadow &
596 ~IO_MASK(R_GEN_CONFIG, g0dir)) |
597 (IO_STATE(R_GEN_CONFIG, g0dir, out)));
598 *R_GEN_CONFIG = genconfig_shadow;
572#endif 599#endif
573 if (!ds1302_probe()) { 600 if (!ds1302_probe()) {
574 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); 601 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
575 return -1; 602 return -1;
576 } 603 }
577#else 604#else
578 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name); 605 printk(KERN_WARNING "%s: RTC not found.\n", ds1302_name);
579 return -1; 606 return -1;
580#endif 607#endif
581 } 608 }
582 /* Initialise trickle charger */ 609 /* Initialise trickle charger */
diff --git a/arch/cris/arch-v10/drivers/eeprom.c b/arch/cris/arch-v10/drivers/eeprom.c
index 316ca15d6802..512f16dec060 100644
--- a/arch/cris/arch-v10/drivers/eeprom.c
+++ b/arch/cris/arch-v10/drivers/eeprom.c
@@ -20,6 +20,12 @@
20*! in the spin-lock. 20*! in the spin-lock.
21*! 21*!
22*! $Log: eeprom.c,v $ 22*! $Log: eeprom.c,v $
23*! Revision 1.12 2005/06/19 17:06:46 starvik
24*! Merge of Linux 2.6.12.
25*!
26*! Revision 1.11 2005/01/26 07:14:46 starvik
27*! Applied diff from kernel janitors (Nish Aravamudan).
28*!
23*! Revision 1.10 2003/09/11 07:29:48 starvik 29*! Revision 1.10 2003/09/11 07:29:48 starvik
24*! Merge of Linux 2.6.0-test5 30*! Merge of Linux 2.6.0-test5
25*! 31*!
@@ -94,6 +100,7 @@
94#include <linux/init.h> 100#include <linux/init.h>
95#include <linux/delay.h> 101#include <linux/delay.h>
96#include <linux/interrupt.h> 102#include <linux/interrupt.h>
103#include <linux/wait.h>
97#include <asm/uaccess.h> 104#include <asm/uaccess.h>
98#include "i2c.h" 105#include "i2c.h"
99 106
@@ -526,15 +533,10 @@ static ssize_t eeprom_read(struct file * file, char * buf, size_t count, loff_t
526 return -EFAULT; 533 return -EFAULT;
527 } 534 }
528 535
529 while(eeprom.busy) 536 wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
530 { 537 if (signal_pending(current))
531 interruptible_sleep_on(&eeprom.wait_q); 538 return -EINTR;
532 539
533 /* bail out if we get interrupted */
534 if (signal_pending(current))
535 return -EINTR;
536
537 }
538 eeprom.busy++; 540 eeprom.busy++;
539 541
540 page = (unsigned char) (p >> 8); 542 page = (unsigned char) (p >> 8);
@@ -604,13 +606,10 @@ static ssize_t eeprom_write(struct file * file, const char * buf, size_t count,
604 return -EFAULT; 606 return -EFAULT;
605 } 607 }
606 608
607 while(eeprom.busy) 609 wait_event_interruptible(eeprom.wait_q, !eeprom.busy);
608 { 610 /* bail out if we get interrupted */
609 interruptible_sleep_on(&eeprom.wait_q); 611 if (signal_pending(current))
610 /* bail out if we get interrupted */ 612 return -EINTR;
611 if (signal_pending(current))
612 return -EINTR;
613 }
614 eeprom.busy++; 613 eeprom.busy++;
615 for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++) 614 for(i = 0; (i < EEPROM_RETRIES) && (restart > 0); i++)
616 { 615 {
diff --git a/arch/cris/arch-v10/drivers/gpio.c b/arch/cris/arch-v10/drivers/gpio.c
index c095de82a0da..09963fe299a7 100644
--- a/arch/cris/arch-v10/drivers/gpio.c
+++ b/arch/cris/arch-v10/drivers/gpio.c
@@ -1,4 +1,4 @@
1/* $Id: gpio.c,v 1.12 2004/08/24 07:19:59 starvik Exp $ 1/* $Id: gpio.c,v 1.17 2005/06/19 17:06:46 starvik Exp $
2 * 2 *
3 * Etrax general port I/O device 3 * Etrax general port I/O device
4 * 4 *
@@ -9,6 +9,18 @@
9 * Johan Adolfsson (read/set directions, write, port G) 9 * Johan Adolfsson (read/set directions, write, port G)
10 * 10 *
11 * $Log: gpio.c,v $ 11 * $Log: gpio.c,v $
12 * Revision 1.17 2005/06/19 17:06:46 starvik
13 * Merge of Linux 2.6.12.
14 *
15 * Revision 1.16 2005/03/07 13:02:29 starvik
16 * Protect driver global states with spinlock
17 *
18 * Revision 1.15 2005/01/05 06:08:55 starvik
19 * No need to do local_irq_disable after local_irq_save.
20 *
21 * Revision 1.14 2004/12/13 12:21:52 starvik
22 * Added I/O and DMA allocators from Linux 2.4
23 *
12 * Revision 1.12 2004/08/24 07:19:59 starvik 24 * Revision 1.12 2004/08/24 07:19:59 starvik
13 * Whitespace cleanup 25 * Whitespace cleanup
14 * 26 *
@@ -142,6 +154,7 @@
142#include <asm/io.h> 154#include <asm/io.h>
143#include <asm/system.h> 155#include <asm/system.h>
144#include <asm/irq.h> 156#include <asm/irq.h>
157#include <asm/arch/io_interface_mux.h>
145 158
146#define GPIO_MAJOR 120 /* experimental MAJOR number */ 159#define GPIO_MAJOR 120 /* experimental MAJOR number */
147 160
@@ -194,6 +207,8 @@ static struct gpio_private *alarmlist = 0;
194static int gpio_some_alarms = 0; /* Set if someone uses alarm */ 207static int gpio_some_alarms = 0; /* Set if someone uses alarm */
195static unsigned long gpio_pa_irq_enabled_mask = 0; 208static unsigned long gpio_pa_irq_enabled_mask = 0;
196 209
210static DEFINE_SPINLOCK(gpio_lock); /* Protect directions etc */
211
197/* Port A and B use 8 bit access, but Port G is 32 bit */ 212/* Port A and B use 8 bit access, but Port G is 32 bit */
198#define NUM_PORTS (GPIO_MINOR_B+1) 213#define NUM_PORTS (GPIO_MINOR_B+1)
199 214
@@ -241,6 +256,9 @@ static volatile unsigned char *dir_shadow[NUM_PORTS] = {
241 &port_pb_dir_shadow 256 &port_pb_dir_shadow
242}; 257};
243 258
259/* All bits in port g that can change dir. */
260static const unsigned long int changeable_dir_g_mask = 0x01FFFF01;
261
244/* Port G is 32 bit, handle it special, some bits are both inputs 262/* Port G is 32 bit, handle it special, some bits are both inputs
245 and outputs at the same time, only some of the bits can change direction 263 and outputs at the same time, only some of the bits can change direction
246 and some of them in groups of 8 bit. */ 264 and some of them in groups of 8 bit. */
@@ -260,6 +278,7 @@ gpio_poll(struct file *file,
260 unsigned int mask = 0; 278 unsigned int mask = 0;
261 struct gpio_private *priv = (struct gpio_private *)file->private_data; 279 struct gpio_private *priv = (struct gpio_private *)file->private_data;
262 unsigned long data; 280 unsigned long data;
281 spin_lock(&gpio_lock);
263 poll_wait(file, &priv->alarm_wq, wait); 282 poll_wait(file, &priv->alarm_wq, wait);
264 if (priv->minor == GPIO_MINOR_A) { 283 if (priv->minor == GPIO_MINOR_A) {
265 unsigned long flags; 284 unsigned long flags;
@@ -270,10 +289,10 @@ gpio_poll(struct file *file,
270 */ 289 */
271 tmp = ~data & priv->highalarm & 0xFF; 290 tmp = ~data & priv->highalarm & 0xFF;
272 tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR); 291 tmp = (tmp << R_IRQ_MASK1_SET__pa0__BITNR);
273 save_flags(flags); cli(); 292 local_irq_save(flags);
274 gpio_pa_irq_enabled_mask |= tmp; 293 gpio_pa_irq_enabled_mask |= tmp;
275 *R_IRQ_MASK1_SET = tmp; 294 *R_IRQ_MASK1_SET = tmp;
276 restore_flags(flags); 295 local_irq_restore(flags);
277 296
278 } else if (priv->minor == GPIO_MINOR_B) 297 } else if (priv->minor == GPIO_MINOR_B)
279 data = *R_PORT_PB_DATA; 298 data = *R_PORT_PB_DATA;
@@ -286,8 +305,11 @@ gpio_poll(struct file *file,
286 (~data & priv->lowalarm)) { 305 (~data & priv->lowalarm)) {
287 mask = POLLIN|POLLRDNORM; 306 mask = POLLIN|POLLRDNORM;
288 } 307 }
308
309 spin_unlock(&gpio_lock);
289 310
290 DP(printk("gpio_poll ready: mask 0x%08X\n", mask)); 311 DP(printk("gpio_poll ready: mask 0x%08X\n", mask));
312
291 return mask; 313 return mask;
292} 314}
293 315
@@ -296,6 +318,7 @@ int etrax_gpio_wake_up_check(void)
296 struct gpio_private *priv = alarmlist; 318 struct gpio_private *priv = alarmlist;
297 unsigned long data = 0; 319 unsigned long data = 0;
298 int ret = 0; 320 int ret = 0;
321 spin_lock(&gpio_lock);
299 while (priv) { 322 while (priv) {
300 if (USE_PORTS(priv)) { 323 if (USE_PORTS(priv)) {
301 data = *priv->port; 324 data = *priv->port;
@@ -310,6 +333,7 @@ int etrax_gpio_wake_up_check(void)
310 } 333 }
311 priv = priv->next; 334 priv = priv->next;
312 } 335 }
336 spin_unlock(&gpio_lock);
313 return ret; 337 return ret;
314} 338}
315 339
@@ -327,6 +351,7 @@ static irqreturn_t
327gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs) 351gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
328{ 352{
329 unsigned long tmp; 353 unsigned long tmp;
354 spin_lock(&gpio_lock);
330 /* Find what PA interrupts are active */ 355 /* Find what PA interrupts are active */
331 tmp = (*R_IRQ_READ1); 356 tmp = (*R_IRQ_READ1);
332 357
@@ -337,6 +362,8 @@ gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
337 *R_IRQ_MASK1_CLR = tmp; 362 *R_IRQ_MASK1_CLR = tmp;
338 gpio_pa_irq_enabled_mask &= ~tmp; 363 gpio_pa_irq_enabled_mask &= ~tmp;
339 364
365 spin_unlock(&gpio_lock);
366
340 if (gpio_some_alarms) { 367 if (gpio_some_alarms) {
341 return IRQ_RETVAL(etrax_gpio_wake_up_check()); 368 return IRQ_RETVAL(etrax_gpio_wake_up_check());
342 } 369 }
@@ -350,6 +377,9 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
350 struct gpio_private *priv = (struct gpio_private *)file->private_data; 377 struct gpio_private *priv = (struct gpio_private *)file->private_data;
351 unsigned char data, clk_mask, data_mask, write_msb; 378 unsigned char data, clk_mask, data_mask, write_msb;
352 unsigned long flags; 379 unsigned long flags;
380
381 spin_lock(&gpio_lock);
382
353 ssize_t retval = count; 383 ssize_t retval = count;
354 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) { 384 if (priv->minor !=GPIO_MINOR_A && priv->minor != GPIO_MINOR_B) {
355 return -EFAULT; 385 return -EFAULT;
@@ -372,7 +402,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
372 data = *buf++; 402 data = *buf++;
373 if (priv->write_msb) { 403 if (priv->write_msb) {
374 for (i = 7; i >= 0;i--) { 404 for (i = 7; i >= 0;i--) {
375 local_irq_save(flags); local_irq_disable(); 405 local_irq_save(flags);
376 *priv->port = *priv->shadow &= ~clk_mask; 406 *priv->port = *priv->shadow &= ~clk_mask;
377 if (data & 1<<i) 407 if (data & 1<<i)
378 *priv->port = *priv->shadow |= data_mask; 408 *priv->port = *priv->shadow |= data_mask;
@@ -384,7 +414,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
384 } 414 }
385 } else { 415 } else {
386 for (i = 0; i <= 7;i++) { 416 for (i = 0; i <= 7;i++) {
387 local_irq_save(flags); local_irq_disable(); 417 local_irq_save(flags);
388 *priv->port = *priv->shadow &= ~clk_mask; 418 *priv->port = *priv->shadow &= ~clk_mask;
389 if (data & 1<<i) 419 if (data & 1<<i)
390 *priv->port = *priv->shadow |= data_mask; 420 *priv->port = *priv->shadow |= data_mask;
@@ -396,6 +426,7 @@ static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
396 } 426 }
397 } 427 }
398 } 428 }
429 spin_unlock(&gpio_lock);
399 return retval; 430 return retval;
400} 431}
401 432
@@ -452,9 +483,14 @@ gpio_open(struct inode *inode, struct file *filp)
452static int 483static int
453gpio_release(struct inode *inode, struct file *filp) 484gpio_release(struct inode *inode, struct file *filp)
454{ 485{
455 struct gpio_private *p = alarmlist; 486 struct gpio_private *p;
456 struct gpio_private *todel = (struct gpio_private *)filp->private_data; 487 struct gpio_private *todel;
457 488
489 spin_lock(&gpio_lock);
490
491 p = alarmlist;
492 todel = (struct gpio_private *)filp->private_data;
493
458 /* unlink from alarmlist and free the private structure */ 494 /* unlink from alarmlist and free the private structure */
459 495
460 if (p == todel) { 496 if (p == todel) {
@@ -476,7 +512,7 @@ gpio_release(struct inode *inode, struct file *filp)
476 p = p->next; 512 p = p->next;
477 } 513 }
478 gpio_some_alarms = 0; 514 gpio_some_alarms = 0;
479 515 spin_unlock(&gpio_lock);
480 return 0; 516 return 0;
481} 517}
482 518
@@ -491,14 +527,14 @@ unsigned long inline setget_input(struct gpio_private *priv, unsigned long arg)
491 */ 527 */
492 unsigned long flags; 528 unsigned long flags;
493 if (USE_PORTS(priv)) { 529 if (USE_PORTS(priv)) {
494 local_irq_save(flags); local_irq_disable(); 530 local_irq_save(flags);
495 *priv->dir = *priv->dir_shadow &= 531 *priv->dir = *priv->dir_shadow &=
496 ~((unsigned char)arg & priv->changeable_dir); 532 ~((unsigned char)arg & priv->changeable_dir);
497 local_irq_restore(flags); 533 local_irq_restore(flags);
498 return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */ 534 return ~(*priv->dir_shadow) & 0xFF; /* Only 8 bits */
499 } else if (priv->minor == GPIO_MINOR_G) { 535 } else if (priv->minor == GPIO_MINOR_G) {
500 /* We must fiddle with R_GEN_CONFIG to change dir */ 536 /* We must fiddle with R_GEN_CONFIG to change dir */
501 save_flags(flags); cli(); 537 local_irq_save(flags);
502 if (((arg & dir_g_in_bits) != arg) && 538 if (((arg & dir_g_in_bits) != arg) &&
503 (arg & changeable_dir_g)) { 539 (arg & changeable_dir_g)) {
504 arg &= changeable_dir_g; 540 arg &= changeable_dir_g;
@@ -533,7 +569,7 @@ unsigned long inline setget_input(struct gpio_private *priv, unsigned long arg)
533 /* Must be a >120 ns delay before writing this again */ 569 /* Must be a >120 ns delay before writing this again */
534 570
535 } 571 }
536 restore_flags(flags); 572 local_irq_restore(flags);
537 return dir_g_in_bits; 573 return dir_g_in_bits;
538 } 574 }
539 return 0; 575 return 0;
@@ -543,14 +579,14 @@ unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg)
543{ 579{
544 unsigned long flags; 580 unsigned long flags;
545 if (USE_PORTS(priv)) { 581 if (USE_PORTS(priv)) {
546 local_irq_save(flags); local_irq_disable(); 582 local_irq_save(flags);
547 *priv->dir = *priv->dir_shadow |= 583 *priv->dir = *priv->dir_shadow |=
548 ((unsigned char)arg & priv->changeable_dir); 584 ((unsigned char)arg & priv->changeable_dir);
549 local_irq_restore(flags); 585 local_irq_restore(flags);
550 return *priv->dir_shadow; 586 return *priv->dir_shadow;
551 } else if (priv->minor == GPIO_MINOR_G) { 587 } else if (priv->minor == GPIO_MINOR_G) {
552 /* We must fiddle with R_GEN_CONFIG to change dir */ 588 /* We must fiddle with R_GEN_CONFIG to change dir */
553 save_flags(flags); cli(); 589 local_irq_save(flags);
554 if (((arg & dir_g_out_bits) != arg) && 590 if (((arg & dir_g_out_bits) != arg) &&
555 (arg & changeable_dir_g)) { 591 (arg & changeable_dir_g)) {
556 /* Set bits in genconfig to set to output */ 592 /* Set bits in genconfig to set to output */
@@ -583,7 +619,7 @@ unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg)
583 *R_GEN_CONFIG = genconfig_shadow; 619 *R_GEN_CONFIG = genconfig_shadow;
584 /* Must be a >120 ns delay before writing this again */ 620 /* Must be a >120 ns delay before writing this again */
585 } 621 }
586 restore_flags(flags); 622 local_irq_restore(flags);
587 return dir_g_out_bits & 0x7FFFFFFF; 623 return dir_g_out_bits & 0x7FFFFFFF;
588 } 624 }
589 return 0; 625 return 0;
@@ -598,22 +634,26 @@ gpio_ioctl(struct inode *inode, struct file *file,
598{ 634{
599 unsigned long flags; 635 unsigned long flags;
600 unsigned long val; 636 unsigned long val;
637 int ret = 0;
638
601 struct gpio_private *priv = (struct gpio_private *)file->private_data; 639 struct gpio_private *priv = (struct gpio_private *)file->private_data;
602 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) { 640 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) {
603 return -EINVAL; 641 return -EINVAL;
604 } 642 }
605 643
644 spin_lock(&gpio_lock);
645
606 switch (_IOC_NR(cmd)) { 646 switch (_IOC_NR(cmd)) {
607 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */ 647 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */
608 // read the port 648 // read the port
609 if (USE_PORTS(priv)) { 649 if (USE_PORTS(priv)) {
610 return *priv->port; 650 ret = *priv->port;
611 } else if (priv->minor == GPIO_MINOR_G) { 651 } else if (priv->minor == GPIO_MINOR_G) {
612 return (*R_PORT_G_DATA) & 0x7FFFFFFF; 652 ret = (*R_PORT_G_DATA) & 0x7FFFFFFF;
613 } 653 }
614 break; 654 break;
615 case IO_SETBITS: 655 case IO_SETBITS:
616 local_irq_save(flags); local_irq_disable(); 656 local_irq_save(flags);
617 // set changeable bits with a 1 in arg 657 // set changeable bits with a 1 in arg
618 if (USE_PORTS(priv)) { 658 if (USE_PORTS(priv)) {
619 *priv->port = *priv->shadow |= 659 *priv->port = *priv->shadow |=
@@ -624,7 +664,7 @@ gpio_ioctl(struct inode *inode, struct file *file,
624 local_irq_restore(flags); 664 local_irq_restore(flags);
625 break; 665 break;
626 case IO_CLRBITS: 666 case IO_CLRBITS:
627 local_irq_save(flags); local_irq_disable(); 667 local_irq_save(flags);
628 // clear changeable bits with a 1 in arg 668 // clear changeable bits with a 1 in arg
629 if (USE_PORTS(priv)) { 669 if (USE_PORTS(priv)) {
630 *priv->port = *priv->shadow &= 670 *priv->port = *priv->shadow &=
@@ -666,33 +706,34 @@ gpio_ioctl(struct inode *inode, struct file *file,
666 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */ 706 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */
667 /* Read direction 0=input 1=output */ 707 /* Read direction 0=input 1=output */
668 if (USE_PORTS(priv)) { 708 if (USE_PORTS(priv)) {
669 return *priv->dir_shadow; 709 ret = *priv->dir_shadow;
670 } else if (priv->minor == GPIO_MINOR_G) { 710 } else if (priv->minor == GPIO_MINOR_G) {
671 /* Note: Some bits are both in and out, 711 /* Note: Some bits are both in and out,
672 * Those that are dual is set here as well. 712 * Those that are dual is set here as well.
673 */ 713 */
674 return (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF; 714 ret = (dir_g_shadow | dir_g_out_bits) & 0x7FFFFFFF;
675 } 715 }
716 break;
676 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */ 717 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */
677 /* Set direction 0=unchanged 1=input, 718 /* Set direction 0=unchanged 1=input,
678 * return mask with 1=input 719 * return mask with 1=input
679 */ 720 */
680 return setget_input(priv, arg) & 0x7FFFFFFF; 721 ret = setget_input(priv, arg) & 0x7FFFFFFF;
681 break; 722 break;
682 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */ 723 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */
683 /* Set direction 0=unchanged 1=output, 724 /* Set direction 0=unchanged 1=output,
684 * return mask with 1=output 725 * return mask with 1=output
685 */ 726 */
686 return setget_output(priv, arg) & 0x7FFFFFFF; 727 ret = setget_output(priv, arg) & 0x7FFFFFFF;
687 728 break;
688 case IO_SHUTDOWN: 729 case IO_SHUTDOWN:
689 SOFT_SHUTDOWN(); 730 SOFT_SHUTDOWN();
690 break; 731 break;
691 case IO_GET_PWR_BT: 732 case IO_GET_PWR_BT:
692#if defined (CONFIG_ETRAX_SOFT_SHUTDOWN) 733#if defined (CONFIG_ETRAX_SOFT_SHUTDOWN)
693 return (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT)); 734 ret = (*R_PORT_G_DATA & ( 1 << CONFIG_ETRAX_POWERBUTTON_BIT));
694#else 735#else
695 return 0; 736 ret = 0;
696#endif 737#endif
697 break; 738 break;
698 case IO_CFG_WRITE_MODE: 739 case IO_CFG_WRITE_MODE:
@@ -709,7 +750,7 @@ gpio_ioctl(struct inode *inode, struct file *file,
709 { 750 {
710 priv->clk_mask = 0; 751 priv->clk_mask = 0;
711 priv->data_mask = 0; 752 priv->data_mask = 0;
712 return -EPERM; 753 ret = -EPERM;
713 } 754 }
714 break; 755 break;
715 case IO_READ_INBITS: 756 case IO_READ_INBITS:
@@ -720,8 +761,7 @@ gpio_ioctl(struct inode *inode, struct file *file,
720 val = *R_PORT_G_DATA; 761 val = *R_PORT_G_DATA;
721 } 762 }
722 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 763 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
723 return -EFAULT; 764 ret = -EFAULT;
724 return 0;
725 break; 765 break;
726 case IO_READ_OUTBITS: 766 case IO_READ_OUTBITS:
727 /* *arg is result of reading the output shadow */ 767 /* *arg is result of reading the output shadow */
@@ -731,36 +771,43 @@ gpio_ioctl(struct inode *inode, struct file *file,
731 val = port_g_data_shadow; 771 val = port_g_data_shadow;
732 } 772 }
733 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 773 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
734 return -EFAULT; 774 ret = -EFAULT;
735 break; 775 break;
736 case IO_SETGET_INPUT: 776 case IO_SETGET_INPUT:
737 /* bits set in *arg is set to input, 777 /* bits set in *arg is set to input,
738 * *arg updated with current input pins. 778 * *arg updated with current input pins.
739 */ 779 */
740 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val))) 780 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
741 return -EFAULT; 781 {
782 ret = -EFAULT;
783 break;
784 }
742 val = setget_input(priv, val); 785 val = setget_input(priv, val);
743 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 786 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
744 return -EFAULT; 787 ret = -EFAULT;
745 break; 788 break;
746 case IO_SETGET_OUTPUT: 789 case IO_SETGET_OUTPUT:
747 /* bits set in *arg is set to output, 790 /* bits set in *arg is set to output,
748 * *arg updated with current output pins. 791 * *arg updated with current output pins.
749 */ 792 */
750 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val))) 793 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
751 return -EFAULT; 794 {
795 ret = -EFAULT;
796 break;
797 }
752 val = setget_output(priv, val); 798 val = setget_output(priv, val);
753 if (copy_to_user((unsigned long*)arg, &val, sizeof(val))) 799 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
754 return -EFAULT; 800 ret = -EFAULT;
755 break; 801 break;
756 default: 802 default:
757 if (priv->minor == GPIO_MINOR_LEDS) 803 if (priv->minor == GPIO_MINOR_LEDS)
758 return gpio_leds_ioctl(cmd, arg); 804 ret = gpio_leds_ioctl(cmd, arg);
759 else 805 else
760 return -EINVAL; 806 ret = -EINVAL;
761 } /* switch */ 807 } /* switch */
762 808
763 return 0; 809 spin_unlock(&gpio_lock);
810 return ret;
764} 811}
765 812
766static int 813static int
@@ -802,60 +849,20 @@ struct file_operations gpio_fops = {
802}; 849};
803 850
804 851
805static void __init gpio_init_port_g(void) 852void ioif_watcher(const unsigned int gpio_in_available,
853 const unsigned int gpio_out_available,
854 const unsigned char pa_available,
855 const unsigned char pb_available)
806{ 856{
807#define GROUPA (0x0000FF3F) 857 unsigned long int flags;
808#define GROUPB (1<<6 | 1<<7) 858 D(printk("gpio.c: ioif_watcher called\n"));
809#define GROUPC (1<<30 | 1<<31) 859 D(printk("gpio.c: G in: 0x%08x G out: 0x%08x PA: 0x%02x PB: 0x%02x\n",
810#define GROUPD (0x3FFF0000) 860 gpio_in_available, gpio_out_available, pa_available, pb_available));
811#define GROUPD_LOW (0x00FF0000)
812 unsigned long used_in_bits = 0;
813 unsigned long used_out_bits = 0;
814 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, scsi0, select)){
815 used_in_bits |= GROUPA | GROUPB | 0 | 0;
816 used_out_bits |= GROUPA | GROUPB | 0 | 0;
817 }
818 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, ata, select)) {
819 used_in_bits |= GROUPA | GROUPB | GROUPC | (GROUPD & ~(1<<25|1<<26));
820 used_out_bits |= GROUPA | GROUPB | GROUPC | GROUPD;
821 }
822 861
823 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, par0, select)) { 862 spin_lock_irqsave(&gpio_lock, flags);
824 used_in_bits |= (GROUPA & ~(1<<0)) | 0 | 0 | 0;
825 used_out_bits |= (GROUPA & ~(1<<0)) | 0 | 0 | 0;
826 }
827 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, ser2, select)) {
828 used_in_bits |= 0 | GROUPB | 0 | 0;
829 used_out_bits |= 0 | GROUPB | 0 | 0;
830 }
831 /* mio same as shared RAM ? */
832 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, mio, select)) {
833 used_in_bits |= (GROUPA & ~(1<<0)) | 0 |0 |GROUPD_LOW;
834 used_out_bits |= (GROUPA & ~(1<<0|1<<1|1<<2)) | 0 |0 |GROUPD_LOW;
835 }
836 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, scsi1, select)) {
837 used_in_bits |= 0 | 0 | GROUPC | GROUPD;
838 used_out_bits |= 0 | 0 | GROUPC | GROUPD;
839 }
840 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, scsi0w, select)) {
841 used_in_bits |= GROUPA | GROUPB | 0 | (GROUPD_LOW | 1<<24);
842 used_out_bits |= GROUPA | GROUPB | 0 | (GROUPD_LOW | 1<<24 | 1<<25|1<<26);
843 }
844 863
845 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, par1, select)) { 864 dir_g_in_bits = gpio_in_available;
846 used_in_bits |= 0 | 0 | 0 | (GROUPD & ~(1<<24)); 865 dir_g_out_bits = gpio_out_available;
847 used_out_bits |= 0 | 0 | 0 | (GROUPD & ~(1<<24));
848 }
849 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, ser3, select)) {
850 used_in_bits |= 0 | 0 | GROUPC | 0;
851 used_out_bits |= 0 | 0 | GROUPC | 0;
852 }
853 /* mio same as shared RAM-W? */
854 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, mio_w, select)) {
855 used_in_bits |= (GROUPA & ~(1<<0)) | 0 | 0 |GROUPD_LOW;
856 used_out_bits |= (GROUPA & ~(1<<0|1<<1|1<<2)) | 0 | 0 |GROUPD_LOW;
857 }
858 /* TODO: USB p2, parw, sync ser3? */
859 866
860 /* Initialise the dir_g_shadow etc. depending on genconfig */ 867 /* Initialise the dir_g_shadow etc. depending on genconfig */
861 /* 0=input 1=output */ 868 /* 0=input 1=output */
@@ -868,10 +875,7 @@ static void __init gpio_init_port_g(void)
868 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, g24dir, out)) 875 if (genconfig_shadow & IO_STATE(R_GEN_CONFIG, g24dir, out))
869 dir_g_shadow |= (1 << 24); 876 dir_g_shadow |= (1 << 24);
870 877
871 dir_g_in_bits = ~used_in_bits; 878 changeable_dir_g = changeable_dir_g_mask;
872 dir_g_out_bits = ~used_out_bits;
873
874 changeable_dir_g = 0x01FFFF01; /* all that can change dir */
875 changeable_dir_g &= dir_g_out_bits; 879 changeable_dir_g &= dir_g_out_bits;
876 changeable_dir_g &= dir_g_in_bits; 880 changeable_dir_g &= dir_g_in_bits;
877 /* Correct the bits that can change direction */ 881 /* Correct the bits that can change direction */
@@ -880,6 +884,7 @@ static void __init gpio_init_port_g(void)
880 dir_g_in_bits &= ~changeable_dir_g; 884 dir_g_in_bits &= ~changeable_dir_g;
881 dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g); 885 dir_g_in_bits |= (~dir_g_shadow & changeable_dir_g);
882 886
887 spin_unlock_irqrestore(&gpio_lock, flags);
883 888
884 printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n", 889 printk(KERN_INFO "GPIO port G: in_bits: 0x%08lX out_bits: 0x%08lX val: %08lX\n",
885 dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA); 890 dir_g_in_bits, dir_g_out_bits, (unsigned long)*R_PORT_G_DATA);
@@ -896,6 +901,7 @@ gpio_init(void)
896#if defined (CONFIG_ETRAX_CSP0_LEDS) 901#if defined (CONFIG_ETRAX_CSP0_LEDS)
897 int i; 902 int i;
898#endif 903#endif
904 printk("gpio init\n");
899 905
900 /* do the formalities */ 906 /* do the formalities */
901 907
@@ -919,8 +925,13 @@ gpio_init(void)
919#endif 925#endif
920 926
921#endif 927#endif
922 gpio_init_port_g(); 928 /* The I/O interface allocation watcher will be called when
923 printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002 Axis Communications AB\n"); 929 * registering it. */
930 if (cris_io_interface_register_watcher(ioif_watcher)){
931 printk(KERN_WARNING "gpio_init: Failed to install IO if allocator watcher\n");
932 }
933
934 printk(KERN_INFO "ETRAX 100LX GPIO driver v2.5, (c) 2001, 2002, 2003, 2004 Axis Communications AB\n");
924 /* We call etrax_gpio_wake_up_check() from timer interrupt and 935 /* We call etrax_gpio_wake_up_check() from timer interrupt and
925 * from cpu_idle() in kernel/process.c 936 * from cpu_idle() in kernel/process.c
926 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms 937 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms
diff --git a/arch/cris/arch-v10/drivers/i2c.c b/arch/cris/arch-v10/drivers/i2c.c
index 8bbe233ba7b1..b38267d60d30 100644
--- a/arch/cris/arch-v10/drivers/i2c.c
+++ b/arch/cris/arch-v10/drivers/i2c.c
@@ -12,6 +12,15 @@
12*! don't use PB_I2C if DS1302 uses same bits, 12*! don't use PB_I2C if DS1302 uses same bits,
13*! use PB. 13*! use PB.
14*! $Log: i2c.c,v $ 14*! $Log: i2c.c,v $
15*! Revision 1.13 2005/03/07 13:13:07 starvik
16*! Added spinlocks to protect states etc
17*!
18*! Revision 1.12 2005/01/05 06:11:22 starvik
19*! No need to do local_irq_disable after local_irq_save.
20*!
21*! Revision 1.11 2004/12/13 12:21:52 starvik
22*! Added I/O and DMA allocators from Linux 2.4
23*!
15*! Revision 1.9 2004/08/24 06:49:14 starvik 24*! Revision 1.9 2004/08/24 06:49:14 starvik
16*! Whitespace cleanup 25*! Whitespace cleanup
17*! 26*!
@@ -75,7 +84,7 @@
75*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN 84*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
76*! 85*!
77*!***************************************************************************/ 86*!***************************************************************************/
78/* $Id: i2c.c,v 1.9 2004/08/24 06:49:14 starvik Exp $ */ 87/* $Id: i2c.c,v 1.13 2005/03/07 13:13:07 starvik Exp $ */
79 88
80/****************** INCLUDE FILES SECTION ***********************************/ 89/****************** INCLUDE FILES SECTION ***********************************/
81 90
@@ -95,6 +104,7 @@
95#include <asm/arch/svinto.h> 104#include <asm/arch/svinto.h>
96#include <asm/io.h> 105#include <asm/io.h>
97#include <asm/delay.h> 106#include <asm/delay.h>
107#include <asm/arch/io_interface_mux.h>
98 108
99#include "i2c.h" 109#include "i2c.h"
100 110
@@ -184,6 +194,7 @@ static const char i2c_name[] = "i2c";
184 194
185#define i2c_delay(usecs) udelay(usecs) 195#define i2c_delay(usecs) udelay(usecs)
186 196
197static DEFINE_SPINLOCK(i2c_lock); /* Protect directions etc */
187 198
188/****************** FUNCTION DEFINITION SECTION *************************/ 199/****************** FUNCTION DEFINITION SECTION *************************/
189 200
@@ -488,13 +499,14 @@ i2c_writereg(unsigned char theSlave, unsigned char theReg,
488 int error, cntr = 3; 499 int error, cntr = 3;
489 unsigned long flags; 500 unsigned long flags;
490 501
502 spin_lock(&i2c_lock);
503
491 do { 504 do {
492 error = 0; 505 error = 0;
493 /* 506 /*
494 * we don't like to be interrupted 507 * we don't like to be interrupted
495 */ 508 */
496 local_irq_save(flags); 509 local_irq_save(flags);
497 local_irq_disable();
498 510
499 i2c_start(); 511 i2c_start();
500 /* 512 /*
@@ -538,6 +550,8 @@ i2c_writereg(unsigned char theSlave, unsigned char theReg,
538 550
539 i2c_delay(CLOCK_LOW_TIME); 551 i2c_delay(CLOCK_LOW_TIME);
540 552
553 spin_unlock(&i2c_lock);
554
541 return -error; 555 return -error;
542} 556}
543 557
@@ -555,13 +569,14 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
555 int error, cntr = 3; 569 int error, cntr = 3;
556 unsigned long flags; 570 unsigned long flags;
557 571
572 spin_lock(&i2c_lock);
573
558 do { 574 do {
559 error = 0; 575 error = 0;
560 /* 576 /*
561 * we don't like to be interrupted 577 * we don't like to be interrupted
562 */ 578 */
563 local_irq_save(flags); 579 local_irq_save(flags);
564 local_irq_disable();
565 /* 580 /*
566 * generate start condition 581 * generate start condition
567 */ 582 */
@@ -620,6 +635,8 @@ i2c_readreg(unsigned char theSlave, unsigned char theReg)
620 635
621 } while(error && cntr--); 636 } while(error && cntr--);
622 637
638 spin_unlock(&i2c_lock);
639
623 return b; 640 return b;
624} 641}
625 642
@@ -686,15 +703,26 @@ static struct file_operations i2c_fops = {
686int __init 703int __init
687i2c_init(void) 704i2c_init(void)
688{ 705{
706 static int res = 0;
707 static int first = 1;
708
709 if (!first) {
710 return res;
711 }
712
689 /* Setup and enable the Port B I2C interface */ 713 /* Setup and enable the Port B I2C interface */
690 714
691#ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C 715#ifndef CONFIG_ETRAX_I2C_USES_PB_NOT_PB_I2C
716 if ((res = cris_request_io_interface(if_i2c, "I2C"))) {
717 printk(KERN_CRIT "i2c_init: Failed to get IO interface\n");
718 return res;
719 }
720
692 *R_PORT_PB_I2C = port_pb_i2c_shadow |= 721 *R_PORT_PB_I2C = port_pb_i2c_shadow |=
693 IO_STATE(R_PORT_PB_I2C, i2c_en, on) | 722 IO_STATE(R_PORT_PB_I2C, i2c_en, on) |
694 IO_FIELD(R_PORT_PB_I2C, i2c_d, 1) | 723 IO_FIELD(R_PORT_PB_I2C, i2c_d, 1) |
695 IO_FIELD(R_PORT_PB_I2C, i2c_clk, 1) | 724 IO_FIELD(R_PORT_PB_I2C, i2c_clk, 1) |
696 IO_STATE(R_PORT_PB_I2C, i2c_oe_, enable); 725 IO_STATE(R_PORT_PB_I2C, i2c_oe_, enable);
697#endif
698 726
699 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir0); 727 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir0);
700 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir1); 728 port_pb_dir_shadow &= ~IO_MASK(R_PORT_PB_DIR, dir1);
@@ -702,8 +730,26 @@ i2c_init(void)
702 *R_PORT_PB_DIR = (port_pb_dir_shadow |= 730 *R_PORT_PB_DIR = (port_pb_dir_shadow |=
703 IO_STATE(R_PORT_PB_DIR, dir0, input) | 731 IO_STATE(R_PORT_PB_DIR, dir0, input) |
704 IO_STATE(R_PORT_PB_DIR, dir1, output)); 732 IO_STATE(R_PORT_PB_DIR, dir1, output));
733#else
734 if ((res = cris_io_interface_allocate_pins(if_i2c,
735 'b',
736 CONFIG_ETRAX_I2C_DATA_PORT,
737 CONFIG_ETRAX_I2C_DATA_PORT))) {
738 printk(KERN_WARNING "i2c_init: Failed to get IO pin for I2C data port\n");
739 return res;
740 } else if ((res = cris_io_interface_allocate_pins(if_i2c,
741 'b',
742 CONFIG_ETRAX_I2C_CLK_PORT,
743 CONFIG_ETRAX_I2C_CLK_PORT))) {
744 cris_io_interface_free_pins(if_i2c,
745 'b',
746 CONFIG_ETRAX_I2C_DATA_PORT,
747 CONFIG_ETRAX_I2C_DATA_PORT);
748 printk(KERN_WARNING "i2c_init: Failed to get IO pin for I2C clk port\n");
749 }
750#endif
705 751
706 return 0; 752 return res;
707} 753}
708 754
709static int __init 755static int __init
@@ -711,14 +757,16 @@ i2c_register(void)
711{ 757{
712 int res; 758 int res;
713 759
714 i2c_init(); 760 res = i2c_init();
761 if (res < 0)
762 return res;
715 res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops); 763 res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
716 if(res < 0) { 764 if(res < 0) {
717 printk(KERN_ERR "i2c: couldn't get a major number.\n"); 765 printk(KERN_ERR "i2c: couldn't get a major number.\n");
718 return res; 766 return res;
719 } 767 }
720 768
721 printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n"); 769 printk(KERN_INFO "I2C driver v2.2, (c) 1999-2004 Axis Communications AB\n");
722 770
723 return 0; 771 return 0;
724} 772}
diff --git a/arch/cris/arch-v10/drivers/pcf8563.c b/arch/cris/arch-v10/drivers/pcf8563.c
index b3dfdf7b8fc5..201f4c90d961 100644
--- a/arch/cris/arch-v10/drivers/pcf8563.c
+++ b/arch/cris/arch-v10/drivers/pcf8563.c
@@ -15,7 +15,7 @@
15 * 15 *
16 * Author: Tobias Anderberg <tobiasa@axis.com>. 16 * Author: Tobias Anderberg <tobiasa@axis.com>.
17 * 17 *
18 * $Id: pcf8563.c,v 1.8 2004/08/24 06:42:51 starvik Exp $ 18 * $Id: pcf8563.c,v 1.11 2005/03/07 13:13:07 starvik Exp $
19 */ 19 */
20 20
21#include <linux/config.h> 21#include <linux/config.h>
@@ -40,7 +40,7 @@
40#define PCF8563_MAJOR 121 /* Local major number. */ 40#define PCF8563_MAJOR 121 /* Local major number. */
41#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */ 41#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
42#define PCF8563_NAME "PCF8563" 42#define PCF8563_NAME "PCF8563"
43#define DRIVER_VERSION "$Revision: 1.8 $" 43#define DRIVER_VERSION "$Revision: 1.11 $"
44 44
45/* I2C bus slave registers. */ 45/* I2C bus slave registers. */
46#define RTC_I2C_READ 0xa3 46#define RTC_I2C_READ 0xa3
@@ -49,6 +49,8 @@
49/* Two simple wrapper macros, saves a few keystrokes. */ 49/* Two simple wrapper macros, saves a few keystrokes. */
50#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x) 50#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
51#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y) 51#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
52
53static DEFINE_SPINLOCK(rtc_lock); /* Protect state etc */
52 54
53static const unsigned char days_in_month[] = 55static const unsigned char days_in_month[] =
54 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 56 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
@@ -125,9 +127,12 @@ get_rtc_time(struct rtc_time *tm)
125int __init 127int __init
126pcf8563_init(void) 128pcf8563_init(void)
127{ 129{
128 unsigned char ret; 130 int ret;
129 131
130 i2c_init(); 132 if ((ret = i2c_init())) {
133 printk(KERN_CRIT "pcf8563_init: failed to init i2c\n");
134 return ret;
135 }
131 136
132 /* 137 /*
133 * First of all we need to reset the chip. This is done by 138 * First of all we need to reset the chip. This is done by
@@ -200,12 +205,15 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
200 { 205 {
201 struct rtc_time tm; 206 struct rtc_time tm;
202 207
208 spin_lock(&rtc_lock);
203 get_rtc_time(&tm); 209 get_rtc_time(&tm);
204 210
205 if (copy_to_user((struct rtc_time *) arg, &tm, sizeof(struct rtc_time))) { 211 if (copy_to_user((struct rtc_time *) arg, &tm, sizeof(struct rtc_time))) {
212 spin_unlock(&rtc_lock);
206 return -EFAULT; 213 return -EFAULT;
207 } 214 }
208 215
216 spin_unlock(&rtc_lock);
209 return 0; 217 return 0;
210 } 218 }
211 break; 219 break;
@@ -250,6 +258,8 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
250 BIN_TO_BCD(tm.tm_min); 258 BIN_TO_BCD(tm.tm_min);
251 BIN_TO_BCD(tm.tm_sec); 259 BIN_TO_BCD(tm.tm_sec);
252 tm.tm_mon |= century; 260 tm.tm_mon |= century;
261
262 spin_lock(&rtc_lock);
253 263
254 rtc_write(RTC_YEAR, tm.tm_year); 264 rtc_write(RTC_YEAR, tm.tm_year);
255 rtc_write(RTC_MONTH, tm.tm_mon); 265 rtc_write(RTC_MONTH, tm.tm_mon);
@@ -258,6 +268,8 @@ pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned
258 rtc_write(RTC_MINUTES, tm.tm_min); 268 rtc_write(RTC_MINUTES, tm.tm_min);
259 rtc_write(RTC_SECONDS, tm.tm_sec); 269 rtc_write(RTC_SECONDS, tm.tm_sec);
260 270
271 spin_unlock(&rtc_lock);
272
261 return 0; 273 return 0;
262#endif /* !CONFIG_ETRAX_RTC_READONLY */ 274#endif /* !CONFIG_ETRAX_RTC_READONLY */
263 } 275 }
diff --git a/arch/cris/arch-v10/kernel/Makefile b/arch/cris/arch-v10/kernel/Makefile
index 52761603b6a5..dcfec41d3533 100644
--- a/arch/cris/arch-v10/kernel/Makefile
+++ b/arch/cris/arch-v10/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.5 2004/06/02 08:24:38 starvik Exp $ 1# $Id: Makefile,v 1.6 2004/12/13 12:21:51 starvik Exp $
2# 2#
3# Makefile for the linux kernel. 3# Makefile for the linux kernel.
4# 4#
@@ -7,7 +7,8 @@ extra-y := head.o
7 7
8 8
9obj-y := entry.o traps.o shadows.o debugport.o irq.o \ 9obj-y := entry.o traps.o shadows.o debugport.o irq.o \
10 process.o setup.o signal.o traps.o time.o ptrace.o 10 process.o setup.o signal.o traps.o time.o ptrace.o \
11 dma.o io_interface_mux.o
11 12
12obj-$(CONFIG_ETRAX_KGDB) += kgdb.o 13obj-$(CONFIG_ETRAX_KGDB) += kgdb.o
13obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o 14obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
diff --git a/arch/cris/arch-v10/kernel/debugport.c b/arch/cris/arch-v10/kernel/debugport.c
index 6cf069e5e7b6..f3a85b77c17e 100644
--- a/arch/cris/arch-v10/kernel/debugport.c
+++ b/arch/cris/arch-v10/kernel/debugport.c
@@ -12,6 +12,31 @@
12 * init_etrax_debug() 12 * init_etrax_debug()
13 * 13 *
14 * $Log: debugport.c,v $ 14 * $Log: debugport.c,v $
15 * Revision 1.27 2005/06/10 10:34:14 starvik
16 * Real console support
17 *
18 * Revision 1.26 2005/06/07 07:06:07 starvik
19 * Added LF->CR translation to make ETRAX customers happy.
20 *
21 * Revision 1.25 2005/03/08 08:56:47 mikaelam
22 * Do only set index as port->index if port is defined, otherwise use the index from the command line
23 *
24 * Revision 1.24 2005/01/19 10:26:33 mikaelam
25 * Return the cris serial driver in console device driver callback function
26 *
27 * Revision 1.23 2005/01/14 10:12:17 starvik
28 * KGDB on separate port.
29 * Console fixes from 2.4.
30 *
31 * Revision 1.22 2005/01/11 16:06:13 starvik
32 * typo
33 *
34 * Revision 1.21 2005/01/11 13:49:14 starvik
35 * Added raw_printk to be used where we don't trust the console.
36 *
37 * Revision 1.20 2004/12/27 11:18:32 starvik
38 * Merge of Linux 2.6.10 (not functional yet).
39 *
15 * Revision 1.19 2004/10/21 07:26:16 starvik 40 * Revision 1.19 2004/10/21 07:26:16 starvik
16 * Made it possible to specify console settings on kernel command line. 41 * Made it possible to specify console settings on kernel command line.
17 * 42 *
@@ -114,7 +139,11 @@ struct dbg_port ports[]=
114 R_SERIAL0_BAUD, 139 R_SERIAL0_BAUD,
115 R_SERIAL0_TR_CTRL, 140 R_SERIAL0_TR_CTRL,
116 R_SERIAL0_REC_CTRL, 141 R_SERIAL0_REC_CTRL,
117 IO_STATE(R_IRQ_MASK1_SET, ser0_data, set) 142 IO_STATE(R_IRQ_MASK1_SET, ser0_data, set),
143 0,
144 115200,
145 'N',
146 8
118 }, 147 },
119 { 148 {
120 1, 149 1,
@@ -124,7 +153,11 @@ struct dbg_port ports[]=
124 R_SERIAL1_BAUD, 153 R_SERIAL1_BAUD,
125 R_SERIAL1_TR_CTRL, 154 R_SERIAL1_TR_CTRL,
126 R_SERIAL1_REC_CTRL, 155 R_SERIAL1_REC_CTRL,
127 IO_STATE(R_IRQ_MASK1_SET, ser1_data, set) 156 IO_STATE(R_IRQ_MASK1_SET, ser1_data, set),
157 0,
158 115200,
159 'N',
160 8
128 }, 161 },
129 { 162 {
130 2, 163 2,
@@ -134,7 +167,11 @@ struct dbg_port ports[]=
134 R_SERIAL2_BAUD, 167 R_SERIAL2_BAUD,
135 R_SERIAL2_TR_CTRL, 168 R_SERIAL2_TR_CTRL,
136 R_SERIAL2_REC_CTRL, 169 R_SERIAL2_REC_CTRL,
137 IO_STATE(R_IRQ_MASK1_SET, ser2_data, set) 170 IO_STATE(R_IRQ_MASK1_SET, ser2_data, set),
171 0,
172 115200,
173 'N',
174 8
138 }, 175 },
139 { 176 {
140 3, 177 3,
@@ -144,11 +181,15 @@ struct dbg_port ports[]=
144 R_SERIAL3_BAUD, 181 R_SERIAL3_BAUD,
145 R_SERIAL3_TR_CTRL, 182 R_SERIAL3_TR_CTRL,
146 R_SERIAL3_REC_CTRL, 183 R_SERIAL3_REC_CTRL,
147 IO_STATE(R_IRQ_MASK1_SET, ser3_data, set) 184 IO_STATE(R_IRQ_MASK1_SET, ser3_data, set),
185 0,
186 115200,
187 'N',
188 8
148 } 189 }
149}; 190};
150 191
151static struct tty_driver *serial_driver; 192extern struct tty_driver *serial_driver;
152 193
153struct dbg_port* port = 194struct dbg_port* port =
154#if defined(CONFIG_ETRAX_DEBUG_PORT0) 195#if defined(CONFIG_ETRAX_DEBUG_PORT0)
@@ -162,37 +203,44 @@ struct dbg_port* port =
162#else 203#else
163 NULL; 204 NULL;
164#endif 205#endif
165/* Used by serial.c to register a debug_write_function so that the normal
166 * serial driver is used for kernel debug output
167 */
168typedef int (*debugport_write_function)(int i, const char *buf, unsigned int len);
169 206
170debugport_write_function debug_write_function = NULL; 207static struct dbg_port* kgdb_port =
208#if defined(CONFIG_ETRAX_KGDB_PORT0)
209 &ports[0];
210#elif defined(CONFIG_ETRAX_KGDB_PORT1)
211 &ports[1];
212#elif defined(CONFIG_ETRAX_KGDB_PORT2)
213 &ports[2];
214#elif defined(CONFIG_ETRAX_KGDB_PORT3)
215 &ports[3];
216#else
217 NULL;
218#endif
171 219
172static void 220static void
173start_port(void) 221start_port(struct dbg_port* p)
174{ 222{
175 unsigned long rec_ctrl = 0; 223 unsigned long rec_ctrl = 0;
176 unsigned long tr_ctrl = 0; 224 unsigned long tr_ctrl = 0;
177 225
178 if (!port) 226 if (!p)
179 return; 227 return;
180 228
181 if (port->started) 229 if (p->started)
182 return; 230 return;
183 port->started = 1; 231 p->started = 1;
184 232
185 if (port->index == 0) 233 if (p->index == 0)
186 { 234 {
187 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6); 235 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma6);
188 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused); 236 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma6, unused);
189 } 237 }
190 else if (port->index == 1) 238 else if (p->index == 1)
191 { 239 {
192 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8); 240 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma8);
193 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb); 241 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma8, usb);
194 } 242 }
195 else if (port->index == 2) 243 else if (p->index == 2)
196 { 244 {
197 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2); 245 genconfig_shadow &= ~IO_MASK(R_GEN_CONFIG, dma2);
198 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0); 246 genconfig_shadow |= IO_STATE(R_GEN_CONFIG, dma2, par0);
@@ -211,69 +259,69 @@ start_port(void)
211 259
212 *R_GEN_CONFIG = genconfig_shadow; 260 *R_GEN_CONFIG = genconfig_shadow;
213 261
214 *port->xoff = 262 *p->xoff =
215 IO_STATE(R_SERIAL0_XOFF, tx_stop, enable) | 263 IO_STATE(R_SERIAL0_XOFF, tx_stop, enable) |
216 IO_STATE(R_SERIAL0_XOFF, auto_xoff, disable) | 264 IO_STATE(R_SERIAL0_XOFF, auto_xoff, disable) |
217 IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0); 265 IO_FIELD(R_SERIAL0_XOFF, xoff_char, 0);
218 266
219 switch (port->baudrate) 267 switch (p->baudrate)
220 { 268 {
221 case 0: 269 case 0:
222 case 115200: 270 case 115200:
223 *port->baud = 271 *p->baud =
224 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) | 272 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
225 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz); 273 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
226 break; 274 break;
227 case 1200: 275 case 1200:
228 *port->baud = 276 *p->baud =
229 IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) | 277 IO_STATE(R_SERIAL0_BAUD, tr_baud, c1200Hz) |
230 IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz); 278 IO_STATE(R_SERIAL0_BAUD, rec_baud, c1200Hz);
231 break; 279 break;
232 case 2400: 280 case 2400:
233 *port->baud = 281 *p->baud =
234 IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) | 282 IO_STATE(R_SERIAL0_BAUD, tr_baud, c2400Hz) |
235 IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz); 283 IO_STATE(R_SERIAL0_BAUD, rec_baud, c2400Hz);
236 break; 284 break;
237 case 4800: 285 case 4800:
238 *port->baud = 286 *p->baud =
239 IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) | 287 IO_STATE(R_SERIAL0_BAUD, tr_baud, c4800Hz) |
240 IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz); 288 IO_STATE(R_SERIAL0_BAUD, rec_baud, c4800Hz);
241 break; 289 break;
242 case 9600: 290 case 9600:
243 *port->baud = 291 *p->baud =
244 IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) | 292 IO_STATE(R_SERIAL0_BAUD, tr_baud, c9600Hz) |
245 IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz); 293 IO_STATE(R_SERIAL0_BAUD, rec_baud, c9600Hz);
246 break; 294 break;
247 case 19200: 295 case 19200:
248 *port->baud = 296 *p->baud =
249 IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) | 297 IO_STATE(R_SERIAL0_BAUD, tr_baud, c19k2Hz) |
250 IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz); 298 IO_STATE(R_SERIAL0_BAUD, rec_baud, c19k2Hz);
251 break; 299 break;
252 case 38400: 300 case 38400:
253 *port->baud = 301 *p->baud =
254 IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) | 302 IO_STATE(R_SERIAL0_BAUD, tr_baud, c38k4Hz) |
255 IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz); 303 IO_STATE(R_SERIAL0_BAUD, rec_baud, c38k4Hz);
256 break; 304 break;
257 case 57600: 305 case 57600:
258 *port->baud = 306 *p->baud =
259 IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) | 307 IO_STATE(R_SERIAL0_BAUD, tr_baud, c57k6Hz) |
260 IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz); 308 IO_STATE(R_SERIAL0_BAUD, rec_baud, c57k6Hz);
261 break; 309 break;
262 default: 310 default:
263 *port->baud = 311 *p->baud =
264 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) | 312 IO_STATE(R_SERIAL0_BAUD, tr_baud, c115k2Hz) |
265 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz); 313 IO_STATE(R_SERIAL0_BAUD, rec_baud, c115k2Hz);
266 break; 314 break;
267 } 315 }
268 316
269 if (port->parity == 'E') { 317 if (p->parity == 'E') {
270 rec_ctrl = 318 rec_ctrl =
271 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) | 319 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, even) |
272 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable); 320 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
273 tr_ctrl = 321 tr_ctrl =
274 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) | 322 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
275 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable); 323 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, enable);
276 } else if (port->parity == 'O') { 324 } else if (p->parity == 'O') {
277 rec_ctrl = 325 rec_ctrl =
278 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) | 326 IO_STATE(R_SERIAL0_REC_CTRL, rec_par, odd) |
279 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable); 327 IO_STATE(R_SERIAL0_REC_CTRL, rec_par_en, enable);
@@ -288,8 +336,7 @@ start_port(void)
288 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) | 336 IO_STATE(R_SERIAL0_TR_CTRL, tr_par, even) |
289 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, disable); 337 IO_STATE(R_SERIAL0_TR_CTRL, tr_par_en, disable);
290 } 338 }
291 339 if (p->bits == 7)
292 if (port->bits == 7)
293 { 340 {
294 rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit); 341 rec_ctrl |= IO_STATE(R_SERIAL0_REC_CTRL, rec_bitnr, rec_7bit);
295 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit); 342 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_7bit);
@@ -300,7 +347,7 @@ start_port(void)
300 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit); 347 tr_ctrl |= IO_STATE(R_SERIAL0_TR_CTRL, tr_bitnr, tr_8bit);
301 } 348 }
302 349
303 *port->rec_ctrl = 350 *p->rec_ctrl =
304 IO_STATE(R_SERIAL0_REC_CTRL, dma_err, stop) | 351 IO_STATE(R_SERIAL0_REC_CTRL, dma_err, stop) |
305 IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable) | 352 IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable) |
306 IO_STATE(R_SERIAL0_REC_CTRL, rts_, active) | 353 IO_STATE(R_SERIAL0_REC_CTRL, rts_, active) |
@@ -308,7 +355,7 @@ start_port(void)
308 IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) | 355 IO_STATE(R_SERIAL0_REC_CTRL, rec_stick_par, normal) |
309 rec_ctrl; 356 rec_ctrl;
310 357
311 *port->tr_ctrl = 358 *p->tr_ctrl =
312 IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) | 359 IO_FIELD(R_SERIAL0_TR_CTRL, txd, 0) |
313 IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable) | 360 IO_STATE(R_SERIAL0_TR_CTRL, tr_enable, enable) |
314 IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) | 361 IO_STATE(R_SERIAL0_TR_CTRL, auto_cts, disabled) |
@@ -323,8 +370,18 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
323 int i; 370 int i;
324 unsigned long flags; 371 unsigned long flags;
325 local_irq_save(flags); 372 local_irq_save(flags);
373
374 if (!port)
375 return;
376
326 /* Send data */ 377 /* Send data */
327 for (i = 0; i < len; i++) { 378 for (i = 0; i < len; i++) {
379 /* LF -> CRLF */
380 if (buf[i] == '\n') {
381 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
382 ;
383 *port->write = '\r';
384 }
328 /* Wait until transmitter is ready and send.*/ 385 /* Wait until transmitter is ready and send.*/
329 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready))) 386 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
330 ; 387 ;
@@ -333,6 +390,25 @@ console_write_direct(struct console *co, const char *buf, unsigned int len)
333 local_irq_restore(flags); 390 local_irq_restore(flags);
334} 391}
335 392
393int raw_printk(const char *fmt, ...)
394{
395 static char buf[1024];
396 int printed_len;
397 static int first = 1;
398 if (first) {
399 /* Force reinitialization of the port to get manual mode. */
400 port->started = 0;
401 start_port(port);
402 first = 0;
403 }
404 va_list args;
405 va_start(args, fmt);
406 printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
407 va_end(args);
408 console_write_direct(NULL, buf, strlen(buf));
409 return printed_len;
410}
411
336static void 412static void
337console_write(struct console *co, const char *buf, unsigned int len) 413console_write(struct console *co, const char *buf, unsigned int len)
338{ 414{
@@ -345,18 +421,7 @@ console_write(struct console *co, const char *buf, unsigned int len)
345 return; 421 return;
346#endif 422#endif
347 423
348 start_port(); 424 console_write_direct(co, buf, len);
349
350#ifdef CONFIG_ETRAX_KGDB
351 /* kgdb needs to output debug info using the gdb protocol */
352 putDebugString(buf, len);
353 return;
354#endif
355
356 if (debug_write_function)
357 debug_write_function(co->index, buf, len);
358 else
359 console_write_direct(co, buf, len);
360} 425}
361 426
362/* legacy function */ 427/* legacy function */
@@ -374,8 +439,11 @@ getDebugChar(void)
374{ 439{
375 unsigned long readval; 440 unsigned long readval;
376 441
442 if (!kgdb_port)
443 return 0;
444
377 do { 445 do {
378 readval = *port->read; 446 readval = *kgdb_port->read;
379 } while (!(readval & IO_MASK(R_SERIAL0_READ, data_avail))); 447 } while (!(readval & IO_MASK(R_SERIAL0_READ, data_avail)));
380 448
381 return (readval & IO_MASK(R_SERIAL0_READ, data_in)); 449 return (readval & IO_MASK(R_SERIAL0_READ, data_in));
@@ -386,9 +454,12 @@ getDebugChar(void)
386void 454void
387putDebugChar(int val) 455putDebugChar(int val)
388{ 456{
389 while (!(*port->read & IO_MASK(R_SERIAL0_READ, tr_ready))) 457 if (!kgdb_port)
458 return;
459
460 while (!(*kgdb_port->read & IO_MASK(R_SERIAL0_READ, tr_ready)))
390 ; 461 ;
391 *port->write = val; 462 *kgdb_port->write = val;
392} 463}
393 464
394/* Enable irq for receiving chars on the debug port, used by kgdb */ 465/* Enable irq for receiving chars on the debug port, used by kgdb */
@@ -396,19 +467,16 @@ putDebugChar(int val)
396void 467void
397enableDebugIRQ(void) 468enableDebugIRQ(void)
398{ 469{
399 *R_IRQ_MASK1_SET = port->irq; 470 if (!kgdb_port)
471 return;
472
473 *R_IRQ_MASK1_SET = kgdb_port->irq;
400 /* use R_VECT_MASK directly, since we really bypass Linux normal 474 /* use R_VECT_MASK directly, since we really bypass Linux normal
401 * IRQ handling in kgdb anyway, we don't need to use enable_irq 475 * IRQ handling in kgdb anyway, we don't need to use enable_irq
402 */ 476 */
403 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set); 477 *R_VECT_MASK_SET = IO_STATE(R_VECT_MASK_SET, serial, set);
404 478
405 *port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable); 479 *kgdb_port->rec_ctrl = IO_STATE(R_SERIAL0_REC_CTRL, rec_enable, enable);
406}
407
408static struct tty_driver*
409etrax_console_device(struct console* co, int *index)
410{
411 return serial_driver;
412} 480}
413 481
414static int __init 482static int __init
@@ -428,11 +496,69 @@ console_setup(struct console *co, char *options)
428 if (*s) port->parity = *s++; 496 if (*s) port->parity = *s++;
429 if (*s) port->bits = *s++ - '0'; 497 if (*s) port->bits = *s++ - '0';
430 port->started = 0; 498 port->started = 0;
431 start_port(); 499 start_port(0);
432 } 500 }
433 return 0; 501 return 0;
434} 502}
435 503
504/* This is a dummy serial device that throws away anything written to it.
505 * This is used when no debug output is wanted.
506 */
507static struct tty_driver dummy_driver;
508
509static int dummy_open(struct tty_struct *tty, struct file * filp)
510{
511 return 0;
512}
513
514static void dummy_close(struct tty_struct *tty, struct file * filp)
515{
516}
517
518static int dummy_write(struct tty_struct * tty,
519 const unsigned char *buf, int count)
520{
521 return count;
522}
523
524static int
525dummy_write_room(struct tty_struct *tty)
526{
527 return 8192;
528}
529
530void __init
531init_dummy_console(void)
532{
533 memset(&dummy_driver, 0, sizeof(struct tty_driver));
534 dummy_driver.driver_name = "serial";
535 dummy_driver.name = "ttyS";
536 dummy_driver.major = TTY_MAJOR;
537 dummy_driver.minor_start = 68;
538 dummy_driver.num = 1; /* etrax100 has 4 serial ports */
539 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
540 dummy_driver.subtype = SERIAL_TYPE_NORMAL;
541 dummy_driver.init_termios = tty_std_termios;
542 dummy_driver.init_termios.c_cflag =
543 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
544 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
545
546 dummy_driver.open = dummy_open;
547 dummy_driver.close = dummy_close;
548 dummy_driver.write = dummy_write;
549 dummy_driver.write_room = dummy_write_room;
550 if (tty_register_driver(&dummy_driver))
551 panic("Couldn't register dummy serial driver\n");
552}
553
554static struct tty_driver*
555etrax_console_device(struct console* co, int *index)
556{
557 if (port)
558 *index = port->index;
559 return port ? serial_driver : &dummy_driver;
560}
561
436static struct console sercons = { 562static struct console sercons = {
437 name : "ttyS", 563 name : "ttyS",
438 write: console_write, 564 write: console_write,
@@ -504,28 +630,21 @@ init_etrax_debug(void)
504 static int first = 1; 630 static int first = 1;
505 631
506 if (!first) { 632 if (!first) {
507 if (!port) { 633 unregister_console(&sercons);
508 register_console(&sercons0); 634 register_console(&sercons0);
509 register_console(&sercons1); 635 register_console(&sercons1);
510 register_console(&sercons2); 636 register_console(&sercons2);
511 register_console(&sercons3); 637 register_console(&sercons3);
512 unregister_console(&sercons); 638 init_dummy_console();
513 }
514 return 0; 639 return 0;
515 } 640 }
516 first = 0;
517 if (port)
518 register_console(&sercons);
519 return 0;
520}
521 641
522int __init 642 first = 0;
523init_console(void) 643 register_console(&sercons);
524{ 644 start_port(port);
525 serial_driver = alloc_tty_driver(1); 645#ifdef CONFIG_ETRAX_KGDB
526 if (!serial_driver) 646 start_port(kgdb_port);
527 return -ENOMEM; 647#endif
528 return 0; 648 return 0;
529} 649}
530
531__initcall(init_etrax_debug); 650__initcall(init_etrax_debug);
diff --git a/arch/cris/arch-v10/kernel/dma.c b/arch/cris/arch-v10/kernel/dma.c
new file mode 100644
index 000000000000..e9a0311b141d
--- /dev/null
+++ b/arch/cris/arch-v10/kernel/dma.c
@@ -0,0 +1,287 @@
1/* Wrapper for DMA channel allocator that updates DMA client muxing.
2 * Copyright 2004, Axis Communications AB
3 * $Id: dma.c,v 1.1 2004/12/13 12:21:51 starvik Exp $
4 */
5
6#include <linux/kernel.h>
7#include <linux/module.h>
8#include <linux/errno.h>
9
10#include <asm/dma.h>
11#include <asm/arch/svinto.h>
12
13/* Macro to access ETRAX 100 registers */
14#define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \
15 IO_STATE_(reg##_, field##_, _##val)
16
17
18static char used_dma_channels[MAX_DMA_CHANNELS];
19static const char * used_dma_channels_users[MAX_DMA_CHANNELS];
20
21int cris_request_dma(unsigned int dmanr, const char * device_id,
22 unsigned options, enum dma_owner owner)
23{
24 unsigned long flags;
25 unsigned long int gens;
26 int fail = -EINVAL;
27
28 if ((dmanr < 0) || (dmanr >= MAX_DMA_CHANNELS)) {
29 printk(KERN_CRIT "cris_request_dma: invalid DMA channel %u\n", dmanr);
30 return -EINVAL;
31 }
32
33 local_irq_save(flags);
34 if (used_dma_channels[dmanr]) {
35 local_irq_restore(flags);
36 if (options & DMA_VERBOSE_ON_ERROR) {
37 printk(KERN_CRIT "Failed to request DMA %i for %s, already allocated by %s\n", dmanr, device_id, used_dma_channels_users[dmanr]);
38 }
39 if (options & DMA_PANIC_ON_ERROR) {
40 panic("request_dma error!");
41 }
42 return -EBUSY;
43 }
44
45 gens = genconfig_shadow;
46
47 switch(owner)
48 {
49 case dma_eth:
50 if ((dmanr != NETWORK_TX_DMA_NBR) &&
51 (dmanr != NETWORK_RX_DMA_NBR)) {
52 printk(KERN_CRIT "Invalid DMA channel for eth\n");
53 goto bail;
54 }
55 break;
56 case dma_ser0:
57 if (dmanr == SER0_TX_DMA_NBR) {
58 SETS(gens, R_GEN_CONFIG, dma6, serial0);
59 } else if (dmanr == SER0_RX_DMA_NBR) {
60 SETS(gens, R_GEN_CONFIG, dma7, serial0);
61 } else {
62 printk(KERN_CRIT "Invalid DMA channel for ser0\n");
63 goto bail;
64 }
65 break;
66 case dma_ser1:
67 if (dmanr == SER1_TX_DMA_NBR) {
68 SETS(gens, R_GEN_CONFIG, dma8, serial1);
69 } else if (dmanr == SER1_RX_DMA_NBR) {
70 SETS(gens, R_GEN_CONFIG, dma9, serial1);
71 } else {
72 printk(KERN_CRIT "Invalid DMA channel for ser1\n");
73 goto bail;
74 }
75 break;
76 case dma_ser2:
77 if (dmanr == SER2_TX_DMA_NBR) {
78 SETS(gens, R_GEN_CONFIG, dma2, serial2);
79 } else if (dmanr == SER2_RX_DMA_NBR) {
80 SETS(gens, R_GEN_CONFIG, dma3, serial2);
81 } else {
82 printk(KERN_CRIT "Invalid DMA channel for ser2\n");
83 goto bail;
84 }
85 break;
86 case dma_ser3:
87 if (dmanr == SER3_TX_DMA_NBR) {
88 SETS(gens, R_GEN_CONFIG, dma4, serial3);
89 } else if (dmanr == SER3_RX_DMA_NBR) {
90 SETS(gens, R_GEN_CONFIG, dma5, serial3);
91 } else {
92 printk(KERN_CRIT "Invalid DMA channel for ser3\n");
93 goto bail;
94 }
95 break;
96 case dma_ata:
97 if (dmanr == ATA_TX_DMA_NBR) {
98 SETS(gens, R_GEN_CONFIG, dma2, ata);
99 } else if (dmanr == ATA_RX_DMA_NBR) {
100 SETS(gens, R_GEN_CONFIG, dma3, ata);
101 } else {
102 printk(KERN_CRIT "Invalid DMA channel for ata\n");
103 goto bail;
104 }
105 break;
106 case dma_ext0:
107 if (dmanr == EXTDMA0_TX_DMA_NBR) {
108 SETS(gens, R_GEN_CONFIG, dma4, extdma0);
109 } else if (dmanr == EXTDMA0_RX_DMA_NBR) {
110 SETS(gens, R_GEN_CONFIG, dma5, extdma0);
111 } else {
112 printk(KERN_CRIT "Invalid DMA channel for ext0\n");
113 goto bail;
114 }
115 break;
116 case dma_ext1:
117 if (dmanr == EXTDMA1_TX_DMA_NBR) {
118 SETS(gens, R_GEN_CONFIG, dma6, extdma1);
119 } else if (dmanr == EXTDMA1_RX_DMA_NBR) {
120 SETS(gens, R_GEN_CONFIG, dma7, extdma1);
121 } else {
122 printk(KERN_CRIT "Invalid DMA channel for ext1\n");
123 goto bail;
124 }
125 break;
126 case dma_int6:
127 if (dmanr == MEM2MEM_RX_DMA_NBR) {
128 SETS(gens, R_GEN_CONFIG, dma7, intdma6);
129 } else {
130 printk(KERN_CRIT "Invalid DMA channel for int6\n");
131 goto bail;
132 }
133 break;
134 case dma_int7:
135 if (dmanr == MEM2MEM_TX_DMA_NBR) {
136 SETS(gens, R_GEN_CONFIG, dma6, intdma7);
137 } else {
138 printk(KERN_CRIT "Invalid DMA channel for int7\n");
139 goto bail;
140 }
141 break;
142 case dma_usb:
143 if (dmanr == USB_TX_DMA_NBR) {
144 SETS(gens, R_GEN_CONFIG, dma8, usb);
145 } else if (dmanr == USB_RX_DMA_NBR) {
146 SETS(gens, R_GEN_CONFIG, dma9, usb);
147 } else {
148 printk(KERN_CRIT "Invalid DMA channel for usb\n");
149 goto bail;
150 }
151 break;
152 case dma_scsi0:
153 if (dmanr == SCSI0_TX_DMA_NBR) {
154 SETS(gens, R_GEN_CONFIG, dma2, scsi0);
155 } else if (dmanr == SCSI0_RX_DMA_NBR) {
156 SETS(gens, R_GEN_CONFIG, dma3, scsi0);
157 } else {
158 printk(KERN_CRIT "Invalid DMA channel for scsi0\n");
159 goto bail;
160 }
161 break;
162 case dma_scsi1:
163 if (dmanr == SCSI1_TX_DMA_NBR) {
164 SETS(gens, R_GEN_CONFIG, dma4, scsi1);
165 } else if (dmanr == SCSI1_RX_DMA_NBR) {
166 SETS(gens, R_GEN_CONFIG, dma5, scsi1);
167 } else {
168 printk(KERN_CRIT "Invalid DMA channel for scsi1\n");
169 goto bail;
170 }
171 break;
172 case dma_par0:
173 if (dmanr == PAR0_TX_DMA_NBR) {
174 SETS(gens, R_GEN_CONFIG, dma2, par0);
175 } else if (dmanr == PAR0_RX_DMA_NBR) {
176 SETS(gens, R_GEN_CONFIG, dma3, par0);
177 } else {
178 printk(KERN_CRIT "Invalid DMA channel for par0\n");
179 goto bail;
180 }
181 break;
182 case dma_par1:
183 if (dmanr == PAR1_TX_DMA_NBR) {
184 SETS(gens, R_GEN_CONFIG, dma4, par1);
185 } else if (dmanr == PAR1_RX_DMA_NBR) {
186 SETS(gens, R_GEN_CONFIG, dma5, par1);
187 } else {
188 printk(KERN_CRIT "Invalid DMA channel for par1\n");
189 goto bail;
190 }
191 break;
192 default:
193 printk(KERN_CRIT "Invalid DMA owner.\n");
194 goto bail;
195 }
196
197 used_dma_channels[dmanr] = 1;
198 used_dma_channels_users[dmanr] = device_id;
199
200 {
201 volatile int i;
202 genconfig_shadow = gens;
203 *R_GEN_CONFIG = genconfig_shadow;
204 /* Wait 12 cycles before doing any DMA command */
205 for(i = 6; i > 0; i--)
206 nop();
207 }
208 fail = 0;
209 bail:
210 local_irq_restore(flags);
211 return fail;
212}
213
214void cris_free_dma(unsigned int dmanr, const char * device_id)
215{
216 unsigned long flags;
217 if ((dmanr < 0) || (dmanr >= MAX_DMA_CHANNELS)) {
218 printk(KERN_CRIT "cris_free_dma: invalid DMA channel %u\n", dmanr);
219 return;
220 }
221
222 local_irq_save(flags);
223 if (!used_dma_channels[dmanr]) {
224 printk(KERN_CRIT "cris_free_dma: DMA channel %u not allocated\n", dmanr);
225 } else if (device_id != used_dma_channels_users[dmanr]) {
226 printk(KERN_CRIT "cris_free_dma: DMA channel %u not allocated by device\n", dmanr);
227 } else {
228 switch(dmanr)
229 {
230 case 0:
231 *R_DMA_CH0_CMD = IO_STATE(R_DMA_CH0_CMD, cmd, reset);
232 while (IO_EXTRACT(R_DMA_CH0_CMD, cmd, *R_DMA_CH0_CMD) ==
233 IO_STATE_VALUE(R_DMA_CH0_CMD, cmd, reset));
234 break;
235 case 1:
236 *R_DMA_CH1_CMD = IO_STATE(R_DMA_CH1_CMD, cmd, reset);
237 while (IO_EXTRACT(R_DMA_CH1_CMD, cmd, *R_DMA_CH1_CMD) ==
238 IO_STATE_VALUE(R_DMA_CH1_CMD, cmd, reset));
239 break;
240 case 2:
241 *R_DMA_CH2_CMD = IO_STATE(R_DMA_CH2_CMD, cmd, reset);
242 while (IO_EXTRACT(R_DMA_CH2_CMD, cmd, *R_DMA_CH2_CMD) ==
243 IO_STATE_VALUE(R_DMA_CH2_CMD, cmd, reset));
244 break;
245 case 3:
246 *R_DMA_CH3_CMD = IO_STATE(R_DMA_CH3_CMD, cmd, reset);
247 while (IO_EXTRACT(R_DMA_CH3_CMD, cmd, *R_DMA_CH3_CMD) ==
248 IO_STATE_VALUE(R_DMA_CH3_CMD, cmd, reset));
249 break;
250 case 4:
251 *R_DMA_CH4_CMD = IO_STATE(R_DMA_CH4_CMD, cmd, reset);
252 while (IO_EXTRACT(R_DMA_CH4_CMD, cmd, *R_DMA_CH4_CMD) ==
253 IO_STATE_VALUE(R_DMA_CH4_CMD, cmd, reset));
254 break;
255 case 5:
256 *R_DMA_CH5_CMD = IO_STATE(R_DMA_CH5_CMD, cmd, reset);
257 while (IO_EXTRACT(R_DMA_CH5_CMD, cmd, *R_DMA_CH5_CMD) ==
258 IO_STATE_VALUE(R_DMA_CH5_CMD, cmd, reset));
259 break;
260 case 6:
261 *R_DMA_CH6_CMD = IO_STATE(R_DMA_CH6_CMD, cmd, reset);
262 while (IO_EXTRACT(R_DMA_CH6_CMD, cmd, *R_DMA_CH6_CMD) ==
263 IO_STATE_VALUE(R_DMA_CH6_CMD, cmd, reset));
264 break;
265 case 7:
266 *R_DMA_CH7_CMD = IO_STATE(R_DMA_CH7_CMD, cmd, reset);
267 while (IO_EXTRACT(R_DMA_CH7_CMD, cmd, *R_DMA_CH7_CMD) ==
268 IO_STATE_VALUE(R_DMA_CH7_CMD, cmd, reset));
269 break;
270 case 8:
271 *R_DMA_CH8_CMD = IO_STATE(R_DMA_CH8_CMD, cmd, reset);
272 while (IO_EXTRACT(R_DMA_CH8_CMD, cmd, *R_DMA_CH8_CMD) ==
273 IO_STATE_VALUE(R_DMA_CH8_CMD, cmd, reset));
274 break;
275 case 9:
276 *R_DMA_CH9_CMD = IO_STATE(R_DMA_CH9_CMD, cmd, reset);
277 while (IO_EXTRACT(R_DMA_CH9_CMD, cmd, *R_DMA_CH9_CMD) ==
278 IO_STATE_VALUE(R_DMA_CH9_CMD, cmd, reset));
279 break;
280 }
281 used_dma_channels[dmanr] = 0;
282 }
283 local_irq_restore(flags);
284}
285
286EXPORT_SYMBOL(cris_request_dma);
287EXPORT_SYMBOL(cris_free_dma);
diff --git a/arch/cris/arch-v10/kernel/entry.S b/arch/cris/arch-v10/kernel/entry.S
index 1bc44f481c34..c0163bf94a50 100644
--- a/arch/cris/arch-v10/kernel/entry.S
+++ b/arch/cris/arch-v10/kernel/entry.S
@@ -1,4 +1,4 @@
1/* $Id: entry.S,v 1.23 2004/10/19 13:07:37 starvik Exp $ 1/* $Id: entry.S,v 1.28 2005/06/20 05:06:30 starvik Exp $
2 * 2 *
3 * linux/arch/cris/entry.S 3 * linux/arch/cris/entry.S
4 * 4 *
@@ -7,6 +7,22 @@
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
9 * $Log: entry.S,v $ 9 * $Log: entry.S,v $
10 * Revision 1.28 2005/06/20 05:06:30 starvik
11 * Remove unnecessary diff to kernel.org tree
12 *
13 * Revision 1.27 2005/03/04 08:16:16 starvik
14 * Merge of Linux 2.6.11.
15 *
16 * Revision 1.26 2005/01/11 13:49:47 starvik
17 * Added NMI handler.
18 *
19 * Revision 1.25 2004/12/27 11:18:32 starvik
20 * Merge of Linux 2.6.10 (not functional yet).
21 *
22 * Revision 1.24 2004/12/22 10:41:23 starvik
23 * Updates to make v10 compile with the latest SMP aware generic code (even
24 * though v10 will never have SMP).
25 *
10 * Revision 1.23 2004/10/19 13:07:37 starvik 26 * Revision 1.23 2004/10/19 13:07:37 starvik
11 * Merge of Linux 2.6.9 27 * Merge of Linux 2.6.9
12 * 28 *
@@ -279,6 +295,7 @@
279#ifdef CONFIG_PREEMPT 295#ifdef CONFIG_PREEMPT
280 ; Check if preemptive kernel scheduling should be done 296 ; Check if preemptive kernel scheduling should be done
281_resume_kernel: 297_resume_kernel:
298 di
282 ; Load current task struct 299 ; Load current task struct
283 movs.w -8192, $r0 ; THREAD_SIZE = 8192 300 movs.w -8192, $r0 ; THREAD_SIZE = 8192
284 and.d $sp, $r0 301 and.d $sp, $r0
@@ -291,12 +308,7 @@ _need_resched:
291 bpl _Rexit 308 bpl _Rexit
292 nop 309 nop
293 ; Ok, lets's do some preemptive kernel scheduling 310 ; Ok, lets's do some preemptive kernel scheduling
294 move.d PREEMPT_ACTIVE, $r10 311 jsr preempt_schedule_irq
295 move.d $r10, [$r0+TI_preempt_count] ; Mark as active
296 ei
297 jsr schedule
298 clear.d [$r0+TI_preempt_count] ; Mark as inactive
299 di
300 ; Load new task struct 312 ; Load new task struct
301 movs.w -8192, $r0 ; THREAD_SIZE = 8192 313 movs.w -8192, $r0 ; THREAD_SIZE = 8192
302 and.d $sp, $r0 314 and.d $sp, $r0
@@ -590,15 +602,15 @@ mmu_bus_fault:
590 move.d $r0, [$sp+16] 602 move.d $r0, [$sp+16]
5911: btstq 12, $r1 ; Refill? 6031: btstq 12, $r1 ; Refill?
592 bpl 2f 604 bpl 2f
593 lsrq PMD_SHIFT, $r1 ; Get PMD index into PGD (bit 24-31) 605 lsrq 24, $r1 ; Get PGD index (bit 24-31)
594 move.d [current_pgd], $r0 ; PGD for the current process 606 move.d [per_cpu__current_pgd], $r0 ; PGD for the current process
595 move.d [$r0+$r1.d], $r0 ; Get PMD 607 move.d [$r0+$r1.d], $r0 ; Get PMD
596 beq 2f 608 beq 2f
597 nop 609 nop
598 and.w PAGE_MASK, $r0 ; Remove PMD flags 610 and.w PAGE_MASK, $r0 ; Remove PMD flags
599 move.d [R_MMU_CAUSE], $r1 611 move.d [R_MMU_CAUSE], $r1
600 lsrq PAGE_SHIFT, $r1 612 lsrq PAGE_SHIFT, $r1
601 and.d 0x7ff, $r1 ; Get PTE index into PMD (bit 13-24) 613 and.d 0x7ff, $r1 ; Get PTE index into PGD (bit 13-23)
602 move.d [$r0+$r1.d], $r1 ; Get PTE 614 move.d [$r0+$r1.d], $r1 ; Get PTE
603 beq 2f 615 beq 2f
604 nop 616 nop
@@ -656,11 +668,6 @@ hwbreakpoint:
656 nop 668 nop
657 669
658IRQ1_interrupt: 670IRQ1_interrupt:
659
660#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
661;; If we receive a watchdog interrupt while it is not expected, then set
662;; up a canonical frame and dump register contents before dying.
663
664 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!! 671 ;; this prologue MUST match the one in irq.h and the struct in ptregs.h!!!
665 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame 672 move $brp,[$sp=$sp-16]; instruction pointer and room for a fake SBFS frame
666 push $srp 673 push $srp
@@ -672,9 +679,16 @@ IRQ1_interrupt:
672 push $r10 ; push orig_r10 679 push $r10 ; push orig_r10
673 clear.d [$sp=$sp-4] ; frametype == 0, normal frame 680 clear.d [$sp=$sp-4] ; frametype == 0, normal frame
674 681
675;; We don't check that we actually were bit by the watchdog as opposed to 682 move.d [R_IRQ_MASK0_RD], $r1 ; External NMI or watchdog?
676;; an external NMI, since there is currently no handler for external NMI. 683 and.d 0x80000000, $r1
677 684 beq wdog
685 move.d $sp, $r10
686 jsr handle_nmi
687 setf m ; Enable NMI again
688 retb ; Return from NMI
689 nop
690wdog:
691#if defined(CONFIG_ETRAX_WATCHDOG) && !defined(CONFIG_SVINTO_SIM)
678;; Check if we're waiting for reset to happen, as signalled by 692;; Check if we're waiting for reset to happen, as signalled by
679;; hard_reset_now setting cause_of_death to a magic value. If so, just 693;; hard_reset_now setting cause_of_death to a magic value. If so, just
680;; get stuck until reset happens. 694;; get stuck until reset happens.
@@ -1118,6 +1132,10 @@ sys_call_table:
1118 .long sys_mq_getsetattr 1132 .long sys_mq_getsetattr
1119 .long sys_ni_syscall /* reserved for kexec */ 1133 .long sys_ni_syscall /* reserved for kexec */
1120 .long sys_waitid 1134 .long sys_waitid
1135 .long sys_ni_syscall /* 285 */ /* available */
1136 .long sys_add_key
1137 .long sys_request_key
1138 .long sys_keyctl
1121 1139
1122 /* 1140 /*
1123 * NOTE!! This doesn't have to be exact - we just have 1141 * NOTE!! This doesn't have to be exact - we just have
diff --git a/arch/cris/arch-v10/kernel/fasttimer.c b/arch/cris/arch-v10/kernel/fasttimer.c
index 4717f7ae8e51..094ff45ae85b 100644
--- a/arch/cris/arch-v10/kernel/fasttimer.c
+++ b/arch/cris/arch-v10/kernel/fasttimer.c
@@ -1,10 +1,20 @@
1/* $Id: fasttimer.c,v 1.6 2004/05/14 10:18:39 starvik Exp $ 1/* $Id: fasttimer.c,v 1.9 2005/03/04 08:16:16 starvik Exp $
2 * linux/arch/cris/kernel/fasttimer.c 2 * linux/arch/cris/kernel/fasttimer.c
3 * 3 *
4 * Fast timers for ETRAX100/ETRAX100LX 4 * Fast timers for ETRAX100/ETRAX100LX
5 * This may be useful in other OS than Linux so use 2 space indentation... 5 * This may be useful in other OS than Linux so use 2 space indentation...
6 * 6 *
7 * $Log: fasttimer.c,v $ 7 * $Log: fasttimer.c,v $
8 * Revision 1.9 2005/03/04 08:16:16 starvik
9 * Merge of Linux 2.6.11.
10 *
11 * Revision 1.8 2005/01/05 06:09:29 starvik
12 * cli()/sti() will be obsolete in 2.6.11.
13 *
14 * Revision 1.7 2005/01/03 13:35:46 starvik
15 * Removed obsolete stuff.
16 * Mark fast timer IRQ as not shared.
17 *
8 * Revision 1.6 2004/05/14 10:18:39 starvik 18 * Revision 1.6 2004/05/14 10:18:39 starvik
9 * Export fast_timer_list 19 * Export fast_timer_list
10 * 20 *
@@ -148,8 +158,7 @@ static int debug_log_cnt_wrapped = 0;
148#define DEBUG_LOG(string, value) \ 158#define DEBUG_LOG(string, value) \
149{ \ 159{ \
150 unsigned long log_flags; \ 160 unsigned long log_flags; \
151 save_flags(log_flags); \ 161 local_irq_save(log_flags); \
152 cli(); \
153 debug_log_string[debug_log_cnt] = (string); \ 162 debug_log_string[debug_log_cnt] = (string); \
154 debug_log_value[debug_log_cnt] = (unsigned long)(value); \ 163 debug_log_value[debug_log_cnt] = (unsigned long)(value); \
155 if (++debug_log_cnt >= DEBUG_LOG_MAX) \ 164 if (++debug_log_cnt >= DEBUG_LOG_MAX) \
@@ -157,7 +166,7 @@ static int debug_log_cnt_wrapped = 0;
157 debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \ 166 debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \
158 debug_log_cnt_wrapped = 1; \ 167 debug_log_cnt_wrapped = 1; \
159 } \ 168 } \
160 restore_flags(log_flags); \ 169 local_irq_restore(log_flags); \
161} 170}
162#else 171#else
163#define DEBUG_LOG(string, value) 172#define DEBUG_LOG(string, value)
@@ -320,8 +329,7 @@ void start_one_shot_timer(struct fast_timer *t,
320 329
321 D1(printk("sft %s %d us\n", name, delay_us)); 330 D1(printk("sft %s %d us\n", name, delay_us));
322 331
323 save_flags(flags); 332 local_irq_save(flags);
324 cli();
325 333
326 do_gettimeofday_fast(&t->tv_set); 334 do_gettimeofday_fast(&t->tv_set);
327 tmp = fast_timer_list; 335 tmp = fast_timer_list;
@@ -395,7 +403,7 @@ void start_one_shot_timer(struct fast_timer *t,
395 403
396 D2(printk("start_one_shot_timer: %d us done\n", delay_us)); 404 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
397 405
398 restore_flags(flags); 406 local_irq_restore(flags);
399} /* start_one_shot_timer */ 407} /* start_one_shot_timer */
400 408
401static inline int fast_timer_pending (const struct fast_timer * t) 409static inline int fast_timer_pending (const struct fast_timer * t)
@@ -425,11 +433,10 @@ int del_fast_timer(struct fast_timer * t)
425 unsigned long flags; 433 unsigned long flags;
426 int ret; 434 int ret;
427 435
428 save_flags(flags); 436 local_irq_save(flags);
429 cli();
430 ret = detach_fast_timer(t); 437 ret = detach_fast_timer(t);
431 t->next = t->prev = NULL; 438 t->next = t->prev = NULL;
432 restore_flags(flags); 439 local_irq_restore(flags);
433 return ret; 440 return ret;
434} /* del_fast_timer */ 441} /* del_fast_timer */
435 442
@@ -444,8 +451,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
444 struct fast_timer *t; 451 struct fast_timer *t;
445 unsigned long flags; 452 unsigned long flags;
446 453
447 save_flags(flags); 454 local_irq_save(flags);
448 cli();
449 455
450 /* Clear timer1 irq */ 456 /* Clear timer1 irq */
451 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr); 457 *R_IRQ_MASK0_CLR = IO_STATE(R_IRQ_MASK0_CLR, timer1, clr);
@@ -462,7 +468,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
462 fast_timer_running = 0; 468 fast_timer_running = 0;
463 fast_timer_ints++; 469 fast_timer_ints++;
464 470
465 restore_flags(flags); 471 local_irq_restore(flags);
466 472
467 t = fast_timer_list; 473 t = fast_timer_list;
468 while (t) 474 while (t)
@@ -482,8 +488,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
482 fast_timers_expired++; 488 fast_timers_expired++;
483 489
484 /* Remove this timer before call, since it may reuse the timer */ 490 /* Remove this timer before call, since it may reuse the timer */
485 save_flags(flags); 491 local_irq_save(flags);
486 cli();
487 if (t->prev) 492 if (t->prev)
488 { 493 {
489 t->prev->next = t->next; 494 t->prev->next = t->next;
@@ -498,7 +503,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
498 } 503 }
499 t->prev = NULL; 504 t->prev = NULL;
500 t->next = NULL; 505 t->next = NULL;
501 restore_flags(flags); 506 local_irq_restore(flags);
502 507
503 if (t->function != NULL) 508 if (t->function != NULL)
504 { 509 {
@@ -515,8 +520,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
515 D1(printk(".\n")); 520 D1(printk(".\n"));
516 } 521 }
517 522
518 save_flags(flags); 523 local_irq_save(flags);
519 cli();
520 if ((t = fast_timer_list) != NULL) 524 if ((t = fast_timer_list) != NULL)
521 { 525 {
522 /* Start next timer.. */ 526 /* Start next timer.. */
@@ -535,7 +539,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
535#endif 539#endif
536 start_timer1(us); 540 start_timer1(us);
537 } 541 }
538 restore_flags(flags); 542 local_irq_restore(flags);
539 break; 543 break;
540 } 544 }
541 else 545 else
@@ -546,7 +550,7 @@ timer1_handler(int irq, void *dev_id, struct pt_regs *regs)
546 D1(printk("e! %d\n", us)); 550 D1(printk("e! %d\n", us));
547 } 551 }
548 } 552 }
549 restore_flags(flags); 553 local_irq_restore(flags);
550 } 554 }
551 555
552 if (!t) 556 if (!t)
@@ -748,13 +752,12 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
748#endif 752#endif
749 753
750 used += sprintf(bigbuf + used, "Active timers:\n"); 754 used += sprintf(bigbuf + used, "Active timers:\n");
751 save_flags(flags); 755 local_irq_save(flags);
752 cli();
753 t = fast_timer_list; 756 t = fast_timer_list;
754 while (t != NULL && (used+100 < BIG_BUF_SIZE)) 757 while (t != NULL && (used+100 < BIG_BUF_SIZE))
755 { 758 {
756 nextt = t->next; 759 nextt = t->next;
757 restore_flags(flags); 760 local_irq_restore(flags);
758 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu " 761 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
759 "d: %6li us data: 0x%08lX" 762 "d: %6li us data: 0x%08lX"
760/* " func: 0x%08lX" */ 763/* " func: 0x%08lX" */
@@ -768,14 +771,14 @@ static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
768 t->data 771 t->data
769/* , t->function */ 772/* , t->function */
770 ); 773 );
771 cli(); 774 local_irq_disable();
772 if (t->next != nextt) 775 if (t->next != nextt)
773 { 776 {
774 printk(KERN_WARNING "timer removed!\n"); 777 printk(KERN_WARNING "timer removed!\n");
775 } 778 }
776 t = nextt; 779 t = nextt;
777 } 780 }
778 restore_flags(flags); 781 local_irq_restore(flags);
779 } 782 }
780 783
781 if (used - offset < len) 784 if (used - offset < len)
@@ -963,7 +966,7 @@ void fast_timer_init(void)
963 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 ))) 966 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
964 fasttimer_proc_entry->read_proc = proc_fasttimer_read; 967 fasttimer_proc_entry->read_proc = proc_fasttimer_read;
965#endif /* PROC_FS */ 968#endif /* PROC_FS */
966 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, SA_SHIRQ, 969 if(request_irq(TIMER1_IRQ_NBR, timer1_handler, 0,
967 "fast timer int", NULL)) 970 "fast timer int", NULL))
968 { 971 {
969 printk("err: timer1 irq\n"); 972 printk("err: timer1 irq\n");
diff --git a/arch/cris/arch-v10/kernel/head.S b/arch/cris/arch-v10/kernel/head.S
index 2c1dd1184a8f..f00c145b43f1 100644
--- a/arch/cris/arch-v10/kernel/head.S
+++ b/arch/cris/arch-v10/kernel/head.S
@@ -1,4 +1,4 @@
1/* $Id: head.S,v 1.7 2004/05/14 07:58:01 starvik Exp $ 1/* $Id: head.S,v 1.10 2005/06/20 05:12:54 starvik Exp $
2 * 2 *
3 * Head of the kernel - alter with care 3 * Head of the kernel - alter with care
4 * 4 *
@@ -7,6 +7,16 @@
7 * Authors: Bjorn Wesen (bjornw@axis.com) 7 * Authors: Bjorn Wesen (bjornw@axis.com)
8 * 8 *
9 * $Log: head.S,v $ 9 * $Log: head.S,v $
10 * Revision 1.10 2005/06/20 05:12:54 starvik
11 * Remove unnecessary diff to kernel.org tree
12 *
13 * Revision 1.9 2004/12/13 12:21:51 starvik
14 * Added I/O and DMA allocators from Linux 2.4
15 *
16 * Revision 1.8 2004/11/22 11:41:14 starvik
17 * Kernel command line may be supplied to kernel. Not used by Axis but may
18 * be used by customers.
19 *
10 * Revision 1.7 2004/05/14 07:58:01 starvik 20 * Revision 1.7 2004/05/14 07:58:01 starvik
11 * Merge of changes from 2.4 21 * Merge of changes from 2.4
12 * 22 *
@@ -181,6 +191,7 @@
181 191
182#define CRAMFS_MAGIC 0x28cd3d45 192#define CRAMFS_MAGIC 0x28cd3d45
183#define RAM_INIT_MAGIC 0x56902387 193#define RAM_INIT_MAGIC 0x56902387
194#define COMMAND_LINE_MAGIC 0x87109563
184 195
185#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\ 196#define START_ETHERNET_CLOCK IO_STATE(R_NETWORK_GEN_CONFIG, enable, on) |\
186 IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk) 197 IO_STATE(R_NETWORK_GEN_CONFIG, phy, mii_clk)
@@ -490,6 +501,23 @@ _no_romfs_in_flash:
490 501
491_start_it: 502_start_it:
492 503
504 ;; Check if kernel command line is supplied
505 cmp.d COMMAND_LINE_MAGIC, $r10
506 bne no_command_line
507 nop
508
509 move.d 256, $r13
510 move.d cris_command_line, $r10
511 or.d 0x80000000, $r11 ; Make it virtual
5121:
513 move.b [$r11+], $r12
514 move.b $r12, [$r10+]
515 subq 1, $r13
516 bne 1b
517 nop
518
519no_command_line:
520
493 ;; the kernel stack is overlayed with the task structure for each 521 ;; the kernel stack is overlayed with the task structure for each
494 ;; task. thus the initial kernel stack is in the same page as the 522 ;; task. thus the initial kernel stack is in the same page as the
495 ;; init_task (but starts in the top of the page, size 8192) 523 ;; init_task (but starts in the top of the page, size 8192)
@@ -567,76 +595,32 @@ _start_it:
567 ;; Etrax product HW genconfig setup 595 ;; Etrax product HW genconfig setup
568 596
569 moveq 0,$r0 597 moveq 0,$r0
570#if (!defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT0)) \ 598
571 && !defined(CONFIG_DMA_MEMCPY) 599 ;; Init interfaces (disable them).
572 ; DMA channels 6 and 7 to ser0, kgdb doesnt want DMA 600 or.d IO_STATE (R_GEN_CONFIG, scsi0, disable) \
573 or.d IO_STATE (R_GEN_CONFIG, dma7, serial0) \ 601 | IO_STATE (R_GEN_CONFIG, ata, disable) \
574 | IO_STATE (R_GEN_CONFIG, dma6, serial0),$r0 602 | IO_STATE (R_GEN_CONFIG, par0, disable) \
575#endif 603 | IO_STATE (R_GEN_CONFIG, ser2, disable) \
576#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT1) 604 | IO_STATE (R_GEN_CONFIG, mio, disable) \
577 ; DMA channels 8 and 9 to ser1, kgdb doesnt want DMA 605 | IO_STATE (R_GEN_CONFIG, scsi1, disable) \
578 or.d IO_STATE (R_GEN_CONFIG, dma9, serial1) \ 606 | IO_STATE (R_GEN_CONFIG, scsi0w, disable) \
579 | IO_STATE (R_GEN_CONFIG, dma8, serial1),$r0 607 | IO_STATE (R_GEN_CONFIG, par1, disable) \
580#endif 608 | IO_STATE (R_GEN_CONFIG, ser3, disable) \
581#ifdef CONFIG_DMA_MEMCPY 609 | IO_STATE (R_GEN_CONFIG, mio_w, disable) \
582 ; 6/7 memory-memory DMA 610 | IO_STATE (R_GEN_CONFIG, usb1, disable) \
583 or.d IO_STATE (R_GEN_CONFIG, dma7, intdma6) \ 611 | IO_STATE (R_GEN_CONFIG, usb2, disable) \
584 | IO_STATE (R_GEN_CONFIG, dma6, intdma7),$r0 612 | IO_STATE (R_GEN_CONFIG, par_w, disable),$r0
585#endif 613
586#ifdef CONFIG_ETRAX_SERIAL_PORT2 614 ;; Init DMA channel muxing (set to unused clients).
587 ; Enable serial port 2 615 or.d IO_STATE (R_GEN_CONFIG, dma2, ata) \
588 or.w IO_STATE (R_GEN_CONFIG, ser2, select),$r0 616 | IO_STATE (R_GEN_CONFIG, dma3, ata) \
589#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT2) 617 | IO_STATE (R_GEN_CONFIG, dma4, scsi1) \
590 ; DMA channels 2 and 3 to ser2, kgdb doesnt want DMA 618 | IO_STATE (R_GEN_CONFIG, dma5, scsi1) \
591 or.d IO_STATE (R_GEN_CONFIG, dma3, serial2) \ 619 | IO_STATE (R_GEN_CONFIG, dma6, unused) \
592 | IO_STATE (R_GEN_CONFIG, dma2, serial2),$r0 620 | IO_STATE (R_GEN_CONFIG, dma7, unused) \
593#endif 621 | IO_STATE (R_GEN_CONFIG, dma8, usb) \
594#endif 622 | IO_STATE (R_GEN_CONFIG, dma9, usb),$r0
595#if defined(CONFIG_ETRAX_SERIAL_PORT3) || defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) 623
596 ; Enable serial port 3
597 or.w IO_STATE (R_GEN_CONFIG, ser3, select),$r0
598#if !defined(CONFIG_ETRAX_KGDB) || !defined(CONFIG_ETRAX_DEBUG_PORT3)
599 ; DMA channels 4 and 5 to ser3, kgdb doesnt want DMA
600 or.d IO_STATE (R_GEN_CONFIG, dma5, serial3) \
601 | IO_STATE (R_GEN_CONFIG, dma4, serial3),$r0
602#endif
603#endif
604#if defined(CONFIG_ETRAX_PARALLEL_PORT0) || defined(CONFIG_ETRAX_ETHERNET_LPSLAVE)
605 ; parport 0 enabled using DMA 2/3
606 or.w IO_STATE (R_GEN_CONFIG, par0, select),$r0
607#endif
608#if defined(CONFIG_ETRAX_PARALLEL_PORT1) || defined(CONFIG_ETRAX_ETHERNET_LPSLAVE)
609 ; parport 1 enabled using DMA 4/5
610 or.w IO_STATE (R_GEN_CONFIG, par1, select),$r0
611#endif
612#ifdef CONFIG_ETRAX_IDE
613 ; DMA channels 2 and 3 to ATA, ATA enabled
614 or.d IO_STATE (R_GEN_CONFIG, dma3, ata) \
615 | IO_STATE (R_GEN_CONFIG, dma2, ata) \
616 | IO_STATE (R_GEN_CONFIG, ata, select),$r0
617#endif
618
619#ifdef CONFIG_ETRAX_USB_HOST_PORT1
620 ; Set the USB port 1 enable bit
621 or.d IO_STATE (R_GEN_CONFIG, usb1, select),$r0
622#endif
623#ifdef CONFIG_ETRAX_USB_HOST_PORT2
624 ; Set the USB port 2 enable bit
625 or.d IO_STATE (R_GEN_CONFIG, usb2, select),$r0
626#endif
627#ifdef CONFIG_ETRAX_USB_HOST
628 ; Connect DMA channels 8 and 9 to USB
629 and.d (~(IO_MASK (R_GEN_CONFIG, dma9) \
630 | IO_MASK (R_GEN_CONFIG, dma8))) \
631 | IO_STATE (R_GEN_CONFIG, dma9, usb) \
632 | IO_STATE (R_GEN_CONFIG, dma8, usb),$r0
633#endif
634
635#ifdef CONFIG_JULIETTE
636 ; DMA channels 4 and 5 to EXTDMA0, for Juliette
637 or.d IO_STATE (R_GEN_CONFIG, dma5, extdma0) \
638 | IO_STATE (R_GEN_CONFIG, dma4, extdma0),$r0
639#endif
640 624
641#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT) 625#if defined(CONFIG_ETRAX_DEF_R_PORT_G0_DIR_OUT)
642 or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0 626 or.d IO_STATE (R_GEN_CONFIG, g0dir, out),$r0
diff --git a/arch/cris/arch-v10/kernel/io_interface_mux.c b/arch/cris/arch-v10/kernel/io_interface_mux.c
new file mode 100644
index 000000000000..29d48ad00df9
--- /dev/null
+++ b/arch/cris/arch-v10/kernel/io_interface_mux.c
@@ -0,0 +1,879 @@
1/* IO interface mux allocator for ETRAX100LX.
2 * Copyright 2004, Axis Communications AB
3 * $Id: io_interface_mux.c,v 1.2 2004/12/21 12:08:38 starvik Exp $
4 */
5
6
7/* C.f. ETRAX100LX Designer's Reference 20.9 */
8
9#include <linux/kernel.h>
10#include <linux/slab.h>
11#include <linux/errno.h>
12#include <linux/module.h>
13#include <linux/init.h>
14
15#include <asm/arch/svinto.h>
16#include <asm/io.h>
17#include <asm/arch/io_interface_mux.h>
18
19
20#define DBG(s)
21
22/* Macro to access ETRAX 100 registers */
23#define SETS(var, reg, field, val) var = (var & ~IO_MASK_(reg##_, field##_)) | \
24 IO_STATE_(reg##_, field##_, _##val)
25
26enum io_if_group {
27 group_a = (1<<0),
28 group_b = (1<<1),
29 group_c = (1<<2),
30 group_d = (1<<3),
31 group_e = (1<<4),
32 group_f = (1<<5)
33};
34
35struct watcher
36{
37 void (*notify)(const unsigned int gpio_in_available,
38 const unsigned int gpio_out_available,
39 const unsigned char pa_available,
40 const unsigned char pb_available);
41 struct watcher *next;
42};
43
44
45struct if_group
46{
47 enum io_if_group group;
48 unsigned char used;
49 enum cris_io_interface owner;
50};
51
52
53struct interface
54{
55 enum cris_io_interface ioif;
56 unsigned char groups;
57 unsigned char used;
58 char *owner;
59 unsigned int gpio_g_in;
60 unsigned int gpio_g_out;
61 unsigned char gpio_b;
62};
63
64static struct if_group if_groups[6] = {
65 {
66 .group = group_a,
67 .used = 0,
68 },
69 {
70 .group = group_b,
71 .used = 0,
72 },
73 {
74 .group = group_c,
75 .used = 0,
76 },
77 {
78 .group = group_d,
79 .used = 0,
80 },
81 {
82 .group = group_e,
83 .used = 0,
84 },
85 {
86 .group = group_f,
87 .used = 0,
88 }
89};
90
91/* The order in the array must match the order of enum
92 * cris_io_interface in io_interface_mux.h */
93static struct interface interfaces[] = {
94 /* Begin Non-multiplexed interfaces */
95 {
96 .ioif = if_eth,
97 .groups = 0,
98 .gpio_g_in = 0,
99 .gpio_g_out = 0,
100 .gpio_b = 0
101 },
102 {
103 .ioif = if_serial_0,
104 .groups = 0,
105 .gpio_g_in = 0,
106 .gpio_g_out = 0,
107 .gpio_b = 0
108 },
109 /* End Non-multiplexed interfaces */
110 {
111 .ioif = if_serial_1,
112 .groups = group_e,
113 .gpio_g_in = 0x00000000,
114 .gpio_g_out = 0x00000000,
115 .gpio_b = 0x00
116 },
117 {
118 .ioif = if_serial_2,
119 .groups = group_b,
120 .gpio_g_in = 0x000000c0,
121 .gpio_g_out = 0x000000c0,
122 .gpio_b = 0x00
123 },
124 {
125 .ioif = if_serial_3,
126 .groups = group_c,
127 .gpio_g_in = 0xc0000000,
128 .gpio_g_out = 0xc0000000,
129 .gpio_b = 0x00
130 },
131 {
132 .ioif = if_sync_serial_1,
133 .groups = group_e | group_f, /* if_sync_serial_1 and if_sync_serial_3
134 can be used simultaneously */
135 .gpio_g_in = 0x00000000,
136 .gpio_g_out = 0x00000000,
137 .gpio_b = 0x10
138 },
139 {
140 .ioif = if_sync_serial_3,
141 .groups = group_c | group_f,
142 .gpio_g_in = 0xc0000000,
143 .gpio_g_out = 0xc0000000,
144 .gpio_b = 0x80
145 },
146 {
147 .ioif = if_shared_ram,
148 .groups = group_a,
149 .gpio_g_in = 0x0000ff3e,
150 .gpio_g_out = 0x0000ff38,
151 .gpio_b = 0x00
152 },
153 {
154 .ioif = if_shared_ram_w,
155 .groups = group_a | group_d,
156 .gpio_g_in = 0x00ffff3e,
157 .gpio_g_out = 0x00ffff38,
158 .gpio_b = 0x00
159 },
160 {
161 .ioif = if_par_0,
162 .groups = group_a,
163 .gpio_g_in = 0x0000ff3e,
164 .gpio_g_out = 0x0000ff3e,
165 .gpio_b = 0x00
166 },
167 {
168 .ioif = if_par_1,
169 .groups = group_d,
170 .gpio_g_in = 0x3eff0000,
171 .gpio_g_out = 0x3eff0000,
172 .gpio_b = 0x00
173 },
174 {
175 .ioif = if_par_w,
176 .groups = group_a | group_d,
177 .gpio_g_in = 0x00ffff3e,
178 .gpio_g_out = 0x00ffff3e,
179 .gpio_b = 0x00
180 },
181 {
182 .ioif = if_scsi8_0,
183 .groups = group_a | group_b | group_f, /* if_scsi8_0 and if_scsi8_1
184 can be used simultaneously */
185 .gpio_g_in = 0x0000ffff,
186 .gpio_g_out = 0x0000ffff,
187 .gpio_b = 0x10
188 },
189 {
190 .ioif = if_scsi8_1,
191 .groups = group_c | group_d | group_f, /* if_scsi8_0 and if_scsi8_1
192 can be used simultaneously */
193 .gpio_g_in = 0xffff0000,
194 .gpio_g_out = 0xffff0000,
195 .gpio_b = 0x80
196 },
197 {
198 .ioif = if_scsi_w,
199 .groups = group_a | group_b | group_d | group_f,
200 .gpio_g_in = 0x01ffffff,
201 .gpio_g_out = 0x07ffffff,
202 .gpio_b = 0x80
203 },
204 {
205 .ioif = if_ata,
206 .groups = group_a | group_b | group_c | group_d,
207 .gpio_g_in = 0xf9ffffff,
208 .gpio_g_out = 0xffffffff,
209 .gpio_b = 0x80
210 },
211 {
212 .ioif = if_csp,
213 .groups = group_f, /* if_csp and if_i2c can be used simultaneously */
214 .gpio_g_in = 0x00000000,
215 .gpio_g_out = 0x00000000,
216 .gpio_b = 0xfc
217 },
218 {
219 .ioif = if_i2c,
220 .groups = group_f, /* if_csp and if_i2c can be used simultaneously */
221 .gpio_g_in = 0x00000000,
222 .gpio_g_out = 0x00000000,
223 .gpio_b = 0x03
224 },
225 {
226 .ioif = if_usb_1,
227 .groups = group_e | group_f,
228 .gpio_g_in = 0x00000000,
229 .gpio_g_out = 0x00000000,
230 .gpio_b = 0x2c
231 },
232 {
233 .ioif = if_usb_2,
234 .groups = group_d,
235 .gpio_g_in = 0x0e000000,
236 .gpio_g_out = 0x3c000000,
237 .gpio_b = 0x00
238 },
239 /* GPIO pins */
240 {
241 .ioif = if_gpio_grp_a,
242 .groups = group_a,
243 .gpio_g_in = 0x0000ff3f,
244 .gpio_g_out = 0x0000ff3f,
245 .gpio_b = 0x00
246 },
247 {
248 .ioif = if_gpio_grp_b,
249 .groups = group_b,
250 .gpio_g_in = 0x000000c0,
251 .gpio_g_out = 0x000000c0,
252 .gpio_b = 0x00
253 },
254 {
255 .ioif = if_gpio_grp_c,
256 .groups = group_c,
257 .gpio_g_in = 0xc0000000,
258 .gpio_g_out = 0xc0000000,
259 .gpio_b = 0x00
260 },
261 {
262 .ioif = if_gpio_grp_d,
263 .groups = group_d,
264 .gpio_g_in = 0x3fff0000,
265 .gpio_g_out = 0x3fff0000,
266 .gpio_b = 0x00
267 },
268 {
269 .ioif = if_gpio_grp_e,
270 .groups = group_e,
271 .gpio_g_in = 0x00000000,
272 .gpio_g_out = 0x00000000,
273 .gpio_b = 0x00
274 },
275 {
276 .ioif = if_gpio_grp_f,
277 .groups = group_f,
278 .gpio_g_in = 0x00000000,
279 .gpio_g_out = 0x00000000,
280 .gpio_b = 0xff
281 }
282 /* Array end */
283};
284
285static struct watcher *watchers = NULL;
286
287static unsigned int gpio_in_pins = 0xffffffff;
288static unsigned int gpio_out_pins = 0xffffffff;
289static unsigned char gpio_pb_pins = 0xff;
290static unsigned char gpio_pa_pins = 0xff;
291
292static enum cris_io_interface gpio_pa_owners[8];
293static enum cris_io_interface gpio_pb_owners[8];
294static enum cris_io_interface gpio_pg_owners[32];
295
296static int cris_io_interface_init(void);
297
298static unsigned char clear_group_from_set(const unsigned char groups, struct if_group *group)
299{
300 return (groups & ~group->group);
301}
302
303
304static struct if_group *get_group(const unsigned char groups)
305{
306 int i;
307 for (i = 0; i < sizeof(if_groups)/sizeof(struct if_group); i++) {
308 if (groups & if_groups[i].group) {
309 return &if_groups[i];
310 }
311 }
312 return NULL;
313}
314
315
316static void notify_watchers(void)
317{
318 struct watcher *w = watchers;
319
320 DBG(printk("io_interface_mux: notifying watchers\n"));
321
322 while (NULL != w) {
323 w->notify((const unsigned int)gpio_in_pins,
324 (const unsigned int)gpio_out_pins,
325 (const unsigned char)gpio_pa_pins,
326 (const unsigned char)gpio_pb_pins);
327 w = w->next;
328 }
329}
330
331
332int cris_request_io_interface(enum cris_io_interface ioif, const char *device_id)
333{
334 int set_gen_config = 0;
335 int set_gen_config_ii = 0;
336 unsigned long int gens;
337 unsigned long int gens_ii;
338 struct if_group *grp;
339 unsigned char group_set;
340 unsigned long flags;
341
342 (void)cris_io_interface_init();
343
344 DBG(printk("cris_request_io_interface(%d, \"%s\")\n", ioif, device_id));
345
346 if ((ioif >= if_max_interfaces) || (ioif < 0)) {
347 printk(KERN_CRIT "cris_request_io_interface: Bad interface %u submitted for %s\n",
348 ioif,
349 device_id);
350 return -EINVAL;
351 }
352
353 local_irq_save(flags);
354
355 if (interfaces[ioif].used) {
356 local_irq_restore(flags);
357 printk(KERN_CRIT "cris_io_interface: Cannot allocate interface for %s, in use by %s\n",
358 device_id,
359 interfaces[ioif].owner);
360 return -EBUSY;
361 }
362
363 /* Check that all required groups are free before allocating, */
364 group_set = interfaces[ioif].groups;
365 while (NULL != (grp = get_group(group_set))) {
366 if (grp->used) {
367 if (grp->group == group_f) {
368 if ((if_sync_serial_1 == ioif) ||
369 (if_sync_serial_3 == ioif)) {
370 if ((grp->owner != if_sync_serial_1) &&
371 (grp->owner != if_sync_serial_3)) {
372 local_irq_restore(flags);
373 return -EBUSY;
374 }
375 } else if ((if_scsi8_0 == ioif) ||
376 (if_scsi8_1 == ioif)) {
377 if ((grp->owner != if_scsi8_0) &&
378 (grp->owner != if_scsi8_1)) {
379 local_irq_restore(flags);
380 return -EBUSY;
381 }
382 }
383 } else {
384 local_irq_restore(flags);
385 return -EBUSY;
386 }
387 }
388 group_set = clear_group_from_set(group_set, grp);
389 }
390
391 /* Are the required GPIO pins available too? */
392 if (((interfaces[ioif].gpio_g_in & gpio_in_pins) != interfaces[ioif].gpio_g_in) ||
393 ((interfaces[ioif].gpio_g_out & gpio_out_pins) != interfaces[ioif].gpio_g_out) ||
394 ((interfaces[ioif].gpio_b & gpio_pb_pins) != interfaces[ioif].gpio_b)) {
395 printk(KERN_CRIT "cris_request_io_interface: Could not get required pins for interface %u\n",
396 ioif);
397 return -EBUSY;
398 }
399
400 /* All needed I/O pins and pin groups are free, allocate. */
401 group_set = interfaces[ioif].groups;
402 while (NULL != (grp = get_group(group_set))) {
403 grp->used = 1;
404 grp->owner = ioif;
405 group_set = clear_group_from_set(group_set, grp);
406 }
407
408 gens = genconfig_shadow;
409 gens_ii = gen_config_ii_shadow;
410
411 set_gen_config = 1;
412 switch (ioif)
413 {
414 /* Begin Non-multiplexed interfaces */
415 case if_eth:
416 /* fall through */
417 case if_serial_0:
418 set_gen_config = 0;
419 break;
420 /* End Non-multiplexed interfaces */
421 case if_serial_1:
422 set_gen_config_ii = 1;
423 SETS(gens_ii, R_GEN_CONFIG_II, sermode1, async);
424 break;
425 case if_serial_2:
426 SETS(gens, R_GEN_CONFIG, ser2, select);
427 break;
428 case if_serial_3:
429 SETS(gens, R_GEN_CONFIG, ser3, select);
430 set_gen_config_ii = 1;
431 SETS(gens_ii, R_GEN_CONFIG_II, sermode3, async);
432 break;
433 case if_sync_serial_1:
434 set_gen_config_ii = 1;
435 SETS(gens_ii, R_GEN_CONFIG_II, sermode1, sync);
436 break;
437 case if_sync_serial_3:
438 SETS(gens, R_GEN_CONFIG, ser3, select);
439 set_gen_config_ii = 1;
440 SETS(gens_ii, R_GEN_CONFIG_II, sermode3, sync);
441 break;
442 case if_shared_ram:
443 SETS(gens, R_GEN_CONFIG, mio, select);
444 break;
445 case if_shared_ram_w:
446 SETS(gens, R_GEN_CONFIG, mio_w, select);
447 break;
448 case if_par_0:
449 SETS(gens, R_GEN_CONFIG, par0, select);
450 break;
451 case if_par_1:
452 SETS(gens, R_GEN_CONFIG, par1, select);
453 break;
454 case if_par_w:
455 SETS(gens, R_GEN_CONFIG, par0, select);
456 SETS(gens, R_GEN_CONFIG, par_w, select);
457 break;
458 case if_scsi8_0:
459 SETS(gens, R_GEN_CONFIG, scsi0, select);
460 break;
461 case if_scsi8_1:
462 SETS(gens, R_GEN_CONFIG, scsi1, select);
463 break;
464 case if_scsi_w:
465 SETS(gens, R_GEN_CONFIG, scsi0, select);
466 SETS(gens, R_GEN_CONFIG, scsi0w, select);
467 break;
468 case if_ata:
469 SETS(gens, R_GEN_CONFIG, ata, select);
470 break;
471 case if_csp:
472 /* fall through */
473 case if_i2c:
474 set_gen_config = 0;
475 break;
476 case if_usb_1:
477 SETS(gens, R_GEN_CONFIG, usb1, select);
478 break;
479 case if_usb_2:
480 SETS(gens, R_GEN_CONFIG, usb2, select);
481 break;
482 case if_gpio_grp_a:
483 /* GPIO groups are only accounted, don't do configuration changes. */
484 /* fall through */
485 case if_gpio_grp_b:
486 /* fall through */
487 case if_gpio_grp_c:
488 /* fall through */
489 case if_gpio_grp_d:
490 /* fall through */
491 case if_gpio_grp_e:
492 /* fall through */
493 case if_gpio_grp_f:
494 set_gen_config = 0;
495 break;
496 default:
497 panic("cris_request_io_interface: Bad interface %u submitted for %s\n",
498 ioif,
499 device_id);
500 }
501
502 interfaces[ioif].used = 1;
503 interfaces[ioif].owner = (char*)device_id;
504
505 if (set_gen_config) {
506 volatile int i;
507 genconfig_shadow = gens;
508 *R_GEN_CONFIG = genconfig_shadow;
509 /* Wait 12 cycles before doing any DMA command */
510 for(i = 6; i > 0; i--)
511 nop();
512 }
513 if (set_gen_config_ii) {
514 gen_config_ii_shadow = gens_ii;
515 *R_GEN_CONFIG_II = gen_config_ii_shadow;
516 }
517
518 DBG(printk("GPIO pins: available before: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
519 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
520 DBG(printk("grabbing pins: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
521 interfaces[ioif].gpio_g_in,
522 interfaces[ioif].gpio_g_out,
523 interfaces[ioif].gpio_b));
524
525 gpio_in_pins &= ~interfaces[ioif].gpio_g_in;
526 gpio_out_pins &= ~interfaces[ioif].gpio_g_out;
527 gpio_pb_pins &= ~interfaces[ioif].gpio_b;
528
529 DBG(printk("GPIO pins: available after: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
530 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
531
532 local_irq_restore(flags);
533
534 notify_watchers();
535
536 return 0;
537}
538
539
540void cris_free_io_interface(enum cris_io_interface ioif)
541{
542 struct if_group *grp;
543 unsigned char group_set;
544 unsigned long flags;
545
546 (void)cris_io_interface_init();
547
548 if ((ioif >= if_max_interfaces) || (ioif < 0)) {
549 printk(KERN_CRIT "cris_free_io_interface: Bad interface %u\n",
550 ioif);
551 return;
552 }
553 local_irq_save(flags);
554 if (!interfaces[ioif].used) {
555 printk(KERN_CRIT "cris_free_io_interface: Freeing free interface %u\n",
556 ioif);
557 local_irq_restore(flags);
558 return;
559 }
560 group_set = interfaces[ioif].groups;
561 while (NULL != (grp = get_group(group_set))) {
562 if (grp->group == group_f) {
563 switch (ioif)
564 {
565 case if_sync_serial_1:
566 if ((grp->owner == if_sync_serial_1) &&
567 interfaces[if_sync_serial_3].used) {
568 grp->owner = if_sync_serial_3;
569 } else
570 grp->used = 0;
571 break;
572 case if_sync_serial_3:
573 if ((grp->owner == if_sync_serial_3) &&
574 interfaces[if_sync_serial_1].used) {
575 grp->owner = if_sync_serial_1;
576 } else
577 grp->used = 0;
578 break;
579 case if_scsi8_0:
580 if ((grp->owner == if_scsi8_0) &&
581 interfaces[if_scsi8_1].used) {
582 grp->owner = if_scsi8_1;
583 } else
584 grp->used = 0;
585 break;
586 case if_scsi8_1:
587 if ((grp->owner == if_scsi8_1) &&
588 interfaces[if_scsi8_0].used) {
589 grp->owner = if_scsi8_0;
590 } else
591 grp->used = 0;
592 break;
593 default:
594 grp->used = 0;
595 }
596 } else {
597 grp->used = 0;
598 }
599 group_set = clear_group_from_set(group_set, grp);
600 }
601 interfaces[ioif].used = 0;
602 interfaces[ioif].owner = NULL;
603
604 DBG(printk("GPIO pins: available before: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
605 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
606 DBG(printk("freeing pins: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
607 interfaces[ioif].gpio_g_in,
608 interfaces[ioif].gpio_g_out,
609 interfaces[ioif].gpio_b));
610
611 gpio_in_pins |= interfaces[ioif].gpio_g_in;
612 gpio_out_pins |= interfaces[ioif].gpio_g_out;
613 gpio_pb_pins |= interfaces[ioif].gpio_b;
614
615 DBG(printk("GPIO pins: available after: g_in=0x%08x g_out=0x%08x pb=0x%02x\n",
616 gpio_in_pins, gpio_out_pins, gpio_pb_pins));
617
618 local_irq_restore(flags);
619
620 notify_watchers();
621}
622
623/* Create a bitmask from bit 0 (inclusive) to bit stop_bit
624 (non-inclusive). stop_bit == 0 returns 0x0 */
625static inline unsigned int create_mask(const unsigned stop_bit)
626{
627 /* Avoid overflow */
628 if (stop_bit >= 32) {
629 return 0xffffffff;
630 }
631 return (1<<stop_bit)-1;
632}
633
634
635/* port can be 'a', 'b' or 'g' */
636int cris_io_interface_allocate_pins(const enum cris_io_interface ioif,
637 const char port,
638 const unsigned start_bit,
639 const unsigned stop_bit)
640{
641 unsigned int i;
642 unsigned int mask = 0;
643 unsigned int tmp_mask;
644 unsigned long int flags;
645 enum cris_io_interface *owners;
646
647 (void)cris_io_interface_init();
648
649 DBG(printk("cris_io_interface_allocate_pins: if=%d port=%c start=%u stop=%u\n",
650 ioif, port, start_bit, stop_bit));
651
652 if (!((start_bit <= stop_bit) &&
653 ((((port == 'a') || (port == 'b')) && (stop_bit < 8)) ||
654 ((port == 'g') && (stop_bit < 32))))) {
655 return -EINVAL;
656 }
657
658 mask = create_mask(stop_bit + 1);
659 tmp_mask = create_mask(start_bit);
660 mask &= ~tmp_mask;
661
662 DBG(printk("cris_io_interface_allocate_pins: port=%c start=%u stop=%u mask=0x%08x\n",
663 port, start_bit, stop_bit, mask));
664
665 local_irq_save(flags);
666
667 switch (port) {
668 case 'a':
669 if ((gpio_pa_pins & mask) != mask) {
670 local_irq_restore(flags);
671 return -EBUSY;
672 }
673 owners = gpio_pa_owners;
674 gpio_pa_pins &= ~mask;
675 break;
676 case 'b':
677 if ((gpio_pb_pins & mask) != mask) {
678 local_irq_restore(flags);
679 return -EBUSY;
680 }
681 owners = gpio_pb_owners;
682 gpio_pb_pins &= ~mask;
683 break;
684 case 'g':
685 if (((gpio_in_pins & mask) != mask) ||
686 ((gpio_out_pins & mask) != mask)) {
687 local_irq_restore(flags);
688 return -EBUSY;
689 }
690 owners = gpio_pg_owners;
691 gpio_in_pins &= ~mask;
692 gpio_out_pins &= ~mask;
693 break;
694 default:
695 local_irq_restore(flags);
696 return -EINVAL;
697 }
698
699 for (i = start_bit; i <= stop_bit; i++) {
700 owners[i] = ioif;
701 }
702 local_irq_restore(flags);
703
704 notify_watchers();
705 return 0;
706}
707
708
709/* port can be 'a', 'b' or 'g' */
710int cris_io_interface_free_pins(const enum cris_io_interface ioif,
711 const char port,
712 const unsigned start_bit,
713 const unsigned stop_bit)
714{
715 unsigned int i;
716 unsigned int mask = 0;
717 unsigned int tmp_mask;
718 unsigned long int flags;
719 enum cris_io_interface *owners;
720
721 (void)cris_io_interface_init();
722
723 if (!((start_bit <= stop_bit) &&
724 ((((port == 'a') || (port == 'b')) && (stop_bit < 8)) ||
725 ((port == 'g') && (stop_bit < 32))))) {
726 return -EINVAL;
727 }
728
729 mask = create_mask(stop_bit + 1);
730 tmp_mask = create_mask(start_bit);
731 mask &= ~tmp_mask;
732
733 DBG(printk("cris_io_interface_free_pins: port=%c start=%u stop=%u mask=0x%08x\n",
734 port, start_bit, stop_bit, mask));
735
736 local_irq_save(flags);
737
738 switch (port) {
739 case 'a':
740 if ((~gpio_pa_pins & mask) != mask) {
741 local_irq_restore(flags);
742 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing free pins");
743 }
744 owners = gpio_pa_owners;
745 break;
746 case 'b':
747 if ((~gpio_pb_pins & mask) != mask) {
748 local_irq_restore(flags);
749 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing free pins");
750 }
751 owners = gpio_pb_owners;
752 break;
753 case 'g':
754 if (((~gpio_in_pins & mask) != mask) ||
755 ((~gpio_out_pins & mask) != mask)) {
756 local_irq_restore(flags);
757 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing free pins");
758 }
759 owners = gpio_pg_owners;
760 break;
761 default:
762 owners = NULL; /* Cannot happen. Shut up, gcc! */
763 }
764
765 for (i = start_bit; i <= stop_bit; i++) {
766 if (owners[i] != ioif) {
767 printk(KERN_CRIT "cris_io_interface_free_pins: Freeing unowned pins");
768 }
769 }
770
771 /* All was ok, change data. */
772 switch (port) {
773 case 'a':
774 gpio_pa_pins |= mask;
775 break;
776 case 'b':
777 gpio_pb_pins |= mask;
778 break;
779 case 'g':
780 gpio_in_pins |= mask;
781 gpio_out_pins |= mask;
782 break;
783 }
784
785 for (i = start_bit; i <= stop_bit; i++) {
786 owners[i] = if_unclaimed;
787 }
788 local_irq_restore(flags);
789 notify_watchers();
790
791 return 0;
792}
793
794
795int cris_io_interface_register_watcher(void (*notify)(const unsigned int gpio_in_available,
796 const unsigned int gpio_out_available,
797 const unsigned char pa_available,
798 const unsigned char pb_available))
799{
800 struct watcher *w;
801
802 (void)cris_io_interface_init();
803
804 if (NULL == notify) {
805 return -EINVAL;
806 }
807 w = kmalloc(sizeof(*w), GFP_KERNEL);
808 if (!w) {
809 return -ENOMEM;
810 }
811 w->notify = notify;
812 w->next = watchers;
813 watchers = w;
814
815 w->notify((const unsigned int)gpio_in_pins,
816 (const unsigned int)gpio_out_pins,
817 (const unsigned char)gpio_pa_pins,
818 (const unsigned char)gpio_pb_pins);
819
820 return 0;
821}
822
823void cris_io_interface_delete_watcher(void (*notify)(const unsigned int gpio_in_available,
824 const unsigned int gpio_out_available,
825 const unsigned char pa_available,
826 const unsigned char pb_available))
827{
828 struct watcher *w = watchers, *prev = NULL;
829
830 (void)cris_io_interface_init();
831
832 while ((NULL != w) && (w->notify != notify)){
833 prev = w;
834 w = w->next;
835 }
836 if (NULL != w) {
837 if (NULL != prev) {
838 prev->next = w->next;
839 } else {
840 watchers = w->next;
841 }
842 kfree(w);
843 return;
844 }
845 printk(KERN_WARNING "cris_io_interface_delete_watcher: Deleting unknown watcher 0x%p\n", notify);
846}
847
848
849static int cris_io_interface_init(void)
850{
851 static int first = 1;
852 int i;
853
854 if (!first) {
855 return 0;
856 }
857 first = 0;
858
859 for (i = 0; i<8; i++) {
860 gpio_pa_owners[i] = if_unclaimed;
861 gpio_pb_owners[i] = if_unclaimed;
862 gpio_pg_owners[i] = if_unclaimed;
863 }
864 for (; i<32; i++) {
865 gpio_pg_owners[i] = if_unclaimed;
866 }
867 return 0;
868}
869
870
871module_init(cris_io_interface_init);
872
873
874EXPORT_SYMBOL(cris_request_io_interface);
875EXPORT_SYMBOL(cris_free_io_interface);
876EXPORT_SYMBOL(cris_io_interface_allocate_pins);
877EXPORT_SYMBOL(cris_io_interface_free_pins);
878EXPORT_SYMBOL(cris_io_interface_register_watcher);
879EXPORT_SYMBOL(cris_io_interface_delete_watcher);
diff --git a/arch/cris/arch-v10/kernel/irq.c b/arch/cris/arch-v10/kernel/irq.c
index b2f16d6fc871..4b368a122015 100644
--- a/arch/cris/arch-v10/kernel/irq.c
+++ b/arch/cris/arch-v10/kernel/irq.c
@@ -1,4 +1,4 @@
1/* $Id: irq.c,v 1.2 2004/06/09 05:30:27 starvik Exp $ 1/* $Id: irq.c,v 1.4 2005/01/04 12:22:28 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/irq.c 3 * linux/arch/cris/kernel/irq.c
4 * 4 *
@@ -12,11 +12,13 @@
12 */ 12 */
13 13
14#include <asm/irq.h> 14#include <asm/irq.h>
15#include <linux/irq.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/config.h> 18#include <linux/config.h>
18 19
19irqvectptr irq_shortcuts[NR_IRQS]; /* vector of shortcut jumps after the irq prologue */ 20#define mask_irq(irq_nr) (*R_VECT_MASK_CLR = 1 << (irq_nr));
21#define unmask_irq(irq_nr) (*R_VECT_MASK_SET = 1 << (irq_nr));
20 22
21/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is 23/* don't use set_int_vector, it bypasses the linux interrupt handlers. it is
22 * global just so that the kernel gdb can use it. 24 * global just so that the kernel gdb can use it.
@@ -102,41 +104,52 @@ static void (*interrupt[NR_IRQS])(void) = {
102 IRQ31_interrupt 104 IRQ31_interrupt
103}; 105};
104 106
105static void (*bad_interrupt[NR_IRQS])(void) = { 107static void enable_crisv10_irq(unsigned int irq);
106 NULL, NULL, 108
107 NULL, bad_IRQ3_interrupt, 109static unsigned int startup_crisv10_irq(unsigned int irq)
108 bad_IRQ4_interrupt, bad_IRQ5_interrupt, 110{
109 bad_IRQ6_interrupt, bad_IRQ7_interrupt, 111 enable_crisv10_irq(irq);
110 bad_IRQ8_interrupt, bad_IRQ9_interrupt, 112 return 0;
111 bad_IRQ10_interrupt, bad_IRQ11_interrupt, 113}
112 bad_IRQ12_interrupt, bad_IRQ13_interrupt, 114
113 NULL, NULL, 115#define shutdown_crisv10_irq disable_crisv10_irq
114 bad_IRQ16_interrupt, bad_IRQ17_interrupt,
115 bad_IRQ18_interrupt, bad_IRQ19_interrupt,
116 bad_IRQ20_interrupt, bad_IRQ21_interrupt,
117 bad_IRQ22_interrupt, bad_IRQ23_interrupt,
118 bad_IRQ24_interrupt, bad_IRQ25_interrupt,
119 NULL, NULL, NULL, NULL, NULL,
120 bad_IRQ31_interrupt
121};
122 116
123void arch_setup_irq(int irq) 117static void enable_crisv10_irq(unsigned int irq)
124{ 118{
125 set_int_vector(irq, interrupt[irq]); 119 unmask_irq(irq);
126} 120}
127 121
128void arch_free_irq(int irq) 122static void disable_crisv10_irq(unsigned int irq)
129{ 123{
130 set_int_vector(irq, bad_interrupt[irq]); 124 mask_irq(irq);
131} 125}
132 126
127static void ack_crisv10_irq(unsigned int irq)
128{
129}
130
131static void end_crisv10_irq(unsigned int irq)
132{
133}
134
135static struct hw_interrupt_type crisv10_irq_type = {
136 .typename = "CRISv10",
137 .startup = startup_crisv10_irq,
138 .shutdown = shutdown_crisv10_irq,
139 .enable = enable_crisv10_irq,
140 .disable = disable_crisv10_irq,
141 .ack = ack_crisv10_irq,
142 .end = end_crisv10_irq,
143 .set_affinity = NULL
144};
145
133void weird_irq(void); 146void weird_irq(void);
134void system_call(void); /* from entry.S */ 147void system_call(void); /* from entry.S */
135void do_sigtrap(void); /* from entry.S */ 148void do_sigtrap(void); /* from entry.S */
136void gdb_handle_breakpoint(void); /* from entry.S */ 149void gdb_handle_breakpoint(void); /* from entry.S */
137 150
138/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and 151/* init_IRQ() is called by start_kernel and is responsible for fixing IRQ masks and
139 setting the irq vector table to point to bad_interrupt ptrs. 152 setting the irq vector table.
140*/ 153*/
141 154
142void __init 155void __init
@@ -154,14 +167,15 @@ init_IRQ(void)
154 167
155 *R_VECT_MASK_CLR = 0xffffffff; 168 *R_VECT_MASK_CLR = 0xffffffff;
156 169
157 /* clear the shortcut entry points */
158
159 for(i = 0; i < NR_IRQS; i++)
160 irq_shortcuts[i] = NULL;
161
162 for (i = 0; i < 256; i++) 170 for (i = 0; i < 256; i++)
163 etrax_irv->v[i] = weird_irq; 171 etrax_irv->v[i] = weird_irq;
164 172
173 /* Initialize IRQ handler descriptiors. */
174 for(i = 2; i < NR_IRQS; i++) {
175 irq_desc[i].handler = &crisv10_irq_type;
176 set_int_vector(i, interrupt[i]);
177 }
178
165 /* the entries in the break vector contain actual code to be 179 /* the entries in the break vector contain actual code to be
166 executed by the associated break handler, rather than just a jump 180 executed by the associated break handler, rather than just a jump
167 address. therefore we need to setup a default breakpoint handler 181 address. therefore we need to setup a default breakpoint handler
@@ -170,10 +184,6 @@ init_IRQ(void)
170 for (i = 0; i < 16; i++) 184 for (i = 0; i < 16; i++)
171 set_break_vector(i, do_sigtrap); 185 set_break_vector(i, do_sigtrap);
172 186
173 /* set all etrax irq's to the bad handlers */
174 for (i = 2; i < NR_IRQS; i++)
175 set_int_vector(i, bad_interrupt[i]);
176
177 /* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */ 187 /* except IRQ 15 which is the multiple-IRQ handler on Etrax100 */
178 188
179 set_int_vector(15, multiple_interrupt); 189 set_int_vector(15, multiple_interrupt);
diff --git a/arch/cris/arch-v10/kernel/kgdb.c b/arch/cris/arch-v10/kernel/kgdb.c
index 7d368c877ee9..b72e6a91a639 100644
--- a/arch/cris/arch-v10/kernel/kgdb.c
+++ b/arch/cris/arch-v10/kernel/kgdb.c
@@ -18,6 +18,10 @@
18*! Jul 21 1999 Bjorn Wesen eLinux port 18*! Jul 21 1999 Bjorn Wesen eLinux port
19*! 19*!
20*! $Log: kgdb.c,v $ 20*! $Log: kgdb.c,v $
21*! Revision 1.6 2005/01/14 10:12:17 starvik
22*! KGDB on separate port.
23*! Console fixes from 2.4.
24*!
21*! Revision 1.5 2004/10/07 13:59:08 starvik 25*! Revision 1.5 2004/10/07 13:59:08 starvik
22*! Corrected call to set_int_vector 26*! Corrected call to set_int_vector
23*! 27*!
@@ -71,7 +75,7 @@
71*! 75*!
72*!--------------------------------------------------------------------------- 76*!---------------------------------------------------------------------------
73*! 77*!
74*! $Id: kgdb.c,v 1.5 2004/10/07 13:59:08 starvik Exp $ 78*! $Id: kgdb.c,v 1.6 2005/01/14 10:12:17 starvik Exp $
75*! 79*!
76*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN 80*! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
77*! 81*!
@@ -225,6 +229,7 @@
225#include <linux/kernel.h> 229#include <linux/kernel.h>
226#include <linux/delay.h> 230#include <linux/delay.h>
227#include <linux/linkage.h> 231#include <linux/linkage.h>
232#include <linux/reboot.h>
228 233
229#include <asm/setup.h> 234#include <asm/setup.h>
230#include <asm/ptrace.h> 235#include <asm/ptrace.h>
@@ -1344,12 +1349,11 @@ handle_exception (int sigval)
1344 } 1349 }
1345} 1350}
1346 1351
1347/* The jump is to the address 0x00000002. Performs a complete re-start 1352/* Performs a complete re-start from scratch. */
1348 from scratch. */
1349static void 1353static void
1350kill_restart () 1354kill_restart ()
1351{ 1355{
1352 __asm__ volatile ("jump 2"); 1356 machine_restart("");
1353} 1357}
1354 1358
1355/********************************** Breakpoint *******************************/ 1359/********************************** Breakpoint *******************************/
@@ -1506,6 +1510,11 @@ kgdb_handle_serial:
1506 bne goback 1510 bne goback
1507 nop 1511 nop
1508 1512
1513 move.d [reg+0x5E], $r10 ; Get DCCR
1514 btstq 8, $r10 ; Test the U-flag.
1515 bmi goback
1516 nop
1517
1509;; 1518;;
1510;; Handle the communication 1519;; Handle the communication
1511;; 1520;;
diff --git a/arch/cris/arch-v10/kernel/process.c b/arch/cris/arch-v10/kernel/process.c
index 87ff37790827..69e28b4057e8 100644
--- a/arch/cris/arch-v10/kernel/process.c
+++ b/arch/cris/arch-v10/kernel/process.c
@@ -1,4 +1,4 @@
1/* $Id: process.c,v 1.9 2004/10/19 13:07:37 starvik Exp $ 1/* $Id: process.c,v 1.12 2004/12/27 11:18:32 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/process.c 3 * linux/arch/cris/kernel/process.c
4 * 4 *
@@ -101,6 +101,7 @@ int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
101 regs.r11 = (unsigned long)fn; 101 regs.r11 = (unsigned long)fn;
102 regs.r12 = (unsigned long)arg; 102 regs.r12 = (unsigned long)arg;
103 regs.irp = (unsigned long)kernel_thread_helper; 103 regs.irp = (unsigned long)kernel_thread_helper;
104 regs.dccr = 1 << I_DCCR_BITNR;
104 105
105 /* Ok, create the new process.. */ 106 /* Ok, create the new process.. */
106 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL); 107 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
diff --git a/arch/cris/arch-v10/kernel/ptrace.c b/arch/cris/arch-v10/kernel/ptrace.c
index 581ecabaae53..130dd214e41d 100644
--- a/arch/cris/arch-v10/kernel/ptrace.c
+++ b/arch/cris/arch-v10/kernel/ptrace.c
@@ -11,6 +11,7 @@
11#include <linux/ptrace.h> 11#include <linux/ptrace.h>
12#include <linux/user.h> 12#include <linux/user.h>
13#include <linux/signal.h> 13#include <linux/signal.h>
14#include <linux/security.h>
14 15
15#include <asm/uaccess.h> 16#include <asm/uaccess.h>
16#include <asm/page.h> 17#include <asm/page.h>
@@ -86,9 +87,13 @@ sys_ptrace(long request, long pid, long addr, long data)
86 ret = -EPERM; 87 ret = -EPERM;
87 88
88 if (request == PTRACE_TRACEME) { 89 if (request == PTRACE_TRACEME) {
90 /* are we already being traced? */
89 if (current->ptrace & PT_PTRACED) 91 if (current->ptrace & PT_PTRACED)
90 goto out; 92 goto out;
91 93 ret = security_ptrace(current->parent, current);
94 if (ret)
95 goto out;
96 /* set the ptrace bit in the process flags. */
92 current->ptrace |= PT_PTRACED; 97 current->ptrace |= PT_PTRACED;
93 ret = 0; 98 ret = 0;
94 goto out; 99 goto out;
@@ -207,7 +212,7 @@ sys_ptrace(long request, long pid, long addr, long data)
207 case PTRACE_KILL: 212 case PTRACE_KILL:
208 ret = 0; 213 ret = 0;
209 214
210 if (child->state == TASK_ZOMBIE) 215 if (child->exit_state == EXIT_ZOMBIE)
211 break; 216 break;
212 217
213 child->exit_code = SIGKILL; 218 child->exit_code = SIGKILL;
diff --git a/arch/cris/arch-v10/kernel/shadows.c b/arch/cris/arch-v10/kernel/shadows.c
index 561a890a8e4c..38fd44dfbc5b 100644
--- a/arch/cris/arch-v10/kernel/shadows.c
+++ b/arch/cris/arch-v10/kernel/shadows.c
@@ -1,4 +1,4 @@
1/* $Id: shadows.c,v 1.1 2001/12/17 13:59:27 bjornw Exp $ 1/* $Id: shadows.c,v 1.2 2004/12/13 12:21:51 starvik Exp $
2 * 2 *
3 * Various shadow registers. Defines for these are in include/asm-etrax100/io.h 3 * Various shadow registers. Defines for these are in include/asm-etrax100/io.h
4 */ 4 */
@@ -6,6 +6,7 @@
6/* Shadows for internal Etrax-registers */ 6/* Shadows for internal Etrax-registers */
7 7
8unsigned long genconfig_shadow; 8unsigned long genconfig_shadow;
9unsigned long gen_config_ii_shadow;
9unsigned long port_g_data_shadow; 10unsigned long port_g_data_shadow;
10unsigned char port_pa_dir_shadow; 11unsigned char port_pa_dir_shadow;
11unsigned char port_pa_data_shadow; 12unsigned char port_pa_data_shadow;
diff --git a/arch/cris/arch-v10/kernel/traps.c b/arch/cris/arch-v10/kernel/traps.c
index da491f438a6e..34a27ea2052d 100644
--- a/arch/cris/arch-v10/kernel/traps.c
+++ b/arch/cris/arch-v10/kernel/traps.c
@@ -1,4 +1,4 @@
1/* $Id: traps.c,v 1.2 2003/07/04 08:27:41 starvik Exp $ 1/* $Id: traps.c,v 1.4 2005/04/24 18:47:55 starvik Exp $
2 * 2 *
3 * linux/arch/cris/arch-v10/traps.c 3 * linux/arch/cris/arch-v10/traps.c
4 * 4 *
@@ -16,6 +16,8 @@
16#include <asm/uaccess.h> 16#include <asm/uaccess.h>
17#include <asm/arch/sv_addr_ag.h> 17#include <asm/arch/sv_addr_ag.h>
18 18
19extern int raw_printk(const char *fmt, ...);
20
19void 21void
20show_registers(struct pt_regs * regs) 22show_registers(struct pt_regs * regs)
21{ 23{
@@ -26,18 +28,18 @@ show_registers(struct pt_regs * regs)
26 register. */ 28 register. */
27 unsigned long usp = rdusp(); 29 unsigned long usp = rdusp();
28 30
29 printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n", 31 raw_printk("IRP: %08lx SRP: %08lx DCCR: %08lx USP: %08lx MOF: %08lx\n",
30 regs->irp, regs->srp, regs->dccr, usp, regs->mof ); 32 regs->irp, regs->srp, regs->dccr, usp, regs->mof );
31 printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n", 33 raw_printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
32 regs->r0, regs->r1, regs->r2, regs->r3); 34 regs->r0, regs->r1, regs->r2, regs->r3);
33 printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n", 35 raw_printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
34 regs->r4, regs->r5, regs->r6, regs->r7); 36 regs->r4, regs->r5, regs->r6, regs->r7);
35 printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n", 37 raw_printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
36 regs->r8, regs->r9, regs->r10, regs->r11); 38 regs->r8, regs->r9, regs->r10, regs->r11);
37 printk("r12: %08lx r13: %08lx oR10: %08lx\n", 39 raw_printk("r12: %08lx r13: %08lx oR10: %08lx sp: %08lx\n",
38 regs->r12, regs->r13, regs->orig_r10); 40 regs->r12, regs->r13, regs->orig_r10, regs);
39 printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE); 41 raw_printk("R_MMU_CAUSE: %08lx\n", (unsigned long)*R_MMU_CAUSE);
40 printk("Process %s (pid: %d, stackpage=%08lx)\n", 42 raw_printk("Process %s (pid: %d, stackpage=%08lx)\n",
41 current->comm, current->pid, (unsigned long)current); 43 current->comm, current->pid, (unsigned long)current);
42 44
43 /* 45 /*
@@ -53,7 +55,7 @@ show_registers(struct pt_regs * regs)
53 if (usp != 0) 55 if (usp != 0)
54 show_stack (NULL, NULL); 56 show_stack (NULL, NULL);
55 57
56 printk("\nCode: "); 58 raw_printk("\nCode: ");
57 if(regs->irp < PAGE_OFFSET) 59 if(regs->irp < PAGE_OFFSET)
58 goto bad; 60 goto bad;
59 61
@@ -70,16 +72,16 @@ show_registers(struct pt_regs * regs)
70 unsigned char c; 72 unsigned char c;
71 if(__get_user(c, &((unsigned char*)regs->irp)[i])) { 73 if(__get_user(c, &((unsigned char*)regs->irp)[i])) {
72bad: 74bad:
73 printk(" Bad IP value."); 75 raw_printk(" Bad IP value.");
74 break; 76 break;
75 } 77 }
76 78
77 if (i == 0) 79 if (i == 0)
78 printk("(%02x) ", c); 80 raw_printk("(%02x) ", c);
79 else 81 else
80 printk("%02x ", c); 82 raw_printk("%02x ", c);
81 } 83 }
82 printk("\n"); 84 raw_printk("\n");
83 } 85 }
84} 86}
85 87
@@ -121,7 +123,7 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err)
121 stop_watchdog(); 123 stop_watchdog();
122#endif 124#endif
123 125
124 printk("%s: %04lx\n", str, err & 0xffff); 126 raw_printk("%s: %04lx\n", str, err & 0xffff);
125 127
126 show_registers(regs); 128 show_registers(regs);
127 129
@@ -130,3 +132,8 @@ die_if_kernel(const char * str, struct pt_regs * regs, long err)
130#endif 132#endif
131 do_exit(SIGSEGV); 133 do_exit(SIGSEGV);
132} 134}
135
136void arch_enable_nmi(void)
137{
138 asm volatile("setf m");
139}
diff --git a/arch/cris/arch-v10/mm/fault.c b/arch/cris/arch-v10/mm/fault.c
index 6805cdb25a53..fe2615022b97 100644
--- a/arch/cris/arch-v10/mm/fault.c
+++ b/arch/cris/arch-v10/mm/fault.c
@@ -14,6 +14,7 @@
14#include <asm/uaccess.h> 14#include <asm/uaccess.h>
15#include <asm/pgtable.h> 15#include <asm/pgtable.h>
16#include <asm/arch/svinto.h> 16#include <asm/arch/svinto.h>
17#include <asm/mmu_context.h>
17 18
18/* debug of low-level TLB reload */ 19/* debug of low-level TLB reload */
19#undef DEBUG 20#undef DEBUG
@@ -24,8 +25,6 @@
24#define D(x) 25#define D(x)
25#endif 26#endif
26 27
27extern volatile pgd_t *current_pgd;
28
29extern const struct exception_table_entry 28extern const struct exception_table_entry
30 *search_exception_tables(unsigned long addr); 29 *search_exception_tables(unsigned long addr);
31 30
@@ -46,7 +45,7 @@ handle_mmu_bus_fault(struct pt_regs *regs)
46 int page_id; 45 int page_id;
47 int acc, inv; 46 int acc, inv;
48#endif 47#endif
49 pgd_t* pgd = (pgd_t*)current_pgd; 48 pgd_t* pgd = (pgd_t*)per_cpu(current_pgd, smp_processor_id());
50 pmd_t *pmd; 49 pmd_t *pmd;
51 pte_t pte; 50 pte_t pte;
52 int miss, we, writeac; 51 int miss, we, writeac;
@@ -94,24 +93,3 @@ handle_mmu_bus_fault(struct pt_regs *regs)
94 *R_TLB_LO = pte_val(pte); 93 *R_TLB_LO = pte_val(pte);
95 local_irq_restore(flags); 94 local_irq_restore(flags);
96} 95}
97
98/* Called from arch/cris/mm/fault.c to find fixup code. */
99int
100find_fixup_code(struct pt_regs *regs)
101{
102 const struct exception_table_entry *fixup;
103
104 if ((fixup = search_exception_tables(regs->irp)) != 0) {
105 /* Adjust the instruction pointer in the stackframe. */
106 regs->irp = fixup->fixup;
107
108 /*
109 * Don't return by restoring the CPU state, so switch
110 * frame-type.
111 */
112 regs->frametype = CRIS_FRAME_NORMAL;
113 return 1;
114 }
115
116 return 0;
117}
diff --git a/arch/cris/arch-v10/mm/init.c b/arch/cris/arch-v10/mm/init.c
index a9f975a9cfb5..ff3481e76dd4 100644
--- a/arch/cris/arch-v10/mm/init.c
+++ b/arch/cris/arch-v10/mm/init.c
@@ -42,7 +42,7 @@ paging_init(void)
42 * switch_mm) 42 * switch_mm)
43 */ 43 */
44 44
45 current_pgd = init_mm.pgd; 45 per_cpu(current_pgd, smp_processor_id()) = init_mm.pgd;
46 46
47 /* initialise the TLB (tlb.c) */ 47 /* initialise the TLB (tlb.c) */
48 48
diff --git a/arch/cris/arch-v10/mm/tlb.c b/arch/cris/arch-v10/mm/tlb.c
index 9d06125ff5a2..70a5523eff78 100644
--- a/arch/cris/arch-v10/mm/tlb.c
+++ b/arch/cris/arch-v10/mm/tlb.c
@@ -139,53 +139,6 @@ flush_tlb_page(struct vm_area_struct *vma,
139 local_irq_restore(flags); 139 local_irq_restore(flags);
140} 140}
141 141
142/* invalidate a page range */
143
144void
145flush_tlb_range(struct vm_area_struct *vma,
146 unsigned long start,
147 unsigned long end)
148{
149 struct mm_struct *mm = vma->vm_mm;
150 int page_id = mm->context.page_id;
151 int i;
152 unsigned long flags;
153
154 D(printk("tlb: flush range %p<->%p in context %d (%p)\n",
155 start, end, page_id, mm));
156
157 if(page_id == NO_CONTEXT)
158 return;
159
160 start &= PAGE_MASK; /* probably not necessary */
161 end &= PAGE_MASK; /* dito */
162
163 /* invalidate those TLB entries that match both the mm context
164 * and the virtual address range
165 */
166
167 local_save_flags(flags);
168 local_irq_disable();
169 for(i = 0; i < NUM_TLB_ENTRIES; i++) {
170 unsigned long tlb_hi, vpn;
171 *R_TLB_SELECT = IO_FIELD(R_TLB_SELECT, index, i);
172 tlb_hi = *R_TLB_HI;
173 vpn = tlb_hi & PAGE_MASK;
174 if (IO_EXTRACT(R_TLB_HI, page_id, tlb_hi) == page_id &&
175 vpn >= start && vpn < end) {
176 *R_TLB_HI = ( IO_FIELD(R_TLB_HI, page_id, INVALID_PAGEID ) |
177 IO_FIELD(R_TLB_HI, vpn, i & 0xf ) );
178
179 *R_TLB_LO = ( IO_STATE(R_TLB_LO, global,no ) |
180 IO_STATE(R_TLB_LO, valid, no ) |
181 IO_STATE(R_TLB_LO, kernel,no ) |
182 IO_STATE(R_TLB_LO, we, no ) |
183 IO_FIELD(R_TLB_LO, pfn, 0 ) );
184 }
185 }
186 local_irq_restore(flags);
187}
188
189/* dump the entire TLB for debug purposes */ 142/* dump the entire TLB for debug purposes */
190 143
191#if 0 144#if 0
@@ -237,7 +190,7 @@ switch_mm(struct mm_struct *prev, struct mm_struct *next,
237 * the pgd. 190 * the pgd.
238 */ 191 */
239 192
240 current_pgd = next->pgd; 193 per_cpu(current_pgd, smp_processor_id()) = next->pgd;
241 194
242 /* switch context in the MMU */ 195 /* switch context in the MMU */
243 196
diff --git a/arch/cris/arch-v32/Kconfig b/arch/cris/arch-v32/Kconfig
new file mode 100644
index 000000000000..22f0ddc04c50
--- /dev/null
+++ b/arch/cris/arch-v32/Kconfig
@@ -0,0 +1,296 @@
1config ETRAX_DRAM_VIRTUAL_BASE
2 hex
3 depends on ETRAX_ARCH_V32
4 default "c0000000"
5
6config ETRAX_LED1G
7 string "First green LED bit"
8 depends on ETRAX_ARCH_V32
9 default "PA3"
10 help
11 Bit to use for the first green LED (network LED).
12 Most Axis products use bit A3 here.
13
14config ETRAX_LED1R
15 string "First red LED bit"
16 depends on ETRAX_ARCH_V32
17 default "PA4"
18 help
19 Bit to use for the first red LED (network LED).
20 Most Axis products use bit A4 here.
21
22config ETRAX_LED2G
23 string "Second green LED bit"
24 depends on ETRAX_ARCH_V32
25 default "PA5"
26 help
27 Bit to use for the first green LED (status LED).
28 Most Axis products use bit A5 here.
29
30config ETRAX_LED2R
31 string "Second red LED bit"
32 depends on ETRAX_ARCH_V32
33 default "PA6"
34 help
35 Bit to use for the first red LED (network LED).
36 Most Axis products use bit A6 here.
37
38config ETRAX_LED3G
39 string "Third green LED bit"
40 depends on ETRAX_ARCH_V32
41 default "PA7"
42 help
43 Bit to use for the first green LED (drive/power LED).
44 Most Axis products use bit A7 here.
45
46config ETRAX_LED3R
47 string "Third red LED bit"
48 depends on ETRAX_ARCH_V32
49 default "PA7"
50 help
51 Bit to use for the first red LED (drive/power LED).
52 Most Axis products use bit A7 here.
53
54choice
55 prompt "Product debug-port"
56 depends on ETRAX_ARCH_V32
57 default ETRAX_DEBUG_PORT0
58
59config ETRAX_DEBUG_PORT0
60 bool "Serial-0"
61 help
62 Choose a serial port for the ETRAX debug console. Default to
63 port 0.
64
65config ETRAX_DEBUG_PORT1
66 bool "Serial-1"
67 help
68 Use serial port 1 for the console.
69
70config ETRAX_DEBUG_PORT2
71 bool "Serial-2"
72 help
73 Use serial port 2 for the console.
74
75config ETRAX_DEBUG_PORT3
76 bool "Serial-3"
77 help
78 Use serial port 3 for the console.
79
80config ETRAX_DEBUG_PORT_NULL
81 bool "disabled"
82 help
83 Disable serial-port debugging.
84
85endchoice
86
87choice
88 prompt "Kernel GDB port"
89 depends on ETRAX_KGDB
90 default ETRAX_KGDB_PORT0
91 help
92 Choose a serial port for kernel debugging. NOTE: This port should
93 not be enabled under Drivers for built-in interfaces (as it has its
94 own initialization code) and should not be the same as the debug port.
95
96config ETRAX_KGDB_PORT0
97 bool "Serial-0"
98 help
99 Use serial port 0 for kernel debugging.
100
101config ETRAX_KGDB_PORT1
102 bool "Serial-1"
103 help
104 Use serial port 1 for kernel debugging.
105
106config ETRAX_KGDB_PORT2
107 bool "Serial-2"
108 help
109 Use serial port 2 for kernel debugging.
110
111config ETRAX_KGDB_PORT3
112 bool "Serial-3"
113 help
114 Use serial port 3 for kernel debugging.
115
116endchoice
117
118config ETRAX_MEM_GRP1_CONFIG
119 hex "MEM_GRP1_CONFIG"
120 depends on ETRAX_ARCH_V32
121 default "4044a"
122 help
123 Waitstates for flash. The default value is suitable for the
124 standard flashes used in axis products (120 ns).
125
126config ETRAX_MEM_GRP2_CONFIG
127 hex "MEM_GRP2_CONFIG"
128 depends on ETRAX_ARCH_V32
129 default "0"
130 help
131 Waitstates for SRAM. 0 is a good choice for most Axis products.
132
133config ETRAX_MEM_GRP3_CONFIG
134 hex "MEM_GRP3_CONFIG"
135 depends on ETRAX_ARCH_V32
136 default "0"
137 help
138 Waitstates for CSP0-3. 0 is a good choice for most Axis products.
139 It may need to be changed if external devices such as extra
140 register-mapped LEDs are used.
141
142config ETRAX_MEM_GRP4_CONFIG
143 hex "MEM_GRP4_CONFIG"
144 depends on ETRAX_ARCH_V32
145 default "0"
146 help
147 Waitstates for CSP4-6. 0 is a good choice for most Axis products.
148
149config ETRAX_SDRAM_GRP0_CONFIG
150 hex "SDRAM_GRP0_CONFIG"
151 depends on ETRAX_ARCH_V32
152 default "336"
153 help
154 SDRAM configuration for group 0. The value depends on the
155 hardware configuration. The default value is suitable
156 for 32 MB organized as two 16 bits chips (e.g. Axis
157 part number 18550) connected as one 32 bit device (i.e. in
158 the same group).
159
160config ETRAX_SDRAM_GRP1_CONFIG
161 hex "SDRAM_GRP1_CONFIG"
162 depends on ETRAX_ARCH_V32
163 default "0"
164 help
165 SDRAM configuration for group 1. The defult value is 0
166 because group 1 is not used in the default configuration,
167 described in the help for SDRAM_GRP0_CONFIG.
168
169config ETRAX_SDRAM_TIMING
170 hex "SDRAM_TIMING"
171 depends on ETRAX_ARCH_V32
172 default "104a"
173 help
174 SDRAM timing parameters. The default value is ok for
175 most hardwares but large SDRAMs may require a faster
176 refresh (a.k.a 8K refresh). The default value implies
177 100MHz clock and SDR mode.
178
179config ETRAX_SDRAM_COMMAND
180 hex "SDRAM_COMMAND"
181 depends on ETRAX_ARCH_V32
182 default "0"
183 help
184 SDRAM command. Should be 0 unless you really know what
185 you are doing (may be != 0 for unusual address line
186 mappings such as in a MCM)..
187
188config ETRAX_DEF_GIO_PA_OE
189 hex "GIO_PA_OE"
190 depends on ETRAX_ARCH_V32
191 default "1c"
192 help
193 Configures the direction of general port A bits. 1 is out, 0 is in.
194 This is often totally different depending on the product used.
195 There are some guidelines though - if you know that only LED's are
196 connected to port PA, then they are usually connected to bits 2-4
197 and you can therefore use 1c. On other boards which don't have the
198 LED's at the general ports, these bits are used for all kinds of
199 stuff. If you don't know what to use, it is always safe to put all
200 as inputs, although floating inputs isn't good.
201
202config ETRAX_DEF_GIO_PA_OUT
203 hex "GIO_PA_OUT"
204 depends on ETRAX_ARCH_V32
205 default "00"
206 help
207 Configures the initial data for the general port A bits. Most
208 products should use 00 here.
209
210config ETRAX_DEF_GIO_PB_OE
211 hex "GIO_PB_OE"
212 depends on ETRAX_ARCH_V32
213 default "00000"
214 help
215 Configures the direction of general port B bits. 1 is out, 0 is in.
216 This is often totally different depending on the product used.
217 There are some guidelines though - if you know that only LED's are
218 connected to port PA, then they are usually connected to bits 2-4
219 and you can therefore use 1c. On other boards which don't have the
220 LED's at the general ports, these bits are used for all kinds of
221 stuff. If you don't know what to use, it is always safe to put all
222 as inputs, although floating inputs isn't good.
223
224config ETRAX_DEF_GIO_PB_OUT
225 hex "GIO_PB_OUT"
226 depends on ETRAX_ARCH_V32
227 default "00000"
228 help
229 Configures the initial data for the general port B bits. Most
230 products should use 00000 here.
231
232config ETRAX_DEF_GIO_PC_OE
233 hex "GIO_PC_OE"
234 depends on ETRAX_ARCH_V32
235 default "00000"
236 help
237 Configures the direction of general port C bits. 1 is out, 0 is in.
238 This is often totally different depending on the product used.
239 There are some guidelines though - if you know that only LED's are
240 connected to port PA, then they are usually connected to bits 2-4
241 and you can therefore use 1c. On other boards which don't have the
242 LED's at the general ports, these bits are used for all kinds of
243 stuff. If you don't know what to use, it is always safe to put all
244 as inputs, although floating inputs isn't good.
245
246config ETRAX_DEF_GIO_PC_OUT
247 hex "GIO_PC_OUT"
248 depends on ETRAX_ARCH_V32
249 default "00000"
250 help
251 Configures the initial data for the general port C bits. Most
252 products should use 00000 here.
253
254config ETRAX_DEF_GIO_PD_OE
255 hex "GIO_PD_OE"
256 depends on ETRAX_ARCH_V32
257 default "00000"
258 help
259 Configures the direction of general port D bits. 1 is out, 0 is in.
260 This is often totally different depending on the product used.
261 There are some guidelines though - if you know that only LED's are
262 connected to port PA, then they are usually connected to bits 2-4
263 and you can therefore use 1c. On other boards which don't have the
264 LED's at the general ports, these bits are used for all kinds of
265 stuff. If you don't know what to use, it is always safe to put all
266 as inputs, although floating inputs isn't good.
267
268config ETRAX_DEF_GIO_PD_OUT
269 hex "GIO_PD_OUT"
270 depends on ETRAX_ARCH_V32
271 default "00000"
272 help
273 Configures the initial data for the general port D bits. Most
274 products should use 00000 here.
275
276config ETRAX_DEF_GIO_PE_OE
277 hex "GIO_PE_OE"
278 depends on ETRAX_ARCH_V32
279 default "00000"
280 help
281 Configures the direction of general port E bits. 1 is out, 0 is in.
282 This is often totally different depending on the product used.
283 There are some guidelines though - if you know that only LED's are
284 connected to port PA, then they are usually connected to bits 2-4
285 and you can therefore use 1c. On other boards which don't have the
286 LED's at the general ports, these bits are used for all kinds of
287 stuff. If you don't know what to use, it is always safe to put all
288 as inputs, although floating inputs isn't good.
289
290config ETRAX_DEF_GIO_PE_OUT
291 hex "GIO_PE_OUT"
292 depends on ETRAX_ARCH_V32
293 default "00000"
294 help
295 Configures the initial data for the general port E bits. Most
296 products should use 00000 here.
diff --git a/arch/cris/arch-v32/boot/Makefile b/arch/cris/arch-v32/boot/Makefile
new file mode 100644
index 000000000000..26f293ab9617
--- /dev/null
+++ b/arch/cris/arch-v32/boot/Makefile
@@ -0,0 +1,14 @@
1#
2# arch/cris/arch-v32/boot/Makefile
3#
4target = $(target_boot_dir)
5src = $(src_boot_dir)
6
7zImage: compressed/vmlinuz
8
9compressed/vmlinuz: $(objtree)/vmlinux
10 @$(MAKE) -f $(src)/compressed/Makefile $(objtree)/vmlinuz
11
12clean:
13 rm -f zImage tools/build compressed/vmlinux.out
14 @$(MAKE) -f $(src)/compressed/Makefile clean
diff --git a/arch/cris/arch-v32/boot/compressed/Makefile b/arch/cris/arch-v32/boot/compressed/Makefile
new file mode 100644
index 000000000000..9f77eda914ba
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/Makefile
@@ -0,0 +1,41 @@
1#
2# lx25/arch/cris/arch-v32/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux files and romfs
5#
6
7target = $(target_compressed_dir)
8src = $(src_compressed_dir)
9
10CC = gcc-cris -mlinux -march=v32 -I $(TOPDIR)/include
11CFLAGS = -O2
12LD = gcc-cris -mlinux -march=v32 -nostdlib
13OBJCOPY = objcopy-cris
14OBJCOPYFLAGS = -O binary --remove-section=.bss
15OBJECTS = $(target)/head.o $(target)/misc.o
16
17# files to compress
18SYSTEM = $(objtree)/vmlinux.bin
19
20all: vmlinuz
21
22$(target)/decompress.bin: $(OBJECTS)
23 $(LD) -T $(src)/decompress.ld -o $(target)/decompress.o $(OBJECTS)
24 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/decompress.o $(target)/decompress.bin
25
26$(objtree)/vmlinuz: $(target) piggy.img $(target)/decompress.bin
27 cat $(target)/decompress.bin piggy.img > $(objtree)/vmlinuz
28 rm -f piggy.img
29 cp $(objtree)/vmlinuz $(src)
30
31$(target)/head.o: $(src)/head.S
32 $(CC) -D__ASSEMBLY__ -c $< -o $@
33
34# gzip the kernel image
35
36piggy.img: $(SYSTEM)
37 cat $(SYSTEM) | gzip -f -9 > piggy.img
38
39clean:
40 rm -f piggy.img $(objtree)/vmlinuz vmlinuz.o decompress.o decompress.bin $(OBJECTS)
41
diff --git a/arch/cris/arch-v32/boot/compressed/README b/arch/cris/arch-v32/boot/compressed/README
new file mode 100644
index 000000000000..e33691d15c57
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/README
@@ -0,0 +1,25 @@
1Creation of the self-extracting compressed kernel image (vmlinuz)
2-----------------------------------------------------------------
3$Id: README,v 1.1 2003/08/21 09:37:03 johana Exp $
4
5This can be slightly confusing because it's a process with many steps.
6
7The kernel object built by the arch/etrax100/Makefile, vmlinux, is split
8by that makefile into text and data binary files, vmlinux.text and
9vmlinux.data.
10
11Those files together with a ROM filesystem can be catted together and
12burned into a flash or executed directly at the DRAM origin.
13
14They can also be catted together and compressed with gzip, which is what
15happens in this makefile. Together they make up piggy.img.
16
17The decompressor is built into the file decompress.o. It is turned into
18the binary file decompress.bin, which is catted together with piggy.img
19into the file vmlinuz. It can be executed in an arbitrary place in flash.
20
21Be careful - it assumes some things about free locations in DRAM. It
22assumes the DRAM starts at 0x40000000 and that it is at least 8 MB,
23so it puts its code at 0x40700000, and initial stack at 0x40800000.
24
25-Bjorn
diff --git a/arch/cris/arch-v32/boot/compressed/decompress.ld b/arch/cris/arch-v32/boot/compressed/decompress.ld
new file mode 100644
index 000000000000..3c837feca3ac
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/decompress.ld
@@ -0,0 +1,30 @@
1/*#OUTPUT_FORMAT(elf32-us-cris) */
2OUTPUT_ARCH (crisv32)
3
4MEMORY
5 {
6 dram : ORIGIN = 0x40700000,
7 LENGTH = 0x00100000
8 }
9
10SECTIONS
11{
12 .text :
13 {
14 _stext = . ;
15 *(.text)
16 *(.rodata)
17 *(.rodata.*)
18 _etext = . ;
19 } > dram
20 .data :
21 {
22 *(.data)
23 _edata = . ;
24 } > dram
25 .bss :
26 {
27 *(.bss)
28 _end = ALIGN( 0x10 ) ;
29 } > dram
30}
diff --git a/arch/cris/arch-v32/boot/compressed/head.S b/arch/cris/arch-v32/boot/compressed/head.S
new file mode 100644
index 000000000000..0c55b83b8287
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/head.S
@@ -0,0 +1,193 @@
1/*
2 * Code that sets up the DRAM registers, calls the
3 * decompressor to unpack the piggybacked kernel, and jumps.
4 *
5 * Copyright (C) 1999 - 2003, Axis Communications AB
6 */
7
8#include <linux/config.h>
9#define ASSEMBLER_MACROS_ONLY
10#include <asm/arch/hwregs/asm/reg_map_asm.h>
11#include <asm/arch/hwregs/asm/gio_defs_asm.h>
12#include <asm/arch/hwregs/asm/config_defs_asm.h>
13
14#define RAM_INIT_MAGIC 0x56902387
15#define COMMAND_LINE_MAGIC 0x87109563
16
17 ;; Exported symbols
18
19 .globl input_data
20
21 .text
22start:
23 di
24
25 ;; Start clocks for used blocks.
26 move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1
27 move.d [$r1], $r0
28 or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \
29 REG_STATE(config, rw_clk_ctrl, bif, yes) | \
30 REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0
31 move.d $r0, [$r1]
32
33 ;; If booting from NAND flash we first have to copy some
34 ;; data from NAND flash to internal RAM to get the code
35 ;; that initializes the SDRAM. Lets copy 20 KB. This
36 ;; code executes at 0x38010000 if booting from NAND and
37 ;; we are guaranted that at least 0x200 bytes are good so
38 ;; lets start from there. The first 8192 bytes in the nand
39 ;; flash is spliced with zeroes and is thus 16384 bytes.
40 move.d 0x38010200, $r10
41 move.d 0x14200, $r11 ; Start offset in NAND flash 0x10200 + 16384
42 move.d 0x5000, $r12 ; Length of copy
43
44 ;; Before this code the tools add a partitiontable so the PC
45 ;; has an offset from the linked address.
46offset1:
47 lapcq ., $r13 ; get PC
48 add.d first_copy_complete-offset1, $r13
49
50#include "../../lib/nand_init.S"
51
52first_copy_complete:
53 ;; Initialze the DRAM registers.
54 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
55 beq dram_init_finished
56 nop
57
58#include "../../lib/dram_init.S"
59
60dram_init_finished:
61 lapcq ., $r13 ; get PC
62 add.d second_copy_complete-dram_init_finished, $r13
63
64 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
65 move.d [$r0], $r0
66 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
67 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
68 bne second_copy_complete ; No NAND boot
69 nop
70
71 ;; Copy 2MB from NAND flash to SDRAM (at 2-4MB into the SDRAM)
72 move.d 0x40204000, $r10
73 move.d 0x8000, $r11
74 move.d 0x200000, $r12
75 ba copy_nand_to_ram
76 nop
77second_copy_complete:
78
79 ;; Initiate the PA port.
80 move.d CONFIG_ETRAX_DEF_GIO_PA_OUT, $r0
81 move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r1
82 move.d $r0, [$r1]
83
84 move.d CONFIG_ETRAX_DEF_GIO_PA_OE, $r0
85 move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r1
86 move.d $r0, [$r1]
87
88 ;; Setup the stack to a suitably high address.
89 ;; We assume 8 MB is the minimum DRAM and put
90 ;; the SP at the top for now.
91
92 move.d 0x40800000, $sp
93
94 ;; Figure out where the compressed piggyback image is
95 ;; in the flash (since we wont try to copy it to DRAM
96 ;; before unpacking). It is at _edata, but in flash.
97 ;; Use (_edata - herami) as offset to the current PC.
98
99 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
100 move.d [$r0], $r0
101 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
102 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
103 beq hereami2
104 nop
105hereami:
106 lapcq ., $r5 ; get PC
107 and.d 0x7fffffff, $r5 ; strip any non-cache bit
108 move.d $r5, $r0 ; save for later - flash address of 'herami'
109 add.d _edata, $r5
110 sub.d hereami, $r5 ; r5 = flash address of '_edata'
111 move.d hereami, $r1 ; destination
112 ba 2f
113 nop
114hereami2:
115 lapcq ., $r5 ; get PC
116 and.d 0x00ffffff, $r5 ; strip any non-cache bit
117 move.d $r5, $r6
118 or.d 0x40200000, $r6
119 move.d $r6, $r0 ; save for later - flash address of 'herami'
120 add.d _edata, $r5
121 sub.d hereami2, $r5 ; r5 = flash address of '_edata'
122 add.d 0x40200000, $r5
123 move.d hereami2, $r1 ; destination
1242:
125 ;; Copy text+data to DRAM
126
127 move.d _edata, $r2 ; end destination
1281: move.w [$r0+], $r3
129 move.w $r3, [$r1+]
130 cmp.d $r2, $r1
131 bcs 1b
132 nop
133
134 move.d input_data, $r0 ; for the decompressor
135 move.d $r5, [$r0] ; for the decompressor
136
137 ;; Clear the decompressors BSS (between _edata and _end)
138
139 moveq 0, $r0
140 move.d _edata, $r1
141 move.d _end, $r2
1421: move.w $r0, [$r1+]
143 cmp.d $r2, $r1
144 bcs 1b
145 nop
146
147 ;; Save command line magic and address.
148 move.d _cmd_line_magic, $r12
149 move.d $r10, [$r12]
150 move.d _cmd_line_addr, $r12
151 move.d $r11, [$r12]
152
153 ;; Do the decompression and save compressed size in _inptr
154
155 jsr decompress_kernel
156 nop
157
158 ;; Restore command line magic and address.
159 move.d _cmd_line_magic, $r10
160 move.d [$r10], $r10
161 move.d _cmd_line_addr, $r11
162 move.d [$r11], $r11
163
164 ;; Put start address of root partition in r9 so the kernel can use it
165 ;; when mounting from flash
166 move.d input_data, $r0
167 move.d [$r0], $r9 ; flash address of compressed kernel
168 move.d inptr, $r0
169 add.d [$r0], $r9 ; size of compressed kernel
170 cmp.d 0x40200000, $r9
171 blo enter_kernel
172 nop
173 sub.d 0x40200000, $r9
174 add.d 0x4000, $r9
175
176enter_kernel:
177 ;; Enter the decompressed kernel
178 move.d RAM_INIT_MAGIC, $r8 ; Tell kernel that DRAM is initialized
179 jump 0x40004000 ; kernel is linked to this address
180 nop
181
182 .data
183
184input_data:
185 .dword 0 ; used by the decompressor
186_cmd_line_magic:
187 .dword 0
188_cmd_line_addr:
189 .dword 0
190is_nand_boot:
191 .dword 0
192
193#include "../../lib/hw_settings.S"
diff --git a/arch/cris/arch-v32/boot/compressed/misc.c b/arch/cris/arch-v32/boot/compressed/misc.c
new file mode 100644
index 000000000000..54644238ed59
--- /dev/null
+++ b/arch/cris/arch-v32/boot/compressed/misc.c
@@ -0,0 +1,318 @@
1/*
2 * misc.c
3 *
4 * $Id: misc.c,v 1.8 2005/04/24 18:34:29 starvik Exp $
5 *
6 * This is a collection of several routines from gzip-1.0.3
7 * adapted for Linux.
8 *
9 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
10 * puts by Nick Holloway 1993, better puts by Martin Mares 1995
11 * adoptation for Linux/CRIS Axis Communications AB, 1999
12 *
13 */
14
15/* where the piggybacked kernel image expects itself to live.
16 * it is the same address we use when we network load an uncompressed
17 * image into DRAM, and it is the address the kernel is linked to live
18 * at by vmlinux.lds.S
19 */
20
21#define KERNEL_LOAD_ADR 0x40004000
22
23#include <linux/config.h>
24
25#include <linux/types.h>
26#include <asm/arch/hwregs/reg_rdwr.h>
27#include <asm/arch/hwregs/reg_map.h>
28#include <asm/arch/hwregs/ser_defs.h>
29
30/*
31 * gzip declarations
32 */
33
34#define OF(args) args
35#define STATIC static
36
37void* memset(void* s, int c, size_t n);
38void* memcpy(void* __dest, __const void* __src,
39 size_t __n);
40
41#define memzero(s, n) memset ((s), 0, (n))
42
43
44typedef unsigned char uch;
45typedef unsigned short ush;
46typedef unsigned long ulg;
47
48#define WSIZE 0x8000 /* Window size must be at least 32k, */
49 /* and a power of two */
50
51static uch *inbuf; /* input buffer */
52static uch window[WSIZE]; /* Sliding window buffer */
53
54unsigned inptr = 0; /* index of next byte to be processed in inbuf
55 * After decompression it will contain the
56 * compressed size, and head.S will read it.
57 */
58
59static unsigned outcnt = 0; /* bytes in output buffer */
60
61/* gzip flag byte */
62#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
63#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
64#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
65#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
66#define COMMENT 0x10 /* bit 4 set: file comment present */
67#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
68#define RESERVED 0xC0 /* bit 6,7: reserved */
69
70#define get_byte() inbuf[inptr++]
71
72/* Diagnostic functions */
73#ifdef DEBUG
74# define Assert(cond,msg) {if(!(cond)) error(msg);}
75# define Trace(x) fprintf x
76# define Tracev(x) {if (verbose) fprintf x ;}
77# define Tracevv(x) {if (verbose>1) fprintf x ;}
78# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
79# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
80#else
81# define Assert(cond,msg)
82# define Trace(x)
83# define Tracev(x)
84# define Tracevv(x)
85# define Tracec(c,x)
86# define Tracecv(c,x)
87#endif
88
89static int fill_inbuf(void);
90static void flush_window(void);
91static void error(char *m);
92static void gzip_mark(void **);
93static void gzip_release(void **);
94
95extern char *input_data; /* lives in head.S */
96
97static long bytes_out = 0;
98static uch *output_data;
99static unsigned long output_ptr = 0;
100
101static void *malloc(int size);
102static void free(void *where);
103static void error(char *m);
104static void gzip_mark(void **);
105static void gzip_release(void **);
106
107static void puts(const char *);
108
109/* the "heap" is put directly after the BSS ends, at end */
110
111extern int _end;
112static long free_mem_ptr = (long)&_end;
113
114#include "../../../../../lib/inflate.c"
115
116static void *malloc(int size)
117{
118 void *p;
119
120 if (size <0) error("Malloc error");
121
122 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
123
124 p = (void *)free_mem_ptr;
125 free_mem_ptr += size;
126
127 return p;
128}
129
130static void free(void *where)
131{ /* Don't care */
132}
133
134static void gzip_mark(void **ptr)
135{
136 *ptr = (void *) free_mem_ptr;
137}
138
139static void gzip_release(void **ptr)
140{
141 free_mem_ptr = (long) *ptr;
142}
143
144/* decompressor info and error messages to serial console */
145
146static inline void
147serout(const char *s, reg_scope_instances regi_ser)
148{
149 reg_ser_rs_stat_din rs;
150 reg_ser_rw_dout dout = {.data = *s};
151
152 do {
153 rs = REG_RD(ser, regi_ser, rs_stat_din);
154 }
155 while (!rs.tr_rdy);/* Wait for tranceiver. */
156
157 REG_WR(ser, regi_ser, rw_dout, dout);
158}
159
160static void
161puts(const char *s)
162{
163#ifndef CONFIG_ETRAX_DEBUG_PORT_NULL
164 while (*s) {
165#ifdef CONFIG_ETRAX_DEBUG_PORT0
166 serout(s, regi_ser0);
167#endif
168#ifdef CONFIG_ETRAX_DEBUG_PORT1
169 serout(s, regi_ser1);
170#endif
171#ifdef CONFIG_ETRAX_DEBUG_PORT2
172 serout(s, regi_ser2);
173#endif
174#ifdef CONFIG_ETRAX_DEBUG_PORT3
175 serout(s, regi_ser3);
176#endif
177 *s++;
178 }
179/* CONFIG_ETRAX_DEBUG_PORT_NULL */
180#endif
181}
182
183void*
184memset(void* s, int c, size_t n)
185{
186 int i;
187 char *ss = (char*)s;
188
189 for (i=0;i<n;i++) ss[i] = c;
190}
191
192void*
193memcpy(void* __dest, __const void* __src,
194 size_t __n)
195{
196 int i;
197 char *d = (char *)__dest, *s = (char *)__src;
198
199 for (i=0;i<__n;i++) d[i] = s[i];
200}
201
202/* ===========================================================================
203 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
204 * (Used for the decompressed data only.)
205 */
206
207static void
208flush_window()
209{
210 ulg c = crc; /* temporary variable */
211 unsigned n;
212 uch *in, *out, ch;
213
214 in = window;
215 out = &output_data[output_ptr];
216 for (n = 0; n < outcnt; n++) {
217 ch = *out++ = *in++;
218 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
219 }
220 crc = c;
221 bytes_out += (ulg)outcnt;
222 output_ptr += (ulg)outcnt;
223 outcnt = 0;
224}
225
226static void
227error(char *x)
228{
229 puts("\n\n");
230 puts(x);
231 puts("\n\n -- System halted\n");
232
233 while(1); /* Halt */
234}
235
236void
237setup_normal_output_buffer()
238{
239 output_data = (char *)KERNEL_LOAD_ADR;
240}
241
242static inline void
243serial_setup(reg_scope_instances regi_ser)
244{
245 reg_ser_rw_xoff xoff;
246 reg_ser_rw_tr_ctrl tr_ctrl;
247 reg_ser_rw_rec_ctrl rec_ctrl;
248 reg_ser_rw_tr_baud_div tr_baud;
249 reg_ser_rw_rec_baud_div rec_baud;
250
251 /* Turn off XOFF. */
252 xoff = REG_RD(ser, regi_ser, rw_xoff);
253
254 xoff.chr = 0;
255 xoff.automatic = regk_ser_no;
256
257 REG_WR(ser, regi_ser, rw_xoff, xoff);
258
259 /* Set baudrate and stopbits. */
260 tr_ctrl = REG_RD(ser, regi_ser, rw_tr_ctrl);
261 rec_ctrl = REG_RD(ser, regi_ser, rw_rec_ctrl);
262 tr_baud = REG_RD(ser, regi_ser, rw_tr_baud_div);
263 rec_baud = REG_RD(ser, regi_ser, rw_rec_baud_div);
264
265 tr_ctrl.stop_bits = 1; /* 2 stop bits. */
266
267 /*
268 * The baudrate setup is a bit fishy, but in the end the tranceiver is
269 * set to 4800 and the receiver to 115200. The magic value is
270 * 29.493 MHz.
271 */
272 tr_ctrl.base_freq = regk_ser_f29_493;
273 rec_ctrl.base_freq = regk_ser_f29_493;
274 tr_baud.div = (29493000 / 8) / 4800;
275 rec_baud.div = (29493000 / 8) / 115200;
276
277 REG_WR(ser, regi_ser, rw_tr_ctrl, tr_ctrl);
278 REG_WR(ser, regi_ser, rw_tr_baud_div, tr_baud);
279 REG_WR(ser, regi_ser, rw_rec_ctrl, rec_ctrl);
280 REG_WR(ser, regi_ser, rw_rec_baud_div, rec_baud);
281}
282
283void
284decompress_kernel()
285{
286 char revision;
287
288 /* input_data is set in head.S */
289 inbuf = input_data;
290
291#ifdef CONFIG_ETRAX_DEBUG_PORT0
292 serial_setup(regi_ser0);
293#endif
294#ifdef CONFIG_ETRAX_DEBUG_PORT1
295 serial_setup(regi_ser1);
296#endif
297#ifdef CONFIG_ETRAX_DEBUG_PORT2
298 serial_setup(regi_ser2);
299#endif
300#ifdef CONFIG_ETRAX_DEBUG_PORT3
301 serial_setup(regi_ser3);
302#endif
303
304 setup_normal_output_buffer();
305
306 makecrc();
307
308 __asm__ volatile ("move $vr,%0" : "=rm" (revision));
309 if (revision < 32)
310 {
311 puts("You need an ETRAX FS to run Linux 2.6/crisv32.\n");
312 while(1);
313 }
314
315 puts("Uncompressing Linux...\n");
316 gunzip();
317 puts("Done. Now booting the kernel.\n");
318}
diff --git a/arch/cris/arch-v32/boot/rescue/Makefile b/arch/cris/arch-v32/boot/rescue/Makefile
new file mode 100644
index 000000000000..f668a8198724
--- /dev/null
+++ b/arch/cris/arch-v32/boot/rescue/Makefile
@@ -0,0 +1,36 @@
1#
2# Makefile for rescue code
3#
4target = $(target_rescue_dir)
5src = $(src_rescue_dir)
6
7CC = gcc-cris -mlinux -march=v32 $(LINUXINCLUDE)
8CFLAGS = -O2
9LD = gcc-cris -mlinux -march=v32 -nostdlib
10OBJCOPY = objcopy-cris
11OBJCOPYFLAGS = -O binary --remove-section=.bss
12
13all: $(target)/rescue.bin
14
15rescue: rescue.bin
16 # do nothing
17
18$(target)/rescue.bin: $(target) $(target)/head.o
19 $(LD) -T $(src)/rescue.ld -o $(target)/rescue.o $(target)/head.o
20 $(OBJCOPY) $(OBJCOPYFLAGS) $(target)/rescue.o $(target)/rescue.bin
21 cp -p $(target)/rescue.bin $(objtree)
22
23$(target):
24 mkdir -p $(target)
25
26$(target)/head.o: $(src)/head.S
27 $(CC) -D__ASSEMBLY__ -c $< -o $*.o
28
29clean:
30 rm -f $(target)/*.o $(target)/*.bin
31
32fastdep:
33
34modules:
35
36modules-install:
diff --git a/arch/cris/arch-v32/boot/rescue/head.S b/arch/cris/arch-v32/boot/rescue/head.S
new file mode 100644
index 000000000000..61ede5f30f99
--- /dev/null
+++ b/arch/cris/arch-v32/boot/rescue/head.S
@@ -0,0 +1,39 @@
1/* $Id: head.S,v 1.4 2004/11/01 16:10:28 starvik Exp $
2 *
3 * This used to be the rescue code but now that is handled by the
4 * RedBoot based RFL instead. Nothing to see here, move along.
5 */
6
7#include <linux/config.h>
8#include <asm/arch/hwregs/reg_map_asm.h>
9#include <asm/arch/hwregs/config_defs_asm.h>
10
11 .text
12
13 ;; Start clocks for used blocks.
14 move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1
15 move.d [$r1], $r0
16 or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \
17 REG_STATE(config, rw_clk_ctrl, bif, yes) | \
18 REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0
19 move.d $r0, [$r1]
20
21 ;; Copy 68KB NAND flash to Internal RAM (if NAND boot)
22 move.d 0x38004000, $r10
23 move.d 0x8000, $r11
24 move.d 0x11000, $r12
25 move.d copy_complete, $r13
26 and.d 0x000fffff, $r13
27 or.d 0x38000000, $r13
28
29#include "../../lib/nand_init.S"
30
31 ;; No NAND found
32 move.d CONFIG_ETRAX_PTABLE_SECTOR, $r10
33 jump $r10 ; Jump to decompresser
34 nop
35
36copy_complete:
37 move.d 0x38000000 + CONFIG_ETRAX_PTABLE_SECTOR, $r10
38 jump $r10 ; Jump to decompresser
39 nop
diff --git a/arch/cris/arch-v32/boot/rescue/rescue.ld b/arch/cris/arch-v32/boot/rescue/rescue.ld
new file mode 100644
index 000000000000..42b11aa122b2
--- /dev/null
+++ b/arch/cris/arch-v32/boot/rescue/rescue.ld
@@ -0,0 +1,20 @@
1MEMORY
2 {
3 flash : ORIGIN = 0x00000000,
4 LENGTH = 0x00100000
5 }
6
7SECTIONS
8{
9 .text :
10 {
11 stext = . ;
12 *(.text)
13 etext = . ;
14 } > flash
15 .data :
16 {
17 *(.data)
18 edata = . ;
19 } > flash
20}
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
new file mode 100644
index 000000000000..a33097f95362
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -0,0 +1,625 @@
1config ETRAX_ETHERNET
2 bool "Ethernet support"
3 depends on ETRAX_ARCH_V32
4 select NET_ETHERNET
5 help
6 This option enables the ETRAX FS built-in 10/100Mbit Ethernet
7 controller.
8
9config ETRAX_ETHERNET_HW_CSUM
10 bool "Hardware accelerated ethernet checksum and scatter/gather"
11 depends on ETRAX_ETHERNET
12 depends on ETRAX_STREAMCOPROC
13 default y
14 help
15 Hardware acceleration of checksumming and scatter/gather
16
17config ETRAX_ETHERNET_IFACE0
18 depends on ETRAX_ETHERNET
19 bool "Enable network interface 0"
20
21config ETRAX_ETHERNET_IFACE1
22 depends on ETRAX_ETHERNET
23 bool "Enable network interface 1 (uses DMA6 and DMA7)"
24
25choice
26 prompt "Network LED behavior"
27 depends on ETRAX_ETHERNET
28 default ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
29
30config ETRAX_NETWORK_LED_ON_WHEN_LINK
31 bool "LED_on_when_link"
32 help
33 Selecting LED_on_when_link will light the LED when there is a
34 connection and will flash off when there is activity.
35
36 Selecting LED_on_when_activity will light the LED only when
37 there is activity.
38
39 This setting will also affect the behaviour of other activity LEDs
40 e.g. Bluetooth.
41
42config ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY
43 bool "LED_on_when_activity"
44 help
45 Selecting LED_on_when_link will light the LED when there is a
46 connection and will flash off when there is activity.
47
48 Selecting LED_on_when_activity will light the LED only when
49 there is activity.
50
51 This setting will also affect the behaviour of other activity LEDs
52 e.g. Bluetooth.
53
54endchoice
55
56config ETRAXFS_SERIAL
57 bool "Serial-port support"
58 depends on ETRAX_ARCH_V32
59 help
60 Enables the ETRAX FS serial driver for ser0 (ttyS0)
61 You probably want this enabled.
62
63config ETRAX_SERIAL_PORT0
64 bool "Serial port 0 enabled"
65 depends on ETRAXFS_SERIAL
66 help
67 Enables the ETRAX FS serial driver for ser0 (ttyS0)
68 Normally you want this on. You can control what DMA channels to use
69 if you do not need DMA to something else.
70 ser0 can use dma4 or dma6 for output and dma5 or dma7 for input.
71
72choice
73 prompt "Ser0 DMA in channel "
74 depends on ETRAX_SERIAL_PORT0
75 default ETRAX_SERIAL_PORT0_NO_DMA_IN
76 help
77 What DMA channel to use for ser0.
78
79
80config ETRAX_SERIAL_PORT0_NO_DMA_IN
81 bool "Ser0 uses no DMA for input"
82 help
83 Do not use DMA for ser0 input.
84
85config ETRAX_SERIAL_PORT0_DMA7_IN
86 bool "Ser0 uses DMA7 for input"
87 depends on ETRAX_SERIAL_PORT0
88 help
89 Enables the DMA7 input channel for ser0 (ttyS0).
90 If you do not enable DMA, an interrupt for each character will be
91 used when receiveing data.
92 Normally you want to use DMA, unless you use the DMA channel for
93 something else.
94
95endchoice
96
97choice
98 prompt "Ser0 DMA out channel"
99 depends on ETRAX_SERIAL_PORT0
100 default ETRAX_SERIAL_PORT0_NO_DMA_OUT
101
102config ETRAX_SERIAL_PORT0_NO_DMA_OUT
103 bool "Ser0 uses no DMA for output"
104 help
105 Do not use DMA for ser0 output.
106
107config ETRAX_SERIAL_PORT0_DMA6_OUT
108 bool "Ser0 uses DMA6 for output"
109 depends on ETRAX_SERIAL_PORT0
110 help
111 Enables the DMA6 output channel for ser0 (ttyS0).
112 If you do not enable DMA, an interrupt for each character will be
113 used when transmitting data.
114 Normally you want to use DMA, unless you use the DMA channel for
115 something else.
116
117endchoice
118
119config ETRAX_SER0_DTR_BIT
120 string "Ser 0 DTR bit (empty = not used)"
121 depends on ETRAX_SERIAL_PORT0
122
123config ETRAX_SER0_RI_BIT
124 string "Ser 0 RI bit (empty = not used)"
125 depends on ETRAX_SERIAL_PORT0
126
127config ETRAX_SER0_DSR_BIT
128 string "Ser 0 DSR bit (empty = not used)"
129 depends on ETRAX_SERIAL_PORT0
130
131config ETRAX_SER0_CD_BIT
132 string "Ser 0 CD bit (empty = not used)"
133 depends on ETRAX_SERIAL_PORT0
134
135config ETRAX_SERIAL_PORT1
136 bool "Serial port 1 enabled"
137 depends on ETRAXFS_SERIAL
138 help
139 Enables the ETRAX FS serial driver for ser1 (ttyS1).
140
141choice
142 prompt "Ser1 DMA in channel "
143 depends on ETRAX_SERIAL_PORT1
144 default ETRAX_SERIAL_PORT1_NO_DMA_IN
145 help
146 What DMA channel to use for ser1.
147
148
149config ETRAX_SERIAL_PORT1_NO_DMA_IN
150 bool "Ser1 uses no DMA for input"
151 help
152 Do not use DMA for ser1 input.
153
154config ETRAX_SERIAL_PORT1_DMA5_IN
155 bool "Ser1 uses DMA5 for input"
156 depends on ETRAX_SERIAL_PORT1
157 help
158 Enables the DMA5 input channel for ser1 (ttyS1).
159 If you do not enable DMA, an interrupt for each character will be
160 used when receiveing data.
161 Normally you want this on, unless you use the DMA channel for
162 something else.
163
164endchoice
165
166choice
167 prompt "Ser1 DMA out channel "
168 depends on ETRAX_SERIAL_PORT1
169 default ETRAX_SERIAL_PORT1_NO_DMA_OUT
170 help
171 What DMA channel to use for ser1.
172
173config ETRAX_SERIAL_PORT1_NO_DMA_OUT
174 bool "Ser1 uses no DMA for output"
175 help
176 Do not use DMA for ser1 output.
177
178config ETRAX_SERIAL_PORT1_DMA4_OUT
179 bool "Ser1 uses DMA4 for output"
180 depends on ETRAX_SERIAL_PORT1
181 help
182 Enables the DMA4 output channel for ser1 (ttyS1).
183 If you do not enable DMA, an interrupt for each character will be
184 used when transmitting data.
185 Normally you want this on, unless you use the DMA channel for
186 something else.
187
188endchoice
189
190config ETRAX_SER1_DTR_BIT
191 string "Ser 1 DTR bit (empty = not used)"
192 depends on ETRAX_SERIAL_PORT1
193
194config ETRAX_SER1_RI_BIT
195 string "Ser 1 RI bit (empty = not used)"
196 depends on ETRAX_SERIAL_PORT1
197
198config ETRAX_SER1_DSR_BIT
199 string "Ser 1 DSR bit (empty = not used)"
200 depends on ETRAX_SERIAL_PORT1
201
202config ETRAX_SER1_CD_BIT
203 string "Ser 1 CD bit (empty = not used)"
204 depends on ETRAX_SERIAL_PORT1
205
206config ETRAX_SERIAL_PORT2
207 bool "Serial port 2 enabled"
208 depends on ETRAXFS_SERIAL
209 help
210 Enables the ETRAX FS serial driver for ser2 (ttyS2).
211
212choice
213 prompt "Ser2 DMA in channel "
214 depends on ETRAX_SERIAL_PORT2
215 default ETRAX_SERIAL_PORT2_NO_DMA_IN
216 help
217 What DMA channel to use for ser2.
218
219
220config ETRAX_SERIAL_PORT2_NO_DMA_IN
221 bool "Ser2 uses no DMA for input"
222 help
223 Do not use DMA for ser2 input.
224
225config ETRAX_SERIAL_PORT2_DMA3_IN
226 bool "Ser2 uses DMA3 for input"
227 depends on ETRAX_SERIAL_PORT2
228 help
229 Enables the DMA3 input channel for ser2 (ttyS2).
230 If you do not enable DMA, an interrupt for each character will be
231 used when receiveing data.
232 Normally you want to use DMA, unless you use the DMA channel for
233 something else.
234
235endchoice
236
237choice
238 prompt "Ser2 DMA out channel"
239 depends on ETRAX_SERIAL_PORT2
240 default ETRAX_SERIAL_PORT2_NO_DMA_OUT
241
242config ETRAX_SERIAL_PORT2_NO_DMA_OUT
243 bool "Ser2 uses no DMA for output"
244 help
245 Do not use DMA for ser2 output.
246
247config ETRAX_SERIAL_PORT2_DMA2_OUT
248 bool "Ser2 uses DMA2 for output"
249 depends on ETRAX_SERIAL_PORT2
250 help
251 Enables the DMA2 output channel for ser2 (ttyS2).
252 If you do not enable DMA, an interrupt for each character will be
253 used when transmitting data.
254 Normally you want to use DMA, unless you use the DMA channel for
255 something else.
256
257endchoice
258
259config ETRAX_SER2_DTR_BIT
260 string "Ser 2 DTR bit (empty = not used)"
261 depends on ETRAX_SERIAL_PORT2
262
263config ETRAX_SER2_RI_BIT
264 string "Ser 2 RI bit (empty = not used)"
265 depends on ETRAX_SERIAL_PORT2
266
267config ETRAX_SER2_DSR_BIT
268 string "Ser 2 DSR bit (empty = not used)"
269 depends on ETRAX_SERIAL_PORT2
270
271config ETRAX_SER2_CD_BIT
272 string "Ser 2 CD bit (empty = not used)"
273 depends on ETRAX_SERIAL_PORT2
274
275config ETRAX_SERIAL_PORT3
276 bool "Serial port 3 enabled"
277 depends on ETRAXFS_SERIAL
278 help
279 Enables the ETRAX FS serial driver for ser3 (ttyS3).
280
281choice
282 prompt "Ser3 DMA in channel "
283 depends on ETRAX_SERIAL_PORT3
284 default ETRAX_SERIAL_PORT3_NO_DMA_IN
285 help
286 What DMA channel to use for ser3.
287
288
289config ETRAX_SERIAL_PORT3_NO_DMA_IN
290 bool "Ser3 uses no DMA for input"
291 help
292 Do not use DMA for ser3 input.
293
294config ETRAX_SERIAL_PORT3_DMA9_IN
295 bool "Ser3 uses DMA9 for input"
296 depends on ETRAX_SERIAL_PORT3
297 help
298 Enables the DMA9 input channel for ser3 (ttyS3).
299 If you do not enable DMA, an interrupt for each character will be
300 used when receiveing data.
301 Normally you want to use DMA, unless you use the DMA channel for
302 something else.
303
304endchoice
305
306choice
307 prompt "Ser3 DMA out channel"
308 depends on ETRAX_SERIAL_PORT3
309 default ETRAX_SERIAL_PORT3_NO_DMA_OUT
310
311config ETRAX_SERIAL_PORT3_NO_DMA_OUT
312 bool "Ser3 uses no DMA for output"
313 help
314 Do not use DMA for ser3 output.
315
316config ETRAX_SERIAL_PORT3_DMA8_OUT
317 bool "Ser3 uses DMA8 for output"
318 depends on ETRAX_SERIAL_PORT3
319 help
320 Enables the DMA8 output channel for ser3 (ttyS3).
321 If you do not enable DMA, an interrupt for each character will be
322 used when transmitting data.
323 Normally you want to use DMA, unless you use the DMA channel for
324 something else.
325
326endchoice
327
328config ETRAX_SER3_DTR_BIT
329 string "Ser 3 DTR bit (empty = not used)"
330 depends on ETRAX_SERIAL_PORT3
331
332config ETRAX_SER3_RI_BIT
333 string "Ser 3 RI bit (empty = not used)"
334 depends on ETRAX_SERIAL_PORT3
335
336config ETRAX_SER3_DSR_BIT
337 string "Ser 3 DSR bit (empty = not used)"
338 depends on ETRAX_SERIAL_PORT3
339
340config ETRAX_SER3_CD_BIT
341 string "Ser 3 CD bit (empty = not used)"
342 depends on ETRAX_SERIAL_PORT3
343
344config ETRAX_RS485
345 bool "RS-485 support"
346 depends on ETRAX_SERIAL
347 help
348 Enables support for RS-485 serial communication. For a primer on
349 RS-485, see <http://www.hw.cz/english/docs/rs485/rs485.html>.
350
351config ETRAX_RS485_DISABLE_RECEIVER
352 bool "Disable serial receiver"
353 depends on ETRAX_RS485
354 help
355 It is necessary to disable the serial receiver to avoid serial
356 loopback. Not all products are able to do this in software only.
357 Axis 2400/2401 must disable receiver.
358
359config ETRAX_AXISFLASHMAP
360 bool "Axis flash-map support"
361 depends on ETRAX_ARCH_V32
362 select MTD
363 select MTD_CFI
364 select MTD_CFI_AMDSTD
365 select MTD_OBSOLETE_CHIPS
366 select MTD_AMDSTD
367 select MTD_CHAR
368 select MTD_BLOCK
369 select MTD_PARTITIONS
370 select MTD_CONCAT
371 select MTD_COMPLEX_MAPPINGS
372 help
373 This option enables MTD mapping of flash devices. Needed to use
374 flash memories. If unsure, say Y.
375
376config ETRAX_SYNCHRONOUS_SERIAL
377 bool "Synchronous serial-port support"
378 depends on ETRAX_ARCH_V32
379 help
380 Enables the ETRAX FS synchronous serial driver.
381
382config ETRAX_SYNCHRONOUS_SERIAL_PORT0
383 bool "Synchronous serial port 0 enabled"
384 depends on ETRAX_SYNCHRONOUS_SERIAL
385 help
386 Enabled synchronous serial port 0.
387
388config ETRAX_SYNCHRONOUS_SERIAL0_DMA
389 bool "Enable DMA on synchronous serial port 0."
390 depends on ETRAX_SYNCHRONOUS_SERIAL_PORT0
391 help
392 A synchronous serial port can run in manual or DMA mode.
393 Selecting this option will make it run in DMA mode.
394
395config ETRAX_SYNCHRONOUS_SERIAL_PORT1
396 bool "Synchronous serial port 1 enabled"
397 depends on ETRAX_SYNCHRONOUS_SERIAL
398 help
399 Enabled synchronous serial port 1.
400
401config ETRAX_SYNCHRONOUS_SERIAL1_DMA
402 bool "Enable DMA on synchronous serial port 1."
403 depends on ETRAX_SYNCHRONOUS_SERIAL_PORT1
404 help
405 A synchronous serial port can run in manual or DMA mode.
406 Selecting this option will make it run in DMA mode.
407
408config ETRAX_PTABLE_SECTOR
409 int "Byte-offset of partition table sector"
410 depends on ETRAX_AXISFLASHMAP
411 default "65536"
412 help
413 Byte-offset of the partition table in the first flash chip.
414 The default value is 64kB and should not be changed unless
415 you know exactly what you are doing. The only valid reason
416 for changing this is when the flash block size is bigger
417 than 64kB (e.g. when using two parallel 16 bit flashes).
418
419config ETRAX_NANDFLASH
420 bool "NAND flash support"
421 depends on ETRAX_ARCH_V32
422 select MTD_NAND
423 select MTD_NAND_IDS
424 help
425 This option enables MTD mapping of NAND flash devices. Needed to use
426 NAND flash memories. If unsure, say Y.
427
428config ETRAX_I2C
429 bool "I2C driver"
430 depends on ETRAX_ARCH_V32
431 help
432 This option enabled the I2C driver used by e.g. the RTC driver.
433
434config ETRAX_I2C_DATA_PORT
435 string "I2C data pin"
436 depends on ETRAX_I2C
437 help
438 The pin to use for I2C data.
439
440config ETRAX_I2C_CLK_PORT
441 string "I2C clock pin"
442 depends on ETRAX_I2C
443 help
444 The pin to use for I2C clock.
445
446config ETRAX_RTC
447 bool "Real Time Clock support"
448 depends on ETRAX_ARCH_V32
449 help
450 Enabled RTC support.
451
452choice
453 prompt "RTC chip"
454 depends on ETRAX_RTC
455 default ETRAX_PCF8563
456
457config ETRAX_PCF8563
458 bool "PCF8563"
459 help
460 Philips PCF8563 RTC
461
462endchoice
463
464config ETRAX_GPIO
465 bool "GPIO support"
466 depends on ETRAX_ARCH_V32
467 ---help---
468 Enables the ETRAX general port device (major 120, minors 0-4).
469 You can use this driver to access the general port bits. It supports
470 these ioctl's:
471 #include <linux/etraxgpio.h>
472 fd = open("/dev/gpioa", O_RDWR); // or /dev/gpiob
473 ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_SETBITS), bits_to_set);
474 ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_CLRBITS), bits_to_clear);
475 err = ioctl(fd, _IO(ETRAXGPIO_IOCTYPE, IO_READ_INBITS), &val);
476 Remember that you need to setup the port directions appropriately in
477 the General configuration.
478
479config ETRAX_PA_BUTTON_BITMASK
480 hex "PA-buttons bitmask"
481 depends on ETRAX_GPIO
482 default "0x02"
483 help
484 This is a bitmask (8 bits) with information about what bits on PA
485 that are used for buttons.
486 Most products has a so called TEST button on PA1, if that is true
487 use 0x02 here.
488 Use 00 if there are no buttons on PA.
489 If the bitmask is <> 00 a button driver will be included in the gpio
490 driver. ETRAX general I/O support must be enabled.
491
492config ETRAX_PA_CHANGEABLE_DIR
493 hex "PA user changeable dir mask"
494 depends on ETRAX_GPIO
495 default "0x00"
496 help
497 This is a bitmask (8 bits) with information of what bits in PA that a
498 user can change direction on using ioctl's.
499 Bit set = changeable.
500 You probably want 0x00 here, but it depends on your hardware.
501
502config ETRAX_PA_CHANGEABLE_BITS
503 hex "PA user changeable bits mask"
504 depends on ETRAX_GPIO
505 default "0x00"
506 help
507 This is a bitmask (8 bits) with information of what bits in PA
508 that a user can change the value on using ioctl's.
509 Bit set = changeable.
510
511config ETRAX_PB_CHANGEABLE_DIR
512 hex "PB user changeable dir mask"
513 depends on ETRAX_GPIO
514 default "0x00000"
515 help
516 This is a bitmask (18 bits) with information of what bits in PB
517 that a user can change direction on using ioctl's.
518 Bit set = changeable.
519 You probably want 0x00000 here, but it depends on your hardware.
520
521config ETRAX_PB_CHANGEABLE_BITS
522 hex "PB user changeable bits mask"
523 depends on ETRAX_GPIO
524 default "0x00000"
525 help
526 This is a bitmask (18 bits) with information of what bits in PB
527 that a user can change the value on using ioctl's.
528 Bit set = changeable.
529
530config ETRAX_PC_CHANGEABLE_DIR
531 hex "PC user changeable dir mask"
532 depends on ETRAX_GPIO
533 default "0x00000"
534 help
535 This is a bitmask (18 bits) with information of what bits in PC
536 that a user can change direction on using ioctl's.
537 Bit set = changeable.
538 You probably want 0x00000 here, but it depends on your hardware.
539
540config ETRAX_PC_CHANGEABLE_BITS
541 hex "PC user changeable bits mask"
542 depends on ETRAX_GPIO
543 default "0x00000"
544 help
545 This is a bitmask (18 bits) with information of what bits in PC
546 that a user can change the value on using ioctl's.
547 Bit set = changeable.
548
549config ETRAX_PD_CHANGEABLE_DIR
550 hex "PD user changeable dir mask"
551 depends on ETRAX_GPIO
552 default "0x00000"
553 help
554 This is a bitmask (18 bits) with information of what bits in PD
555 that a user can change direction on using ioctl's.
556 Bit set = changeable.
557 You probably want 0x00000 here, but it depends on your hardware.
558
559config ETRAX_PD_CHANGEABLE_BITS
560 hex "PD user changeable bits mask"
561 depends on ETRAX_GPIO
562 default "0x00000"
563 help
564 This is a bitmask (18 bits) with information of what bits in PD
565 that a user can change the value on using ioctl's.
566 Bit set = changeable.
567
568config ETRAX_PE_CHANGEABLE_DIR
569 hex "PE user changeable dir mask"
570 depends on ETRAX_GPIO
571 default "0x00000"
572 help
573 This is a bitmask (18 bits) with information of what bits in PE
574 that a user can change direction on using ioctl's.
575 Bit set = changeable.
576 You probably want 0x00000 here, but it depends on your hardware.
577
578config ETRAX_PE_CHANGEABLE_BITS
579 hex "PE user changeable bits mask"
580 depends on ETRAX_GPIO
581 default "0x00000"
582 help
583 This is a bitmask (18 bits) with information of what bits in PE
584 that a user can change the value on using ioctl's.
585 Bit set = changeable.
586
587config ETRAX_IDE
588 bool "ATA/IDE support"
589 depends on ETRAX_ARCH_V32
590 select IDE
591 select BLK_DEV_IDE
592 select BLK_DEV_IDEDISK
593 select BLK_DEV_IDECD
594 select BLK_DEV_IDEDMA
595 help
596 Enables the ETRAX IDE driver.
597
598config ETRAX_CARDBUS
599 bool "Cardbus support"
600 depends on ETRAX_ARCH_V32
601 select PCCARD
602 select CARDBUS
603 select HOTPLUG
604 select PCCARD_NONSTATIC
605 help
606 Enabled the ETRAX Carbus driver.
607
608config PCI
609 bool
610 depends on ETRAX_CARDBUS
611 default y
612
613config ETRAX_IOP_FW_LOAD
614 tristate "IO-processor hotplug firmware loading support"
615 depends on ETRAX_ARCH_V32
616 select FW_LOADER
617 help
618 Enables IO-processor hotplug firmware loading support.
619
620config ETRAX_STREAMCOPROC
621 tristate "Stream co-processor driver enabled"
622 depends on ETRAX_ARCH_V32
623 help
624 This option enables a driver for the stream co-processor
625 for cryptographic operations.
diff --git a/arch/cris/arch-v32/drivers/Makefile b/arch/cris/arch-v32/drivers/Makefile
new file mode 100644
index 000000000000..a359cd20ae75
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/Makefile
@@ -0,0 +1,13 @@
1#
2# Makefile for Etrax-specific drivers
3#
4
5obj-$(CONFIG_ETRAX_STREAMCOPROC) += cryptocop.o
6obj-$(CONFIG_ETRAX_AXISFLASHMAP) += axisflashmap.o
7obj-$(CONFIG_ETRAX_NANDFLASH) += nandflash.o
8obj-$(CONFIG_ETRAX_GPIO) += gpio.o
9obj-$(CONFIG_ETRAX_IOP_FW_LOAD) += iop_fw_load.o
10obj-$(CONFIG_ETRAX_PCF8563) += pcf8563.o
11obj-$(CONFIG_ETRAX_I2C) += i2c.o
12obj-$(CONFIG_ETRAX_SYNCHRONOUS_SERIAL) += sync_serial.o
13obj-$(CONFIG_PCI) += pci/
diff --git a/arch/cris/arch-v32/drivers/axisflashmap.c b/arch/cris/arch-v32/drivers/axisflashmap.c
new file mode 100644
index 000000000000..78ed52b1cdac
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/axisflashmap.c
@@ -0,0 +1,455 @@
1/*
2 * Physical mapping layer for MTD using the Axis partitiontable format
3 *
4 * Copyright (c) 2001, 2002, 2003 Axis Communications AB
5 *
6 * This file is under the GPL.
7 *
8 * First partition is always sector 0 regardless of if we find a partitiontable
9 * or not. In the start of the next sector, there can be a partitiontable that
10 * tells us what other partitions to define. If there isn't, we use a default
11 * partition split defined below.
12 *
13 * Copy of os/lx25/arch/cris/arch-v10/drivers/axisflashmap.c 1.5
14 * with minor changes.
15 *
16 */
17
18#include <linux/module.h>
19#include <linux/types.h>
20#include <linux/kernel.h>
21#include <linux/config.h>
22#include <linux/init.h>
23
24#include <linux/mtd/concat.h>
25#include <linux/mtd/map.h>
26#include <linux/mtd/mtd.h>
27#include <linux/mtd/mtdram.h>
28#include <linux/mtd/partitions.h>
29
30#include <asm/arch/hwregs/config_defs.h>
31#include <asm/axisflashmap.h>
32#include <asm/mmu.h>
33
34#define MEM_CSE0_SIZE (0x04000000)
35#define MEM_CSE1_SIZE (0x04000000)
36
37#define FLASH_UNCACHED_ADDR KSEG_E
38#define FLASH_CACHED_ADDR KSEG_F
39
40#if CONFIG_ETRAX_FLASH_BUSWIDTH==1
41#define flash_data __u8
42#elif CONFIG_ETRAX_FLASH_BUSWIDTH==2
43#define flash_data __u16
44#elif CONFIG_ETRAX_FLASH_BUSWIDTH==4
45#define flash_data __u16
46#endif
47
48/* From head.S */
49extern unsigned long romfs_start, romfs_length, romfs_in_flash;
50
51/* The master mtd for the entire flash. */
52struct mtd_info* axisflash_mtd = NULL;
53
54/* Map driver functions. */
55
56static map_word flash_read(struct map_info *map, unsigned long ofs)
57{
58 map_word tmp;
59 tmp.x[0] = *(flash_data *)(map->map_priv_1 + ofs);
60 return tmp;
61}
62
63static void flash_copy_from(struct map_info *map, void *to,
64 unsigned long from, ssize_t len)
65{
66 memcpy(to, (void *)(map->map_priv_1 + from), len);
67}
68
69static void flash_write(struct map_info *map, map_word d, unsigned long adr)
70{
71 *(flash_data *)(map->map_priv_1 + adr) = (flash_data)d.x[0];
72}
73
74/*
75 * The map for chip select e0.
76 *
77 * We run into tricky coherence situations if we mix cached with uncached
78 * accesses to we only use the uncached version here.
79 *
80 * The size field is the total size where the flash chips may be mapped on the
81 * chip select. MTD probes should find all devices there and it does not matter
82 * if there are unmapped gaps or aliases (mirrors of flash devices). The MTD
83 * probes will ignore them.
84 *
85 * The start address in map_priv_1 is in virtual memory so we cannot use
86 * MEM_CSE0_START but must rely on that FLASH_UNCACHED_ADDR is the start
87 * address of cse0.
88 */
89static struct map_info map_cse0 = {
90 .name = "cse0",
91 .size = MEM_CSE0_SIZE,
92 .bankwidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
93 .read = flash_read,
94 .copy_from = flash_copy_from,
95 .write = flash_write,
96 .map_priv_1 = FLASH_UNCACHED_ADDR
97};
98
99/*
100 * The map for chip select e1.
101 *
102 * If there was a gap between cse0 and cse1, map_priv_1 would get the wrong
103 * address, but there isn't.
104 */
105static struct map_info map_cse1 = {
106 .name = "cse1",
107 .size = MEM_CSE1_SIZE,
108 .bankwidth = CONFIG_ETRAX_FLASH_BUSWIDTH,
109 .read = flash_read,
110 .copy_from = flash_copy_from,
111 .write = flash_write,
112 .map_priv_1 = FLASH_UNCACHED_ADDR + MEM_CSE0_SIZE
113};
114
115/* If no partition-table was found, we use this default-set. */
116#define MAX_PARTITIONS 7
117#define NUM_DEFAULT_PARTITIONS 3
118
119/*
120 * Default flash size is 2MB. CONFIG_ETRAX_PTABLE_SECTOR is most likely the
121 * size of one flash block and "filesystem"-partition needs 5 blocks to be able
122 * to use JFFS.
123 */
124static struct mtd_partition axis_default_partitions[NUM_DEFAULT_PARTITIONS] = {
125 {
126 .name = "boot firmware",
127 .size = CONFIG_ETRAX_PTABLE_SECTOR,
128 .offset = 0
129 },
130 {
131 .name = "kernel",
132 .size = 0x200000 - (6 * CONFIG_ETRAX_PTABLE_SECTOR),
133 .offset = CONFIG_ETRAX_PTABLE_SECTOR
134 },
135 {
136 .name = "filesystem",
137 .size = 5 * CONFIG_ETRAX_PTABLE_SECTOR,
138 .offset = 0x200000 - (5 * CONFIG_ETRAX_PTABLE_SECTOR)
139 }
140};
141
142/* Initialize the ones normally used. */
143static struct mtd_partition axis_partitions[MAX_PARTITIONS] = {
144 {
145 .name = "part0",
146 .size = CONFIG_ETRAX_PTABLE_SECTOR,
147 .offset = 0
148 },
149 {
150 .name = "part1",
151 .size = 0,
152 .offset = 0
153 },
154 {
155 .name = "part2",
156 .size = 0,
157 .offset = 0
158 },
159 {
160 .name = "part3",
161 .size = 0,
162 .offset = 0
163 },
164 {
165 .name = "part4",
166 .size = 0,
167 .offset = 0
168 },
169 {
170 .name = "part5",
171 .size = 0,
172 .offset = 0
173 },
174 {
175 .name = "part6",
176 .size = 0,
177 .offset = 0
178 },
179};
180
181/*
182 * Probe a chip select for AMD-compatible (JEDEC) or CFI-compatible flash
183 * chips in that order (because the amd_flash-driver is faster).
184 */
185static struct mtd_info *probe_cs(struct map_info *map_cs)
186{
187 struct mtd_info *mtd_cs = NULL;
188
189 printk(KERN_INFO
190 "%s: Probing a 0x%08lx bytes large window at 0x%08lx.\n",
191 map_cs->name, map_cs->size, map_cs->map_priv_1);
192
193#ifdef CONFIG_MTD_AMDSTD
194 mtd_cs = do_map_probe("amd_flash", map_cs);
195#endif
196#ifdef CONFIG_MTD_CFI
197 if (!mtd_cs) {
198 mtd_cs = do_map_probe("cfi_probe", map_cs);
199 }
200#endif
201
202 return mtd_cs;
203}
204
205/*
206 * Probe each chip select individually for flash chips. If there are chips on
207 * both cse0 and cse1, the mtd_info structs will be concatenated to one struct
208 * so that MTD partitions can cross chip boundries.
209 *
210 * The only known restriction to how you can mount your chips is that each
211 * chip select must hold similar flash chips. But you need external hardware
212 * to do that anyway and you can put totally different chips on cse0 and cse1
213 * so it isn't really much of a restriction.
214 */
215extern struct mtd_info* __init crisv32_nand_flash_probe (void);
216static struct mtd_info *flash_probe(void)
217{
218 struct mtd_info *mtd_cse0;
219 struct mtd_info *mtd_cse1;
220 struct mtd_info *mtd_nand = NULL;
221 struct mtd_info *mtd_total;
222 struct mtd_info *mtds[3];
223 int count = 0;
224
225 if ((mtd_cse0 = probe_cs(&map_cse0)) != NULL)
226 mtds[count++] = mtd_cse0;
227 if ((mtd_cse1 = probe_cs(&map_cse1)) != NULL)
228 mtds[count++] = mtd_cse1;
229
230#ifdef CONFIG_ETRAX_NANDFLASH
231 if ((mtd_nand = crisv32_nand_flash_probe()) != NULL)
232 mtds[count++] = mtd_nand;
233#endif
234
235 if (!mtd_cse0 && !mtd_cse1 && !mtd_nand) {
236 /* No chip found. */
237 return NULL;
238 }
239
240 if (count > 1) {
241#ifdef CONFIG_MTD_CONCAT
242 /* Since the concatenation layer adds a small overhead we
243 * could try to figure out if the chips in cse0 and cse1 are
244 * identical and reprobe the whole cse0+cse1 window. But since
245 * flash chips are slow, the overhead is relatively small.
246 * So we use the MTD concatenation layer instead of further
247 * complicating the probing procedure.
248 */
249 mtd_total = mtd_concat_create(mtds,
250 count,
251 "cse0+cse1+nand");
252#else
253 printk(KERN_ERR "%s and %s: Cannot concatenate due to kernel "
254 "(mis)configuration!\n", map_cse0.name, map_cse1.name);
255 mtd_toal = NULL;
256#endif
257 if (!mtd_total) {
258 printk(KERN_ERR "%s and %s: Concatenation failed!\n",
259 map_cse0.name, map_cse1.name);
260
261 /* The best we can do now is to only use what we found
262 * at cse0.
263 */
264 mtd_total = mtd_cse0;
265 map_destroy(mtd_cse1);
266 }
267 } else {
268 mtd_total = mtd_cse0? mtd_cse0 : mtd_cse1 ? mtd_cse1 : mtd_nand;
269
270 }
271
272 return mtd_total;
273}
274
275extern unsigned long crisv32_nand_boot;
276extern unsigned long crisv32_nand_cramfs_offset;
277
278/*
279 * Probe the flash chip(s) and, if it succeeds, read the partition-table
280 * and register the partitions with MTD.
281 */
282static int __init init_axis_flash(void)
283{
284 struct mtd_info *mymtd;
285 int err = 0;
286 int pidx = 0;
287 struct partitiontable_head *ptable_head = NULL;
288 struct partitiontable_entry *ptable;
289 int use_default_ptable = 1; /* Until proven otherwise. */
290 const char *pmsg = KERN_INFO " /dev/flash%d at 0x%08x, size 0x%08x\n";
291 static char page[512];
292 size_t len;
293
294#ifndef CONFIG_ETRAXFS_SIM
295 mymtd = flash_probe();
296 mymtd->read(mymtd, CONFIG_ETRAX_PTABLE_SECTOR, 512, &len, page);
297 ptable_head = (struct partitiontable_head *)(page + PARTITION_TABLE_OFFSET);
298
299 if (!mymtd) {
300 /* There's no reason to use this module if no flash chip can
301 * be identified. Make sure that's understood.
302 */
303 printk(KERN_INFO "axisflashmap: Found no flash chip.\n");
304 } else {
305 printk(KERN_INFO "%s: 0x%08x bytes of flash memory.\n",
306 mymtd->name, mymtd->size);
307 axisflash_mtd = mymtd;
308 }
309
310 if (mymtd) {
311 mymtd->owner = THIS_MODULE;
312 }
313 pidx++; /* First partition is always set to the default. */
314
315 if (ptable_head && (ptable_head->magic == PARTITION_TABLE_MAGIC)
316 && (ptable_head->size <
317 (MAX_PARTITIONS * sizeof(struct partitiontable_entry) +
318 PARTITIONTABLE_END_MARKER_SIZE))
319 && (*(unsigned long*)((void*)ptable_head + sizeof(*ptable_head) +
320 ptable_head->size -
321 PARTITIONTABLE_END_MARKER_SIZE)
322 == PARTITIONTABLE_END_MARKER)) {
323 /* Looks like a start, sane length and end of a
324 * partition table, lets check csum etc.
325 */
326 int ptable_ok = 0;
327 struct partitiontable_entry *max_addr =
328 (struct partitiontable_entry *)
329 ((unsigned long)ptable_head + sizeof(*ptable_head) +
330 ptable_head->size);
331 unsigned long offset = CONFIG_ETRAX_PTABLE_SECTOR;
332 unsigned char *p;
333 unsigned long csum = 0;
334
335 ptable = (struct partitiontable_entry *)
336 ((unsigned long)ptable_head + sizeof(*ptable_head));
337
338 /* Lets be PARANOID, and check the checksum. */
339 p = (unsigned char*) ptable;
340
341 while (p <= (unsigned char*)max_addr) {
342 csum += *p++;
343 csum += *p++;
344 csum += *p++;
345 csum += *p++;
346 }
347 ptable_ok = (csum == ptable_head->checksum);
348
349 /* Read the entries and use/show the info. */
350 printk(KERN_INFO " Found a%s partition table at 0x%p-0x%p.\n",
351 (ptable_ok ? " valid" : "n invalid"), ptable_head,
352 max_addr);
353
354 /* We have found a working bootblock. Now read the
355 * partition table. Scan the table. It ends when
356 * there is 0xffffffff, that is, empty flash.
357 */
358 while (ptable_ok
359 && ptable->offset != 0xffffffff
360 && ptable < max_addr
361 && pidx < MAX_PARTITIONS) {
362
363 axis_partitions[pidx].offset = offset + ptable->offset + (crisv32_nand_boot ? 16384 : 0);
364 axis_partitions[pidx].size = ptable->size;
365
366 printk(pmsg, pidx, axis_partitions[pidx].offset,
367 axis_partitions[pidx].size);
368 pidx++;
369 ptable++;
370 }
371 use_default_ptable = !ptable_ok;
372 }
373
374 if (romfs_in_flash) {
375 /* Add an overlapping device for the root partition (romfs). */
376
377 axis_partitions[pidx].name = "romfs";
378 if (crisv32_nand_boot) {
379 char* data = kmalloc(1024, GFP_KERNEL);
380 int len;
381 int offset = crisv32_nand_cramfs_offset & ~(1024-1);
382 char* tmp;
383
384 mymtd->read(mymtd, offset, 1024, &len, data);
385 tmp = &data[crisv32_nand_cramfs_offset % 512];
386 axis_partitions[pidx].size = *(unsigned*)(tmp + 4);
387 axis_partitions[pidx].offset = crisv32_nand_cramfs_offset;
388 kfree(data);
389 } else {
390 axis_partitions[pidx].size = romfs_length;
391 axis_partitions[pidx].offset = romfs_start - FLASH_CACHED_ADDR;
392 }
393
394 axis_partitions[pidx].mask_flags |= MTD_WRITEABLE;
395
396 printk(KERN_INFO
397 " Adding readonly flash partition for romfs image:\n");
398 printk(pmsg, pidx, axis_partitions[pidx].offset,
399 axis_partitions[pidx].size);
400 pidx++;
401 }
402
403 if (mymtd) {
404 if (use_default_ptable) {
405 printk(KERN_INFO " Using default partition table.\n");
406 err = add_mtd_partitions(mymtd, axis_default_partitions,
407 NUM_DEFAULT_PARTITIONS);
408 } else {
409 err = add_mtd_partitions(mymtd, axis_partitions, pidx);
410 }
411
412 if (err) {
413 panic("axisflashmap could not add MTD partitions!\n");
414 }
415 }
416/* CONFIG_EXTRAXFS_SIM */
417#endif
418
419 if (!romfs_in_flash) {
420 /* Create an RAM device for the root partition (romfs). */
421
422#if !defined(CONFIG_MTD_MTDRAM) || (CONFIG_MTDRAM_TOTAL_SIZE != 0) || (CONFIG_MTDRAM_ABS_POS != 0)
423 /* No use trying to boot this kernel from RAM. Panic! */
424 printk(KERN_EMERG "axisflashmap: Cannot create an MTD RAM "
425 "device due to kernel (mis)configuration!\n");
426 panic("This kernel cannot boot from RAM!\n");
427#else
428 struct mtd_info *mtd_ram;
429
430 mtd_ram = (struct mtd_info *)kmalloc(sizeof(struct mtd_info),
431 GFP_KERNEL);
432 if (!mtd_ram) {
433 panic("axisflashmap couldn't allocate memory for "
434 "mtd_info!\n");
435 }
436
437 printk(KERN_INFO " Adding RAM partition for romfs image:\n");
438 printk(pmsg, pidx, romfs_start, romfs_length);
439
440 err = mtdram_init_device(mtd_ram, (void*)romfs_start,
441 romfs_length, "romfs");
442 if (err) {
443 panic("axisflashmap could not initialize MTD RAM "
444 "device!\n");
445 }
446#endif
447 }
448
449 return err;
450}
451
452/* This adds the above to the kernels init-call chain. */
453module_init(init_axis_flash);
454
455EXPORT_SYMBOL(axisflash_mtd);
diff --git a/arch/cris/arch-v32/drivers/cryptocop.c b/arch/cris/arch-v32/drivers/cryptocop.c
new file mode 100644
index 000000000000..ca72076c630a
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/cryptocop.c
@@ -0,0 +1,3522 @@
1/* $Id: cryptocop.c,v 1.13 2005/04/21 17:27:55 henriken Exp $
2 *
3 * Stream co-processor driver for the ETRAX FS
4 *
5 * Copyright (C) 2003-2005 Axis Communications AB
6 */
7
8#include <linux/init.h>
9#include <linux/sched.h>
10#include <linux/module.h>
11#include <linux/slab.h>
12#include <linux/string.h>
13#include <linux/fs.h>
14#include <linux/mm.h>
15#include <linux/spinlock.h>
16#include <linux/stddef.h>
17
18#include <asm/uaccess.h>
19#include <asm/io.h>
20#include <asm/atomic.h>
21
22#include <linux/list.h>
23#include <linux/interrupt.h>
24
25#include <asm/signal.h>
26#include <asm/irq.h>
27
28#include <asm/arch/dma.h>
29#include <asm/arch/hwregs/dma.h>
30#include <asm/arch/hwregs/reg_map.h>
31#include <asm/arch/hwregs/reg_rdwr.h>
32#include <asm/arch/hwregs/intr_vect_defs.h>
33
34#include <asm/arch/hwregs/strcop.h>
35#include <asm/arch/hwregs/strcop_defs.h>
36#include <asm/arch/cryptocop.h>
37
38
39
40#define DESCR_ALLOC_PAD (31)
41
42struct cryptocop_dma_desc {
43 char *free_buf; /* If non-null will be kfreed in free_cdesc() */
44 dma_descr_data *dma_descr;
45
46 unsigned char dma_descr_buf[sizeof(dma_descr_data) + DESCR_ALLOC_PAD];
47
48 unsigned int from_pool:1; /* If 1 'allocated' from the descriptor pool. */
49 struct cryptocop_dma_desc *next;
50};
51
52
53struct cryptocop_int_operation{
54 void *alloc_ptr;
55 cryptocop_session_id sid;
56
57 dma_descr_context ctx_out;
58 dma_descr_context ctx_in;
59
60 /* DMA descriptors allocated by driver. */
61 struct cryptocop_dma_desc *cdesc_out;
62 struct cryptocop_dma_desc *cdesc_in;
63
64 /* Strcop config to use. */
65 cryptocop_3des_mode tdes_mode;
66 cryptocop_csum_type csum_mode;
67
68 /* DMA descrs provided by consumer. */
69 dma_descr_data *ddesc_out;
70 dma_descr_data *ddesc_in;
71};
72
73
74struct cryptocop_tfrm_ctx {
75 cryptocop_tfrm_id tid;
76 unsigned int blocklength;
77
78 unsigned int start_ix;
79
80 struct cryptocop_tfrm_cfg *tcfg;
81 struct cryptocop_transform_ctx *tctx;
82
83 unsigned char previous_src;
84 unsigned char current_src;
85
86 /* Values to use in metadata out. */
87 unsigned char hash_conf;
88 unsigned char hash_mode;
89 unsigned char ciph_conf;
90 unsigned char cbcmode;
91 unsigned char decrypt;
92
93 unsigned int requires_padding:1;
94 unsigned int strict_block_length:1;
95 unsigned int active:1;
96 unsigned int done:1;
97 size_t consumed;
98 size_t produced;
99
100 /* Pad (input) descriptors to put in the DMA out list when the transform
101 * output is put on the DMA in list. */
102 struct cryptocop_dma_desc *pad_descs;
103
104 struct cryptocop_tfrm_ctx *prev_src;
105 struct cryptocop_tfrm_ctx *curr_src;
106
107 /* Mapping to HW. */
108 unsigned char unit_no;
109};
110
111
112struct cryptocop_private{
113 cryptocop_session_id sid;
114 struct cryptocop_private *next;
115};
116
117/* Session list. */
118
119struct cryptocop_transform_ctx{
120 struct cryptocop_transform_init init;
121 unsigned char dec_key[CRYPTOCOP_MAX_KEY_LENGTH];
122 unsigned int dec_key_set:1;
123
124 struct cryptocop_transform_ctx *next;
125};
126
127
128struct cryptocop_session{
129 cryptocop_session_id sid;
130
131 struct cryptocop_transform_ctx *tfrm_ctx;
132
133 struct cryptocop_session *next;
134};
135
136/* Priority levels for jobs sent to the cryptocop. Checksum operations from
137 kernel have highest priority since TCPIP stack processing must not
138 be a bottleneck. */
139typedef enum {
140 cryptocop_prio_kernel_csum = 0,
141 cryptocop_prio_kernel = 1,
142 cryptocop_prio_user = 2,
143 cryptocop_prio_no_prios = 3
144} cryptocop_queue_priority;
145
146struct cryptocop_prio_queue{
147 struct list_head jobs;
148 cryptocop_queue_priority prio;
149};
150
151struct cryptocop_prio_job{
152 struct list_head node;
153 cryptocop_queue_priority prio;
154
155 struct cryptocop_operation *oper;
156 struct cryptocop_int_operation *iop;
157};
158
159struct ioctl_job_cb_ctx {
160 unsigned int processed:1;
161};
162
163
164static struct cryptocop_session *cryptocop_sessions = NULL;
165spinlock_t cryptocop_sessions_lock;
166
167/* Next Session ID to assign. */
168static cryptocop_session_id next_sid = 1;
169
170/* Pad for checksum. */
171static const char csum_zero_pad[1] = {0x00};
172
173/* Trash buffer for mem2mem operations. */
174#define MEM2MEM_DISCARD_BUF_LENGTH (512)
175static unsigned char mem2mem_discard_buf[MEM2MEM_DISCARD_BUF_LENGTH];
176
177/* Descriptor pool. */
178/* FIXME Tweak this value. */
179#define CRYPTOCOP_DESCRIPTOR_POOL_SIZE (100)
180static struct cryptocop_dma_desc descr_pool[CRYPTOCOP_DESCRIPTOR_POOL_SIZE];
181static struct cryptocop_dma_desc *descr_pool_free_list;
182static int descr_pool_no_free;
183static spinlock_t descr_pool_lock;
184
185/* Lock to stop cryptocop to start processing of a new operation. The holder
186 of this lock MUST call cryptocop_start_job() after it is unlocked. */
187spinlock_t cryptocop_process_lock;
188
189static struct cryptocop_prio_queue cryptocop_job_queues[cryptocop_prio_no_prios];
190static spinlock_t cryptocop_job_queue_lock;
191static struct cryptocop_prio_job *cryptocop_running_job = NULL;
192static spinlock_t running_job_lock;
193
194/* The interrupt handler appends completed jobs to this list. The scehduled
195 * tasklet removes them upon sending the response to the crypto consumer. */
196static struct list_head cryptocop_completed_jobs;
197static spinlock_t cryptocop_completed_jobs_lock;
198
199DECLARE_WAIT_QUEUE_HEAD(cryptocop_ioc_process_wq);
200
201
202/** Local functions. **/
203
204static int cryptocop_open(struct inode *, struct file *);
205
206static int cryptocop_release(struct inode *, struct file *);
207
208static int cryptocop_ioctl(struct inode *inode, struct file *file,
209 unsigned int cmd, unsigned long arg);
210
211static void cryptocop_start_job(void);
212
213static int cryptocop_job_queue_insert(cryptocop_queue_priority prio, struct cryptocop_operation *operation);
214static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_operation *operation);
215
216static int cryptocop_job_queue_init(void);
217static void cryptocop_job_queue_close(void);
218
219static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length);
220
221static int create_sha1_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length);
222
223static int transform_ok(struct cryptocop_transform_init *tinit);
224
225static struct cryptocop_session *get_session(cryptocop_session_id sid);
226
227static struct cryptocop_transform_ctx *get_transform_ctx(struct cryptocop_session *sess, cryptocop_tfrm_id tid);
228
229static void delete_internal_operation(struct cryptocop_int_operation *iop);
230
231static void get_aes_decrypt_key(unsigned char *dec_key, const unsigned char *key, unsigned int keylength);
232
233static int init_stream_coprocessor(void);
234
235static void __exit exit_stream_coprocessor(void);
236
237/*#define LDEBUG*/
238#ifdef LDEBUG
239#define DEBUG(s) s
240#define DEBUG_API(s) s
241static void print_cryptocop_operation(struct cryptocop_operation *cop);
242static void print_dma_descriptors(struct cryptocop_int_operation *iop);
243static void print_strcop_crypto_op(struct strcop_crypto_op *cop);
244static void print_lock_status(void);
245static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op);
246#define assert(s) do{if (!(s)) panic(#s);} while(0);
247#else
248#define DEBUG(s)
249#define DEBUG_API(s)
250#define assert(s)
251#endif
252
253
254/* Transform constants. */
255#define DES_BLOCK_LENGTH (8)
256#define AES_BLOCK_LENGTH (16)
257#define MD5_BLOCK_LENGTH (64)
258#define SHA1_BLOCK_LENGTH (64)
259#define CSUM_BLOCK_LENGTH (2)
260#define MD5_STATE_LENGTH (16)
261#define SHA1_STATE_LENGTH (20)
262
263/* The device number. */
264#define CRYPTOCOP_MAJOR (254)
265#define CRYPTOCOP_MINOR (0)
266
267
268
269struct file_operations cryptocop_fops = {
270 owner: THIS_MODULE,
271 open: cryptocop_open,
272 release: cryptocop_release,
273 ioctl: cryptocop_ioctl
274};
275
276
277static void free_cdesc(struct cryptocop_dma_desc *cdesc)
278{
279 DEBUG(printk("free_cdesc: cdesc 0x%p, from_pool=%d\n", cdesc, cdesc->from_pool));
280 if (cdesc->free_buf) kfree(cdesc->free_buf);
281
282 if (cdesc->from_pool) {
283 unsigned long int flags;
284 spin_lock_irqsave(&descr_pool_lock, flags);
285 cdesc->next = descr_pool_free_list;
286 descr_pool_free_list = cdesc;
287 ++descr_pool_no_free;
288 spin_unlock_irqrestore(&descr_pool_lock, flags);
289 } else {
290 kfree(cdesc);
291 }
292}
293
294
295static struct cryptocop_dma_desc *alloc_cdesc(int alloc_flag)
296{
297 int use_pool = (alloc_flag & GFP_ATOMIC) ? 1 : 0;
298 struct cryptocop_dma_desc *cdesc;
299
300 if (use_pool) {
301 unsigned long int flags;
302 spin_lock_irqsave(&descr_pool_lock, flags);
303 if (!descr_pool_free_list) {
304 spin_unlock_irqrestore(&descr_pool_lock, flags);
305 DEBUG_API(printk("alloc_cdesc: pool is empty\n"));
306 return NULL;
307 }
308 cdesc = descr_pool_free_list;
309 descr_pool_free_list = descr_pool_free_list->next;
310 --descr_pool_no_free;
311 spin_unlock_irqrestore(&descr_pool_lock, flags);
312 cdesc->from_pool = 1;
313 } else {
314 cdesc = kmalloc(sizeof(struct cryptocop_dma_desc), alloc_flag);
315 if (!cdesc) {
316 DEBUG_API(printk("alloc_cdesc: kmalloc\n"));
317 return NULL;
318 }
319 cdesc->from_pool = 0;
320 }
321 cdesc->dma_descr = (dma_descr_data*)(((unsigned long int)cdesc + offsetof(struct cryptocop_dma_desc, dma_descr_buf) + DESCR_ALLOC_PAD) & ~0x0000001F);
322
323 cdesc->next = NULL;
324
325 cdesc->free_buf = NULL;
326 cdesc->dma_descr->out_eop = 0;
327 cdesc->dma_descr->in_eop = 0;
328 cdesc->dma_descr->intr = 0;
329 cdesc->dma_descr->eol = 0;
330 cdesc->dma_descr->wait = 0;
331 cdesc->dma_descr->buf = NULL;
332 cdesc->dma_descr->after = NULL;
333
334 DEBUG_API(printk("alloc_cdesc: return 0x%p, cdesc->dma_descr=0x%p, from_pool=%d\n", cdesc, cdesc->dma_descr, cdesc->from_pool));
335 return cdesc;
336}
337
338
339static void setup_descr_chain(struct cryptocop_dma_desc *cd)
340{
341 DEBUG(printk("setup_descr_chain: entering\n"));
342 while (cd) {
343 if (cd->next) {
344 cd->dma_descr->next = (dma_descr_data*)virt_to_phys(cd->next->dma_descr);
345 } else {
346 cd->dma_descr->next = NULL;
347 }
348 cd = cd->next;
349 }
350 DEBUG(printk("setup_descr_chain: exit\n"));
351}
352
353
354/* Create a pad descriptor for the transform.
355 * Return -1 for error, 0 if pad created. */
356static int create_pad_descriptor(struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **pad_desc, int alloc_flag)
357{
358 struct cryptocop_dma_desc *cdesc = NULL;
359 int error = 0;
360 struct strcop_meta_out mo = {
361 .ciphsel = src_none,
362 .hashsel = src_none,
363 .csumsel = src_none
364 };
365 char *pad;
366 size_t plen;
367
368 DEBUG(printk("create_pad_descriptor: start.\n"));
369 /* Setup pad descriptor. */
370
371 DEBUG(printk("create_pad_descriptor: setting up padding.\n"));
372 cdesc = alloc_cdesc(alloc_flag);
373 if (!cdesc){
374 DEBUG_API(printk("create_pad_descriptor: alloc pad desc\n"));
375 goto error_cleanup;
376 }
377 switch (tc->unit_no) {
378 case src_md5:
379 error = create_md5_pad(alloc_flag, tc->consumed, &pad, &plen);
380 if (error){
381 DEBUG_API(printk("create_pad_descriptor: create_md5_pad_failed\n"));
382 goto error_cleanup;
383 }
384 cdesc->free_buf = pad;
385 mo.hashsel = src_dma;
386 mo.hashconf = tc->hash_conf;
387 mo.hashmode = tc->hash_mode;
388 break;
389 case src_sha1:
390 error = create_sha1_pad(alloc_flag, tc->consumed, &pad, &plen);
391 if (error){
392 DEBUG_API(printk("create_pad_descriptor: create_sha1_pad_failed\n"));
393 goto error_cleanup;
394 }
395 cdesc->free_buf = pad;
396 mo.hashsel = src_dma;
397 mo.hashconf = tc->hash_conf;
398 mo.hashmode = tc->hash_mode;
399 break;
400 case src_csum:
401 if (tc->consumed % tc->blocklength){
402 pad = (char*)csum_zero_pad;
403 plen = 1;
404 } else {
405 pad = (char*)cdesc; /* Use any pointer. */
406 plen = 0;
407 }
408 mo.csumsel = src_dma;
409 break;
410 }
411 cdesc->dma_descr->wait = 1;
412 cdesc->dma_descr->out_eop = 1; /* Since this is a pad output is pushed. EOP is ok here since the padded unit is the only one active. */
413 cdesc->dma_descr->buf = (char*)virt_to_phys((char*)pad);
414 cdesc->dma_descr->after = cdesc->dma_descr->buf + plen;
415
416 cdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, mo);
417 *pad_desc = cdesc;
418
419 return 0;
420
421 error_cleanup:
422 if (cdesc) free_cdesc(cdesc);
423 return -1;
424}
425
426
427static int setup_key_dl_desc(struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **kd, int alloc_flag)
428{
429 struct cryptocop_dma_desc *key_desc = alloc_cdesc(alloc_flag);
430 struct strcop_meta_out mo = {0};
431
432 DEBUG(printk("setup_key_dl_desc\n"));
433
434 if (!key_desc) {
435 DEBUG_API(printk("setup_key_dl_desc: failed descriptor allocation.\n"));
436 return -ENOMEM;
437 }
438
439 /* Download key. */
440 if ((tc->tctx->init.alg == cryptocop_alg_aes) && (tc->tcfg->flags & CRYPTOCOP_DECRYPT)) {
441 /* Precook the AES decrypt key. */
442 if (!tc->tctx->dec_key_set){
443 get_aes_decrypt_key(tc->tctx->dec_key, tc->tctx->init.key, tc->tctx->init.keylen);
444 tc->tctx->dec_key_set = 1;
445 }
446 key_desc->dma_descr->buf = (char*)virt_to_phys(tc->tctx->dec_key);
447 key_desc->dma_descr->after = key_desc->dma_descr->buf + tc->tctx->init.keylen/8;
448 } else {
449 key_desc->dma_descr->buf = (char*)virt_to_phys(tc->tctx->init.key);
450 key_desc->dma_descr->after = key_desc->dma_descr->buf + tc->tctx->init.keylen/8;
451 }
452 /* Setup metadata. */
453 mo.dlkey = 1;
454 switch (tc->tctx->init.keylen) {
455 case 64:
456 mo.decrypt = 0;
457 mo.hashmode = 0;
458 break;
459 case 128:
460 mo.decrypt = 0;
461 mo.hashmode = 1;
462 break;
463 case 192:
464 mo.decrypt = 1;
465 mo.hashmode = 0;
466 break;
467 case 256:
468 mo.decrypt = 1;
469 mo.hashmode = 1;
470 break;
471 default:
472 break;
473 }
474 mo.ciphsel = mo.hashsel = mo.csumsel = src_none;
475 key_desc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, mo);
476
477 key_desc->dma_descr->out_eop = 1;
478 key_desc->dma_descr->wait = 1;
479 key_desc->dma_descr->intr = 0;
480
481 *kd = key_desc;
482 return 0;
483}
484
485static int setup_cipher_iv_desc(struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **id, int alloc_flag)
486{
487 struct cryptocop_dma_desc *iv_desc = alloc_cdesc(alloc_flag);
488 struct strcop_meta_out mo = {0};
489
490 DEBUG(printk("setup_cipher_iv_desc\n"));
491
492 if (!iv_desc) {
493 DEBUG_API(printk("setup_cipher_iv_desc: failed CBC IV descriptor allocation.\n"));
494 return -ENOMEM;
495 }
496 /* Download IV. */
497 iv_desc->dma_descr->buf = (char*)virt_to_phys(tc->tcfg->iv);
498 iv_desc->dma_descr->after = iv_desc->dma_descr->buf + tc->blocklength;
499
500 /* Setup metadata. */
501 mo.hashsel = mo.csumsel = src_none;
502 mo.ciphsel = src_dma;
503 mo.ciphconf = tc->ciph_conf;
504 mo.cbcmode = tc->cbcmode;
505
506 iv_desc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, mo);
507
508 iv_desc->dma_descr->out_eop = 0;
509 iv_desc->dma_descr->wait = 1;
510 iv_desc->dma_descr->intr = 0;
511
512 *id = iv_desc;
513 return 0;
514}
515
516/* Map the ouput length of the transform to operation output starting on the inject index. */
517static int create_input_descriptors(struct cryptocop_operation *operation, struct cryptocop_tfrm_ctx *tc, struct cryptocop_dma_desc **id, int alloc_flag)
518{
519 int err = 0;
520 struct cryptocop_dma_desc head = {0};
521 struct cryptocop_dma_desc *outdesc = &head;
522 size_t iov_offset = 0;
523 size_t out_ix = 0;
524 int outiov_ix = 0;
525 struct strcop_meta_in mi = {0};
526
527 size_t out_length = tc->produced;
528 int rem_length;
529 int dlength;
530
531 assert(out_length != 0);
532 if (((tc->produced + tc->tcfg->inject_ix) > operation->tfrm_op.outlen) || (tc->produced && (operation->tfrm_op.outlen == 0))) {
533 DEBUG_API(printk("create_input_descriptors: operation outdata too small\n"));
534 return -EINVAL;
535 }
536 /* Traverse the out iovec until the result inject index is reached. */
537 while ((outiov_ix < operation->tfrm_op.outcount) && ((out_ix + operation->tfrm_op.outdata[outiov_ix].iov_len) <= tc->tcfg->inject_ix)){
538 out_ix += operation->tfrm_op.outdata[outiov_ix].iov_len;
539 outiov_ix++;
540 }
541 if (outiov_ix >= operation->tfrm_op.outcount){
542 DEBUG_API(printk("create_input_descriptors: operation outdata too small\n"));
543 return -EINVAL;
544 }
545 iov_offset = tc->tcfg->inject_ix - out_ix;
546 mi.dmasel = tc->unit_no;
547
548 /* Setup the output descriptors. */
549 while ((out_length > 0) && (outiov_ix < operation->tfrm_op.outcount)) {
550 outdesc->next = alloc_cdesc(alloc_flag);
551 if (!outdesc->next) {
552 DEBUG_API(printk("create_input_descriptors: alloc_cdesc\n"));
553 err = -ENOMEM;
554 goto error_cleanup;
555 }
556 outdesc = outdesc->next;
557 rem_length = operation->tfrm_op.outdata[outiov_ix].iov_len - iov_offset;
558 dlength = (out_length < rem_length) ? out_length : rem_length;
559
560 DEBUG(printk("create_input_descriptors:\n"
561 "outiov_ix=%d, rem_length=%d, dlength=%d\n"
562 "iov_offset=%d, outdata[outiov_ix].iov_len=%d\n"
563 "outcount=%d, outiov_ix=%d\n",
564 outiov_ix, rem_length, dlength, iov_offset, operation->tfrm_op.outdata[outiov_ix].iov_len, operation->tfrm_op.outcount, outiov_ix));
565
566 outdesc->dma_descr->buf = (char*)virt_to_phys(operation->tfrm_op.outdata[outiov_ix].iov_base + iov_offset);
567 outdesc->dma_descr->after = outdesc->dma_descr->buf + dlength;
568 outdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
569
570 out_length -= dlength;
571 iov_offset += dlength;
572 if (iov_offset >= operation->tfrm_op.outdata[outiov_ix].iov_len) {
573 iov_offset = 0;
574 ++outiov_ix;
575 }
576 }
577 if (out_length > 0){
578 DEBUG_API(printk("create_input_descriptors: not enough room for output, %d remained\n", out_length));
579 err = -EINVAL;
580 goto error_cleanup;
581 }
582 /* Set sync in last descriptor. */
583 mi.sync = 1;
584 outdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
585
586 *id = head.next;
587 return 0;
588
589 error_cleanup:
590 while (head.next) {
591 outdesc = head.next->next;
592 free_cdesc(head.next);
593 head.next = outdesc;
594 }
595 return err;
596}
597
598
599static int create_output_descriptors(struct cryptocop_operation *operation, int *iniov_ix, int *iniov_offset, size_t desc_len, struct cryptocop_dma_desc **current_out_cdesc, struct strcop_meta_out *meta_out, int alloc_flag)
600{
601 while (desc_len != 0) {
602 struct cryptocop_dma_desc *cdesc;
603 int rem_length = operation->tfrm_op.indata[*iniov_ix].iov_len - *iniov_offset;
604 int dlength = (desc_len < rem_length) ? desc_len : rem_length;
605
606 cdesc = alloc_cdesc(alloc_flag);
607 if (!cdesc) {
608 DEBUG_API(printk("create_output_descriptors: alloc_cdesc\n"));
609 return -ENOMEM;
610 }
611 (*current_out_cdesc)->next = cdesc;
612 (*current_out_cdesc) = cdesc;
613
614 cdesc->free_buf = NULL;
615
616 cdesc->dma_descr->buf = (char*)virt_to_phys(operation->tfrm_op.indata[*iniov_ix].iov_base + *iniov_offset);
617 cdesc->dma_descr->after = cdesc->dma_descr->buf + dlength;
618
619 desc_len -= dlength;
620 *iniov_offset += dlength;
621 assert(desc_len >= 0);
622 if (*iniov_offset >= operation->tfrm_op.indata[*iniov_ix].iov_len) {
623 *iniov_offset = 0;
624 ++(*iniov_ix);
625 if (*iniov_ix > operation->tfrm_op.incount) {
626 DEBUG_API(printk("create_output_descriptors: not enough indata in operation."));
627 return -EINVAL;
628 }
629 }
630 cdesc->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, (*meta_out));
631 } /* while (desc_len != 0) */
632 /* Last DMA descriptor gets a 'wait' bit to signal expected change in metadata. */
633 (*current_out_cdesc)->dma_descr->wait = 1; /* This will set extraneous WAIT in some situations, e.g. when padding hashes and checksums. */
634
635 return 0;
636}
637
638
639static int append_input_descriptors(struct cryptocop_operation *operation, struct cryptocop_dma_desc **current_in_cdesc, struct cryptocop_dma_desc **current_out_cdesc, struct cryptocop_tfrm_ctx *tc, int alloc_flag)
640{
641 DEBUG(printk("append_input_descriptors, tc=0x%p, unit_no=%d\n", tc, tc->unit_no));
642 if (tc->tcfg) {
643 int failed = 0;
644 struct cryptocop_dma_desc *idescs = NULL;
645 DEBUG(printk("append_input_descriptors: pushing output, consumed %d produced %d bytes.\n", tc->consumed, tc->produced));
646 if (tc->pad_descs) {
647 DEBUG(printk("append_input_descriptors: append pad descriptors to DMA out list.\n"));
648 while (tc->pad_descs) {
649 DEBUG(printk("append descriptor 0x%p\n", tc->pad_descs));
650 (*current_out_cdesc)->next = tc->pad_descs;
651 tc->pad_descs = tc->pad_descs->next;
652 (*current_out_cdesc) = (*current_out_cdesc)->next;
653 }
654 }
655
656 /* Setup and append output descriptors to DMA in list. */
657 if (tc->unit_no == src_dma){
658 /* mem2mem. Setup DMA in descriptors to discard all input prior to the requested mem2mem data. */
659 struct strcop_meta_in mi = {.sync = 0, .dmasel = src_dma};
660 unsigned int start_ix = tc->start_ix;
661 while (start_ix){
662 unsigned int desclen = start_ix < MEM2MEM_DISCARD_BUF_LENGTH ? start_ix : MEM2MEM_DISCARD_BUF_LENGTH;
663 (*current_in_cdesc)->next = alloc_cdesc(alloc_flag);
664 if (!(*current_in_cdesc)->next){
665 DEBUG_API(printk("append_input_descriptors: alloc_cdesc mem2mem discard failed\n"));
666 return -ENOMEM;
667 }
668 (*current_in_cdesc) = (*current_in_cdesc)->next;
669 (*current_in_cdesc)->dma_descr->buf = (char*)virt_to_phys(mem2mem_discard_buf);
670 (*current_in_cdesc)->dma_descr->after = (*current_in_cdesc)->dma_descr->buf + desclen;
671 (*current_in_cdesc)->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
672 start_ix -= desclen;
673 }
674 mi.sync = 1;
675 (*current_in_cdesc)->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_in, mi);
676 }
677
678 failed = create_input_descriptors(operation, tc, &idescs, alloc_flag);
679 if (failed){
680 DEBUG_API(printk("append_input_descriptors: output descriptor setup failed\n"));
681 return failed;
682 }
683 DEBUG(printk("append_input_descriptors: append output descriptors to DMA in list.\n"));
684 while (idescs) {
685 DEBUG(printk("append descriptor 0x%p\n", idescs));
686 (*current_in_cdesc)->next = idescs;
687 idescs = idescs->next;
688 (*current_in_cdesc) = (*current_in_cdesc)->next;
689 }
690 }
691 return 0;
692}
693
694
695
696static int cryptocop_setup_dma_list(struct cryptocop_operation *operation, struct cryptocop_int_operation **int_op, int alloc_flag)
697{
698 struct cryptocop_session *sess;
699 struct cryptocop_transform_ctx *tctx;
700
701 struct cryptocop_tfrm_ctx digest_ctx = {
702 .previous_src = src_none,
703 .current_src = src_none,
704 .start_ix = 0,
705 .requires_padding = 1,
706 .strict_block_length = 0,
707 .hash_conf = 0,
708 .hash_mode = 0,
709 .ciph_conf = 0,
710 .cbcmode = 0,
711 .decrypt = 0,
712 .consumed = 0,
713 .produced = 0,
714 .pad_descs = NULL,
715 .active = 0,
716 .done = 0,
717 .prev_src = NULL,
718 .curr_src = NULL,
719 .tcfg = NULL};
720 struct cryptocop_tfrm_ctx cipher_ctx = {
721 .previous_src = src_none,
722 .current_src = src_none,
723 .start_ix = 0,
724 .requires_padding = 0,
725 .strict_block_length = 1,
726 .hash_conf = 0,
727 .hash_mode = 0,
728 .ciph_conf = 0,
729 .cbcmode = 0,
730 .decrypt = 0,
731 .consumed = 0,
732 .produced = 0,
733 .pad_descs = NULL,
734 .active = 0,
735 .done = 0,
736 .prev_src = NULL,
737 .curr_src = NULL,
738 .tcfg = NULL};
739 struct cryptocop_tfrm_ctx csum_ctx = {
740 .previous_src = src_none,
741 .current_src = src_none,
742 .start_ix = 0,
743 .blocklength = 2,
744 .requires_padding = 1,
745 .strict_block_length = 0,
746 .hash_conf = 0,
747 .hash_mode = 0,
748 .ciph_conf = 0,
749 .cbcmode = 0,
750 .decrypt = 0,
751 .consumed = 0,
752 .produced = 0,
753 .pad_descs = NULL,
754 .active = 0,
755 .done = 0,
756 .tcfg = NULL,
757 .prev_src = NULL,
758 .curr_src = NULL,
759 .unit_no = src_csum};
760 struct cryptocop_tfrm_cfg *tcfg = operation->tfrm_op.tfrm_cfg;
761
762 unsigned int indata_ix = 0;
763
764 /* iovec accounting. */
765 int iniov_ix = 0;
766 int iniov_offset = 0;
767
768 /* Operation descriptor cfg traversal pointer. */
769 struct cryptocop_desc *odsc;
770
771 int failed = 0;
772 /* List heads for allocated descriptors. */
773 struct cryptocop_dma_desc out_cdesc_head = {0};
774 struct cryptocop_dma_desc in_cdesc_head = {0};
775
776 struct cryptocop_dma_desc *current_out_cdesc = &out_cdesc_head;
777 struct cryptocop_dma_desc *current_in_cdesc = &in_cdesc_head;
778
779 struct cryptocop_tfrm_ctx *output_tc = NULL;
780 void *iop_alloc_ptr;
781
782 assert(operation != NULL);
783 assert(int_op != NULL);
784
785 DEBUG(printk("cryptocop_setup_dma_list: start\n"));
786 DEBUG(print_cryptocop_operation(operation));
787
788 sess = get_session(operation->sid);
789 if (!sess) {
790 DEBUG_API(printk("cryptocop_setup_dma_list: no session found for operation.\n"));
791 failed = -EINVAL;
792 goto error_cleanup;
793 }
794 iop_alloc_ptr = kmalloc(DESCR_ALLOC_PAD + sizeof(struct cryptocop_int_operation), alloc_flag);
795 if (!iop_alloc_ptr) {
796 DEBUG_API(printk("cryptocop_setup_dma_list: kmalloc cryptocop_int_operation\n"));
797 failed = -ENOMEM;
798 goto error_cleanup;
799 }
800 (*int_op) = (struct cryptocop_int_operation*)(((unsigned long int)(iop_alloc_ptr + DESCR_ALLOC_PAD + offsetof(struct cryptocop_int_operation, ctx_out)) & ~0x0000001F) - offsetof(struct cryptocop_int_operation, ctx_out));
801 DEBUG(memset((*int_op), 0xff, sizeof(struct cryptocop_int_operation)));
802 (*int_op)->alloc_ptr = iop_alloc_ptr;
803 DEBUG(printk("cryptocop_setup_dma_list: *int_op=0x%p, alloc_ptr=0x%p\n", *int_op, (*int_op)->alloc_ptr));
804
805 (*int_op)->sid = operation->sid;
806 (*int_op)->cdesc_out = NULL;
807 (*int_op)->cdesc_in = NULL;
808 (*int_op)->tdes_mode = cryptocop_3des_ede;
809 (*int_op)->csum_mode = cryptocop_csum_le;
810 (*int_op)->ddesc_out = NULL;
811 (*int_op)->ddesc_in = NULL;
812
813 /* Scan operation->tfrm_op.tfrm_cfg for bad configuration and set up the local contexts. */
814 if (!tcfg) {
815 DEBUG_API(printk("cryptocop_setup_dma_list: no configured transforms in operation.\n"));
816 failed = -EINVAL;
817 goto error_cleanup;
818 }
819 while (tcfg) {
820 tctx = get_transform_ctx(sess, tcfg->tid);
821 if (!tctx) {
822 DEBUG_API(printk("cryptocop_setup_dma_list: no transform id %d in session.\n", tcfg->tid));
823 failed = -EINVAL;
824 goto error_cleanup;
825 }
826 if (tcfg->inject_ix > operation->tfrm_op.outlen){
827 DEBUG_API(printk("cryptocop_setup_dma_list: transform id %d inject_ix (%d) > operation->tfrm_op.outlen(%d)", tcfg->tid, tcfg->inject_ix, operation->tfrm_op.outlen));
828 failed = -EINVAL;
829 goto error_cleanup;
830 }
831 switch (tctx->init.alg){
832 case cryptocop_alg_mem2mem:
833 if (cipher_ctx.tcfg != NULL){
834 DEBUG_API(printk("cryptocop_setup_dma_list: multiple ciphers in operation.\n"));
835 failed = -EINVAL;
836 goto error_cleanup;
837 }
838 /* mem2mem is handled as a NULL cipher. */
839 cipher_ctx.cbcmode = 0;
840 cipher_ctx.decrypt = 0;
841 cipher_ctx.blocklength = 1;
842 cipher_ctx.ciph_conf = 0;
843 cipher_ctx.unit_no = src_dma;
844 cipher_ctx.tcfg = tcfg;
845 cipher_ctx.tctx = tctx;
846 break;
847 case cryptocop_alg_des:
848 case cryptocop_alg_3des:
849 case cryptocop_alg_aes:
850 /* cipher */
851 if (cipher_ctx.tcfg != NULL){
852 DEBUG_API(printk("cryptocop_setup_dma_list: multiple ciphers in operation.\n"));
853 failed = -EINVAL;
854 goto error_cleanup;
855 }
856 cipher_ctx.tcfg = tcfg;
857 cipher_ctx.tctx = tctx;
858 if (cipher_ctx.tcfg->flags & CRYPTOCOP_DECRYPT){
859 cipher_ctx.decrypt = 1;
860 }
861 switch (tctx->init.cipher_mode) {
862 case cryptocop_cipher_mode_ecb:
863 cipher_ctx.cbcmode = 0;
864 break;
865 case cryptocop_cipher_mode_cbc:
866 cipher_ctx.cbcmode = 1;
867 break;
868 default:
869 DEBUG_API(printk("cryptocop_setup_dma_list: cipher_ctx, bad cipher mode==%d\n", tctx->init.cipher_mode));
870 failed = -EINVAL;
871 goto error_cleanup;
872 }
873 DEBUG(printk("cryptocop_setup_dma_list: cipher_ctx, set CBC mode==%d\n", cipher_ctx.cbcmode));
874 switch (tctx->init.alg){
875 case cryptocop_alg_des:
876 cipher_ctx.ciph_conf = 0;
877 cipher_ctx.unit_no = src_des;
878 cipher_ctx.blocklength = DES_BLOCK_LENGTH;
879 break;
880 case cryptocop_alg_3des:
881 cipher_ctx.ciph_conf = 1;
882 cipher_ctx.unit_no = src_des;
883 cipher_ctx.blocklength = DES_BLOCK_LENGTH;
884 break;
885 case cryptocop_alg_aes:
886 cipher_ctx.ciph_conf = 2;
887 cipher_ctx.unit_no = src_aes;
888 cipher_ctx.blocklength = AES_BLOCK_LENGTH;
889 break;
890 default:
891 panic("cryptocop_setup_dma_list: impossible algorithm %d\n", tctx->init.alg);
892 }
893 (*int_op)->tdes_mode = tctx->init.tdes_mode;
894 break;
895 case cryptocop_alg_md5:
896 case cryptocop_alg_sha1:
897 /* digest */
898 if (digest_ctx.tcfg != NULL){
899 DEBUG_API(printk("cryptocop_setup_dma_list: multiple digests in operation.\n"));
900 failed = -EINVAL;
901 goto error_cleanup;
902 }
903 digest_ctx.tcfg = tcfg;
904 digest_ctx.tctx = tctx;
905 digest_ctx.hash_mode = 0; /* Don't use explicit IV in this API. */
906 switch (tctx->init.alg){
907 case cryptocop_alg_md5:
908 digest_ctx.blocklength = MD5_BLOCK_LENGTH;
909 digest_ctx.unit_no = src_md5;
910 digest_ctx.hash_conf = 1; /* 1 => MD-5 */
911 break;
912 case cryptocop_alg_sha1:
913 digest_ctx.blocklength = SHA1_BLOCK_LENGTH;
914 digest_ctx.unit_no = src_sha1;
915 digest_ctx.hash_conf = 0; /* 0 => SHA-1 */
916 break;
917 default:
918 panic("cryptocop_setup_dma_list: impossible digest algorithm\n");
919 }
920 break;
921 case cryptocop_alg_csum:
922 /* digest */
923 if (csum_ctx.tcfg != NULL){
924 DEBUG_API(printk("cryptocop_setup_dma_list: multiple checksums in operation.\n"));
925 failed = -EINVAL;
926 goto error_cleanup;
927 }
928 (*int_op)->csum_mode = tctx->init.csum_mode;
929 csum_ctx.tcfg = tcfg;
930 csum_ctx.tctx = tctx;
931 break;
932 default:
933 /* no algorithm. */
934 DEBUG_API(printk("cryptocop_setup_dma_list: invalid algorithm %d specified in tfrm %d.\n", tctx->init.alg, tcfg->tid));
935 failed = -EINVAL;
936 goto error_cleanup;
937 }
938 tcfg = tcfg->next;
939 }
940 /* Download key if a cipher is used. */
941 if (cipher_ctx.tcfg && (cipher_ctx.tctx->init.alg != cryptocop_alg_mem2mem)){
942 struct cryptocop_dma_desc *key_desc = NULL;
943
944 failed = setup_key_dl_desc(&cipher_ctx, &key_desc, alloc_flag);
945 if (failed) {
946 DEBUG_API(printk("cryptocop_setup_dma_list: setup key dl\n"));
947 goto error_cleanup;
948 }
949 current_out_cdesc->next = key_desc;
950 current_out_cdesc = key_desc;
951 indata_ix += (unsigned int)(key_desc->dma_descr->after - key_desc->dma_descr->buf);
952
953 /* Download explicit IV if a cipher is used and CBC mode and explicit IV selected. */
954 if ((cipher_ctx.tctx->init.cipher_mode == cryptocop_cipher_mode_cbc) && (cipher_ctx.tcfg->flags & CRYPTOCOP_EXPLICIT_IV)) {
955 struct cryptocop_dma_desc *iv_desc = NULL;
956
957 DEBUG(printk("cryptocop_setup_dma_list: setup cipher CBC IV descriptor.\n"));
958
959 failed = setup_cipher_iv_desc(&cipher_ctx, &iv_desc, alloc_flag);
960 if (failed) {
961 DEBUG_API(printk("cryptocop_setup_dma_list: CBC IV descriptor.\n"));
962 goto error_cleanup;
963 }
964 current_out_cdesc->next = iv_desc;
965 current_out_cdesc = iv_desc;
966 indata_ix += (unsigned int)(iv_desc->dma_descr->after - iv_desc->dma_descr->buf);
967 }
968 }
969
970 /* Process descriptors. */
971 odsc = operation->tfrm_op.desc;
972 while (odsc) {
973 struct cryptocop_desc_cfg *dcfg = odsc->cfg;
974 struct strcop_meta_out meta_out = {0};
975 size_t desc_len = odsc->length;
976 int active_count, eop_needed_count;
977
978 output_tc = NULL;
979
980 DEBUG(printk("cryptocop_setup_dma_list: parsing an operation descriptor\n"));
981
982 while (dcfg) {
983 struct cryptocop_tfrm_ctx *tc = NULL;
984
985 DEBUG(printk("cryptocop_setup_dma_list: parsing an operation descriptor configuration.\n"));
986 /* Get the local context for the transform and mark it as the output unit if it produces output. */
987 if (digest_ctx.tcfg && (digest_ctx.tcfg->tid == dcfg->tid)){
988 tc = &digest_ctx;
989 } else if (cipher_ctx.tcfg && (cipher_ctx.tcfg->tid == dcfg->tid)){
990 tc = &cipher_ctx;
991 } else if (csum_ctx.tcfg && (csum_ctx.tcfg->tid == dcfg->tid)){
992 tc = &csum_ctx;
993 }
994 if (!tc) {
995 DEBUG_API(printk("cryptocop_setup_dma_list: invalid transform %d specified in descriptor.\n", dcfg->tid));
996 failed = -EINVAL;
997 goto error_cleanup;
998 }
999 if (tc->done) {
1000 DEBUG_API(printk("cryptocop_setup_dma_list: completed transform %d reused.\n", dcfg->tid));
1001 failed = -EINVAL;
1002 goto error_cleanup;
1003 }
1004 if (!tc->active) {
1005 tc->start_ix = indata_ix;
1006 tc->active = 1;
1007 }
1008
1009 tc->previous_src = tc->current_src;
1010 tc->prev_src = tc->curr_src;
1011 /* Map source unit id to DMA source config. */
1012 switch (dcfg->src){
1013 case cryptocop_source_dma:
1014 tc->current_src = src_dma;
1015 break;
1016 case cryptocop_source_des:
1017 tc->current_src = src_des;
1018 break;
1019 case cryptocop_source_3des:
1020 tc->current_src = src_des;
1021 break;
1022 case cryptocop_source_aes:
1023 tc->current_src = src_aes;
1024 break;
1025 case cryptocop_source_md5:
1026 case cryptocop_source_sha1:
1027 case cryptocop_source_csum:
1028 case cryptocop_source_none:
1029 default:
1030 /* We do not allow using accumulating style units (SHA-1, MD5, checksum) as sources to other units.
1031 */
1032 DEBUG_API(printk("cryptocop_setup_dma_list: bad unit source configured %d.\n", dcfg->src));
1033 failed = -EINVAL;
1034 goto error_cleanup;
1035 }
1036 if (tc->current_src != src_dma) {
1037 /* Find the unit we are sourcing from. */
1038 if (digest_ctx.unit_no == tc->current_src){
1039 tc->curr_src = &digest_ctx;
1040 } else if (cipher_ctx.unit_no == tc->current_src){
1041 tc->curr_src = &cipher_ctx;
1042 } else if (csum_ctx.unit_no == tc->current_src){
1043 tc->curr_src = &csum_ctx;
1044 }
1045 if ((tc->curr_src == tc) && (tc->unit_no != src_dma)){
1046 DEBUG_API(printk("cryptocop_setup_dma_list: unit %d configured to source from itself.\n", tc->unit_no));
1047 failed = -EINVAL;
1048 goto error_cleanup;
1049 }
1050 } else {
1051 tc->curr_src = NULL;
1052 }
1053
1054 /* Detect source switch. */
1055 DEBUG(printk("cryptocop_setup_dma_list: tc->active=%d tc->unit_no=%d tc->current_src=%d tc->previous_src=%d, tc->curr_src=0x%p, tc->prev_srv=0x%p\n", tc->active, tc->unit_no, tc->current_src, tc->previous_src, tc->curr_src, tc->prev_src));
1056 if (tc->active && (tc->current_src != tc->previous_src)) {
1057 /* Only allow source switch when both the old source unit and the new one have
1058 * no pending data to process (i.e. the consumed length must be a multiple of the
1059 * transform blocklength). */
1060 /* Note: if the src == NULL we are actually sourcing from DMA out. */
1061 if (((tc->prev_src != NULL) && (tc->prev_src->consumed % tc->prev_src->blocklength)) ||
1062 ((tc->curr_src != NULL) && (tc->curr_src->consumed % tc->curr_src->blocklength)))
1063 {
1064 DEBUG_API(printk("cryptocop_setup_dma_list: can only disconnect from or connect to a unit on a multiple of the blocklength, old: cons=%d, prod=%d, block=%d, new: cons=%d prod=%d, block=%d.\n", tc->prev_src ? tc->prev_src->consumed : INT_MIN, tc->prev_src ? tc->prev_src->produced : INT_MIN, tc->prev_src ? tc->prev_src->blocklength : INT_MIN, tc->curr_src ? tc->curr_src->consumed : INT_MIN, tc->curr_src ? tc->curr_src->produced : INT_MIN, tc->curr_src ? tc->curr_src->blocklength : INT_MIN));
1065 failed = -EINVAL;
1066 goto error_cleanup;
1067 }
1068 }
1069 /* Detect unit deactivation. */
1070 if (dcfg->last) {
1071 /* Length check of this is handled below. */
1072 tc->done = 1;
1073 }
1074 dcfg = dcfg->next;
1075 } /* while (dcfg) */
1076 DEBUG(printk("cryptocop_setup_dma_list: parsing operation descriptor configuration complete.\n"));
1077
1078 if (cipher_ctx.active && (cipher_ctx.curr_src != NULL) && !cipher_ctx.curr_src->active){
1079 DEBUG_API(printk("cryptocop_setup_dma_list: cipher source from inactive unit %d\n", cipher_ctx.curr_src->unit_no));
1080 failed = -EINVAL;
1081 goto error_cleanup;
1082 }
1083 if (digest_ctx.active && (digest_ctx.curr_src != NULL) && !digest_ctx.curr_src->active){
1084 DEBUG_API(printk("cryptocop_setup_dma_list: digest source from inactive unit %d\n", digest_ctx.curr_src->unit_no));
1085 failed = -EINVAL;
1086 goto error_cleanup;
1087 }
1088 if (csum_ctx.active && (csum_ctx.curr_src != NULL) && !csum_ctx.curr_src->active){
1089 DEBUG_API(printk("cryptocop_setup_dma_list: cipher source from inactive unit %d\n", csum_ctx.curr_src->unit_no));
1090 failed = -EINVAL;
1091 goto error_cleanup;
1092 }
1093
1094 /* Update consumed and produced lengths.
1095
1096 The consumed length accounting here is actually cheating. If a unit source from DMA (or any
1097 other unit that process data in blocks of one octet) it is correct, but if it source from a
1098 block processing unit, i.e. a cipher, it will be temporarily incorrect at some times. However
1099 since it is only allowed--by the HW--to change source to or from a block processing unit at times where that
1100 unit has processed an exact multiple of its block length the end result will be correct.
1101 Beware that if the source change restriction change this code will need to be (much) reworked.
1102 */
1103 DEBUG(printk("cryptocop_setup_dma_list: desc->length=%d, desc_len=%d.\n", odsc->length, desc_len));
1104
1105 if (csum_ctx.active) {
1106 csum_ctx.consumed += desc_len;
1107 if (csum_ctx.done) {
1108 csum_ctx.produced = 2;
1109 }
1110 DEBUG(printk("cryptocop_setup_dma_list: csum_ctx producing: consumed=%d, produced=%d, blocklength=%d.\n", csum_ctx.consumed, csum_ctx.produced, csum_ctx.blocklength));
1111 }
1112 if (digest_ctx.active) {
1113 digest_ctx.consumed += desc_len;
1114 if (digest_ctx.done) {
1115 if (digest_ctx.unit_no == src_md5) {
1116 digest_ctx.produced = MD5_STATE_LENGTH;
1117 } else {
1118 digest_ctx.produced = SHA1_STATE_LENGTH;
1119 }
1120 }
1121 DEBUG(printk("cryptocop_setup_dma_list: digest_ctx producing: consumed=%d, produced=%d, blocklength=%d.\n", digest_ctx.consumed, digest_ctx.produced, digest_ctx.blocklength));
1122 }
1123 if (cipher_ctx.active) {
1124 /* Ciphers are allowed only to source from DMA out. That is filtered above. */
1125 assert(cipher_ctx.current_src == src_dma);
1126 cipher_ctx.consumed += desc_len;
1127 cipher_ctx.produced = cipher_ctx.blocklength * (cipher_ctx.consumed / cipher_ctx.blocklength);
1128 if (cipher_ctx.cbcmode && !(cipher_ctx.tcfg->flags & CRYPTOCOP_EXPLICIT_IV) && cipher_ctx.produced){
1129 cipher_ctx.produced -= cipher_ctx.blocklength; /* Compensate for CBC iv. */
1130 }
1131 DEBUG(printk("cryptocop_setup_dma_list: cipher_ctx producing: consumed=%d, produced=%d, blocklength=%d.\n", cipher_ctx.consumed, cipher_ctx.produced, cipher_ctx.blocklength));
1132 }
1133
1134 /* Setup the DMA out descriptors. */
1135 /* Configure the metadata. */
1136 active_count = 0;
1137 eop_needed_count = 0;
1138 if (cipher_ctx.active) {
1139 ++active_count;
1140 if (cipher_ctx.unit_no == src_dma){
1141 /* mem2mem */
1142 meta_out.ciphsel = src_none;
1143 } else {
1144 meta_out.ciphsel = cipher_ctx.current_src;
1145 }
1146 meta_out.ciphconf = cipher_ctx.ciph_conf;
1147 meta_out.cbcmode = cipher_ctx.cbcmode;
1148 meta_out.decrypt = cipher_ctx.decrypt;
1149 DEBUG(printk("set ciphsel=%d ciphconf=%d cbcmode=%d decrypt=%d\n", meta_out.ciphsel, meta_out.ciphconf, meta_out.cbcmode, meta_out.decrypt));
1150 if (cipher_ctx.done) ++eop_needed_count;
1151 } else {
1152 meta_out.ciphsel = src_none;
1153 }
1154
1155 if (digest_ctx.active) {
1156 ++active_count;
1157 meta_out.hashsel = digest_ctx.current_src;
1158 meta_out.hashconf = digest_ctx.hash_conf;
1159 meta_out.hashmode = 0; /* Explicit mode is not used here. */
1160 DEBUG(printk("set hashsel=%d hashconf=%d hashmode=%d\n", meta_out.hashsel, meta_out.hashconf, meta_out.hashmode));
1161 if (digest_ctx.done) {
1162 assert(digest_ctx.pad_descs == NULL);
1163 failed = create_pad_descriptor(&digest_ctx, &digest_ctx.pad_descs, alloc_flag);
1164 if (failed) {
1165 DEBUG_API(printk("cryptocop_setup_dma_list: failed digest pad creation.\n"));
1166 goto error_cleanup;
1167 }
1168 }
1169 } else {
1170 meta_out.hashsel = src_none;
1171 }
1172
1173 if (csum_ctx.active) {
1174 ++active_count;
1175 meta_out.csumsel = csum_ctx.current_src;
1176 if (csum_ctx.done) {
1177 assert(csum_ctx.pad_descs == NULL);
1178 failed = create_pad_descriptor(&csum_ctx, &csum_ctx.pad_descs, alloc_flag);
1179 if (failed) {
1180 DEBUG_API(printk("cryptocop_setup_dma_list: failed csum pad creation.\n"));
1181 goto error_cleanup;
1182 }
1183 }
1184 } else {
1185 meta_out.csumsel = src_none;
1186 }
1187 DEBUG(printk("cryptocop_setup_dma_list: %d eop needed, %d active units\n", eop_needed_count, active_count));
1188 /* Setup DMA out descriptors for the indata. */
1189 failed = create_output_descriptors(operation, &iniov_ix, &iniov_offset, desc_len, &current_out_cdesc, &meta_out, alloc_flag);
1190 if (failed) {
1191 DEBUG_API(printk("cryptocop_setup_dma_list: create_output_descriptors %d\n", failed));
1192 goto error_cleanup;
1193 }
1194 /* Setup out EOP. If there are active units that are not done here they cannot get an EOP
1195 * so we ust setup a zero length descriptor to DMA to signal EOP only to done units.
1196 * If there is a pad descriptor EOP for the padded unit will be EOPed by it.
1197 */
1198 assert(active_count >= eop_needed_count);
1199 assert((eop_needed_count == 0) || (eop_needed_count == 1));
1200 if (eop_needed_count) {
1201 /* This means that the bulk operation (cipeher/m2m) is terminated. */
1202 if (active_count > 1) {
1203 /* Use zero length EOP descriptor. */
1204 struct cryptocop_dma_desc *ed = alloc_cdesc(alloc_flag);
1205 struct strcop_meta_out ed_mo = {0};
1206 if (!ed) {
1207 DEBUG_API(printk("cryptocop_setup_dma_list: alloc EOP descriptor for cipher\n"));
1208 failed = -ENOMEM;
1209 goto error_cleanup;
1210 }
1211
1212 assert(cipher_ctx.active && cipher_ctx.done);
1213
1214 if (cipher_ctx.unit_no == src_dma){
1215 /* mem2mem */
1216 ed_mo.ciphsel = src_none;
1217 } else {
1218 ed_mo.ciphsel = cipher_ctx.current_src;
1219 }
1220 ed_mo.ciphconf = cipher_ctx.ciph_conf;
1221 ed_mo.cbcmode = cipher_ctx.cbcmode;
1222 ed_mo.decrypt = cipher_ctx.decrypt;
1223
1224 ed->free_buf = NULL;
1225 ed->dma_descr->wait = 1;
1226 ed->dma_descr->out_eop = 1;
1227
1228 ed->dma_descr->buf = (char*)virt_to_phys(&ed); /* Use any valid physical address for zero length descriptor. */
1229 ed->dma_descr->after = ed->dma_descr->buf;
1230 ed->dma_descr->md = REG_TYPE_CONV(unsigned short int, struct strcop_meta_out, ed_mo);
1231 current_out_cdesc->next = ed;
1232 current_out_cdesc = ed;
1233 } else {
1234 /* Set EOP in the current out descriptor since the only active module is
1235 * the one needing the EOP. */
1236
1237 current_out_cdesc->dma_descr->out_eop = 1;
1238 }
1239 }
1240
1241 if (cipher_ctx.done && cipher_ctx.active) cipher_ctx.active = 0;
1242 if (digest_ctx.done && digest_ctx.active) digest_ctx.active = 0;
1243 if (csum_ctx.done && csum_ctx.active) csum_ctx.active = 0;
1244 indata_ix += odsc->length;
1245 odsc = odsc->next;
1246 } /* while (odsc) */ /* Process descriptors. */
1247 DEBUG(printk("cryptocop_setup_dma_list: done parsing operation descriptors\n"));
1248 if (cipher_ctx.tcfg && (cipher_ctx.active || !cipher_ctx.done)){
1249 DEBUG_API(printk("cryptocop_setup_dma_list: cipher operation not terminated.\n"));
1250 failed = -EINVAL;
1251 goto error_cleanup;
1252 }
1253 if (digest_ctx.tcfg && (digest_ctx.active || !digest_ctx.done)){
1254 DEBUG_API(printk("cryptocop_setup_dma_list: digest operation not terminated.\n"));
1255 failed = -EINVAL;
1256 goto error_cleanup;
1257 }
1258 if (csum_ctx.tcfg && (csum_ctx.active || !csum_ctx.done)){
1259 DEBUG_API(printk("cryptocop_setup_dma_list: csum operation not terminated.\n"));
1260 failed = -EINVAL;
1261 goto error_cleanup;
1262 }
1263
1264 failed = append_input_descriptors(operation, &current_in_cdesc, &current_out_cdesc, &cipher_ctx, alloc_flag);
1265 if (failed){
1266 DEBUG_API(printk("cryptocop_setup_dma_list: append_input_descriptors cipher_ctx %d\n", failed));
1267 goto error_cleanup;
1268 }
1269 failed = append_input_descriptors(operation, &current_in_cdesc, &current_out_cdesc, &digest_ctx, alloc_flag);
1270 if (failed){
1271 DEBUG_API(printk("cryptocop_setup_dma_list: append_input_descriptors cipher_ctx %d\n", failed));
1272 goto error_cleanup;
1273 }
1274 failed = append_input_descriptors(operation, &current_in_cdesc, &current_out_cdesc, &csum_ctx, alloc_flag);
1275 if (failed){
1276 DEBUG_API(printk("cryptocop_setup_dma_list: append_input_descriptors cipher_ctx %d\n", failed));
1277 goto error_cleanup;
1278 }
1279
1280 DEBUG(printk("cryptocop_setup_dma_list: int_op=0x%p, *int_op=0x%p\n", int_op, *int_op));
1281 (*int_op)->cdesc_out = out_cdesc_head.next;
1282 (*int_op)->cdesc_in = in_cdesc_head.next;
1283 DEBUG(printk("cryptocop_setup_dma_list: out_cdesc_head=0x%p in_cdesc_head=0x%p\n", (*int_op)->cdesc_out, (*int_op)->cdesc_in));
1284
1285 setup_descr_chain(out_cdesc_head.next);
1286 setup_descr_chain(in_cdesc_head.next);
1287
1288 /* Last but not least: mark the last DMA in descriptor for a INTR and EOL and the the
1289 * last DMA out descriptor for EOL.
1290 */
1291 current_in_cdesc->dma_descr->intr = 1;
1292 current_in_cdesc->dma_descr->eol = 1;
1293 current_out_cdesc->dma_descr->eol = 1;
1294
1295 /* Setup DMA contexts. */
1296 (*int_op)->ctx_out.next = NULL;
1297 (*int_op)->ctx_out.eol = 1;
1298 (*int_op)->ctx_out.intr = 0;
1299 (*int_op)->ctx_out.store_mode = 0;
1300 (*int_op)->ctx_out.en = 0;
1301 (*int_op)->ctx_out.dis = 0;
1302 (*int_op)->ctx_out.md0 = 0;
1303 (*int_op)->ctx_out.md1 = 0;
1304 (*int_op)->ctx_out.md2 = 0;
1305 (*int_op)->ctx_out.md3 = 0;
1306 (*int_op)->ctx_out.md4 = 0;
1307 (*int_op)->ctx_out.saved_data = (dma_descr_data*)virt_to_phys((*int_op)->cdesc_out->dma_descr);
1308 (*int_op)->ctx_out.saved_data_buf = (*int_op)->cdesc_out->dma_descr->buf; /* Already physical address. */
1309
1310 (*int_op)->ctx_in.next = NULL;
1311 (*int_op)->ctx_in.eol = 1;
1312 (*int_op)->ctx_in.intr = 0;
1313 (*int_op)->ctx_in.store_mode = 0;
1314 (*int_op)->ctx_in.en = 0;
1315 (*int_op)->ctx_in.dis = 0;
1316 (*int_op)->ctx_in.md0 = 0;
1317 (*int_op)->ctx_in.md1 = 0;
1318 (*int_op)->ctx_in.md2 = 0;
1319 (*int_op)->ctx_in.md3 = 0;
1320 (*int_op)->ctx_in.md4 = 0;
1321
1322 (*int_op)->ctx_in.saved_data = (dma_descr_data*)virt_to_phys((*int_op)->cdesc_in->dma_descr);
1323 (*int_op)->ctx_in.saved_data_buf = (*int_op)->cdesc_in->dma_descr->buf; /* Already physical address. */
1324
1325 DEBUG(printk("cryptocop_setup_dma_list: done\n"));
1326 return 0;
1327
1328error_cleanup:
1329 {
1330 /* Free all allocated resources. */
1331 struct cryptocop_dma_desc *tmp_cdesc;
1332 while (digest_ctx.pad_descs){
1333 tmp_cdesc = digest_ctx.pad_descs->next;
1334 free_cdesc(digest_ctx.pad_descs);
1335 digest_ctx.pad_descs = tmp_cdesc;
1336 }
1337 while (csum_ctx.pad_descs){
1338 tmp_cdesc = csum_ctx.pad_descs->next;
1339 free_cdesc(csum_ctx.pad_descs);
1340 csum_ctx.pad_descs = tmp_cdesc;
1341 }
1342 assert(cipher_ctx.pad_descs == NULL); /* The ciphers are never padded. */
1343
1344 if (*int_op != NULL) delete_internal_operation(*int_op);
1345 }
1346 DEBUG_API(printk("cryptocop_setup_dma_list: done with error %d\n", failed));
1347 return failed;
1348}
1349
1350
1351static void delete_internal_operation(struct cryptocop_int_operation *iop)
1352{
1353 void *ptr = iop->alloc_ptr;
1354 struct cryptocop_dma_desc *cd = iop->cdesc_out;
1355 struct cryptocop_dma_desc *next;
1356
1357 DEBUG(printk("delete_internal_operation: iop=0x%p, alloc_ptr=0x%p\n", iop, ptr));
1358
1359 while (cd) {
1360 next = cd->next;
1361 free_cdesc(cd);
1362 cd = next;
1363 }
1364 cd = iop->cdesc_in;
1365 while (cd) {
1366 next = cd->next;
1367 free_cdesc(cd);
1368 cd = next;
1369 }
1370 kfree(ptr);
1371}
1372
1373#define MD5_MIN_PAD_LENGTH (9)
1374#define MD5_PAD_LENGTH_FIELD_LENGTH (8)
1375
1376static int create_md5_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length)
1377{
1378 size_t padlen = MD5_BLOCK_LENGTH - (hashed_length % MD5_BLOCK_LENGTH);
1379 unsigned char *p;
1380 int i;
1381 unsigned long long int bit_length = hashed_length << 3;
1382
1383 if (padlen < MD5_MIN_PAD_LENGTH) padlen += MD5_BLOCK_LENGTH;
1384
1385 p = kmalloc(padlen, alloc_flag);
1386 if (!pad) return -ENOMEM;
1387
1388 *p = 0x80;
1389 memset(p+1, 0, padlen - 1);
1390
1391 DEBUG(printk("create_md5_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length));
1392
1393 i = padlen - MD5_PAD_LENGTH_FIELD_LENGTH;
1394 while (bit_length != 0){
1395 p[i++] = bit_length % 0x100;
1396 bit_length >>= 8;
1397 }
1398
1399 *pad = (char*)p;
1400 *pad_length = padlen;
1401
1402 return 0;
1403}
1404
1405#define SHA1_MIN_PAD_LENGTH (9)
1406#define SHA1_PAD_LENGTH_FIELD_LENGTH (8)
1407
1408static int create_sha1_pad(int alloc_flag, unsigned long long hashed_length, char **pad, size_t *pad_length)
1409{
1410 size_t padlen = SHA1_BLOCK_LENGTH - (hashed_length % SHA1_BLOCK_LENGTH);
1411 unsigned char *p;
1412 int i;
1413 unsigned long long int bit_length = hashed_length << 3;
1414
1415 if (padlen < SHA1_MIN_PAD_LENGTH) padlen += SHA1_BLOCK_LENGTH;
1416
1417 p = kmalloc(padlen, alloc_flag);
1418 if (!pad) return -ENOMEM;
1419
1420 *p = 0x80;
1421 memset(p+1, 0, padlen - 1);
1422
1423 DEBUG(printk("create_sha1_pad: hashed_length=%lld bits == %lld bytes\n", bit_length, hashed_length));
1424
1425 i = padlen - 1;
1426 while (bit_length != 0){
1427 p[i--] = bit_length % 0x100;
1428 bit_length >>= 8;
1429 }
1430
1431 *pad = (char*)p;
1432 *pad_length = padlen;
1433
1434 return 0;
1435}
1436
1437
1438static int transform_ok(struct cryptocop_transform_init *tinit)
1439{
1440 switch (tinit->alg){
1441 case cryptocop_alg_csum:
1442 switch (tinit->csum_mode){
1443 case cryptocop_csum_le:
1444 case cryptocop_csum_be:
1445 break;
1446 default:
1447 DEBUG_API(printk("transform_ok: Bad mode set for csum transform\n"));
1448 return -EINVAL;
1449 }
1450 case cryptocop_alg_mem2mem:
1451 case cryptocop_alg_md5:
1452 case cryptocop_alg_sha1:
1453 if (tinit->keylen != 0) {
1454 DEBUG_API(printk("transform_ok: non-zero keylength, %d, for a digest/csum algorithm\n", tinit->keylen));
1455 return -EINVAL; /* This check is a bit strict. */
1456 }
1457 break;
1458 case cryptocop_alg_des:
1459 if (tinit->keylen != 64) {
1460 DEBUG_API(printk("transform_ok: keylen %d invalid for DES\n", tinit->keylen));
1461 return -EINVAL;
1462 }
1463 break;
1464 case cryptocop_alg_3des:
1465 if (tinit->keylen != 192) {
1466 DEBUG_API(printk("transform_ok: keylen %d invalid for 3DES\n", tinit->keylen));
1467 return -EINVAL;
1468 }
1469 break;
1470 case cryptocop_alg_aes:
1471 if (tinit->keylen != 128 && tinit->keylen != 192 && tinit->keylen != 256) {
1472 DEBUG_API(printk("transform_ok: keylen %d invalid for AES\n", tinit->keylen));
1473 return -EINVAL;
1474 }
1475 break;
1476 case cryptocop_no_alg:
1477 default:
1478 DEBUG_API(printk("transform_ok: no such algorithm %d\n", tinit->alg));
1479 return -EINVAL;
1480 }
1481
1482 switch (tinit->alg){
1483 case cryptocop_alg_des:
1484 case cryptocop_alg_3des:
1485 case cryptocop_alg_aes:
1486 if (tinit->cipher_mode != cryptocop_cipher_mode_ecb && tinit->cipher_mode != cryptocop_cipher_mode_cbc) return -EINVAL;
1487 default:
1488 break;
1489 }
1490 return 0;
1491}
1492
1493
1494int cryptocop_new_session(cryptocop_session_id *sid, struct cryptocop_transform_init *tinit, int alloc_flag)
1495{
1496 struct cryptocop_session *sess;
1497 struct cryptocop_transform_init *tfrm_in = tinit;
1498 struct cryptocop_transform_init *tmp_in;
1499 int no_tfrms = 0;
1500 int i;
1501 unsigned long int flags;
1502
1503 init_stream_coprocessor(); /* For safety if we are called early */
1504
1505 while (tfrm_in){
1506 int err;
1507 ++no_tfrms;
1508 if ((err = transform_ok(tfrm_in))) {
1509 DEBUG_API(printk("cryptocop_new_session, bad transform\n"));
1510 return err;
1511 }
1512 tfrm_in = tfrm_in->next;
1513 }
1514 if (0 == no_tfrms) {
1515 DEBUG_API(printk("cryptocop_new_session, no transforms specified\n"));
1516 return -EINVAL;
1517 }
1518
1519 sess = kmalloc(sizeof(struct cryptocop_session), alloc_flag);
1520 if (!sess){
1521 DEBUG_API(printk("cryptocop_new_session, kmalloc cryptocop_session\n"));
1522 return -ENOMEM;
1523 }
1524
1525 sess->tfrm_ctx = kmalloc(no_tfrms * sizeof(struct cryptocop_transform_ctx), alloc_flag);
1526 if (!sess->tfrm_ctx) {
1527 DEBUG_API(printk("cryptocop_new_session, kmalloc cryptocop_transform_ctx\n"));
1528 kfree(sess);
1529 return -ENOMEM;
1530 }
1531
1532 tfrm_in = tinit;
1533 for (i = 0; i < no_tfrms; i++){
1534 tmp_in = tfrm_in->next;
1535 while (tmp_in){
1536 if (tmp_in->tid == tfrm_in->tid) {
1537 DEBUG_API(printk("cryptocop_new_session, duplicate transform ids\n"));
1538 kfree(sess->tfrm_ctx);
1539 kfree(sess);
1540 return -EINVAL;
1541 }
1542 tmp_in = tmp_in->next;
1543 }
1544 memcpy(&sess->tfrm_ctx[i].init, tfrm_in, sizeof(struct cryptocop_transform_init));
1545 sess->tfrm_ctx[i].dec_key_set = 0;
1546 sess->tfrm_ctx[i].next = &sess->tfrm_ctx[i] + 1;
1547
1548 tfrm_in = tfrm_in->next;
1549 }
1550 sess->tfrm_ctx[i-1].next = NULL;
1551
1552 spin_lock_irqsave(&cryptocop_sessions_lock, flags);
1553 sess->sid = next_sid;
1554 next_sid++;
1555 /* TODO If we are really paranoid we should do duplicate check to handle sid wraparound.
1556 * OTOH 2^64 is a really large number of session. */
1557 if (next_sid == 0) next_sid = 1;
1558
1559 /* Prepend to session list. */
1560 sess->next = cryptocop_sessions;
1561 cryptocop_sessions = sess;
1562 spin_unlock_irqrestore(&cryptocop_sessions_lock, flags);
1563 *sid = sess->sid;
1564 return 0;
1565}
1566
1567
1568int cryptocop_free_session(cryptocop_session_id sid)
1569{
1570 struct cryptocop_transform_ctx *tc;
1571 struct cryptocop_session *sess = NULL;
1572 struct cryptocop_session *psess = NULL;
1573 unsigned long int flags;
1574 int i;
1575 LIST_HEAD(remove_list);
1576 struct list_head *node, *tmp;
1577 struct cryptocop_prio_job *pj;
1578
1579 DEBUG(printk("cryptocop_free_session: sid=%lld\n", sid));
1580
1581 spin_lock_irqsave(&cryptocop_sessions_lock, flags);
1582 sess = cryptocop_sessions;
1583 while (sess && sess->sid != sid){
1584 psess = sess;
1585 sess = sess->next;
1586 }
1587 if (sess){
1588 if (psess){
1589 psess->next = sess->next;
1590 } else {
1591 cryptocop_sessions = sess->next;
1592 }
1593 }
1594 spin_unlock_irqrestore(&cryptocop_sessions_lock, flags);
1595
1596 if (!sess) return -EINVAL;
1597
1598 /* Remove queued jobs. */
1599 spin_lock_irqsave(&cryptocop_job_queue_lock, flags);
1600
1601 for (i = 0; i < cryptocop_prio_no_prios; i++){
1602 if (!list_empty(&(cryptocop_job_queues[i].jobs))){
1603 list_for_each_safe(node, tmp, &(cryptocop_job_queues[i].jobs)) {
1604 pj = list_entry(node, struct cryptocop_prio_job, node);
1605 if (pj->oper->sid == sid) {
1606 list_move_tail(node, &remove_list);
1607 }
1608 }
1609 }
1610 }
1611 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
1612
1613 list_for_each_safe(node, tmp, &remove_list) {
1614 list_del(node);
1615 pj = list_entry(node, struct cryptocop_prio_job, node);
1616 pj->oper->operation_status = -EAGAIN; /* EAGAIN is not ideal for job/session terminated but it's the best choice I know of. */
1617 DEBUG(printk("cryptocop_free_session: pj=0x%p, pj->oper=0x%p, pj->iop=0x%p\n", pj, pj->oper, pj->iop));
1618 pj->oper->cb(pj->oper, pj->oper->cb_data);
1619 delete_internal_operation(pj->iop);
1620 kfree(pj);
1621 }
1622
1623 tc = sess->tfrm_ctx;
1624 /* Erase keying data. */
1625 while (tc){
1626 DEBUG(printk("cryptocop_free_session: memset keys, tfrm id=%d\n", tc->init.tid));
1627 memset(tc->init.key, 0xff, CRYPTOCOP_MAX_KEY_LENGTH);
1628 memset(tc->dec_key, 0xff, CRYPTOCOP_MAX_KEY_LENGTH);
1629 tc = tc->next;
1630 }
1631 kfree(sess->tfrm_ctx);
1632 kfree(sess);
1633
1634 return 0;
1635}
1636
1637static struct cryptocop_session *get_session(cryptocop_session_id sid)
1638{
1639 struct cryptocop_session *sess;
1640 unsigned long int flags;
1641
1642 spin_lock_irqsave(&cryptocop_sessions_lock, flags);
1643 sess = cryptocop_sessions;
1644 while (sess && (sess->sid != sid)){
1645 sess = sess->next;
1646 }
1647 spin_unlock_irqrestore(&cryptocop_sessions_lock, flags);
1648
1649 return sess;
1650}
1651
1652static struct cryptocop_transform_ctx *get_transform_ctx(struct cryptocop_session *sess, cryptocop_tfrm_id tid)
1653{
1654 struct cryptocop_transform_ctx *tc = sess->tfrm_ctx;
1655
1656 DEBUG(printk("get_transform_ctx, sess=0x%p, tid=%d\n", sess, tid));
1657 assert(sess != NULL);
1658 while (tc && tc->init.tid != tid){
1659 DEBUG(printk("tc=0x%p, tc->next=0x%p\n", tc, tc->next));
1660 tc = tc->next;
1661 }
1662 DEBUG(printk("get_transform_ctx, returning tc=0x%p\n", tc));
1663 return tc;
1664}
1665
1666
1667
1668/* The AES s-transform matrix (s-box). */
1669static const u8 aes_sbox[256] = {
1670 99, 124, 119, 123, 242, 107, 111, 197, 48, 1, 103, 43, 254, 215, 171, 118,
1671 202, 130, 201, 125, 250, 89, 71, 240, 173, 212, 162, 175, 156, 164, 114, 192,
1672 183, 253, 147, 38, 54, 63, 247, 204, 52, 165, 229, 241, 113, 216, 49, 21,
1673 4, 199, 35, 195, 24, 150, 5, 154, 7, 18, 128, 226, 235, 39, 178, 117,
1674 9, 131, 44, 26, 27, 110, 90, 160, 82, 59, 214, 179, 41, 227, 47, 132,
1675 83, 209, 0, 237, 32, 252, 177, 91, 106, 203, 190, 57, 74, 76, 88, 207,
1676 208, 239, 170, 251, 67, 77, 51, 133, 69, 249, 2, 127, 80, 60, 159, 168,
1677 81, 163, 64, 143, 146, 157, 56, 245, 188, 182, 218, 33, 16, 255, 243, 210,
1678 205, 12, 19, 236, 95, 151, 68, 23, 196, 167, 126, 61, 100, 93, 25, 115,
1679 96, 129, 79, 220, 34, 42, 144, 136, 70, 238, 184, 20, 222, 94, 11, 219,
1680 224, 50, 58, 10, 73, 6, 36, 92, 194, 211, 172, 98, 145, 149, 228, 121,
1681 231, 200, 55, 109, 141, 213, 78, 169, 108, 86, 244, 234, 101, 122, 174, 8,
1682 186, 120, 37, 46, 28, 166, 180, 198, 232, 221, 116, 31, 75, 189, 139, 138,
1683 112, 62, 181, 102, 72, 3, 246, 14, 97, 53, 87, 185, 134, 193, 29, 158,
1684 225, 248, 152, 17, 105, 217, 142, 148, 155, 30, 135, 233, 206, 85, 40, 223,
1685 140, 161, 137, 13, 191, 230, 66, 104, 65, 153, 45, 15, 176, 84, 187, 22
1686};
1687
1688/* AES has a 32 bit word round constants for each round in the
1689 * key schedule. round_constant[i] is really Rcon[i+1] in FIPS187.
1690 */
1691static u32 round_constant[11] = {
1692 0x01000000, 0x02000000, 0x04000000, 0x08000000,
1693 0x10000000, 0x20000000, 0x40000000, 0x80000000,
1694 0x1B000000, 0x36000000, 0x6C000000
1695};
1696
1697/* Apply the s-box to each of the four occtets in w. */
1698static u32 aes_ks_subword(const u32 w)
1699{
1700 u8 bytes[4];
1701
1702 *(u32*)(&bytes[0]) = w;
1703 bytes[0] = aes_sbox[bytes[0]];
1704 bytes[1] = aes_sbox[bytes[1]];
1705 bytes[2] = aes_sbox[bytes[2]];
1706 bytes[3] = aes_sbox[bytes[3]];
1707 return *(u32*)(&bytes[0]);
1708}
1709
1710/* The encrypt (forward) Rijndael key schedule algorithm pseudo code:
1711 * (Note that AES words are 32 bit long)
1712 *
1713 * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk){
1714 * word temp
1715 * i = 0
1716 * while (i < Nk) {
1717 * w[i] = word(key[4*i, 4*i + 1, 4*i + 2, 4*i + 3])
1718 * i = i + 1
1719 * }
1720 * i = Nk
1721 *
1722 * while (i < (Nb * (Nr + 1))) {
1723 * temp = w[i - 1]
1724 * if ((i mod Nk) == 0) {
1725 * temp = SubWord(RotWord(temp)) xor Rcon[i/Nk]
1726 * }
1727 * else if ((Nk > 6) && ((i mod Nk) == 4)) {
1728 * temp = SubWord(temp)
1729 * }
1730 * w[i] = w[i - Nk] xor temp
1731 * }
1732 * RotWord(t) does a 8 bit cyclic shift left on a 32 bit word.
1733 * SubWord(t) applies the AES s-box individually to each octet
1734 * in a 32 bit word.
1735 *
1736 * For AES Nk can have the values 4, 6, and 8 (corresponding to
1737 * values for Nr of 10, 12, and 14). Nb is always 4.
1738 *
1739 * To construct w[i], w[i - 1] and w[i - Nk] must be
1740 * available. Consequently we must keep a state of the last Nk words
1741 * to be able to create the last round keys.
1742 */
1743static void get_aes_decrypt_key(unsigned char *dec_key, const unsigned char *key, unsigned int keylength)
1744{
1745 u32 temp;
1746 u32 w_ring[8]; /* nk is max 8, use elements 0..(nk - 1) as a ringbuffer */
1747 u8 w_last_ix;
1748 int i;
1749 u8 nr, nk;
1750
1751 switch (keylength){
1752 case 128:
1753 nk = 4;
1754 nr = 10;
1755 break;
1756 case 192:
1757 nk = 6;
1758 nr = 12;
1759 break;
1760 case 256:
1761 nk = 8;
1762 nr = 14;
1763 break;
1764 default:
1765 panic("stream co-processor: bad aes key length in get_aes_decrypt_key\n");
1766 };
1767
1768 /* Need to do host byte order correction here since key is byte oriented and the
1769 * kx algorithm is word (u32) oriented. */
1770 for (i = 0; i < nk; i+=1) {
1771 w_ring[i] = be32_to_cpu(*(u32*)&key[4*i]);
1772 }
1773
1774 i = (int)nk;
1775 w_last_ix = i - 1;
1776 while (i < (4 * (nr + 2))) {
1777 temp = w_ring[w_last_ix];
1778 if (!(i % nk)) {
1779 /* RotWord(temp) */
1780 temp = (temp << 8) | (temp >> 24);
1781 temp = aes_ks_subword(temp);
1782 temp ^= round_constant[i/nk - 1];
1783 } else if ((nk > 6) && ((i % nk) == 4)) {
1784 temp = aes_ks_subword(temp);
1785 }
1786 w_last_ix = (w_last_ix + 1) % nk; /* This is the same as (i-Nk) mod Nk */
1787 temp ^= w_ring[w_last_ix];
1788 w_ring[w_last_ix] = temp;
1789
1790 /* We need the round keys for round Nr+1 and Nr+2 (round key
1791 * Nr+2 is the round key beyond the last one used when
1792 * encrypting). Rounds are numbered starting from 0, Nr=10
1793 * implies 11 rounds are used in encryption/decryption.
1794 */
1795 if (i >= (4 * nr)) {
1796 /* Need to do host byte order correction here, the key
1797 * is byte oriented. */
1798 *(u32*)dec_key = cpu_to_be32(temp);
1799 dec_key += 4;
1800 }
1801 ++i;
1802 }
1803}
1804
1805
1806/**** Job/operation management. ****/
1807
1808int cryptocop_job_queue_insert_csum(struct cryptocop_operation *operation)
1809{
1810 return cryptocop_job_queue_insert(cryptocop_prio_kernel_csum, operation);
1811}
1812
1813int cryptocop_job_queue_insert_crypto(struct cryptocop_operation *operation)
1814{
1815 return cryptocop_job_queue_insert(cryptocop_prio_kernel, operation);
1816}
1817
1818int cryptocop_job_queue_insert_user_job(struct cryptocop_operation *operation)
1819{
1820 return cryptocop_job_queue_insert(cryptocop_prio_user, operation);
1821}
1822
1823static int cryptocop_job_queue_insert(cryptocop_queue_priority prio, struct cryptocop_operation *operation)
1824{
1825 int ret;
1826 struct cryptocop_prio_job *pj = NULL;
1827 unsigned long int flags;
1828
1829 DEBUG(printk("cryptocop_job_queue_insert(%d, 0x%p)\n", prio, operation));
1830
1831 if (!operation || !operation->cb){
1832 DEBUG_API(printk("cryptocop_job_queue_insert oper=0x%p, NULL operation or callback\n", operation));
1833 return -EINVAL;
1834 }
1835
1836 if ((ret = cryptocop_job_setup(&pj, operation)) != 0){
1837 DEBUG_API(printk("cryptocop_job_queue_insert: job setup failed\n"));
1838 return ret;
1839 }
1840 assert(pj != NULL);
1841
1842 spin_lock_irqsave(&cryptocop_job_queue_lock, flags);
1843 list_add_tail(&pj->node, &cryptocop_job_queues[prio].jobs);
1844 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
1845
1846 /* Make sure a job is running */
1847 cryptocop_start_job();
1848 return 0;
1849}
1850
1851static void cryptocop_do_tasklet(unsigned long unused);
1852DECLARE_TASKLET (cryptocop_tasklet, cryptocop_do_tasklet, 0);
1853
1854static void cryptocop_do_tasklet(unsigned long unused)
1855{
1856 struct list_head *node;
1857 struct cryptocop_prio_job *pj = NULL;
1858 unsigned long flags;
1859
1860 DEBUG(printk("cryptocop_do_tasklet: entering\n"));
1861
1862 do {
1863 spin_lock_irqsave(&cryptocop_completed_jobs_lock, flags);
1864 if (!list_empty(&cryptocop_completed_jobs)){
1865 node = cryptocop_completed_jobs.next;
1866 list_del(node);
1867 pj = list_entry(node, struct cryptocop_prio_job, node);
1868 } else {
1869 pj = NULL;
1870 }
1871 spin_unlock_irqrestore(&cryptocop_completed_jobs_lock, flags);
1872 if (pj) {
1873 assert(pj->oper != NULL);
1874
1875 /* Notify consumer of operation completeness. */
1876 DEBUG(printk("cryptocop_do_tasklet: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
1877
1878 pj->oper->operation_status = 0; /* Job is completed. */
1879 pj->oper->cb(pj->oper, pj->oper->cb_data);
1880 delete_internal_operation(pj->iop);
1881 kfree(pj);
1882 }
1883 } while (pj != NULL);
1884
1885 DEBUG(printk("cryptocop_do_tasklet: exiting\n"));
1886}
1887
1888static irqreturn_t
1889dma_done_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1890{
1891 struct cryptocop_prio_job *done_job;
1892 reg_dma_rw_ack_intr ack_intr = {
1893 .data = 1,
1894 };
1895
1896 REG_WR (dma, regi_dma9, rw_ack_intr, ack_intr);
1897
1898 DEBUG(printk("cryptocop DMA done\n"));
1899
1900 spin_lock(&running_job_lock);
1901 if (cryptocop_running_job == NULL){
1902 printk("stream co-processor got interrupt when not busy\n");
1903 spin_unlock(&running_job_lock);
1904 return IRQ_HANDLED;
1905 }
1906 done_job = cryptocop_running_job;
1907 cryptocop_running_job = NULL;
1908 spin_unlock(&running_job_lock);
1909
1910 /* Start processing a job. */
1911 if (!spin_trylock(&cryptocop_process_lock)){
1912 DEBUG(printk("cryptocop irq handler, not starting a job\n"));
1913 } else {
1914 cryptocop_start_job();
1915 spin_unlock(&cryptocop_process_lock);
1916 }
1917
1918 done_job->oper->operation_status = 0; /* Job is completed. */
1919 if (done_job->oper->fast_callback){
1920 /* This operation wants callback from interrupt. */
1921 done_job->oper->cb(done_job->oper, done_job->oper->cb_data);
1922 delete_internal_operation(done_job->iop);
1923 kfree(done_job);
1924 } else {
1925 spin_lock(&cryptocop_completed_jobs_lock);
1926 list_add_tail(&(done_job->node), &cryptocop_completed_jobs);
1927 spin_unlock(&cryptocop_completed_jobs_lock);
1928 tasklet_schedule(&cryptocop_tasklet);
1929 }
1930
1931 DEBUG(printk("cryptocop leave irq handler\n"));
1932 return IRQ_HANDLED;
1933}
1934
1935
1936/* Setup interrupts and DMA channels. */
1937static int init_cryptocop(void)
1938{
1939 unsigned long flags;
1940 reg_intr_vect_rw_mask intr_mask;
1941 reg_dma_rw_cfg dma_cfg = {.en = 1};
1942 reg_dma_rw_intr_mask intr_mask_in = {.data = regk_dma_yes}; /* Only want descriptor interrupts from the DMA in channel. */
1943 reg_dma_rw_ack_intr ack_intr = {.data = 1,.in_eop = 1 };
1944 reg_strcop_rw_cfg strcop_cfg = {
1945 .ipend = regk_strcop_little,
1946 .td1 = regk_strcop_e,
1947 .td2 = regk_strcop_d,
1948 .td3 = regk_strcop_e,
1949 .ignore_sync = 0,
1950 .en = 1
1951 };
1952
1953 if (request_irq(DMA9_INTR_VECT, dma_done_interrupt, 0, "stream co-processor DMA", NULL)) panic("request_irq stream co-processor irq dma9");
1954
1955 (void)crisv32_request_dma(8, "strcop", DMA_PANIC_ON_ERROR, 0, dma_strp);
1956 (void)crisv32_request_dma(9, "strcop", DMA_PANIC_ON_ERROR, 0, dma_strp);
1957
1958 local_irq_save(flags);
1959
1960 /* Reset and enable the cryptocop. */
1961 strcop_cfg.en = 0;
1962 REG_WR(strcop, regi_strcop, rw_cfg, strcop_cfg);
1963 strcop_cfg.en = 1;
1964 REG_WR(strcop, regi_strcop, rw_cfg, strcop_cfg);
1965
1966 /* Enable DMA9 interrupt */
1967 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1968 intr_mask.dma9 = 1;
1969 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1970
1971 /* Enable DMAs. */
1972 REG_WR(dma, regi_dma9, rw_cfg, dma_cfg); /* input DMA */
1973 REG_WR(dma, regi_dma8, rw_cfg, dma_cfg); /* output DMA */
1974
1975 /* Set up wordsize = 4 for DMAs. */
1976 DMA_WR_CMD (regi_dma8, regk_dma_set_w_size4);
1977 DMA_WR_CMD (regi_dma9, regk_dma_set_w_size4);
1978
1979 /* Enable interrupts. */
1980 REG_WR(dma, regi_dma9, rw_intr_mask, intr_mask_in);
1981
1982 /* Clear intr ack. */
1983 REG_WR(dma, regi_dma9, rw_ack_intr, ack_intr);
1984
1985 local_irq_restore(flags);
1986
1987 return 0;
1988}
1989
1990/* Free used cryptocop hw resources (interrupt and DMA channels). */
1991static void release_cryptocop(void)
1992{
1993 unsigned long flags;
1994 reg_intr_vect_rw_mask intr_mask;
1995 reg_dma_rw_cfg dma_cfg = {.en = 0};
1996 reg_dma_rw_intr_mask intr_mask_in = {0};
1997 reg_dma_rw_ack_intr ack_intr = {.data = 1,.in_eop = 1 };
1998
1999 local_irq_save(flags);
2000
2001 /* Clear intr ack. */
2002 REG_WR(dma, regi_dma9, rw_ack_intr, ack_intr);
2003
2004 /* Disable DMA9 interrupt */
2005 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
2006 intr_mask.dma9 = 0;
2007 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
2008
2009 /* Disable DMAs. */
2010 REG_WR(dma, regi_dma9, rw_cfg, dma_cfg); /* input DMA */
2011 REG_WR(dma, regi_dma8, rw_cfg, dma_cfg); /* output DMA */
2012
2013 /* Disable interrupts. */
2014 REG_WR(dma, regi_dma9, rw_intr_mask, intr_mask_in);
2015
2016 local_irq_restore(flags);
2017
2018 free_irq(DMA9_INTR_VECT, NULL);
2019
2020 (void)crisv32_free_dma(8);
2021 (void)crisv32_free_dma(9);
2022}
2023
2024
2025/* Init job queue. */
2026static int cryptocop_job_queue_init(void)
2027{
2028 int i;
2029
2030 INIT_LIST_HEAD(&cryptocop_completed_jobs);
2031
2032 for (i = 0; i < cryptocop_prio_no_prios; i++){
2033 cryptocop_job_queues[i].prio = (cryptocop_queue_priority)i;
2034 INIT_LIST_HEAD(&cryptocop_job_queues[i].jobs);
2035 }
2036 return 0;
2037}
2038
2039
2040static void cryptocop_job_queue_close(void)
2041{
2042 struct list_head *node, *tmp;
2043 struct cryptocop_prio_job *pj = NULL;
2044 unsigned long int process_flags, flags;
2045 int i;
2046
2047 /* FIXME: This is as yet untested code. */
2048
2049 /* Stop strcop from getting an operation to process while we are closing the
2050 module. */
2051 spin_lock_irqsave(&cryptocop_process_lock, process_flags);
2052
2053 /* Empty the job queue. */
2054 spin_lock_irqsave(&cryptocop_process_lock, process_flags);
2055 for (i = 0; i < cryptocop_prio_no_prios; i++){
2056 if (!list_empty(&(cryptocop_job_queues[i].jobs))){
2057 list_for_each_safe(node, tmp, &(cryptocop_job_queues[i].jobs)) {
2058 pj = list_entry(node, struct cryptocop_prio_job, node);
2059 list_del(node);
2060
2061 /* Call callback to notify consumer of job removal. */
2062 DEBUG(printk("cryptocop_job_queue_close: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
2063 pj->oper->operation_status = -EINTR; /* Job is terminated without completion. */
2064 pj->oper->cb(pj->oper, pj->oper->cb_data);
2065
2066 delete_internal_operation(pj->iop);
2067 kfree(pj);
2068 }
2069 }
2070 }
2071 spin_unlock_irqrestore(&cryptocop_process_lock, process_flags);
2072
2073 /* Remove the running job, if any. */
2074 spin_lock_irqsave(&running_job_lock, flags);
2075 if (cryptocop_running_job){
2076 reg_strcop_rw_cfg rw_cfg;
2077 reg_dma_rw_cfg dma_out_cfg, dma_in_cfg;
2078
2079 /* Stop DMA. */
2080 dma_out_cfg = REG_RD(dma, regi_dma8, rw_cfg);
2081 dma_out_cfg.en = regk_dma_no;
2082 REG_WR(dma, regi_dma8, rw_cfg, dma_out_cfg);
2083
2084 dma_in_cfg = REG_RD(dma, regi_dma9, rw_cfg);
2085 dma_in_cfg.en = regk_dma_no;
2086 REG_WR(dma, regi_dma9, rw_cfg, dma_in_cfg);
2087
2088 /* Disble the cryptocop. */
2089 rw_cfg = REG_RD(strcop, regi_strcop, rw_cfg);
2090 rw_cfg.en = 0;
2091 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
2092
2093 pj = cryptocop_running_job;
2094 cryptocop_running_job = NULL;
2095
2096 /* Call callback to notify consumer of job removal. */
2097 DEBUG(printk("cryptocop_job_queue_close: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
2098 pj->oper->operation_status = -EINTR; /* Job is terminated without completion. */
2099 pj->oper->cb(pj->oper, pj->oper->cb_data);
2100
2101 delete_internal_operation(pj->iop);
2102 kfree(pj);
2103 }
2104 spin_unlock_irqrestore(&running_job_lock, flags);
2105
2106 /* Remove completed jobs, if any. */
2107 spin_lock_irqsave(&cryptocop_completed_jobs_lock, flags);
2108
2109 list_for_each_safe(node, tmp, &cryptocop_completed_jobs) {
2110 pj = list_entry(node, struct cryptocop_prio_job, node);
2111 list_del(node);
2112 /* Call callback to notify consumer of job removal. */
2113 DEBUG(printk("cryptocop_job_queue_close: callback 0x%p, data 0x%p\n", pj->oper->cb, pj->oper->cb_data));
2114 pj->oper->operation_status = -EINTR; /* Job is terminated without completion. */
2115 pj->oper->cb(pj->oper, pj->oper->cb_data);
2116
2117 delete_internal_operation(pj->iop);
2118 kfree(pj);
2119 }
2120 spin_unlock_irqrestore(&cryptocop_completed_jobs_lock, flags);
2121}
2122
2123
2124static void cryptocop_start_job(void)
2125{
2126 int i;
2127 struct cryptocop_prio_job *pj;
2128 unsigned long int flags;
2129 unsigned long int running_job_flags;
2130 reg_strcop_rw_cfg rw_cfg = {.en = 1, .ignore_sync = 0};
2131
2132 DEBUG(printk("cryptocop_start_job: entering\n"));
2133
2134 spin_lock_irqsave(&running_job_lock, running_job_flags);
2135 if (cryptocop_running_job != NULL){
2136 /* Already running. */
2137 DEBUG(printk("cryptocop_start_job: already running, exit\n"));
2138 spin_unlock_irqrestore(&running_job_lock, running_job_flags);
2139 return;
2140 }
2141 spin_lock_irqsave(&cryptocop_job_queue_lock, flags);
2142
2143 /* Check the queues in priority order. */
2144 for (i = cryptocop_prio_kernel_csum; (i < cryptocop_prio_no_prios) && list_empty(&cryptocop_job_queues[i].jobs); i++);
2145 if (i == cryptocop_prio_no_prios) {
2146 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
2147 spin_unlock_irqrestore(&running_job_lock, running_job_flags);
2148 DEBUG(printk("cryptocop_start_job: no jobs to run\n"));
2149 return; /* No jobs to run */
2150 }
2151 DEBUG(printk("starting job for prio %d\n", i));
2152
2153 /* TODO: Do not starve lower priority jobs. Let in a lower
2154 * prio job for every N-th processed higher prio job or some
2155 * other scheduling policy. This could reasonably be
2156 * tweakable since the optimal balance would depend on the
2157 * type of load on the system. */
2158
2159 /* Pull the DMA lists from the job and start the DMA client. */
2160 pj = list_entry(cryptocop_job_queues[i].jobs.next, struct cryptocop_prio_job, node);
2161 list_del(&pj->node);
2162 spin_unlock_irqrestore(&cryptocop_job_queue_lock, flags);
2163 cryptocop_running_job = pj;
2164
2165 /* Set config register (3DES and CSUM modes). */
2166 switch (pj->iop->tdes_mode){
2167 case cryptocop_3des_eee:
2168 rw_cfg.td1 = regk_strcop_e;
2169 rw_cfg.td2 = regk_strcop_e;
2170 rw_cfg.td3 = regk_strcop_e;
2171 break;
2172 case cryptocop_3des_eed:
2173 rw_cfg.td1 = regk_strcop_e;
2174 rw_cfg.td2 = regk_strcop_e;
2175 rw_cfg.td3 = regk_strcop_d;
2176 break;
2177 case cryptocop_3des_ede:
2178 rw_cfg.td1 = regk_strcop_e;
2179 rw_cfg.td2 = regk_strcop_d;
2180 rw_cfg.td3 = regk_strcop_e;
2181 break;
2182 case cryptocop_3des_edd:
2183 rw_cfg.td1 = regk_strcop_e;
2184 rw_cfg.td2 = regk_strcop_d;
2185 rw_cfg.td3 = regk_strcop_d;
2186 break;
2187 case cryptocop_3des_dee:
2188 rw_cfg.td1 = regk_strcop_d;
2189 rw_cfg.td2 = regk_strcop_e;
2190 rw_cfg.td3 = regk_strcop_e;
2191 break;
2192 case cryptocop_3des_ded:
2193 rw_cfg.td1 = regk_strcop_d;
2194 rw_cfg.td2 = regk_strcop_e;
2195 rw_cfg.td3 = regk_strcop_d;
2196 break;
2197 case cryptocop_3des_dde:
2198 rw_cfg.td1 = regk_strcop_d;
2199 rw_cfg.td2 = regk_strcop_d;
2200 rw_cfg.td3 = regk_strcop_e;
2201 break;
2202 case cryptocop_3des_ddd:
2203 rw_cfg.td1 = regk_strcop_d;
2204 rw_cfg.td2 = regk_strcop_d;
2205 rw_cfg.td3 = regk_strcop_d;
2206 break;
2207 default:
2208 DEBUG(printk("cryptocop_setup_dma_list: bad 3DES mode\n"));
2209 }
2210 switch (pj->iop->csum_mode){
2211 case cryptocop_csum_le:
2212 rw_cfg.ipend = regk_strcop_little;
2213 break;
2214 case cryptocop_csum_be:
2215 rw_cfg.ipend = regk_strcop_big;
2216 break;
2217 default:
2218 DEBUG(printk("cryptocop_setup_dma_list: bad checksum mode\n"));
2219 }
2220 REG_WR(strcop, regi_strcop, rw_cfg, rw_cfg);
2221
2222 DEBUG(printk("cryptocop_start_job: starting DMA, new cryptocop_running_job=0x%p\n"
2223 "ctx_in: 0x%p, phys: 0x%p\n"
2224 "ctx_out: 0x%p, phys: 0x%p\n",
2225 pj,
2226 &pj->iop->ctx_in, (char*)virt_to_phys(&pj->iop->ctx_in),
2227 &pj->iop->ctx_out, (char*)virt_to_phys(&pj->iop->ctx_out)));
2228
2229 /* Start input DMA. */
2230 DMA_START_CONTEXT(regi_dma9, virt_to_phys(&pj->iop->ctx_in));
2231
2232 /* Start output DMA. */
2233 DMA_START_CONTEXT(regi_dma8, virt_to_phys(&pj->iop->ctx_out));
2234
2235 spin_unlock_irqrestore(&running_job_lock, running_job_flags);
2236 DEBUG(printk("cryptocop_start_job: exiting\n"));
2237}
2238
2239
2240static int cryptocop_job_setup(struct cryptocop_prio_job **pj, struct cryptocop_operation *operation)
2241{
2242 int err;
2243 int alloc_flag = operation->in_interrupt ? GFP_ATOMIC : GFP_KERNEL;
2244 void *iop_alloc_ptr = NULL;
2245
2246 *pj = kmalloc(sizeof (struct cryptocop_prio_job), alloc_flag);
2247 if (!*pj) return -ENOMEM;
2248
2249 DEBUG(printk("cryptocop_job_setup: operation=0x%p\n", operation));
2250
2251 (*pj)->oper = operation;
2252 DEBUG(printk("cryptocop_job_setup, cb=0x%p cb_data=0x%p\n", (*pj)->oper->cb, (*pj)->oper->cb_data));
2253
2254 if (operation->use_dmalists) {
2255 DEBUG(print_user_dma_lists(&operation->list_op));
2256 if (!operation->list_op.inlist || !operation->list_op.outlist || !operation->list_op.out_data_buf || !operation->list_op.in_data_buf){
2257 DEBUG_API(printk("cryptocop_job_setup: bad indata (use_dmalists)\n"));
2258 kfree(*pj);
2259 return -EINVAL;
2260 }
2261 iop_alloc_ptr = kmalloc(DESCR_ALLOC_PAD + sizeof(struct cryptocop_int_operation), alloc_flag);
2262 if (!iop_alloc_ptr) {
2263 DEBUG_API(printk("cryptocop_job_setup: kmalloc cryptocop_int_operation\n"));
2264 kfree(*pj);
2265 return -ENOMEM;
2266 }
2267 (*pj)->iop = (struct cryptocop_int_operation*)(((unsigned long int)(iop_alloc_ptr + DESCR_ALLOC_PAD + offsetof(struct cryptocop_int_operation, ctx_out)) & ~0x0000001F) - offsetof(struct cryptocop_int_operation, ctx_out));
2268 DEBUG(memset((*pj)->iop, 0xff, sizeof(struct cryptocop_int_operation)));
2269 (*pj)->iop->alloc_ptr = iop_alloc_ptr;
2270 (*pj)->iop->sid = operation->sid;
2271 (*pj)->iop->cdesc_out = NULL;
2272 (*pj)->iop->cdesc_in = NULL;
2273 (*pj)->iop->tdes_mode = operation->list_op.tdes_mode;
2274 (*pj)->iop->csum_mode = operation->list_op.csum_mode;
2275 (*pj)->iop->ddesc_out = operation->list_op.outlist;
2276 (*pj)->iop->ddesc_in = operation->list_op.inlist;
2277
2278 /* Setup DMA contexts. */
2279 (*pj)->iop->ctx_out.next = NULL;
2280 (*pj)->iop->ctx_out.eol = 1;
2281 (*pj)->iop->ctx_out.saved_data = operation->list_op.outlist;
2282 (*pj)->iop->ctx_out.saved_data_buf = operation->list_op.out_data_buf;
2283
2284 (*pj)->iop->ctx_in.next = NULL;
2285 (*pj)->iop->ctx_in.eol = 1;
2286 (*pj)->iop->ctx_in.saved_data = operation->list_op.inlist;
2287 (*pj)->iop->ctx_in.saved_data_buf = operation->list_op.in_data_buf;
2288 } else {
2289 if ((err = cryptocop_setup_dma_list(operation, &(*pj)->iop, alloc_flag))) {
2290 DEBUG_API(printk("cryptocop_job_setup: cryptocop_setup_dma_list failed %d\n", err));
2291 kfree(*pj);
2292 return err;
2293 }
2294 }
2295 DEBUG(print_dma_descriptors((*pj)->iop));
2296
2297 DEBUG(printk("cryptocop_job_setup, DMA list setup successful\n"));
2298
2299 return 0;
2300}
2301
2302
2303static int cryptocop_open(struct inode *inode, struct file *filp)
2304{
2305 int p = MINOR(inode->i_rdev);
2306
2307 if (p != CRYPTOCOP_MINOR) return -EINVAL;
2308
2309 filp->private_data = NULL;
2310 return 0;
2311}
2312
2313
2314static int cryptocop_release(struct inode *inode, struct file *filp)
2315{
2316 struct cryptocop_private *dev = filp->private_data;
2317 struct cryptocop_private *dev_next;
2318
2319 while (dev){
2320 dev_next = dev->next;
2321 if (dev->sid != CRYPTOCOP_SESSION_ID_NONE) {
2322 (void)cryptocop_free_session(dev->sid);
2323 }
2324 kfree(dev);
2325 dev = dev_next;
2326 }
2327
2328 return 0;
2329}
2330
2331
2332static int cryptocop_ioctl_close_session(struct inode *inode, struct file *filp,
2333 unsigned int cmd, unsigned long arg)
2334{
2335 struct cryptocop_private *dev = filp->private_data;
2336 struct cryptocop_private *prev_dev = NULL;
2337 struct strcop_session_op *sess_op = (struct strcop_session_op *)arg;
2338 struct strcop_session_op sop;
2339 int err;
2340
2341 DEBUG(printk("cryptocop_ioctl_close_session\n"));
2342
2343 if (!access_ok(VERIFY_READ, sess_op, sizeof(struct strcop_session_op)))
2344 return -EFAULT;
2345 err = copy_from_user(&sop, sess_op, sizeof(struct strcop_session_op));
2346 if (err) return -EFAULT;
2347
2348 while (dev && (dev->sid != sop.ses_id)) {
2349 prev_dev = dev;
2350 dev = dev->next;
2351 }
2352 if (dev){
2353 if (prev_dev){
2354 prev_dev->next = dev->next;
2355 } else {
2356 filp->private_data = dev->next;
2357 }
2358 err = cryptocop_free_session(dev->sid);
2359 if (err) return -EFAULT;
2360 } else {
2361 DEBUG_API(printk("cryptocop_ioctl_close_session: session %lld not found\n", sop.ses_id));
2362 return -EINVAL;
2363 }
2364 return 0;
2365}
2366
2367
2368static void ioctl_process_job_callback(struct cryptocop_operation *op, void*cb_data)
2369{
2370 struct ioctl_job_cb_ctx *jc = (struct ioctl_job_cb_ctx *)cb_data;
2371
2372 DEBUG(printk("ioctl_process_job_callback: op=0x%p, cb_data=0x%p\n", op, cb_data));
2373
2374 jc->processed = 1;
2375 wake_up(&cryptocop_ioc_process_wq);
2376}
2377
2378
2379#define CRYPTOCOP_IOCTL_CIPHER_TID (1)
2380#define CRYPTOCOP_IOCTL_DIGEST_TID (2)
2381#define CRYPTOCOP_IOCTL_CSUM_TID (3)
2382
2383static size_t first_cfg_change_ix(struct strcop_crypto_op *crp_op)
2384{
2385 size_t ch_ix = 0;
2386
2387 if (crp_op->do_cipher) ch_ix = crp_op->cipher_start;
2388 if (crp_op->do_digest && (crp_op->digest_start < ch_ix)) ch_ix = crp_op->digest_start;
2389 if (crp_op->do_csum && (crp_op->csum_start < ch_ix)) ch_ix = crp_op->csum_start;
2390
2391 DEBUG(printk("first_cfg_change_ix: ix=%d\n", ch_ix));
2392 return ch_ix;
2393}
2394
2395
2396static size_t next_cfg_change_ix(struct strcop_crypto_op *crp_op, size_t ix)
2397{
2398 size_t ch_ix = INT_MAX;
2399 size_t tmp_ix = 0;
2400
2401 if (crp_op->do_cipher && ((crp_op->cipher_start + crp_op->cipher_len) > ix)){
2402 if (crp_op->cipher_start > ix) {
2403 ch_ix = crp_op->cipher_start;
2404 } else {
2405 ch_ix = crp_op->cipher_start + crp_op->cipher_len;
2406 }
2407 }
2408 if (crp_op->do_digest && ((crp_op->digest_start + crp_op->digest_len) > ix)){
2409 if (crp_op->digest_start > ix) {
2410 tmp_ix = crp_op->digest_start;
2411 } else {
2412 tmp_ix = crp_op->digest_start + crp_op->digest_len;
2413 }
2414 if (tmp_ix < ch_ix) ch_ix = tmp_ix;
2415 }
2416 if (crp_op->do_csum && ((crp_op->csum_start + crp_op->csum_len) > ix)){
2417 if (crp_op->csum_start > ix) {
2418 tmp_ix = crp_op->csum_start;
2419 } else {
2420 tmp_ix = crp_op->csum_start + crp_op->csum_len;
2421 }
2422 if (tmp_ix < ch_ix) ch_ix = tmp_ix;
2423 }
2424 if (ch_ix == INT_MAX) ch_ix = ix;
2425 DEBUG(printk("next_cfg_change_ix prev ix=%d, next ix=%d\n", ix, ch_ix));
2426 return ch_ix;
2427}
2428
2429
2430/* Map map_length bytes from the pages starting on *pageix and *pageoffset to iovecs starting on *iovix.
2431 * Return -1 for ok, 0 for fail. */
2432static int map_pages_to_iovec(struct iovec *iov, int iovlen, int *iovix, struct page **pages, int nopages, int *pageix, int *pageoffset, int map_length )
2433{
2434 int tmplen;
2435
2436 assert(iov != NULL);
2437 assert(iovix != NULL);
2438 assert(pages != NULL);
2439 assert(pageix != NULL);
2440 assert(pageoffset != NULL);
2441
2442 DEBUG(printk("map_pages_to_iovec, map_length=%d, iovlen=%d, *iovix=%d, nopages=%d, *pageix=%d, *pageoffset=%d\n", map_length, iovlen, *iovix, nopages, *pageix, *pageoffset));
2443
2444 while (map_length > 0){
2445 DEBUG(printk("map_pages_to_iovec, map_length=%d, iovlen=%d, *iovix=%d, nopages=%d, *pageix=%d, *pageoffset=%d\n", map_length, iovlen, *iovix, nopages, *pageix, *pageoffset));
2446 if (*iovix >= iovlen){
2447 DEBUG_API(printk("map_page_to_iovec: *iovix=%d >= iovlen=%d\n", *iovix, iovlen));
2448 return 0;
2449 }
2450 if (*pageix >= nopages){
2451 DEBUG_API(printk("map_page_to_iovec: *pageix=%d >= nopages=%d\n", *pageix, nopages));
2452 return 0;
2453 }
2454 iov[*iovix].iov_base = (unsigned char*)page_address(pages[*pageix]) + *pageoffset;
2455 tmplen = PAGE_SIZE - *pageoffset;
2456 if (tmplen < map_length){
2457 (*pageoffset) = 0;
2458 (*pageix)++;
2459 } else {
2460 tmplen = map_length;
2461 (*pageoffset) += map_length;
2462 }
2463 DEBUG(printk("mapping %d bytes from page %d (or %d) to iovec %d\n", tmplen, *pageix, *pageix-1, *iovix));
2464 iov[*iovix].iov_len = tmplen;
2465 map_length -= tmplen;
2466 (*iovix)++;
2467 }
2468 DEBUG(printk("map_page_to_iovec, exit, *iovix=%d\n", *iovix));
2469 return -1;
2470}
2471
2472
2473
2474static int cryptocop_ioctl_process(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
2475{
2476 int i;
2477 struct cryptocop_private *dev = filp->private_data;
2478 struct strcop_crypto_op *crp_oper = (struct strcop_crypto_op *)arg;
2479 struct strcop_crypto_op oper = {0};
2480 int err = 0;
2481 struct cryptocop_operation *cop = NULL;
2482
2483 struct ioctl_job_cb_ctx *jc = NULL;
2484
2485 struct page **inpages = NULL;
2486 struct page **outpages = NULL;
2487 int noinpages = 0;
2488 int nooutpages = 0;
2489
2490 struct cryptocop_desc descs[5]; /* Max 5 descriptors are needed, there are three transforms that
2491 * can get connected/disconnected on different places in the indata. */
2492 struct cryptocop_desc_cfg dcfgs[5*3];
2493 int desc_ix = 0;
2494 int dcfg_ix = 0;
2495 struct cryptocop_tfrm_cfg ciph_tcfg = {0};
2496 struct cryptocop_tfrm_cfg digest_tcfg = {0};
2497 struct cryptocop_tfrm_cfg csum_tcfg = {0};
2498
2499 unsigned char *digest_result = NULL;
2500 int digest_length = 0;
2501 int cblocklen = 0;
2502 unsigned char csum_result[CSUM_BLOCK_LENGTH];
2503 struct cryptocop_session *sess;
2504
2505 int iovlen = 0;
2506 int iovix = 0;
2507 int pageix = 0;
2508 int pageoffset = 0;
2509
2510 size_t prev_ix = 0;
2511 size_t next_ix;
2512
2513 int cipher_active, digest_active, csum_active;
2514 int end_digest, end_csum;
2515 int digest_done = 0;
2516 int cipher_done = 0;
2517 int csum_done = 0;
2518
2519 DEBUG(printk("cryptocop_ioctl_process\n"));
2520
2521 if (!access_ok(VERIFY_WRITE, crp_oper, sizeof(struct strcop_crypto_op))){
2522 DEBUG_API(printk("cryptocop_ioctl_process: !access_ok crp_oper!\n"));
2523 return -EFAULT;
2524 }
2525 if (copy_from_user(&oper, crp_oper, sizeof(struct strcop_crypto_op))) {
2526 DEBUG_API(printk("cryptocop_ioctl_process: copy_from_user\n"));
2527 return -EFAULT;
2528 }
2529 DEBUG(print_strcop_crypto_op(&oper));
2530
2531 while (dev && dev->sid != oper.ses_id) dev = dev->next;
2532 if (!dev){
2533 DEBUG_API(printk("cryptocop_ioctl_process: session %lld not found\n", oper.ses_id));
2534 return -EINVAL;
2535 }
2536
2537 /* Check buffers. */
2538 if (((oper.indata + oper.inlen) < oper.indata) || ((oper.cipher_outdata + oper.cipher_outlen) < oper.cipher_outdata)){
2539 DEBUG_API(printk("cryptocop_ioctl_process: user buffers wrapped around, bad user!\n"));
2540 return -EINVAL;
2541 }
2542
2543 if (!access_ok(VERIFY_WRITE, oper.cipher_outdata, oper.cipher_outlen)){
2544 DEBUG_API(printk("cryptocop_ioctl_process: !access_ok out data!\n"));
2545 return -EFAULT;
2546 }
2547 if (!access_ok(VERIFY_READ, oper.indata, oper.inlen)){
2548 DEBUG_API(printk("cryptocop_ioctl_process: !access_ok in data!\n"));
2549 return -EFAULT;
2550 }
2551
2552 cop = kmalloc(sizeof(struct cryptocop_operation), GFP_KERNEL);
2553 if (!cop) {
2554 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc\n"));
2555 return -ENOMEM;
2556 }
2557 jc = kmalloc(sizeof(struct ioctl_job_cb_ctx), GFP_KERNEL);
2558 if (!jc) {
2559 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc\n"));
2560 err = -ENOMEM;
2561 goto error_cleanup;
2562 }
2563 jc->processed = 0;
2564
2565 cop->cb_data = jc;
2566 cop->cb = ioctl_process_job_callback;
2567 cop->operation_status = 0;
2568 cop->use_dmalists = 0;
2569 cop->in_interrupt = 0;
2570 cop->fast_callback = 0;
2571 cop->tfrm_op.tfrm_cfg = NULL;
2572 cop->tfrm_op.desc = NULL;
2573 cop->tfrm_op.indata = NULL;
2574 cop->tfrm_op.incount = 0;
2575 cop->tfrm_op.inlen = 0;
2576 cop->tfrm_op.outdata = NULL;
2577 cop->tfrm_op.outcount = 0;
2578 cop->tfrm_op.outlen = 0;
2579
2580 sess = get_session(oper.ses_id);
2581 if (!sess){
2582 DEBUG_API(printk("cryptocop_ioctl_process: bad session id.\n"));
2583 kfree(cop);
2584 kfree(jc);
2585 return -EINVAL;
2586 }
2587
2588 if (oper.do_cipher) {
2589 unsigned int cipher_outlen = 0;
2590 struct cryptocop_transform_ctx *tc = get_transform_ctx(sess, CRYPTOCOP_IOCTL_CIPHER_TID);
2591 if (!tc) {
2592 DEBUG_API(printk("cryptocop_ioctl_process: no cipher transform in session.\n"));
2593 err = -EINVAL;
2594 goto error_cleanup;
2595 }
2596 ciph_tcfg.tid = CRYPTOCOP_IOCTL_CIPHER_TID;
2597 ciph_tcfg.inject_ix = 0;
2598 ciph_tcfg.flags = 0;
2599 if ((oper.cipher_start < 0) || (oper.cipher_len <= 0) || (oper.cipher_start > oper.inlen) || ((oper.cipher_start + oper.cipher_len) > oper.inlen)){
2600 DEBUG_API(printk("cryptocop_ioctl_process: bad cipher length\n"));
2601 kfree(cop);
2602 kfree(jc);
2603 return -EINVAL;
2604 }
2605 cblocklen = tc->init.alg == cryptocop_alg_aes ? AES_BLOCK_LENGTH : DES_BLOCK_LENGTH;
2606 if (oper.cipher_len % cblocklen) {
2607 kfree(cop);
2608 kfree(jc);
2609 DEBUG_API(printk("cryptocop_ioctl_process: cipher inlength not multiple of block length.\n"));
2610 return -EINVAL;
2611 }
2612 cipher_outlen = oper.cipher_len;
2613 if (tc->init.cipher_mode == cryptocop_cipher_mode_cbc){
2614 if (oper.cipher_explicit) {
2615 ciph_tcfg.flags |= CRYPTOCOP_EXPLICIT_IV;
2616 memcpy(ciph_tcfg.iv, oper.cipher_iv, cblocklen);
2617 } else {
2618 cipher_outlen = oper.cipher_len - cblocklen;
2619 }
2620 } else {
2621 if (oper.cipher_explicit){
2622 kfree(cop);
2623 kfree(jc);
2624 DEBUG_API(printk("cryptocop_ioctl_process: explicit_iv when not CBC mode\n"));
2625 return -EINVAL;
2626 }
2627 }
2628 if (oper.cipher_outlen != cipher_outlen) {
2629 kfree(cop);
2630 kfree(jc);
2631 DEBUG_API(printk("cryptocop_ioctl_process: cipher_outlen incorrect, should be %d not %d.\n", cipher_outlen, oper.cipher_outlen));
2632 return -EINVAL;
2633 }
2634
2635 if (oper.decrypt){
2636 ciph_tcfg.flags |= CRYPTOCOP_DECRYPT;
2637 } else {
2638 ciph_tcfg.flags |= CRYPTOCOP_ENCRYPT;
2639 }
2640 ciph_tcfg.next = cop->tfrm_op.tfrm_cfg;
2641 cop->tfrm_op.tfrm_cfg = &ciph_tcfg;
2642 }
2643 if (oper.do_digest){
2644 struct cryptocop_transform_ctx *tc = get_transform_ctx(sess, CRYPTOCOP_IOCTL_DIGEST_TID);
2645 if (!tc) {
2646 DEBUG_API(printk("cryptocop_ioctl_process: no digest transform in session.\n"));
2647 err = -EINVAL;
2648 goto error_cleanup;
2649 }
2650 digest_length = tc->init.alg == cryptocop_alg_md5 ? 16 : 20;
2651 digest_result = kmalloc(digest_length, GFP_KERNEL);
2652 if (!digest_result) {
2653 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc digest_result\n"));
2654 err = -EINVAL;
2655 goto error_cleanup;
2656 }
2657 DEBUG(memset(digest_result, 0xff, digest_length));
2658
2659 digest_tcfg.tid = CRYPTOCOP_IOCTL_DIGEST_TID;
2660 digest_tcfg.inject_ix = 0;
2661 ciph_tcfg.inject_ix += digest_length;
2662 if ((oper.digest_start < 0) || (oper.digest_len <= 0) || (oper.digest_start > oper.inlen) || ((oper.digest_start + oper.digest_len) > oper.inlen)){
2663 DEBUG_API(printk("cryptocop_ioctl_process: bad digest length\n"));
2664 err = -EINVAL;
2665 goto error_cleanup;
2666 }
2667
2668 digest_tcfg.next = cop->tfrm_op.tfrm_cfg;
2669 cop->tfrm_op.tfrm_cfg = &digest_tcfg;
2670 }
2671 if (oper.do_csum){
2672 csum_tcfg.tid = CRYPTOCOP_IOCTL_CSUM_TID;
2673 csum_tcfg.inject_ix = digest_length;
2674 ciph_tcfg.inject_ix += 2;
2675
2676 if ((oper.csum_start < 0) || (oper.csum_len <= 0) || (oper.csum_start > oper.inlen) || ((oper.csum_start + oper.csum_len) > oper.inlen)){
2677 DEBUG_API(printk("cryptocop_ioctl_process: bad csum length\n"));
2678 kfree(cop);
2679 kfree(jc);
2680 return -EINVAL;
2681 }
2682
2683 csum_tcfg.next = cop->tfrm_op.tfrm_cfg;
2684 cop->tfrm_op.tfrm_cfg = &csum_tcfg;
2685 }
2686
2687 prev_ix = first_cfg_change_ix(&oper);
2688 if (prev_ix > oper.inlen) {
2689 DEBUG_API(printk("cryptocop_ioctl_process: length mismatch\n"));
2690 nooutpages = noinpages = 0;
2691 err = -EINVAL;
2692 goto error_cleanup;
2693 }
2694 DEBUG(printk("cryptocop_ioctl_process: inlen=%d, cipher_outlen=%d\n", oper.inlen, oper.cipher_outlen));
2695
2696 /* Map user pages for in and out data of the operation. */
2697 noinpages = (((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK) + oper.inlen - 1 - prev_ix + ~PAGE_MASK) >> PAGE_SHIFT;
2698 DEBUG(printk("cryptocop_ioctl_process: noinpages=%d\n", noinpages));
2699 inpages = kmalloc(noinpages * sizeof(struct page*), GFP_KERNEL);
2700 if (!inpages){
2701 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc inpages\n"));
2702 nooutpages = noinpages = 0;
2703 err = -ENOMEM;
2704 goto error_cleanup;
2705 }
2706 if (oper.do_cipher){
2707 nooutpages = (((unsigned long int)oper.cipher_outdata & ~PAGE_MASK) + oper.cipher_outlen - 1 + ~PAGE_MASK) >> PAGE_SHIFT;
2708 DEBUG(printk("cryptocop_ioctl_process: nooutpages=%d\n", nooutpages));
2709 outpages = kmalloc(nooutpages * sizeof(struct page*), GFP_KERNEL);
2710 if (!outpages){
2711 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc outpages\n"));
2712 nooutpages = noinpages = 0;
2713 err = -ENOMEM;
2714 goto error_cleanup;
2715 }
2716 }
2717
2718 /* Acquire the mm page semaphore. */
2719 down_read(&current->mm->mmap_sem);
2720
2721 err = get_user_pages(current,
2722 current->mm,
2723 (unsigned long int)(oper.indata + prev_ix),
2724 noinpages,
2725 0, /* read access only for in data */
2726 0, /* no force */
2727 inpages,
2728 NULL);
2729
2730 if (err < 0) {
2731 up_read(&current->mm->mmap_sem);
2732 nooutpages = noinpages = 0;
2733 DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages indata\n"));
2734 goto error_cleanup;
2735 }
2736 noinpages = err;
2737 if (oper.do_cipher){
2738 err = get_user_pages(current,
2739 current->mm,
2740 (unsigned long int)oper.cipher_outdata,
2741 nooutpages,
2742 1, /* write access for out data */
2743 0, /* no force */
2744 outpages,
2745 NULL);
2746 up_read(&current->mm->mmap_sem);
2747 if (err < 0) {
2748 nooutpages = 0;
2749 DEBUG_API(printk("cryptocop_ioctl_process: get_user_pages outdata\n"));
2750 goto error_cleanup;
2751 }
2752 nooutpages = err;
2753 } else {
2754 up_read(&current->mm->mmap_sem);
2755 }
2756
2757 /* Add 6 to nooutpages to make room for possibly inserted buffers for storing digest and
2758 * csum output and splits when units are (dis-)connected. */
2759 cop->tfrm_op.indata = kmalloc((noinpages) * sizeof(struct iovec), GFP_KERNEL);
2760 cop->tfrm_op.outdata = kmalloc((6 + nooutpages) * sizeof(struct iovec), GFP_KERNEL);
2761 if (!cop->tfrm_op.indata || !cop->tfrm_op.outdata) {
2762 DEBUG_API(printk("cryptocop_ioctl_process: kmalloc iovecs\n"));
2763 err = -ENOMEM;
2764 goto error_cleanup;
2765 }
2766
2767 cop->tfrm_op.inlen = oper.inlen - prev_ix;
2768 cop->tfrm_op.outlen = 0;
2769 if (oper.do_cipher) cop->tfrm_op.outlen += oper.cipher_outlen;
2770 if (oper.do_digest) cop->tfrm_op.outlen += digest_length;
2771 if (oper.do_csum) cop->tfrm_op.outlen += 2;
2772
2773 /* Setup the in iovecs. */
2774 cop->tfrm_op.incount = noinpages;
2775 if (noinpages > 1){
2776 size_t tmplen = cop->tfrm_op.inlen;
2777
2778 cop->tfrm_op.indata[0].iov_len = PAGE_SIZE - ((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK);
2779 cop->tfrm_op.indata[0].iov_base = (unsigned char*)page_address(inpages[0]) + ((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK);
2780 tmplen -= cop->tfrm_op.indata[0].iov_len;
2781 for (i = 1; i<noinpages; i++){
2782 cop->tfrm_op.indata[i].iov_len = tmplen < PAGE_SIZE ? tmplen : PAGE_SIZE;
2783 cop->tfrm_op.indata[i].iov_base = (unsigned char*)page_address(inpages[i]);
2784 tmplen -= PAGE_SIZE;
2785 }
2786 } else {
2787 cop->tfrm_op.indata[0].iov_len = oper.inlen - prev_ix;
2788 cop->tfrm_op.indata[0].iov_base = (unsigned char*)page_address(inpages[0]) + ((unsigned long int)(oper.indata + prev_ix) & ~PAGE_MASK);
2789 }
2790
2791 iovlen = nooutpages + 6;
2792 pageoffset = oper.do_cipher ? ((unsigned long int)oper.cipher_outdata & ~PAGE_MASK) : 0;
2793
2794 next_ix = next_cfg_change_ix(&oper, prev_ix);
2795 if (prev_ix == next_ix){
2796 DEBUG_API(printk("cryptocop_ioctl_process: length configuration broken.\n"));
2797 err = -EINVAL; /* This should be impossible barring bugs. */
2798 goto error_cleanup;
2799 }
2800 while (prev_ix != next_ix){
2801 end_digest = end_csum = cipher_active = digest_active = csum_active = 0;
2802 descs[desc_ix].cfg = NULL;
2803 descs[desc_ix].length = next_ix - prev_ix;
2804
2805 if (oper.do_cipher && (oper.cipher_start < next_ix) && (prev_ix < (oper.cipher_start + oper.cipher_len))) {
2806 dcfgs[dcfg_ix].tid = CRYPTOCOP_IOCTL_CIPHER_TID;
2807 dcfgs[dcfg_ix].src = cryptocop_source_dma;
2808 cipher_active = 1;
2809
2810 if (next_ix == (oper.cipher_start + oper.cipher_len)){
2811 cipher_done = 1;
2812 dcfgs[dcfg_ix].last = 1;
2813 } else {
2814 dcfgs[dcfg_ix].last = 0;
2815 }
2816 dcfgs[dcfg_ix].next = descs[desc_ix].cfg;
2817 descs[desc_ix].cfg = &dcfgs[dcfg_ix];
2818 ++dcfg_ix;
2819 }
2820 if (oper.do_digest && (oper.digest_start < next_ix) && (prev_ix < (oper.digest_start + oper.digest_len))) {
2821 digest_active = 1;
2822 dcfgs[dcfg_ix].tid = CRYPTOCOP_IOCTL_DIGEST_TID;
2823 dcfgs[dcfg_ix].src = cryptocop_source_dma;
2824 if (next_ix == (oper.digest_start + oper.digest_len)){
2825 assert(!digest_done);
2826 digest_done = 1;
2827 dcfgs[dcfg_ix].last = 1;
2828 } else {
2829 dcfgs[dcfg_ix].last = 0;
2830 }
2831 dcfgs[dcfg_ix].next = descs[desc_ix].cfg;
2832 descs[desc_ix].cfg = &dcfgs[dcfg_ix];
2833 ++dcfg_ix;
2834 }
2835 if (oper.do_csum && (oper.csum_start < next_ix) && (prev_ix < (oper.csum_start + oper.csum_len))){
2836 csum_active = 1;
2837 dcfgs[dcfg_ix].tid = CRYPTOCOP_IOCTL_CSUM_TID;
2838 dcfgs[dcfg_ix].src = cryptocop_source_dma;
2839 if (next_ix == (oper.csum_start + oper.csum_len)){
2840 csum_done = 1;
2841 dcfgs[dcfg_ix].last = 1;
2842 } else {
2843 dcfgs[dcfg_ix].last = 0;
2844 }
2845 dcfgs[dcfg_ix].next = descs[desc_ix].cfg;
2846 descs[desc_ix].cfg = &dcfgs[dcfg_ix];
2847 ++dcfg_ix;
2848 }
2849 if (!descs[desc_ix].cfg){
2850 DEBUG_API(printk("cryptocop_ioctl_process: data segment %d (%d to %d) had no active transforms\n", desc_ix, prev_ix, next_ix));
2851 err = -EINVAL;
2852 goto error_cleanup;
2853 }
2854 descs[desc_ix].next = &(descs[desc_ix]) + 1;
2855 ++desc_ix;
2856 prev_ix = next_ix;
2857 next_ix = next_cfg_change_ix(&oper, prev_ix);
2858 }
2859 if (desc_ix > 0){
2860 descs[desc_ix-1].next = NULL;
2861 } else {
2862 descs[0].next = NULL;
2863 }
2864 if (oper.do_digest) {
2865 DEBUG(printk("cryptocop_ioctl_process: mapping %d byte digest output to iovec %d\n", digest_length, iovix));
2866 /* Add outdata iovec, length == <length of type of digest> */
2867 cop->tfrm_op.outdata[iovix].iov_base = digest_result;
2868 cop->tfrm_op.outdata[iovix].iov_len = digest_length;
2869 ++iovix;
2870 }
2871 if (oper.do_csum) {
2872 /* Add outdata iovec, length == 2, the length of csum. */
2873 DEBUG(printk("cryptocop_ioctl_process: mapping 2 byte csum output to iovec %d\n", iovix));
2874 /* Add outdata iovec, length == <length of type of digest> */
2875 cop->tfrm_op.outdata[iovix].iov_base = csum_result;
2876 cop->tfrm_op.outdata[iovix].iov_len = 2;
2877 ++iovix;
2878 }
2879 if (oper.do_cipher) {
2880 if (!map_pages_to_iovec(cop->tfrm_op.outdata, iovlen, &iovix, outpages, nooutpages, &pageix, &pageoffset, oper.cipher_outlen)){
2881 DEBUG_API(printk("cryptocop_ioctl_process: failed to map pages to iovec.\n"));
2882 err = -ENOSYS; /* This should be impossible barring bugs. */
2883 goto error_cleanup;
2884 }
2885 }
2886 DEBUG(printk("cryptocop_ioctl_process: setting cop->tfrm_op.outcount %d\n", iovix));
2887 cop->tfrm_op.outcount = iovix;
2888 assert(iovix <= (nooutpages + 6));
2889
2890 cop->sid = oper.ses_id;
2891 cop->tfrm_op.desc = &descs[0];
2892
2893 DEBUG(printk("cryptocop_ioctl_process: inserting job, cb_data=0x%p\n", cop->cb_data));
2894
2895 if ((err = cryptocop_job_queue_insert_user_job(cop)) != 0) {
2896 DEBUG_API(printk("cryptocop_ioctl_process: insert job %d\n", err));
2897 err = -EINVAL;
2898 goto error_cleanup;
2899 }
2900
2901 DEBUG(printk("cryptocop_ioctl_process: begin wait for result\n"));
2902
2903 wait_event(cryptocop_ioc_process_wq, (jc->processed != 0));
2904 DEBUG(printk("cryptocop_ioctl_process: end wait for result\n"));
2905 if (!jc->processed){
2906 printk(KERN_WARNING "cryptocop_ioctl_process: job not processed at completion\n");
2907 err = -EIO;
2908 goto error_cleanup;
2909 }
2910
2911 /* Job process done. Cipher output should already be correct in job so no post processing of outdata. */
2912 DEBUG(printk("cryptocop_ioctl_process: operation_status = %d\n", cop->operation_status));
2913 if (cop->operation_status == 0){
2914 if (oper.do_digest){
2915 DEBUG(printk("cryptocop_ioctl_process: copy %d bytes digest to user\n", digest_length));
2916 err = copy_to_user((unsigned char*)crp_oper + offsetof(struct strcop_crypto_op, digest), digest_result, digest_length);
2917 if (0 != err){
2918 DEBUG_API(printk("cryptocop_ioctl_process: copy_to_user, digest length %d, err %d\n", digest_length, err));
2919 err = -EFAULT;
2920 goto error_cleanup;
2921 }
2922 }
2923 if (oper.do_csum){
2924 DEBUG(printk("cryptocop_ioctl_process: copy 2 bytes checksum to user\n"));
2925 err = copy_to_user((unsigned char*)crp_oper + offsetof(struct strcop_crypto_op, csum), csum_result, 2);
2926 if (0 != err){
2927 DEBUG_API(printk("cryptocop_ioctl_process: copy_to_user, csum, err %d\n", err));
2928 err = -EFAULT;
2929 goto error_cleanup;
2930 }
2931 }
2932 err = 0;
2933 } else {
2934 DEBUG(printk("cryptocop_ioctl_process: returning err = operation_status = %d\n", cop->operation_status));
2935 err = cop->operation_status;
2936 }
2937
2938 error_cleanup:
2939 /* Release page caches. */
2940 for (i = 0; i < noinpages; i++){
2941 put_page(inpages[i]);
2942 }
2943 for (i = 0; i < nooutpages; i++){
2944 int spdl_err;
2945 /* Mark output pages dirty. */
2946 spdl_err = set_page_dirty_lock(outpages[i]);
2947 DEBUG(if (spdl_err)printk("cryptocop_ioctl_process: set_page_dirty_lock returned %d\n", spdl_err));
2948 }
2949 for (i = 0; i < nooutpages; i++){
2950 put_page(outpages[i]);
2951 }
2952
2953 if (digest_result) kfree(digest_result);
2954 if (inpages) kfree(inpages);
2955 if (outpages) kfree(outpages);
2956 if (cop){
2957 if (cop->tfrm_op.indata) kfree(cop->tfrm_op.indata);
2958 if (cop->tfrm_op.outdata) kfree(cop->tfrm_op.outdata);
2959 kfree(cop);
2960 }
2961 if (jc) kfree(jc);
2962
2963 DEBUG(print_lock_status());
2964
2965 return err;
2966}
2967
2968
2969static int cryptocop_ioctl_create_session(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
2970{
2971 cryptocop_session_id sid;
2972 int err;
2973 struct cryptocop_private *dev;
2974 struct strcop_session_op *sess_op = (struct strcop_session_op *)arg;
2975 struct strcop_session_op sop;
2976 struct cryptocop_transform_init *tis = NULL;
2977 struct cryptocop_transform_init ti_cipher = {0};
2978 struct cryptocop_transform_init ti_digest = {0};
2979 struct cryptocop_transform_init ti_csum = {0};
2980
2981 if (!access_ok(VERIFY_WRITE, sess_op, sizeof(struct strcop_session_op)))
2982 return -EFAULT;
2983 err = copy_from_user(&sop, sess_op, sizeof(struct strcop_session_op));
2984 if (err) return -EFAULT;
2985 if (sop.cipher != cryptocop_cipher_none) {
2986 if (!access_ok(VERIFY_READ, sop.key, sop.keylen)) return -EFAULT;
2987 }
2988 DEBUG(printk("cryptocop_ioctl_create_session, sess_op:\n"));
2989
2990 DEBUG(printk("\tcipher:%d\n"
2991 "\tcipher_mode:%d\n"
2992 "\tdigest:%d\n"
2993 "\tcsum:%d\n",
2994 (int)sop.cipher,
2995 (int)sop.cmode,
2996 (int)sop.digest,
2997 (int)sop.csum));
2998
2999 if (sop.cipher != cryptocop_cipher_none){
3000 /* Init the cipher. */
3001 switch (sop.cipher){
3002 case cryptocop_cipher_des:
3003 ti_cipher.alg = cryptocop_alg_des;
3004 break;
3005 case cryptocop_cipher_3des:
3006 ti_cipher.alg = cryptocop_alg_3des;
3007 break;
3008 case cryptocop_cipher_aes:
3009 ti_cipher.alg = cryptocop_alg_aes;
3010 break;
3011 default:
3012 DEBUG_API(printk("create session, bad cipher algorithm %d\n", sop.cipher));
3013 return -EINVAL;
3014 };
3015 DEBUG(printk("setting cipher transform %d\n", ti_cipher.alg));
3016 copy_from_user(ti_cipher.key, sop.key, sop.keylen/8);
3017 ti_cipher.keylen = sop.keylen;
3018 switch (sop.cmode){
3019 case cryptocop_cipher_mode_cbc:
3020 case cryptocop_cipher_mode_ecb:
3021 ti_cipher.cipher_mode = sop.cmode;
3022 break;
3023 default:
3024 DEBUG_API(printk("create session, bad cipher mode %d\n", sop.cmode));
3025 return -EINVAL;
3026 }
3027 DEBUG(printk("cryptocop_ioctl_create_session: setting CBC mode %d\n", ti_cipher.cipher_mode));
3028 switch (sop.des3_mode){
3029 case cryptocop_3des_eee:
3030 case cryptocop_3des_eed:
3031 case cryptocop_3des_ede:
3032 case cryptocop_3des_edd:
3033 case cryptocop_3des_dee:
3034 case cryptocop_3des_ded:
3035 case cryptocop_3des_dde:
3036 case cryptocop_3des_ddd:
3037 ti_cipher.tdes_mode = sop.des3_mode;
3038 break;
3039 default:
3040 DEBUG_API(printk("create session, bad 3DES mode %d\n", sop.des3_mode));
3041 return -EINVAL;
3042 }
3043 ti_cipher.tid = CRYPTOCOP_IOCTL_CIPHER_TID;
3044 ti_cipher.next = tis;
3045 tis = &ti_cipher;
3046 } /* if (sop.cipher != cryptocop_cipher_none) */
3047 if (sop.digest != cryptocop_digest_none){
3048 DEBUG(printk("setting digest transform\n"));
3049 switch (sop.digest){
3050 case cryptocop_digest_md5:
3051 ti_digest.alg = cryptocop_alg_md5;
3052 break;
3053 case cryptocop_digest_sha1:
3054 ti_digest.alg = cryptocop_alg_sha1;
3055 break;
3056 default:
3057 DEBUG_API(printk("create session, bad digest algorithm %d\n", sop.digest));
3058 return -EINVAL;
3059 }
3060 ti_digest.tid = CRYPTOCOP_IOCTL_DIGEST_TID;
3061 ti_digest.next = tis;
3062 tis = &ti_digest;
3063 } /* if (sop.digest != cryptocop_digest_none) */
3064 if (sop.csum != cryptocop_csum_none){
3065 DEBUG(printk("setting csum transform\n"));
3066 switch (sop.csum){
3067 case cryptocop_csum_le:
3068 case cryptocop_csum_be:
3069 ti_csum.csum_mode = sop.csum;
3070 break;
3071 default:
3072 DEBUG_API(printk("create session, bad checksum algorithm %d\n", sop.csum));
3073 return -EINVAL;
3074 }
3075 ti_csum.alg = cryptocop_alg_csum;
3076 ti_csum.tid = CRYPTOCOP_IOCTL_CSUM_TID;
3077 ti_csum.next = tis;
3078 tis = &ti_csum;
3079 } /* (sop.csum != cryptocop_csum_none) */
3080 dev = kmalloc(sizeof(struct cryptocop_private), GFP_KERNEL);
3081 if (!dev){
3082 DEBUG_API(printk("create session, alloc dev\n"));
3083 return -ENOMEM;
3084 }
3085
3086 err = cryptocop_new_session(&sid, tis, GFP_KERNEL);
3087 DEBUG({ if (err) printk("create session, cryptocop_new_session %d\n", err);});
3088
3089 if (err) {
3090 kfree(dev);
3091 return err;
3092 }
3093 sess_op->ses_id = sid;
3094 dev->sid = sid;
3095 dev->next = filp->private_data;
3096 filp->private_data = dev;
3097
3098 return 0;
3099}
3100
3101static int cryptocop_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
3102{
3103 int err = 0;
3104 if (_IOC_TYPE(cmd) != ETRAXCRYPTOCOP_IOCTYPE) {
3105 DEBUG_API(printk("cryptocop_ioctl: wrong type\n"));
3106 return -ENOTTY;
3107 }
3108 if (_IOC_NR(cmd) > CRYPTOCOP_IO_MAXNR){
3109 return -ENOTTY;
3110 }
3111 /* Access check of the argument. Some commands, e.g. create session and process op,
3112 needs additional checks. Those are handled in the command handling functions. */
3113 if (_IOC_DIR(cmd) & _IOC_READ)
3114 err = !access_ok(VERIFY_WRITE, (void *)arg, _IOC_SIZE(cmd));
3115 else if (_IOC_DIR(cmd) & _IOC_WRITE)
3116 err = !access_ok(VERIFY_READ, (void *)arg, _IOC_SIZE(cmd));
3117 if (err) return -EFAULT;
3118
3119 switch (cmd) {
3120 case CRYPTOCOP_IO_CREATE_SESSION:
3121 return cryptocop_ioctl_create_session(inode, filp, cmd, arg);
3122 case CRYPTOCOP_IO_CLOSE_SESSION:
3123 return cryptocop_ioctl_close_session(inode, filp, cmd, arg);
3124 case CRYPTOCOP_IO_PROCESS_OP:
3125 return cryptocop_ioctl_process(inode, filp, cmd, arg);
3126 default:
3127 DEBUG_API(printk("cryptocop_ioctl: unknown command\n"));
3128 return -ENOTTY;
3129 }
3130 return 0;
3131}
3132
3133
3134#ifdef LDEBUG
3135static void print_dma_descriptors(struct cryptocop_int_operation *iop)
3136{
3137 struct cryptocop_dma_desc *cdesc_out = iop->cdesc_out;
3138 struct cryptocop_dma_desc *cdesc_in = iop->cdesc_in;
3139 int i;
3140
3141 printk("print_dma_descriptors start\n");
3142
3143 printk("iop:\n");
3144 printk("\tsid: 0x%lld\n", iop->sid);
3145
3146 printk("\tcdesc_out: 0x%p\n", iop->cdesc_out);
3147 printk("\tcdesc_in: 0x%p\n", iop->cdesc_in);
3148 printk("\tddesc_out: 0x%p\n", iop->ddesc_out);
3149 printk("\tddesc_in: 0x%p\n", iop->ddesc_in);
3150
3151 printk("\niop->ctx_out: 0x%p phys: 0x%p\n", &iop->ctx_out, (char*)virt_to_phys(&iop->ctx_out));
3152 printk("\tnext: 0x%p\n"
3153 "\tsaved_data: 0x%p\n"
3154 "\tsaved_data_buf: 0x%p\n",
3155 iop->ctx_out.next,
3156 iop->ctx_out.saved_data,
3157 iop->ctx_out.saved_data_buf);
3158
3159 printk("\niop->ctx_in: 0x%p phys: 0x%p\n", &iop->ctx_in, (char*)virt_to_phys(&iop->ctx_in));
3160 printk("\tnext: 0x%p\n"
3161 "\tsaved_data: 0x%p\n"
3162 "\tsaved_data_buf: 0x%p\n",
3163 iop->ctx_in.next,
3164 iop->ctx_in.saved_data,
3165 iop->ctx_in.saved_data_buf);
3166
3167 i = 0;
3168 while (cdesc_out) {
3169 dma_descr_data *td;
3170 printk("cdesc_out %d, desc=0x%p\n", i, cdesc_out->dma_descr);
3171 printk("\n\tvirt_to_phys(desc): 0x%p\n", (char*)virt_to_phys(cdesc_out->dma_descr));
3172 td = cdesc_out->dma_descr;
3173 printk("\n\tbuf: 0x%p\n"
3174 "\tafter: 0x%p\n"
3175 "\tmd: 0x%04x\n"
3176 "\tnext: 0x%p\n",
3177 td->buf,
3178 td->after,
3179 td->md,
3180 td->next);
3181 printk("flags:\n"
3182 "\twait:\t%d\n"
3183 "\teol:\t%d\n"
3184 "\touteop:\t%d\n"
3185 "\tineop:\t%d\n"
3186 "\tintr:\t%d\n",
3187 td->wait,
3188 td->eol,
3189 td->out_eop,
3190 td->in_eop,
3191 td->intr);
3192 cdesc_out = cdesc_out->next;
3193 i++;
3194 }
3195 i = 0;
3196 while (cdesc_in) {
3197 dma_descr_data *td;
3198 printk("cdesc_in %d, desc=0x%p\n", i, cdesc_in->dma_descr);
3199 printk("\n\tvirt_to_phys(desc): 0x%p\n", (char*)virt_to_phys(cdesc_in->dma_descr));
3200 td = cdesc_in->dma_descr;
3201 printk("\n\tbuf: 0x%p\n"
3202 "\tafter: 0x%p\n"
3203 "\tmd: 0x%04x\n"
3204 "\tnext: 0x%p\n",
3205 td->buf,
3206 td->after,
3207 td->md,
3208 td->next);
3209 printk("flags:\n"
3210 "\twait:\t%d\n"
3211 "\teol:\t%d\n"
3212 "\touteop:\t%d\n"
3213 "\tineop:\t%d\n"
3214 "\tintr:\t%d\n",
3215 td->wait,
3216 td->eol,
3217 td->out_eop,
3218 td->in_eop,
3219 td->intr);
3220 cdesc_in = cdesc_in->next;
3221 i++;
3222 }
3223
3224 printk("print_dma_descriptors end\n");
3225}
3226
3227
3228static void print_strcop_crypto_op(struct strcop_crypto_op *cop)
3229{
3230 printk("print_strcop_crypto_op, 0x%p\n", cop);
3231
3232 /* Indata. */
3233 printk("indata=0x%p\n"
3234 "inlen=%d\n"
3235 "do_cipher=%d\n"
3236 "decrypt=%d\n"
3237 "cipher_explicit=%d\n"
3238 "cipher_start=%d\n"
3239 "cipher_len=%d\n"
3240 "outdata=0x%p\n"
3241 "outlen=%d\n",
3242 cop->indata,
3243 cop->inlen,
3244 cop->do_cipher,
3245 cop->decrypt,
3246 cop->cipher_explicit,
3247 cop->cipher_start,
3248 cop->cipher_len,
3249 cop->cipher_outdata,
3250 cop->cipher_outlen);
3251
3252 printk("do_digest=%d\n"
3253 "digest_start=%d\n"
3254 "digest_len=%d\n",
3255 cop->do_digest,
3256 cop->digest_start,
3257 cop->digest_len);
3258
3259 printk("do_csum=%d\n"
3260 "csum_start=%d\n"
3261 "csum_len=%d\n",
3262 cop->do_csum,
3263 cop->csum_start,
3264 cop->csum_len);
3265}
3266
3267static void print_cryptocop_operation(struct cryptocop_operation *cop)
3268{
3269 struct cryptocop_desc *d;
3270 struct cryptocop_tfrm_cfg *tc;
3271 struct cryptocop_desc_cfg *dc;
3272 int i;
3273
3274 printk("print_cryptocop_operation, cop=0x%p\n\n", cop);
3275 printk("sid: %lld\n", cop->sid);
3276 printk("operation_status=%d\n"
3277 "use_dmalists=%d\n"
3278 "in_interrupt=%d\n"
3279 "fast_callback=%d\n",
3280 cop->operation_status,
3281 cop->use_dmalists,
3282 cop->in_interrupt,
3283 cop->fast_callback);
3284
3285 if (cop->use_dmalists){
3286 print_user_dma_lists(&cop->list_op);
3287 } else {
3288 printk("cop->tfrm_op\n"
3289 "tfrm_cfg=0x%p\n"
3290 "desc=0x%p\n"
3291 "indata=0x%p\n"
3292 "incount=%d\n"
3293 "inlen=%d\n"
3294 "outdata=0x%p\n"
3295 "outcount=%d\n"
3296 "outlen=%d\n\n",
3297 cop->tfrm_op.tfrm_cfg,
3298 cop->tfrm_op.desc,
3299 cop->tfrm_op.indata,
3300 cop->tfrm_op.incount,
3301 cop->tfrm_op.inlen,
3302 cop->tfrm_op.outdata,
3303 cop->tfrm_op.outcount,
3304 cop->tfrm_op.outlen);
3305
3306 tc = cop->tfrm_op.tfrm_cfg;
3307 while (tc){
3308 printk("tfrm_cfg, 0x%p\n"
3309 "tid=%d\n"
3310 "flags=%d\n"
3311 "inject_ix=%d\n"
3312 "next=0x%p\n",
3313 tc,
3314 tc->tid,
3315 tc->flags,
3316 tc->inject_ix,
3317 tc->next);
3318 tc = tc->next;
3319 }
3320 d = cop->tfrm_op.desc;
3321 while (d){
3322 printk("\n======================desc, 0x%p\n"
3323 "length=%d\n"
3324 "cfg=0x%p\n"
3325 "next=0x%p\n",
3326 d,
3327 d->length,
3328 d->cfg,
3329 d->next);
3330 dc = d->cfg;
3331 while (dc){
3332 printk("=========desc_cfg, 0x%p\n"
3333 "tid=%d\n"
3334 "src=%d\n"
3335 "last=%d\n"
3336 "next=0x%p\n",
3337 dc,
3338 dc->tid,
3339 dc->src,
3340 dc->last,
3341 dc->next);
3342 dc = dc->next;
3343 }
3344 d = d->next;
3345 }
3346 printk("\n====iniov\n");
3347 for (i = 0; i < cop->tfrm_op.incount; i++){
3348 printk("indata[%d]\n"
3349 "base=0x%p\n"
3350 "len=%d\n",
3351 i,
3352 cop->tfrm_op.indata[i].iov_base,
3353 cop->tfrm_op.indata[i].iov_len);
3354 }
3355 printk("\n====outiov\n");
3356 for (i = 0; i < cop->tfrm_op.outcount; i++){
3357 printk("outdata[%d]\n"
3358 "base=0x%p\n"
3359 "len=%d\n",
3360 i,
3361 cop->tfrm_op.outdata[i].iov_base,
3362 cop->tfrm_op.outdata[i].iov_len);
3363 }
3364 }
3365 printk("------------end print_cryptocop_operation\n");
3366}
3367
3368
3369static void print_user_dma_lists(struct cryptocop_dma_list_operation *dma_op)
3370{
3371 dma_descr_data *dd;
3372 int i;
3373
3374 printk("print_user_dma_lists, dma_op=0x%p\n", dma_op);
3375
3376 printk("out_data_buf = 0x%p, phys_to_virt(out_data_buf) = 0x%p\n", dma_op->out_data_buf, phys_to_virt((unsigned long int)dma_op->out_data_buf));
3377 printk("in_data_buf = 0x%p, phys_to_virt(in_data_buf) = 0x%p\n", dma_op->in_data_buf, phys_to_virt((unsigned long int)dma_op->in_data_buf));
3378
3379 printk("##############outlist\n");
3380 dd = phys_to_virt((unsigned long int)dma_op->outlist);
3381 i = 0;
3382 while (dd != NULL) {
3383 printk("#%d phys_to_virt(desc) 0x%p\n", i, dd);
3384 printk("\n\tbuf: 0x%p\n"
3385 "\tafter: 0x%p\n"
3386 "\tmd: 0x%04x\n"
3387 "\tnext: 0x%p\n",
3388 dd->buf,
3389 dd->after,
3390 dd->md,
3391 dd->next);
3392 printk("flags:\n"
3393 "\twait:\t%d\n"
3394 "\teol:\t%d\n"
3395 "\touteop:\t%d\n"
3396 "\tineop:\t%d\n"
3397 "\tintr:\t%d\n",
3398 dd->wait,
3399 dd->eol,
3400 dd->out_eop,
3401 dd->in_eop,
3402 dd->intr);
3403 if (dd->eol)
3404 dd = NULL;
3405 else
3406 dd = phys_to_virt((unsigned long int)dd->next);
3407 ++i;
3408 }
3409
3410 printk("##############inlist\n");
3411 dd = phys_to_virt((unsigned long int)dma_op->inlist);
3412 i = 0;
3413 while (dd != NULL) {
3414 printk("#%d phys_to_virt(desc) 0x%p\n", i, dd);
3415 printk("\n\tbuf: 0x%p\n"
3416 "\tafter: 0x%p\n"
3417 "\tmd: 0x%04x\n"
3418 "\tnext: 0x%p\n",
3419 dd->buf,
3420 dd->after,
3421 dd->md,
3422 dd->next);
3423 printk("flags:\n"
3424 "\twait:\t%d\n"
3425 "\teol:\t%d\n"
3426 "\touteop:\t%d\n"
3427 "\tineop:\t%d\n"
3428 "\tintr:\t%d\n",
3429 dd->wait,
3430 dd->eol,
3431 dd->out_eop,
3432 dd->in_eop,
3433 dd->intr);
3434 if (dd->eol)
3435 dd = NULL;
3436 else
3437 dd = phys_to_virt((unsigned long int)dd->next);
3438 ++i;
3439 }
3440}
3441
3442
3443static void print_lock_status(void)
3444{
3445 printk("**********************print_lock_status\n");
3446 printk("cryptocop_completed_jobs_lock %d\n", spin_is_locked(&cryptocop_completed_jobs_lock));
3447 printk("cryptocop_job_queue_lock %d\n", spin_is_locked(&cryptocop_job_queue_lock));
3448 printk("descr_pool_lock %d\n", spin_is_locked(&descr_pool_lock));
3449 printk("cryptocop_sessions_lock %d\n", spin_is_locked(cryptocop_sessions_lock));
3450 printk("running_job_lock %d\n", spin_is_locked(running_job_lock));
3451 printk("cryptocop_process_lock %d\n", spin_is_locked(cryptocop_process_lock));
3452}
3453#endif /* LDEBUG */
3454
3455
3456static const char cryptocop_name[] = "ETRAX FS stream co-processor";
3457
3458static int init_stream_coprocessor(void)
3459{
3460 int err;
3461 int i;
3462 static int initialized = 0;
3463
3464 if (initialized)
3465 return 0;
3466
3467 initialized = 1;
3468
3469 printk("ETRAX FS stream co-processor driver v0.01, (c) 2003 Axis Communications AB\n");
3470
3471 err = register_chrdev(CRYPTOCOP_MAJOR, cryptocop_name, &cryptocop_fops);
3472 if (err < 0) {
3473 printk(KERN_ERR "stream co-processor: could not get major number.\n");
3474 return err;
3475 }
3476
3477 err = init_cryptocop();
3478 if (err) {
3479 (void)unregister_chrdev(CRYPTOCOP_MAJOR, cryptocop_name);
3480 return err;
3481 }
3482 err = cryptocop_job_queue_init();
3483 if (err) {
3484 release_cryptocop();
3485 (void)unregister_chrdev(CRYPTOCOP_MAJOR, cryptocop_name);
3486 return err;
3487 }
3488 /* Init the descriptor pool. */
3489 for (i = 0; i < CRYPTOCOP_DESCRIPTOR_POOL_SIZE - 1; i++) {
3490 descr_pool[i].from_pool = 1;
3491 descr_pool[i].next = &descr_pool[i + 1];
3492 }
3493 descr_pool[i].from_pool = 1;
3494 descr_pool[i].next = NULL;
3495 descr_pool_free_list = &descr_pool[0];
3496 descr_pool_no_free = CRYPTOCOP_DESCRIPTOR_POOL_SIZE;
3497
3498 spin_lock_init(&cryptocop_completed_jobs_lock);
3499 spin_lock_init(&cryptocop_job_queue_lock);
3500 spin_lock_init(&descr_pool_lock);
3501 spin_lock_init(&cryptocop_sessions_lock);
3502 spin_lock_init(&running_job_lock);
3503 spin_lock_init(&cryptocop_process_lock);
3504
3505 cryptocop_sessions = NULL;
3506 next_sid = 1;
3507
3508 cryptocop_running_job = NULL;
3509
3510 printk("stream co-processor: init done.\n");
3511 return 0;
3512}
3513
3514static void __exit exit_stream_coprocessor(void)
3515{
3516 release_cryptocop();
3517 cryptocop_job_queue_close();
3518}
3519
3520module_init(init_stream_coprocessor);
3521module_exit(exit_stream_coprocessor);
3522
diff --git a/arch/cris/arch-v32/drivers/gpio.c b/arch/cris/arch-v32/drivers/gpio.c
new file mode 100644
index 000000000000..a551237dcb5e
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/gpio.c
@@ -0,0 +1,766 @@
1/* $Id: gpio.c,v 1.16 2005/06/19 17:06:49 starvik Exp $
2 *
3 * ETRAX CRISv32 general port I/O device
4 *
5 * Copyright (c) 1999, 2000, 2001, 2002, 2003 Axis Communications AB
6 *
7 * Authors: Bjorn Wesen (initial version)
8 * Ola Knutsson (LED handling)
9 * Johan Adolfsson (read/set directions, write, port G,
10 * port to ETRAX FS.
11 *
12 * $Log: gpio.c,v $
13 * Revision 1.16 2005/06/19 17:06:49 starvik
14 * Merge of Linux 2.6.12.
15 *
16 * Revision 1.15 2005/05/25 08:22:20 starvik
17 * Changed GPIO port order to fit packages/devices/axis-2.4.
18 *
19 * Revision 1.14 2005/04/24 18:35:08 starvik
20 * Updated with final register headers.
21 *
22 * Revision 1.13 2005/03/15 15:43:00 starvik
23 * dev_id needs to be supplied for shared IRQs.
24 *
25 * Revision 1.12 2005/03/10 17:12:00 starvik
26 * Protect alarm list with spinlock.
27 *
28 * Revision 1.11 2005/01/05 06:08:59 starvik
29 * No need to do local_irq_disable after local_irq_save.
30 *
31 * Revision 1.10 2004/11/19 08:38:31 starvik
32 * Removed old crap.
33 *
34 * Revision 1.9 2004/05/14 07:58:02 starvik
35 * Merge of changes from 2.4
36 *
37 * Revision 1.8 2003/09/11 07:29:50 starvik
38 * Merge of Linux 2.6.0-test5
39 *
40 * Revision 1.7 2003/07/10 13:25:46 starvik
41 * Compiles for 2.5.74
42 * Lindented ethernet.c
43 *
44 * Revision 1.6 2003/07/04 08:27:46 starvik
45 * Merge of Linux 2.5.74
46 *
47 * Revision 1.5 2003/06/10 08:26:37 johana
48 * Etrax -> ETRAX CRISv32
49 *
50 * Revision 1.4 2003/06/05 14:22:48 johana
51 * Initialise some_alarms.
52 *
53 * Revision 1.3 2003/06/05 10:15:46 johana
54 * New INTR_VECT macros.
55 * Enable interrupts in global config.
56 *
57 * Revision 1.2 2003/06/03 15:52:50 johana
58 * Initial CRIS v32 version.
59 *
60 * Revision 1.1 2003/06/03 08:53:15 johana
61 * Copy of os/lx25/arch/cris/arch-v10/drivers/gpio.c version 1.7.
62 *
63 */
64
65#include <linux/config.h>
66
67#include <linux/module.h>
68#include <linux/sched.h>
69#include <linux/slab.h>
70#include <linux/ioport.h>
71#include <linux/errno.h>
72#include <linux/kernel.h>
73#include <linux/fs.h>
74#include <linux/string.h>
75#include <linux/poll.h>
76#include <linux/init.h>
77#include <linux/interrupt.h>
78#include <linux/spinlock.h>
79
80#include <asm/etraxgpio.h>
81#include <asm/arch/hwregs/reg_map.h>
82#include <asm/arch/hwregs/reg_rdwr.h>
83#include <asm/arch/hwregs/gio_defs.h>
84#include <asm/arch/hwregs/intr_vect_defs.h>
85#include <asm/io.h>
86#include <asm/system.h>
87#include <asm/irq.h>
88
89/* The following gio ports on ETRAX FS is available:
90 * pa 8 bits, supports interrupts off, hi, low, set, posedge, negedge anyedge
91 * pb 18 bits
92 * pc 18 bits
93 * pd 18 bits
94 * pe 18 bits
95 * each port has a rw_px_dout, r_px_din and rw_px_oe register.
96 */
97
98#define GPIO_MAJOR 120 /* experimental MAJOR number */
99
100#define D(x)
101
102#if 0
103static int dp_cnt;
104#define DP(x) do { dp_cnt++; if (dp_cnt % 1000 == 0) x; }while(0)
105#else
106#define DP(x)
107#endif
108
109static char gpio_name[] = "etrax gpio";
110
111#if 0
112static wait_queue_head_t *gpio_wq;
113#endif
114
115static int gpio_ioctl(struct inode *inode, struct file *file,
116 unsigned int cmd, unsigned long arg);
117static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
118 loff_t *off);
119static int gpio_open(struct inode *inode, struct file *filp);
120static int gpio_release(struct inode *inode, struct file *filp);
121static unsigned int gpio_poll(struct file *filp, struct poll_table_struct *wait);
122
123/* private data per open() of this driver */
124
125struct gpio_private {
126 struct gpio_private *next;
127 /* The IO_CFG_WRITE_MODE_VALUE only support 8 bits: */
128 unsigned char clk_mask;
129 unsigned char data_mask;
130 unsigned char write_msb;
131 unsigned char pad1;
132 /* These fields are generic */
133 unsigned long highalarm, lowalarm;
134 wait_queue_head_t alarm_wq;
135 int minor;
136};
137
138/* linked list of alarms to check for */
139
140static struct gpio_private *alarmlist = 0;
141
142static int gpio_some_alarms = 0; /* Set if someone uses alarm */
143static unsigned long gpio_pa_high_alarms = 0;
144static unsigned long gpio_pa_low_alarms = 0;
145
146static DEFINE_SPINLOCK(alarm_lock);
147
148#define NUM_PORTS (GPIO_MINOR_LAST+1)
149#define GIO_REG_RD_ADDR(reg) (volatile unsigned long*) (regi_gio + REG_RD_ADDR_gio_##reg )
150#define GIO_REG_WR_ADDR(reg) (volatile unsigned long*) (regi_gio + REG_RD_ADDR_gio_##reg )
151unsigned long led_dummy;
152
153static volatile unsigned long *data_out[NUM_PORTS] = {
154 GIO_REG_WR_ADDR(rw_pa_dout),
155 GIO_REG_WR_ADDR(rw_pb_dout),
156 &led_dummy,
157 GIO_REG_WR_ADDR(rw_pc_dout),
158 GIO_REG_WR_ADDR(rw_pd_dout),
159 GIO_REG_WR_ADDR(rw_pe_dout),
160};
161
162static volatile unsigned long *data_in[NUM_PORTS] = {
163 GIO_REG_RD_ADDR(r_pa_din),
164 GIO_REG_RD_ADDR(r_pb_din),
165 &led_dummy,
166 GIO_REG_RD_ADDR(r_pc_din),
167 GIO_REG_RD_ADDR(r_pd_din),
168 GIO_REG_RD_ADDR(r_pe_din),
169};
170
171static unsigned long changeable_dir[NUM_PORTS] = {
172 CONFIG_ETRAX_PA_CHANGEABLE_DIR,
173 CONFIG_ETRAX_PB_CHANGEABLE_DIR,
174 0,
175 CONFIG_ETRAX_PC_CHANGEABLE_DIR,
176 CONFIG_ETRAX_PD_CHANGEABLE_DIR,
177 CONFIG_ETRAX_PE_CHANGEABLE_DIR,
178};
179
180static unsigned long changeable_bits[NUM_PORTS] = {
181 CONFIG_ETRAX_PA_CHANGEABLE_BITS,
182 CONFIG_ETRAX_PB_CHANGEABLE_BITS,
183 0,
184 CONFIG_ETRAX_PC_CHANGEABLE_BITS,
185 CONFIG_ETRAX_PD_CHANGEABLE_BITS,
186 CONFIG_ETRAX_PE_CHANGEABLE_BITS,
187};
188
189static volatile unsigned long *dir_oe[NUM_PORTS] = {
190 GIO_REG_WR_ADDR(rw_pa_oe),
191 GIO_REG_WR_ADDR(rw_pb_oe),
192 &led_dummy,
193 GIO_REG_WR_ADDR(rw_pc_oe),
194 GIO_REG_WR_ADDR(rw_pd_oe),
195 GIO_REG_WR_ADDR(rw_pe_oe),
196};
197
198
199
200static unsigned int
201gpio_poll(struct file *file,
202 poll_table *wait)
203{
204 unsigned int mask = 0;
205 struct gpio_private *priv = (struct gpio_private *)file->private_data;
206 unsigned long data;
207 poll_wait(file, &priv->alarm_wq, wait);
208 if (priv->minor == GPIO_MINOR_A) {
209 reg_gio_rw_intr_cfg intr_cfg;
210 unsigned long tmp;
211 unsigned long flags;
212
213 local_irq_save(flags);
214 data = REG_TYPE_CONV(unsigned long, reg_gio_r_pa_din, REG_RD(gio, regi_gio, r_pa_din));
215 /* PA has support for interrupt
216 * lets activate high for those low and with highalarm set
217 */
218 intr_cfg = REG_RD(gio, regi_gio, rw_intr_cfg);
219
220 tmp = ~data & priv->highalarm & 0xFF;
221 if (tmp & (1 << 0)) {
222 intr_cfg.pa0 = regk_gio_hi;
223 }
224 if (tmp & (1 << 1)) {
225 intr_cfg.pa1 = regk_gio_hi;
226 }
227 if (tmp & (1 << 2)) {
228 intr_cfg.pa2 = regk_gio_hi;
229 }
230 if (tmp & (1 << 3)) {
231 intr_cfg.pa3 = regk_gio_hi;
232 }
233 if (tmp & (1 << 4)) {
234 intr_cfg.pa4 = regk_gio_hi;
235 }
236 if (tmp & (1 << 5)) {
237 intr_cfg.pa5 = regk_gio_hi;
238 }
239 if (tmp & (1 << 6)) {
240 intr_cfg.pa6 = regk_gio_hi;
241 }
242 if (tmp & (1 << 7)) {
243 intr_cfg.pa7 = regk_gio_hi;
244 }
245 /*
246 * lets activate low for those high and with lowalarm set
247 */
248 tmp = data & priv->lowalarm & 0xFF;
249 if (tmp & (1 << 0)) {
250 intr_cfg.pa0 = regk_gio_lo;
251 }
252 if (tmp & (1 << 1)) {
253 intr_cfg.pa1 = regk_gio_lo;
254 }
255 if (tmp & (1 << 2)) {
256 intr_cfg.pa2 = regk_gio_lo;
257 }
258 if (tmp & (1 << 3)) {
259 intr_cfg.pa3 = regk_gio_lo;
260 }
261 if (tmp & (1 << 4)) {
262 intr_cfg.pa4 = regk_gio_lo;
263 }
264 if (tmp & (1 << 5)) {
265 intr_cfg.pa5 = regk_gio_lo;
266 }
267 if (tmp & (1 << 6)) {
268 intr_cfg.pa6 = regk_gio_lo;
269 }
270 if (tmp & (1 << 7)) {
271 intr_cfg.pa7 = regk_gio_lo;
272 }
273
274 REG_WR(gio, regi_gio, rw_intr_cfg, intr_cfg);
275 local_irq_restore(flags);
276 } else if (priv->minor <= GPIO_MINOR_E)
277 data = *data_in[priv->minor];
278 else
279 return 0;
280
281 if ((data & priv->highalarm) ||
282 (~data & priv->lowalarm)) {
283 mask = POLLIN|POLLRDNORM;
284 }
285
286 DP(printk("gpio_poll ready: mask 0x%08X\n", mask));
287 return mask;
288}
289
290int etrax_gpio_wake_up_check(void)
291{
292 struct gpio_private *priv = alarmlist;
293 unsigned long data = 0;
294 int ret = 0;
295 while (priv) {
296 data = *data_in[priv->minor];
297 if ((data & priv->highalarm) ||
298 (~data & priv->lowalarm)) {
299 DP(printk("etrax_gpio_wake_up_check %i\n",priv->minor));
300 wake_up_interruptible(&priv->alarm_wq);
301 ret = 1;
302 }
303 priv = priv->next;
304 }
305 return ret;
306}
307
308static irqreturn_t
309gpio_poll_timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
310{
311 if (gpio_some_alarms) {
312 return IRQ_RETVAL(etrax_gpio_wake_up_check());
313 }
314 return IRQ_NONE;
315}
316
317static irqreturn_t
318gpio_pa_interrupt(int irq, void *dev_id, struct pt_regs *regs)
319{
320 reg_gio_rw_intr_mask intr_mask;
321 reg_gio_r_masked_intr masked_intr;
322 reg_gio_rw_ack_intr ack_intr;
323 unsigned long tmp;
324 unsigned long tmp2;
325
326 /* Find what PA interrupts are active */
327 masked_intr = REG_RD(gio, regi_gio, r_masked_intr);
328 tmp = REG_TYPE_CONV(unsigned long, reg_gio_r_masked_intr, masked_intr);
329
330 /* Find those that we have enabled */
331 spin_lock(&alarm_lock);
332 tmp &= (gpio_pa_high_alarms | gpio_pa_low_alarms);
333 spin_unlock(&alarm_lock);
334
335 /* Ack them */
336 ack_intr = REG_TYPE_CONV(reg_gio_rw_ack_intr, unsigned long, tmp);
337 REG_WR(gio, regi_gio, rw_ack_intr, ack_intr);
338
339 /* Disable those interrupts.. */
340 intr_mask = REG_RD(gio, regi_gio, rw_intr_mask);
341 tmp2 = REG_TYPE_CONV(unsigned long, reg_gio_rw_intr_mask, intr_mask);
342 tmp2 &= ~tmp;
343 intr_mask = REG_TYPE_CONV(reg_gio_rw_intr_mask, unsigned long, tmp2);
344 REG_WR(gio, regi_gio, rw_intr_mask, intr_mask);
345
346 if (gpio_some_alarms) {
347 return IRQ_RETVAL(etrax_gpio_wake_up_check());
348 }
349 return IRQ_NONE;
350}
351
352
353static ssize_t gpio_write(struct file * file, const char * buf, size_t count,
354 loff_t *off)
355{
356 struct gpio_private *priv = (struct gpio_private *)file->private_data;
357 unsigned char data, clk_mask, data_mask, write_msb;
358 unsigned long flags;
359 unsigned long shadow;
360 volatile unsigned long *port;
361 ssize_t retval = count;
362 /* Only bits 0-7 may be used for write operations but allow all
363 devices except leds... */
364 if (priv->minor == GPIO_MINOR_LEDS) {
365 return -EFAULT;
366 }
367
368 if (!access_ok(VERIFY_READ, buf, count)) {
369 return -EFAULT;
370 }
371 clk_mask = priv->clk_mask;
372 data_mask = priv->data_mask;
373 /* It must have been configured using the IO_CFG_WRITE_MODE */
374 /* Perhaps a better error code? */
375 if (clk_mask == 0 || data_mask == 0) {
376 return -EPERM;
377 }
378 write_msb = priv->write_msb;
379 D(printk("gpio_write: %lu to data 0x%02X clk 0x%02X msb: %i\n",count, data_mask, clk_mask, write_msb));
380 port = data_out[priv->minor];
381
382 while (count--) {
383 int i;
384 data = *buf++;
385 if (priv->write_msb) {
386 for (i = 7; i >= 0;i--) {
387 local_irq_save(flags);
388 shadow = *port;
389 *port = shadow &= ~clk_mask;
390 if (data & 1<<i)
391 *port = shadow |= data_mask;
392 else
393 *port = shadow &= ~data_mask;
394 /* For FPGA: min 5.0ns (DCC) before CCLK high */
395 *port = shadow |= clk_mask;
396 local_irq_restore(flags);
397 }
398 } else {
399 for (i = 0; i <= 7;i++) {
400 local_irq_save(flags);
401 shadow = *port;
402 *port = shadow &= ~clk_mask;
403 if (data & 1<<i)
404 *port = shadow |= data_mask;
405 else
406 *port = shadow &= ~data_mask;
407 /* For FPGA: min 5.0ns (DCC) before CCLK high */
408 *port = shadow |= clk_mask;
409 local_irq_restore(flags);
410 }
411 }
412 }
413 return retval;
414}
415
416
417
418static int
419gpio_open(struct inode *inode, struct file *filp)
420{
421 struct gpio_private *priv;
422 int p = MINOR(inode->i_rdev);
423
424 if (p > GPIO_MINOR_LAST)
425 return -EINVAL;
426
427 priv = (struct gpio_private *)kmalloc(sizeof(struct gpio_private),
428 GFP_KERNEL);
429
430 if (!priv)
431 return -ENOMEM;
432
433 priv->minor = p;
434
435 /* initialize the io/alarm struct and link it into our alarmlist */
436
437 priv->next = alarmlist;
438 alarmlist = priv;
439 priv->clk_mask = 0;
440 priv->data_mask = 0;
441 priv->highalarm = 0;
442 priv->lowalarm = 0;
443 init_waitqueue_head(&priv->alarm_wq);
444
445 filp->private_data = (void *)priv;
446
447 return 0;
448}
449
450static int
451gpio_release(struct inode *inode, struct file *filp)
452{
453 struct gpio_private *p = alarmlist;
454 struct gpio_private *todel = (struct gpio_private *)filp->private_data;
455 /* local copies while updating them: */
456 unsigned long a_high, a_low;
457 unsigned long some_alarms;
458
459 /* unlink from alarmlist and free the private structure */
460
461 if (p == todel) {
462 alarmlist = todel->next;
463 } else {
464 while (p->next != todel)
465 p = p->next;
466 p->next = todel->next;
467 }
468
469 kfree(todel);
470 /* Check if there are still any alarms set */
471 p = alarmlist;
472 some_alarms = 0;
473 a_high = 0;
474 a_low = 0;
475 while (p) {
476 if (p->minor == GPIO_MINOR_A) {
477 a_high |= p->highalarm;
478 a_low |= p->lowalarm;
479 }
480
481 if (p->highalarm | p->lowalarm) {
482 some_alarms = 1;
483 }
484 p = p->next;
485 }
486
487 spin_lock(&alarm_lock);
488 gpio_some_alarms = some_alarms;
489 gpio_pa_high_alarms = a_high;
490 gpio_pa_low_alarms = a_low;
491 spin_unlock(&alarm_lock);
492
493 return 0;
494}
495
496/* Main device API. ioctl's to read/set/clear bits, as well as to
497 * set alarms to wait for using a subsequent select().
498 */
499
500unsigned long inline setget_input(struct gpio_private *priv, unsigned long arg)
501{
502 /* Set direction 0=unchanged 1=input,
503 * return mask with 1=input
504 */
505 unsigned long flags;
506 unsigned long dir_shadow;
507
508 local_irq_save(flags);
509 dir_shadow = *dir_oe[priv->minor];
510 dir_shadow &= ~(arg & changeable_dir[priv->minor]);
511 *dir_oe[priv->minor] = dir_shadow;
512 local_irq_restore(flags);
513
514 if (priv->minor == GPIO_MINOR_A)
515 dir_shadow ^= 0xFF; /* Only 8 bits */
516 else
517 dir_shadow ^= 0x3FFFF; /* Only 18 bits */
518 return dir_shadow;
519
520} /* setget_input */
521
522unsigned long inline setget_output(struct gpio_private *priv, unsigned long arg)
523{
524 unsigned long flags;
525 unsigned long dir_shadow;
526
527 local_irq_save(flags);
528 dir_shadow = *dir_oe[priv->minor];
529 dir_shadow |= (arg & changeable_dir[priv->minor]);
530 *dir_oe[priv->minor] = dir_shadow;
531 local_irq_restore(flags);
532 return dir_shadow;
533} /* setget_output */
534
535static int
536gpio_leds_ioctl(unsigned int cmd, unsigned long arg);
537
538static int
539gpio_ioctl(struct inode *inode, struct file *file,
540 unsigned int cmd, unsigned long arg)
541{
542 unsigned long flags;
543 unsigned long val;
544 unsigned long shadow;
545 struct gpio_private *priv = (struct gpio_private *)file->private_data;
546 if (_IOC_TYPE(cmd) != ETRAXGPIO_IOCTYPE) {
547 return -EINVAL;
548 }
549
550 switch (_IOC_NR(cmd)) {
551 case IO_READBITS: /* Use IO_READ_INBITS and IO_READ_OUTBITS instead */
552 // read the port
553 return *data_in[priv->minor];
554 break;
555 case IO_SETBITS:
556 local_irq_save(flags);
557 if (arg & 0x04)
558 printk("GPIO SET 2\n");
559 // set changeable bits with a 1 in arg
560 shadow = *data_out[priv->minor];
561 shadow |= (arg & changeable_bits[priv->minor]);
562 *data_out[priv->minor] = shadow;
563 local_irq_restore(flags);
564 break;
565 case IO_CLRBITS:
566 local_irq_save(flags);
567 if (arg & 0x04)
568 printk("GPIO CLR 2\n");
569 // clear changeable bits with a 1 in arg
570 shadow = *data_out[priv->minor];
571 shadow &= ~(arg & changeable_bits[priv->minor]);
572 *data_out[priv->minor] = shadow;
573 local_irq_restore(flags);
574 break;
575 case IO_HIGHALARM:
576 // set alarm when bits with 1 in arg go high
577 priv->highalarm |= arg;
578 spin_lock(&alarm_lock);
579 gpio_some_alarms = 1;
580 if (priv->minor == GPIO_MINOR_A) {
581 gpio_pa_high_alarms |= arg;
582 }
583 spin_unlock(&alarm_lock);
584 break;
585 case IO_LOWALARM:
586 // set alarm when bits with 1 in arg go low
587 priv->lowalarm |= arg;
588 spin_lock(&alarm_lock);
589 gpio_some_alarms = 1;
590 if (priv->minor == GPIO_MINOR_A) {
591 gpio_pa_low_alarms |= arg;
592 }
593 spin_unlock(&alarm_lock);
594 break;
595 case IO_CLRALARM:
596 // clear alarm for bits with 1 in arg
597 priv->highalarm &= ~arg;
598 priv->lowalarm &= ~arg;
599 spin_lock(&alarm_lock);
600 if (priv->minor == GPIO_MINOR_A) {
601 if (gpio_pa_high_alarms & arg ||
602 gpio_pa_low_alarms & arg) {
603 /* Must update the gpio_pa_*alarms masks */
604 }
605 }
606 spin_unlock(&alarm_lock);
607 break;
608 case IO_READDIR: /* Use IO_SETGET_INPUT/OUTPUT instead! */
609 /* Read direction 0=input 1=output */
610 return *dir_oe[priv->minor];
611 case IO_SETINPUT: /* Use IO_SETGET_INPUT instead! */
612 /* Set direction 0=unchanged 1=input,
613 * return mask with 1=input
614 */
615 return setget_input(priv, arg);
616 break;
617 case IO_SETOUTPUT: /* Use IO_SETGET_OUTPUT instead! */
618 /* Set direction 0=unchanged 1=output,
619 * return mask with 1=output
620 */
621 return setget_output(priv, arg);
622
623 case IO_CFG_WRITE_MODE:
624 {
625 unsigned long dir_shadow;
626 dir_shadow = *dir_oe[priv->minor];
627
628 priv->clk_mask = arg & 0xFF;
629 priv->data_mask = (arg >> 8) & 0xFF;
630 priv->write_msb = (arg >> 16) & 0x01;
631 /* Check if we're allowed to change the bits and
632 * the direction is correct
633 */
634 if (!((priv->clk_mask & changeable_bits[priv->minor]) &&
635 (priv->data_mask & changeable_bits[priv->minor]) &&
636 (priv->clk_mask & dir_shadow) &&
637 (priv->data_mask & dir_shadow)))
638 {
639 priv->clk_mask = 0;
640 priv->data_mask = 0;
641 return -EPERM;
642 }
643 break;
644 }
645 case IO_READ_INBITS:
646 /* *arg is result of reading the input pins */
647 val = *data_in[priv->minor];
648 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
649 return -EFAULT;
650 return 0;
651 break;
652 case IO_READ_OUTBITS:
653 /* *arg is result of reading the output shadow */
654 val = *data_out[priv->minor];
655 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
656 return -EFAULT;
657 break;
658 case IO_SETGET_INPUT:
659 /* bits set in *arg is set to input,
660 * *arg updated with current input pins.
661 */
662 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
663 return -EFAULT;
664 val = setget_input(priv, val);
665 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
666 return -EFAULT;
667 break;
668 case IO_SETGET_OUTPUT:
669 /* bits set in *arg is set to output,
670 * *arg updated with current output pins.
671 */
672 if (copy_from_user(&val, (unsigned long*)arg, sizeof(val)))
673 return -EFAULT;
674 val = setget_output(priv, val);
675 if (copy_to_user((unsigned long*)arg, &val, sizeof(val)))
676 return -EFAULT;
677 break;
678 default:
679 if (priv->minor == GPIO_MINOR_LEDS)
680 return gpio_leds_ioctl(cmd, arg);
681 else
682 return -EINVAL;
683 } /* switch */
684
685 return 0;
686}
687
688static int
689gpio_leds_ioctl(unsigned int cmd, unsigned long arg)
690{
691 unsigned char green;
692 unsigned char red;
693
694 switch (_IOC_NR(cmd)) {
695 case IO_LEDACTIVE_SET:
696 green = ((unsigned char) arg) & 1;
697 red = (((unsigned char) arg) >> 1) & 1;
698 LED_ACTIVE_SET_G(green);
699 LED_ACTIVE_SET_R(red);
700 break;
701
702 default:
703 return -EINVAL;
704 } /* switch */
705
706 return 0;
707}
708
709struct file_operations gpio_fops = {
710 .owner = THIS_MODULE,
711 .poll = gpio_poll,
712 .ioctl = gpio_ioctl,
713 .write = gpio_write,
714 .open = gpio_open,
715 .release = gpio_release,
716};
717
718
719/* main driver initialization routine, called from mem.c */
720
721static __init int
722gpio_init(void)
723{
724 int res;
725 reg_intr_vect_rw_mask intr_mask;
726
727 /* do the formalities */
728
729 res = register_chrdev(GPIO_MAJOR, gpio_name, &gpio_fops);
730 if (res < 0) {
731 printk(KERN_ERR "gpio: couldn't get a major number.\n");
732 return res;
733 }
734
735 /* Clear all leds */
736 LED_NETWORK_SET(0);
737 LED_ACTIVE_SET(0);
738 LED_DISK_READ(0);
739 LED_DISK_WRITE(0);
740
741 printk("ETRAX FS GPIO driver v2.5, (c) 2003-2005 Axis Communications AB\n");
742 /* We call etrax_gpio_wake_up_check() from timer interrupt and
743 * from cpu_idle() in kernel/process.c
744 * The check in cpu_idle() reduces latency from ~15 ms to ~6 ms
745 * in some tests.
746 */
747 if (request_irq(TIMER_INTR_VECT, gpio_poll_timer_interrupt,
748 SA_SHIRQ | SA_INTERRUPT,"gpio poll", &alarmlist)) {
749 printk("err: timer0 irq for gpio\n");
750 }
751 if (request_irq(GEN_IO_INTR_VECT, gpio_pa_interrupt,
752 SA_SHIRQ | SA_INTERRUPT,"gpio PA", &alarmlist)) {
753 printk("err: PA irq for gpio\n");
754 }
755 /* enable the gio and timer irq in global config */
756 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
757 intr_mask.timer = 1;
758 intr_mask.gen_io = 1;
759 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
760
761 return res;
762}
763
764/* this makes sure that gpio_init is called during kernel boot */
765
766module_init(gpio_init);
diff --git a/arch/cris/arch-v32/drivers/i2c.c b/arch/cris/arch-v32/drivers/i2c.c
new file mode 100644
index 000000000000..440c20a94963
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/i2c.c
@@ -0,0 +1,611 @@
1/*!***************************************************************************
2*!
3*! FILE NAME : i2c.c
4*!
5*! DESCRIPTION: implements an interface for IIC/I2C, both directly from other
6*! kernel modules (i2c_writereg/readreg) and from userspace using
7*! ioctl()'s
8*!
9*! Nov 30 1998 Torbjorn Eliasson Initial version.
10*! Bjorn Wesen Elinux kernel version.
11*! Jan 14 2000 Johan Adolfsson Fixed PB shadow register stuff -
12*! don't use PB_I2C if DS1302 uses same bits,
13*! use PB.
14*| June 23 2003 Pieter Grimmerink Added 'i2c_sendnack'. i2c_readreg now
15*| generates nack on last received byte,
16*| instead of ack.
17*| i2c_getack changed data level while clock
18*| was high, causing DS75 to see a stop condition
19*!
20*! ---------------------------------------------------------------------------
21*!
22*! (C) Copyright 1999-2002 Axis Communications AB, LUND, SWEDEN
23*!
24*!***************************************************************************/
25/* $Id: i2c.c,v 1.2 2005/05/09 15:29:49 starvik Exp $ */
26/****************** INCLUDE FILES SECTION ***********************************/
27
28#include <linux/module.h>
29#include <linux/sched.h>
30#include <linux/slab.h>
31#include <linux/errno.h>
32#include <linux/kernel.h>
33#include <linux/fs.h>
34#include <linux/string.h>
35#include <linux/init.h>
36#include <linux/config.h>
37
38#include <asm/etraxi2c.h>
39
40#include <asm/system.h>
41#include <asm/io.h>
42#include <asm/delay.h>
43
44#include "i2c.h"
45
46/****************** I2C DEFINITION SECTION *************************/
47
48#define D(x)
49
50#define I2C_MAJOR 123 /* LOCAL/EXPERIMENTAL */
51static const char i2c_name[] = "i2c";
52
53#define CLOCK_LOW_TIME 8
54#define CLOCK_HIGH_TIME 8
55#define START_CONDITION_HOLD_TIME 8
56#define STOP_CONDITION_HOLD_TIME 8
57#define ENABLE_OUTPUT 0x01
58#define ENABLE_INPUT 0x00
59#define I2C_CLOCK_HIGH 1
60#define I2C_CLOCK_LOW 0
61#define I2C_DATA_HIGH 1
62#define I2C_DATA_LOW 0
63
64#define i2c_enable()
65#define i2c_disable()
66
67/* enable or disable output-enable, to select output or input on the i2c bus */
68
69#define i2c_dir_out() crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_out)
70#define i2c_dir_in() crisv32_io_set_dir(&cris_i2c_data, crisv32_io_dir_in)
71
72/* control the i2c clock and data signals */
73
74#define i2c_clk(x) crisv32_io_set(&cris_i2c_clk, x)
75#define i2c_data(x) crisv32_io_set(&cris_i2c_data, x)
76
77/* read a bit from the i2c interface */
78
79#define i2c_getbit() crisv32_io_rd(&cris_i2c_data)
80
81#define i2c_delay(usecs) udelay(usecs)
82
83/****************** VARIABLE SECTION ************************************/
84
85static struct crisv32_iopin cris_i2c_clk;
86static struct crisv32_iopin cris_i2c_data;
87
88/****************** FUNCTION DEFINITION SECTION *************************/
89
90
91/* generate i2c start condition */
92
93void
94i2c_start(void)
95{
96 /*
97 * SCL=1 SDA=1
98 */
99 i2c_dir_out();
100 i2c_delay(CLOCK_HIGH_TIME/6);
101 i2c_data(I2C_DATA_HIGH);
102 i2c_clk(I2C_CLOCK_HIGH);
103 i2c_delay(CLOCK_HIGH_TIME);
104 /*
105 * SCL=1 SDA=0
106 */
107 i2c_data(I2C_DATA_LOW);
108 i2c_delay(START_CONDITION_HOLD_TIME);
109 /*
110 * SCL=0 SDA=0
111 */
112 i2c_clk(I2C_CLOCK_LOW);
113 i2c_delay(CLOCK_LOW_TIME);
114}
115
116/* generate i2c stop condition */
117
118void
119i2c_stop(void)
120{
121 i2c_dir_out();
122
123 /*
124 * SCL=0 SDA=0
125 */
126 i2c_clk(I2C_CLOCK_LOW);
127 i2c_data(I2C_DATA_LOW);
128 i2c_delay(CLOCK_LOW_TIME*2);
129 /*
130 * SCL=1 SDA=0
131 */
132 i2c_clk(I2C_CLOCK_HIGH);
133 i2c_delay(CLOCK_HIGH_TIME*2);
134 /*
135 * SCL=1 SDA=1
136 */
137 i2c_data(I2C_DATA_HIGH);
138 i2c_delay(STOP_CONDITION_HOLD_TIME);
139
140 i2c_dir_in();
141}
142
143/* write a byte to the i2c interface */
144
145void
146i2c_outbyte(unsigned char x)
147{
148 int i;
149
150 i2c_dir_out();
151
152 for (i = 0; i < 8; i++) {
153 if (x & 0x80) {
154 i2c_data(I2C_DATA_HIGH);
155 } else {
156 i2c_data(I2C_DATA_LOW);
157 }
158
159 i2c_delay(CLOCK_LOW_TIME/2);
160 i2c_clk(I2C_CLOCK_HIGH);
161 i2c_delay(CLOCK_HIGH_TIME);
162 i2c_clk(I2C_CLOCK_LOW);
163 i2c_delay(CLOCK_LOW_TIME/2);
164 x <<= 1;
165 }
166 i2c_data(I2C_DATA_LOW);
167 i2c_delay(CLOCK_LOW_TIME/2);
168
169 /*
170 * enable input
171 */
172 i2c_dir_in();
173}
174
175/* read a byte from the i2c interface */
176
177unsigned char
178i2c_inbyte(void)
179{
180 unsigned char aBitByte = 0;
181 int i;
182
183 /* Switch off I2C to get bit */
184 i2c_disable();
185 i2c_dir_in();
186 i2c_delay(CLOCK_HIGH_TIME/2);
187
188 /* Get bit */
189 aBitByte |= i2c_getbit();
190
191 /* Enable I2C */
192 i2c_enable();
193 i2c_delay(CLOCK_LOW_TIME/2);
194
195 for (i = 1; i < 8; i++) {
196 aBitByte <<= 1;
197 /* Clock pulse */
198 i2c_clk(I2C_CLOCK_HIGH);
199 i2c_delay(CLOCK_HIGH_TIME);
200 i2c_clk(I2C_CLOCK_LOW);
201 i2c_delay(CLOCK_LOW_TIME);
202
203 /* Switch off I2C to get bit */
204 i2c_disable();
205 i2c_dir_in();
206 i2c_delay(CLOCK_HIGH_TIME/2);
207
208 /* Get bit */
209 aBitByte |= i2c_getbit();
210
211 /* Enable I2C */
212 i2c_enable();
213 i2c_delay(CLOCK_LOW_TIME/2);
214 }
215 i2c_clk(I2C_CLOCK_HIGH);
216 i2c_delay(CLOCK_HIGH_TIME);
217
218 /*
219 * we leave the clock low, getbyte is usually followed
220 * by sendack/nack, they assume the clock to be low
221 */
222 i2c_clk(I2C_CLOCK_LOW);
223 return aBitByte;
224}
225
226/*#---------------------------------------------------------------------------
227*#
228*# FUNCTION NAME: i2c_getack
229*#
230*# DESCRIPTION : checks if ack was received from ic2
231*#
232*#--------------------------------------------------------------------------*/
233
234int
235i2c_getack(void)
236{
237 int ack = 1;
238 /*
239 * enable output
240 */
241 i2c_dir_out();
242 /*
243 * Release data bus by setting
244 * data high
245 */
246 i2c_data(I2C_DATA_HIGH);
247 /*
248 * enable input
249 */
250 i2c_dir_in();
251 i2c_delay(CLOCK_HIGH_TIME/4);
252 /*
253 * generate ACK clock pulse
254 */
255 i2c_clk(I2C_CLOCK_HIGH);
256 /*
257 * Use PORT PB instead of I2C
258 * for input. (I2C not working)
259 */
260 i2c_clk(1);
261 i2c_data(1);
262 /*
263 * switch off I2C
264 */
265 i2c_data(1);
266 i2c_disable();
267 i2c_dir_in();
268 /*
269 * now wait for ack
270 */
271 i2c_delay(CLOCK_HIGH_TIME/2);
272 /*
273 * check for ack
274 */
275 if(i2c_getbit())
276 ack = 0;
277 i2c_delay(CLOCK_HIGH_TIME/2);
278 if(!ack){
279 if(!i2c_getbit()) /* receiver pulld SDA low */
280 ack = 1;
281 i2c_delay(CLOCK_HIGH_TIME/2);
282 }
283
284 /*
285 * our clock is high now, make sure data is low
286 * before we enable our output. If we keep data high
287 * and enable output, we would generate a stop condition.
288 */
289 i2c_data(I2C_DATA_LOW);
290
291 /*
292 * end clock pulse
293 */
294 i2c_enable();
295 i2c_dir_out();
296 i2c_clk(I2C_CLOCK_LOW);
297 i2c_delay(CLOCK_HIGH_TIME/4);
298 /*
299 * enable output
300 */
301 i2c_dir_out();
302 /*
303 * remove ACK clock pulse
304 */
305 i2c_data(I2C_DATA_HIGH);
306 i2c_delay(CLOCK_LOW_TIME/2);
307 return ack;
308}
309
310/*#---------------------------------------------------------------------------
311*#
312*# FUNCTION NAME: I2C::sendAck
313*#
314*# DESCRIPTION : Send ACK on received data
315*#
316*#--------------------------------------------------------------------------*/
317void
318i2c_sendack(void)
319{
320 /*
321 * enable output
322 */
323 i2c_delay(CLOCK_LOW_TIME);
324 i2c_dir_out();
325 /*
326 * set ack pulse high
327 */
328 i2c_data(I2C_DATA_LOW);
329 /*
330 * generate clock pulse
331 */
332 i2c_delay(CLOCK_HIGH_TIME/6);
333 i2c_clk(I2C_CLOCK_HIGH);
334 i2c_delay(CLOCK_HIGH_TIME);
335 i2c_clk(I2C_CLOCK_LOW);
336 i2c_delay(CLOCK_LOW_TIME/6);
337 /*
338 * reset data out
339 */
340 i2c_data(I2C_DATA_HIGH);
341 i2c_delay(CLOCK_LOW_TIME);
342
343 i2c_dir_in();
344}
345
346/*#---------------------------------------------------------------------------
347*#
348*# FUNCTION NAME: i2c_sendnack
349*#
350*# DESCRIPTION : Sends NACK on received data
351*#
352*#--------------------------------------------------------------------------*/
353void
354i2c_sendnack(void)
355{
356 /*
357 * enable output
358 */
359 i2c_delay(CLOCK_LOW_TIME);
360 i2c_dir_out();
361 /*
362 * set data high
363 */
364 i2c_data(I2C_DATA_HIGH);
365 /*
366 * generate clock pulse
367 */
368 i2c_delay(CLOCK_HIGH_TIME/6);
369 i2c_clk(I2C_CLOCK_HIGH);
370 i2c_delay(CLOCK_HIGH_TIME);
371 i2c_clk(I2C_CLOCK_LOW);
372 i2c_delay(CLOCK_LOW_TIME);
373
374 i2c_dir_in();
375}
376
377/*#---------------------------------------------------------------------------
378*#
379*# FUNCTION NAME: i2c_writereg
380*#
381*# DESCRIPTION : Writes a value to an I2C device
382*#
383*#--------------------------------------------------------------------------*/
384int
385i2c_writereg(unsigned char theSlave, unsigned char theReg,
386 unsigned char theValue)
387{
388 int error, cntr = 3;
389 unsigned long flags;
390
391 do {
392 error = 0;
393 /*
394 * we don't like to be interrupted
395 */
396 local_irq_save(flags);
397
398 i2c_start();
399 /*
400 * send slave address
401 */
402 i2c_outbyte((theSlave & 0xfe));
403 /*
404 * wait for ack
405 */
406 if(!i2c_getack())
407 error = 1;
408 /*
409 * now select register
410 */
411 i2c_dir_out();
412 i2c_outbyte(theReg);
413 /*
414 * now it's time to wait for ack
415 */
416 if(!i2c_getack())
417 error |= 2;
418 /*
419 * send register register data
420 */
421 i2c_outbyte(theValue);
422 /*
423 * now it's time to wait for ack
424 */
425 if(!i2c_getack())
426 error |= 4;
427 /*
428 * end byte stream
429 */
430 i2c_stop();
431 /*
432 * enable interrupt again
433 */
434 local_irq_restore(flags);
435
436 } while(error && cntr--);
437
438 i2c_delay(CLOCK_LOW_TIME);
439
440 return -error;
441}
442
443/*#---------------------------------------------------------------------------
444*#
445*# FUNCTION NAME: i2c_readreg
446*#
447*# DESCRIPTION : Reads a value from the decoder registers.
448*#
449*#--------------------------------------------------------------------------*/
450unsigned char
451i2c_readreg(unsigned char theSlave, unsigned char theReg)
452{
453 unsigned char b = 0;
454 int error, cntr = 3;
455 unsigned long flags;
456
457 do {
458 error = 0;
459 /*
460 * we don't like to be interrupted
461 */
462 local_irq_save(flags);
463 /*
464 * generate start condition
465 */
466 i2c_start();
467
468 /*
469 * send slave address
470 */
471 i2c_outbyte((theSlave & 0xfe));
472 /*
473 * wait for ack
474 */
475 if(!i2c_getack())
476 error = 1;
477 /*
478 * now select register
479 */
480 i2c_dir_out();
481 i2c_outbyte(theReg);
482 /*
483 * now it's time to wait for ack
484 */
485 if(!i2c_getack())
486 error = 1;
487 /*
488 * repeat start condition
489 */
490 i2c_delay(CLOCK_LOW_TIME);
491 i2c_start();
492 /*
493 * send slave address
494 */
495 i2c_outbyte(theSlave | 0x01);
496 /*
497 * wait for ack
498 */
499 if(!i2c_getack())
500 error = 1;
501 /*
502 * fetch register
503 */
504 b = i2c_inbyte();
505 /*
506 * last received byte needs to be nacked
507 * instead of acked
508 */
509 i2c_sendnack();
510 /*
511 * end sequence
512 */
513 i2c_stop();
514 /*
515 * enable interrupt again
516 */
517 local_irq_restore(flags);
518
519 } while(error && cntr--);
520
521 return b;
522}
523
524static int
525i2c_open(struct inode *inode, struct file *filp)
526{
527 return 0;
528}
529
530static int
531i2c_release(struct inode *inode, struct file *filp)
532{
533 return 0;
534}
535
536/* Main device API. ioctl's to write or read to/from i2c registers.
537 */
538
539static int
540i2c_ioctl(struct inode *inode, struct file *file,
541 unsigned int cmd, unsigned long arg)
542{
543 if(_IOC_TYPE(cmd) != ETRAXI2C_IOCTYPE) {
544 return -EINVAL;
545 }
546
547 switch (_IOC_NR(cmd)) {
548 case I2C_WRITEREG:
549 /* write to an i2c slave */
550 D(printk("i2cw %d %d %d\n",
551 I2C_ARGSLAVE(arg),
552 I2C_ARGREG(arg),
553 I2C_ARGVALUE(arg)));
554
555 return i2c_writereg(I2C_ARGSLAVE(arg),
556 I2C_ARGREG(arg),
557 I2C_ARGVALUE(arg));
558 case I2C_READREG:
559 {
560 unsigned char val;
561 /* read from an i2c slave */
562 D(printk("i2cr %d %d ",
563 I2C_ARGSLAVE(arg),
564 I2C_ARGREG(arg)));
565 val = i2c_readreg(I2C_ARGSLAVE(arg), I2C_ARGREG(arg));
566 D(printk("= %d\n", val));
567 return val;
568 }
569 default:
570 return -EINVAL;
571
572 }
573
574 return 0;
575}
576
577static struct file_operations i2c_fops = {
578 owner: THIS_MODULE,
579 ioctl: i2c_ioctl,
580 open: i2c_open,
581 release: i2c_release,
582};
583
584int __init
585i2c_init(void)
586{
587 int res;
588
589 /* Setup and enable the Port B I2C interface */
590
591 crisv32_io_get_name(&cris_i2c_data, CONFIG_ETRAX_I2C_DATA_PORT);
592 crisv32_io_get_name(&cris_i2c_clk, CONFIG_ETRAX_I2C_CLK_PORT);
593
594 /* register char device */
595
596 res = register_chrdev(I2C_MAJOR, i2c_name, &i2c_fops);
597 if(res < 0) {
598 printk(KERN_ERR "i2c: couldn't get a major number.\n");
599 return res;
600 }
601
602 printk(KERN_INFO "I2C driver v2.2, (c) 1999-2001 Axis Communications AB\n");
603
604 return 0;
605}
606
607/* this makes sure that i2c_init is called during boot */
608
609module_init(i2c_init);
610
611/****************** END OF FILE i2c.c ********************************/
diff --git a/arch/cris/arch-v32/drivers/i2c.h b/arch/cris/arch-v32/drivers/i2c.h
new file mode 100644
index 000000000000..bfe1a13f9f35
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/i2c.h
@@ -0,0 +1,15 @@
1
2#include <linux/init.h>
3
4/* High level I2C actions */
5int __init i2c_init(void);
6int i2c_writereg(unsigned char theSlave, unsigned char theReg, unsigned char theValue);
7unsigned char i2c_readreg(unsigned char theSlave, unsigned char theReg);
8
9/* Low level I2C */
10void i2c_start(void);
11void i2c_stop(void);
12void i2c_outbyte(unsigned char x);
13unsigned char i2c_inbyte(void);
14int i2c_getack(void);
15void i2c_sendack(void);
diff --git a/arch/cris/arch-v32/drivers/iop_fw_load.c b/arch/cris/arch-v32/drivers/iop_fw_load.c
new file mode 100644
index 000000000000..11f9895ded50
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/iop_fw_load.c
@@ -0,0 +1,219 @@
1/* $Id: iop_fw_load.c,v 1.4 2005/04/07 09:27:46 larsv Exp $
2 *
3 * Firmware loader for ETRAX FS IO-Processor
4 *
5 * Copyright (C) 2004 Axis Communications AB
6 */
7
8#include <linux/module.h>
9#include <linux/kernel.h>
10#include <linux/init.h>
11#include <linux/device.h>
12#include <linux/firmware.h>
13
14#include <asm/arch/hwregs/reg_map.h>
15#include <asm/arch/hwregs/iop/iop_reg_space.h>
16#include <asm/arch/hwregs/iop/iop_mpu_macros.h>
17#include <asm/arch/hwregs/iop/iop_mpu_defs.h>
18#include <asm/arch/hwregs/iop/iop_spu_defs.h>
19#include <asm/arch/hwregs/iop/iop_sw_cpu_defs.h>
20
21#define IOP_TIMEOUT 100
22
23static struct device iop_spu_device[2] = {
24 { .bus_id = "iop-spu0", },
25 { .bus_id = "iop-spu1", },
26};
27
28static struct device iop_mpu_device = {
29 .bus_id = "iop-mpu",
30};
31
32static int wait_mpu_idle(void)
33{
34 reg_iop_mpu_r_stat mpu_stat;
35 unsigned int timeout = IOP_TIMEOUT;
36
37 do {
38 mpu_stat = REG_RD(iop_mpu, regi_iop_mpu, r_stat);
39 } while (mpu_stat.instr_reg_busy == regk_iop_mpu_yes && --timeout > 0);
40 if (timeout == 0) {
41 printk(KERN_ERR "Timeout waiting for MPU to be idle\n");
42 return -EBUSY;
43 }
44 return 0;
45}
46
47int iop_fw_load_spu(const unsigned char *fw_name, unsigned int spu_inst)
48{
49 reg_iop_sw_cpu_rw_mc_ctrl mc_ctrl = {
50 .wr_spu0_mem = regk_iop_sw_cpu_no,
51 .wr_spu1_mem = regk_iop_sw_cpu_no,
52 .size = 4,
53 .cmd = regk_iop_sw_cpu_reg_copy,
54 .keep_owner = regk_iop_sw_cpu_yes
55 };
56 reg_iop_spu_rw_ctrl spu_ctrl = {
57 .en = regk_iop_spu_no,
58 .fsm = regk_iop_spu_no,
59 };
60 reg_iop_sw_cpu_r_mc_stat mc_stat;
61 const struct firmware *fw_entry;
62 u32 *data;
63 unsigned int timeout;
64 int retval, i;
65
66 if (spu_inst > 1)
67 return -ENODEV;
68
69 /* get firmware */
70 retval = request_firmware(&fw_entry,
71 fw_name,
72 &iop_spu_device[spu_inst]);
73 if (retval != 0)
74 {
75 printk(KERN_ERR
76 "iop_load_spu: Failed to load firmware \"%s\"\n",
77 fw_name);
78 return retval;
79 }
80 data = (u32 *) fw_entry->data;
81
82 /* acquire ownership of memory controller */
83 switch (spu_inst) {
84 case 0:
85 mc_ctrl.wr_spu0_mem = regk_iop_sw_cpu_yes;
86 REG_WR(iop_spu, regi_iop_spu0, rw_ctrl, spu_ctrl);
87 break;
88 case 1:
89 mc_ctrl.wr_spu1_mem = regk_iop_sw_cpu_yes;
90 REG_WR(iop_spu, regi_iop_spu1, rw_ctrl, spu_ctrl);
91 break;
92 }
93 timeout = IOP_TIMEOUT;
94 do {
95 REG_WR(iop_sw_cpu, regi_iop_sw_cpu, rw_mc_ctrl, mc_ctrl);
96 mc_stat = REG_RD(iop_sw_cpu, regi_iop_sw_cpu, r_mc_stat);
97 } while (mc_stat.owned_by_cpu == regk_iop_sw_cpu_no && --timeout > 0);
98 if (timeout == 0) {
99 printk(KERN_ERR "Timeout waiting to acquire MC\n");
100 retval = -EBUSY;
101 goto out;
102 }
103
104 /* write to SPU memory */
105 for (i = 0; i < (fw_entry->size/4); i++) {
106 switch (spu_inst) {
107 case 0:
108 REG_WR_INT(iop_spu, regi_iop_spu0, rw_seq_pc, (i*4));
109 break;
110 case 1:
111 REG_WR_INT(iop_spu, regi_iop_spu1, rw_seq_pc, (i*4));
112 break;
113 }
114 REG_WR_INT(iop_sw_cpu, regi_iop_sw_cpu, rw_mc_data, *data);
115 data++;
116 }
117
118 /* release ownership of memory controller */
119 (void) REG_RD(iop_sw_cpu, regi_iop_sw_cpu, rs_mc_data);
120
121 out:
122 release_firmware(fw_entry);
123 return retval;
124}
125
126int iop_fw_load_mpu(unsigned char *fw_name)
127{
128 const unsigned int start_addr = 0;
129 reg_iop_mpu_rw_ctrl mpu_ctrl;
130 const struct firmware *fw_entry;
131 u32 *data;
132 int retval, i;
133
134 /* get firmware */
135 retval = request_firmware(&fw_entry, fw_name, &iop_mpu_device);
136 if (retval != 0)
137 {
138 printk(KERN_ERR
139 "iop_load_spu: Failed to load firmware \"%s\"\n",
140 fw_name);
141 return retval;
142 }
143 data = (u32 *) fw_entry->data;
144
145 /* disable MPU */
146 mpu_ctrl.en = regk_iop_mpu_no;
147 REG_WR(iop_mpu, regi_iop_mpu, rw_ctrl, mpu_ctrl);
148 /* put start address in R0 */
149 REG_WR_VECT(iop_mpu, regi_iop_mpu, rw_r, 0, start_addr);
150 /* write to memory by executing 'SWX i, 4, R0' for each word */
151 if ((retval = wait_mpu_idle()) != 0)
152 goto out;
153 REG_WR(iop_mpu, regi_iop_mpu, rw_instr, MPU_SWX_IIR_INSTR(0, 4, 0));
154 for (i = 0; i < (fw_entry->size / 4); i++) {
155 REG_WR_INT(iop_mpu, regi_iop_mpu, rw_immediate, *data);
156 if ((retval = wait_mpu_idle()) != 0)
157 goto out;
158 data++;
159 }
160
161 out:
162 release_firmware(fw_entry);
163 return retval;
164}
165
166int iop_start_mpu(unsigned int start_addr)
167{
168 reg_iop_mpu_rw_ctrl mpu_ctrl = { .en = regk_iop_mpu_yes };
169 int retval;
170
171 /* disable MPU */
172 if ((retval = wait_mpu_idle()) != 0)
173 goto out;
174 REG_WR(iop_mpu, regi_iop_mpu, rw_instr, MPU_HALT());
175 if ((retval = wait_mpu_idle()) != 0)
176 goto out;
177 /* set PC and wait for it to bite */
178 if ((retval = wait_mpu_idle()) != 0)
179 goto out;
180 REG_WR_INT(iop_mpu, regi_iop_mpu, rw_instr, MPU_BA_I(start_addr));
181 if ((retval = wait_mpu_idle()) != 0)
182 goto out;
183 /* make sure the MPU starts executing with interrupts disabled */
184 REG_WR(iop_mpu, regi_iop_mpu, rw_instr, MPU_DI());
185 if ((retval = wait_mpu_idle()) != 0)
186 goto out;
187 /* enable MPU */
188 REG_WR(iop_mpu, regi_iop_mpu, rw_ctrl, mpu_ctrl);
189 out:
190 return retval;
191}
192
193static int __init iop_fw_load_init(void)
194{
195 device_initialize(&iop_spu_device[0]);
196 kobject_set_name(&iop_spu_device[0].kobj, "iop-spu0");
197 kobject_add(&iop_spu_device[0].kobj);
198 device_initialize(&iop_spu_device[1]);
199 kobject_set_name(&iop_spu_device[1].kobj, "iop-spu1");
200 kobject_add(&iop_spu_device[1].kobj);
201 device_initialize(&iop_mpu_device);
202 kobject_set_name(&iop_mpu_device.kobj, "iop-mpu");
203 kobject_add(&iop_mpu_device.kobj);
204 return 0;
205}
206
207static void __exit iop_fw_load_exit(void)
208{
209}
210
211module_init(iop_fw_load_init);
212module_exit(iop_fw_load_exit);
213
214MODULE_DESCRIPTION("ETRAX FS IO-Processor Firmware Loader");
215MODULE_LICENSE("GPL");
216
217EXPORT_SYMBOL(iop_fw_load_spu);
218EXPORT_SYMBOL(iop_fw_load_mpu);
219EXPORT_SYMBOL(iop_start_mpu);
diff --git a/arch/cris/arch-v32/drivers/nandflash.c b/arch/cris/arch-v32/drivers/nandflash.c
new file mode 100644
index 000000000000..fc2a619b035d
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/nandflash.c
@@ -0,0 +1,157 @@
1/*
2 * arch/cris/arch-v32/drivers/nandflash.c
3 *
4 * Copyright (c) 2004
5 *
6 * Derived from drivers/mtd/nand/spia.c
7 * Copyright (C) 2000 Steven J. Hill (sjhill@realitydiluted.com)
8 *
9 * $Id: nandflash.c,v 1.3 2005/06/01 10:57:12 starvik Exp $
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 *
15 */
16
17#include <linux/version.h>
18#include <linux/slab.h>
19#include <linux/init.h>
20#include <linux/module.h>
21#include <linux/mtd/mtd.h>
22#include <linux/mtd/nand.h>
23#include <linux/mtd/partitions.h>
24#include <asm/arch/memmap.h>
25#include <asm/arch/hwregs/reg_map.h>
26#include <asm/arch/hwregs/reg_rdwr.h>
27#include <asm/arch/hwregs/gio_defs.h>
28#include <asm/arch/hwregs/bif_core_defs.h>
29#include <asm/io.h>
30
31#define CE_BIT 4
32#define CLE_BIT 5
33#define ALE_BIT 6
34#define BY_BIT 7
35
36static struct mtd_info *crisv32_mtd = NULL;
37/*
38 * hardware specific access to control-lines
39*/
40static void crisv32_hwcontrol(struct mtd_info *mtd, int cmd)
41{
42 unsigned long flags;
43 reg_gio_rw_pa_dout dout = REG_RD(gio, regi_gio, rw_pa_dout);
44
45 local_irq_save(flags);
46 switch(cmd){
47 case NAND_CTL_SETCLE:
48 dout.data |= (1<<CLE_BIT);
49 break;
50 case NAND_CTL_CLRCLE:
51 dout.data &= ~(1<<CLE_BIT);
52 break;
53 case NAND_CTL_SETALE:
54 dout.data |= (1<<ALE_BIT);
55 break;
56 case NAND_CTL_CLRALE:
57 dout.data &= ~(1<<ALE_BIT);
58 break;
59 case NAND_CTL_SETNCE:
60 dout.data |= (1<<CE_BIT);
61 break;
62 case NAND_CTL_CLRNCE:
63 dout.data &= ~(1<<CE_BIT);
64 break;
65 }
66 REG_WR(gio, regi_gio, rw_pa_dout, dout);
67 local_irq_restore(flags);
68}
69
70/*
71* read device ready pin
72*/
73int crisv32_device_ready(struct mtd_info *mtd)
74{
75 reg_gio_r_pa_din din = REG_RD(gio, regi_gio, r_pa_din);
76 return ((din.data & (1 << BY_BIT)) >> BY_BIT);
77}
78
79/*
80 * Main initialization routine
81 */
82struct mtd_info* __init crisv32_nand_flash_probe (void)
83{
84 void __iomem *read_cs;
85 void __iomem *write_cs;
86
87 reg_bif_core_rw_grp3_cfg bif_cfg = REG_RD(bif_core, regi_bif_core, rw_grp3_cfg);
88 reg_gio_rw_pa_oe pa_oe = REG_RD(gio, regi_gio, rw_pa_oe);
89 struct nand_chip *this;
90 int err = 0;
91
92 /* Allocate memory for MTD device structure and private data */
93 crisv32_mtd = kmalloc (sizeof(struct mtd_info) + sizeof (struct nand_chip),
94 GFP_KERNEL);
95 if (!crisv32_mtd) {
96 printk ("Unable to allocate CRISv32 NAND MTD device structure.\n");
97 err = -ENOMEM;
98 return NULL;
99 }
100
101 read_cs = ioremap(MEM_CSP0_START | MEM_NON_CACHEABLE, 8192);
102 write_cs = ioremap(MEM_CSP1_START | MEM_NON_CACHEABLE, 8192);
103
104 if (!read_cs || !write_cs) {
105 printk("CRISv32 NAND ioremap failed\n");
106 err = -EIO;
107 goto out_mtd;
108 }
109
110 /* Get pointer to private data */
111 this = (struct nand_chip *) (&crisv32_mtd[1]);
112
113 pa_oe.oe |= 1 << CE_BIT;
114 pa_oe.oe |= 1 << ALE_BIT;
115 pa_oe.oe |= 1 << CLE_BIT;
116 pa_oe.oe &= ~ (1 << BY_BIT);
117 REG_WR(gio, regi_gio, rw_pa_oe, pa_oe);
118
119 bif_cfg.gated_csp0 = regk_bif_core_rd;
120 bif_cfg.gated_csp1 = regk_bif_core_wr;
121 REG_WR(bif_core, regi_bif_core, rw_grp3_cfg, bif_cfg);
122
123 /* Initialize structures */
124 memset((char *) crisv32_mtd, 0, sizeof(struct mtd_info));
125 memset((char *) this, 0, sizeof(struct nand_chip));
126
127 /* Link the private data with the MTD structure */
128 crisv32_mtd->priv = this;
129
130 /* Set address of NAND IO lines */
131 this->IO_ADDR_R = read_cs;
132 this->IO_ADDR_W = write_cs;
133 this->hwcontrol = crisv32_hwcontrol;
134 this->dev_ready = crisv32_device_ready;
135 /* 20 us command delay time */
136 this->chip_delay = 20;
137 this->eccmode = NAND_ECC_SOFT;
138
139 /* Enable the following for a flash based bad block table */
140 this->options = NAND_USE_FLASH_BBT;
141
142 /* Scan to find existance of the device */
143 if (nand_scan (crisv32_mtd, 1)) {
144 err = -ENXIO;
145 goto out_ior;
146 }
147
148 return crisv32_mtd;
149
150out_ior:
151 iounmap((void *)read_cs);
152 iounmap((void *)write_cs);
153out_mtd:
154 kfree (crisv32_mtd);
155 return NULL;
156}
157
diff --git a/arch/cris/arch-v32/drivers/pcf8563.c b/arch/cris/arch-v32/drivers/pcf8563.c
new file mode 100644
index 000000000000..f894580b648b
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pcf8563.c
@@ -0,0 +1,341 @@
1/*
2 * PCF8563 RTC
3 *
4 * From Phillips' datasheet:
5 *
6 * The PCF8563 is a CMOS real-time clock/calendar optimized for low power
7 * consumption. A programmable clock output, interupt output and voltage
8 * low detector are also provided. All address and data are transferred
9 * serially via two-line bidirectional I2C-bus. Maximum bus speed is
10 * 400 kbits/s. The built-in word address register is incremented
11 * automatically after each written or read byte.
12 *
13 * Copyright (c) 2002-2003, Axis Communications AB
14 * All rights reserved.
15 *
16 * Author: Tobias Anderberg <tobiasa@axis.com>.
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/version.h>
22#include <linux/module.h>
23#include <linux/kernel.h>
24#include <linux/types.h>
25#include <linux/sched.h>
26#include <linux/init.h>
27#include <linux/fs.h>
28#include <linux/ioctl.h>
29#include <linux/delay.h>
30#include <linux/bcd.h>
31
32#include <asm/uaccess.h>
33#include <asm/system.h>
34#include <asm/io.h>
35#include <asm/rtc.h>
36
37#include "i2c.h"
38
39#define PCF8563_MAJOR 121 /* Local major number. */
40#define DEVICE_NAME "rtc" /* Name which is registered in /proc/devices. */
41#define PCF8563_NAME "PCF8563"
42#define DRIVER_VERSION "$Revision: 1.1 $"
43
44/* Two simple wrapper macros, saves a few keystrokes. */
45#define rtc_read(x) i2c_readreg(RTC_I2C_READ, x)
46#define rtc_write(x,y) i2c_writereg(RTC_I2C_WRITE, x, y)
47
48static const unsigned char days_in_month[] =
49 { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
50
51int pcf8563_ioctl(struct inode *, struct file *, unsigned int, unsigned long);
52int pcf8563_open(struct inode *, struct file *);
53int pcf8563_release(struct inode *, struct file *);
54
55static struct file_operations pcf8563_fops = {
56 owner: THIS_MODULE,
57 ioctl: pcf8563_ioctl,
58 open: pcf8563_open,
59 release: pcf8563_release,
60};
61
62unsigned char
63pcf8563_readreg(int reg)
64{
65 unsigned char res = rtc_read(reg);
66
67 /* The PCF8563 does not return 0 for unimplemented bits */
68 switch (reg) {
69 case RTC_SECONDS:
70 case RTC_MINUTES:
71 res &= 0x7F;
72 break;
73 case RTC_HOURS:
74 case RTC_DAY_OF_MONTH:
75 res &= 0x3F;
76 break;
77 case RTC_WEEKDAY:
78 res &= 0x07;
79 break;
80 case RTC_MONTH:
81 res &= 0x1F;
82 break;
83 case RTC_CONTROL1:
84 res &= 0xA8;
85 break;
86 case RTC_CONTROL2:
87 res &= 0x1F;
88 break;
89 case RTC_CLOCKOUT_FREQ:
90 case RTC_TIMER_CONTROL:
91 res &= 0x83;
92 break;
93 }
94 return res;
95}
96
97void
98pcf8563_writereg(int reg, unsigned char val)
99{
100#ifdef CONFIG_ETRAX_RTC_READONLY
101 if (reg == RTC_CONTROL1 || (reg >= RTC_SECONDS && reg <= RTC_YEAR))
102 return;
103#endif
104
105 rtc_write(reg, val);
106}
107
108void
109get_rtc_time(struct rtc_time *tm)
110{
111 tm->tm_sec = rtc_read(RTC_SECONDS);
112 tm->tm_min = rtc_read(RTC_MINUTES);
113 tm->tm_hour = rtc_read(RTC_HOURS);
114 tm->tm_mday = rtc_read(RTC_DAY_OF_MONTH);
115 tm->tm_wday = rtc_read(RTC_WEEKDAY);
116 tm->tm_mon = rtc_read(RTC_MONTH);
117 tm->tm_year = rtc_read(RTC_YEAR);
118
119 if (tm->tm_sec & 0x80)
120 printk(KERN_WARNING "%s: RTC Voltage Low - reliable date/time "
121 "information is no longer guaranteed!\n", PCF8563_NAME);
122
123 tm->tm_year = BCD_TO_BIN(tm->tm_year) + ((tm->tm_mon & 0x80) ? 100 : 0);
124 tm->tm_sec &= 0x7F;
125 tm->tm_min &= 0x7F;
126 tm->tm_hour &= 0x3F;
127 tm->tm_mday &= 0x3F;
128 tm->tm_wday &= 0x07; /* Not coded in BCD. */
129 tm->tm_mon &= 0x1F;
130
131 BCD_TO_BIN(tm->tm_sec);
132 BCD_TO_BIN(tm->tm_min);
133 BCD_TO_BIN(tm->tm_hour);
134 BCD_TO_BIN(tm->tm_mday);
135 BCD_TO_BIN(tm->tm_mon);
136 tm->tm_mon--; /* Month is 1..12 in RTC but 0..11 in linux */
137}
138
139int __init
140pcf8563_init(void)
141{
142 /* Initiate the i2c protocol. */
143 i2c_init();
144
145 /*
146 * First of all we need to reset the chip. This is done by
147 * clearing control1, control2 and clk freq and resetting
148 * all alarms.
149 */
150 if (rtc_write(RTC_CONTROL1, 0x00) < 0)
151 goto err;
152
153 if (rtc_write(RTC_CONTROL2, 0x00) < 0)
154 goto err;
155
156 if (rtc_write(RTC_CLOCKOUT_FREQ, 0x00) < 0)
157 goto err;
158
159 if (rtc_write(RTC_TIMER_CONTROL, 0x03) < 0)
160 goto err;
161
162 /* Reset the alarms. */
163 if (rtc_write(RTC_MINUTE_ALARM, 0x80) < 0)
164 goto err;
165
166 if (rtc_write(RTC_HOUR_ALARM, 0x80) < 0)
167 goto err;
168
169 if (rtc_write(RTC_DAY_ALARM, 0x80) < 0)
170 goto err;
171
172 if (rtc_write(RTC_WEEKDAY_ALARM, 0x80) < 0)
173 goto err;
174
175 if (register_chrdev(PCF8563_MAJOR, DEVICE_NAME, &pcf8563_fops) < 0) {
176 printk(KERN_INFO "%s: Unable to get major numer %d for RTC device.\n",
177 PCF8563_NAME, PCF8563_MAJOR);
178 return -1;
179 }
180
181 printk(KERN_INFO "%s Real-Time Clock Driver, %s\n", PCF8563_NAME, DRIVER_VERSION);
182
183 /* Check for low voltage, and warn about it.. */
184 if (rtc_read(RTC_SECONDS) & 0x80)
185 printk(KERN_WARNING "%s: RTC Voltage Low - reliable date/time "
186 "information is no longer guaranteed!\n", PCF8563_NAME);
187
188 return 0;
189
190err:
191 printk(KERN_INFO "%s: Error initializing chip.\n", PCF8563_NAME);
192 return -1;
193}
194
195void __exit
196pcf8563_exit(void)
197{
198 if (unregister_chrdev(PCF8563_MAJOR, DEVICE_NAME) < 0) {
199 printk(KERN_INFO "%s: Unable to unregister device.\n", PCF8563_NAME);
200 }
201}
202
203/*
204 * ioctl calls for this driver. Why return -ENOTTY upon error? Because
205 * POSIX says so!
206 */
207int
208pcf8563_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg)
209{
210 /* Some sanity checks. */
211 if (_IOC_TYPE(cmd) != RTC_MAGIC)
212 return -ENOTTY;
213
214 if (_IOC_NR(cmd) > RTC_MAX_IOCTL)
215 return -ENOTTY;
216
217 switch (cmd) {
218 case RTC_RD_TIME:
219 {
220 struct rtc_time tm;
221
222 memset(&tm, 0, sizeof (struct rtc_time));
223 get_rtc_time(&tm);
224
225 if (copy_to_user((struct rtc_time *) arg, &tm, sizeof tm)) {
226 return -EFAULT;
227 }
228
229 return 0;
230 }
231
232 case RTC_SET_TIME:
233 {
234#ifdef CONFIG_ETRAX_RTC_READONLY
235 return -EPERM;
236#else
237 int leap;
238 int year;
239 int century;
240 struct rtc_time tm;
241
242 if (!capable(CAP_SYS_TIME))
243 return -EPERM;
244
245 if (copy_from_user(&tm, (struct rtc_time *) arg, sizeof tm))
246 return -EFAULT;
247
248 /* Convert from struct tm to struct rtc_time. */
249 tm.tm_year += 1900;
250 tm.tm_mon += 1;
251
252 /*
253 * Check if tm.tm_year is a leap year. A year is a leap
254 * year if it is divisible by 4 but not 100, except
255 * that years divisible by 400 _are_ leap years.
256 */
257 year = tm.tm_year;
258 leap = (tm.tm_mon == 2) && ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
259
260 /* Perform some sanity checks. */
261 if ((tm.tm_year < 1970) ||
262 (tm.tm_mon > 12) ||
263 (tm.tm_mday == 0) ||
264 (tm.tm_mday > days_in_month[tm.tm_mon] + leap) ||
265 (tm.tm_wday >= 7) ||
266 (tm.tm_hour >= 24) ||
267 (tm.tm_min >= 60) ||
268 (tm.tm_sec >= 60))
269 return -EINVAL;
270
271 century = (tm.tm_year >= 2000) ? 0x80 : 0;
272 tm.tm_year = tm.tm_year % 100;
273
274 BIN_TO_BCD(tm.tm_year);
275 BIN_TO_BCD(tm.tm_mday);
276 BIN_TO_BCD(tm.tm_hour);
277 BIN_TO_BCD(tm.tm_min);
278 BIN_TO_BCD(tm.tm_sec);
279 tm.tm_mon |= century;
280
281 rtc_write(RTC_YEAR, tm.tm_year);
282 rtc_write(RTC_MONTH, tm.tm_mon);
283 rtc_write(RTC_WEEKDAY, tm.tm_wday); /* Not coded in BCD. */
284 rtc_write(RTC_DAY_OF_MONTH, tm.tm_mday);
285 rtc_write(RTC_HOURS, tm.tm_hour);
286 rtc_write(RTC_MINUTES, tm.tm_min);
287 rtc_write(RTC_SECONDS, tm.tm_sec);
288
289 return 0;
290#endif /* !CONFIG_ETRAX_RTC_READONLY */
291 }
292
293 case RTC_VLOW_RD:
294 {
295 int vl_bit = 0;
296
297 if (rtc_read(RTC_SECONDS) & 0x80) {
298 vl_bit = 1;
299 printk(KERN_WARNING "%s: RTC Voltage Low - reliable "
300 "date/time information is no longer guaranteed!\n",
301 PCF8563_NAME);
302 }
303 if (copy_to_user((int *) arg, &vl_bit, sizeof(int)))
304 return -EFAULT;
305
306 return 0;
307 }
308
309 case RTC_VLOW_SET:
310 {
311 /* Clear the VL bit in the seconds register */
312 int ret = rtc_read(RTC_SECONDS);
313
314 rtc_write(RTC_SECONDS, (ret & 0x7F));
315
316 return 0;
317 }
318
319 default:
320 return -ENOTTY;
321 }
322
323 return 0;
324}
325
326int
327pcf8563_open(struct inode *inode, struct file *filp)
328{
329 MOD_INC_USE_COUNT;
330 return 0;
331}
332
333int
334pcf8563_release(struct inode *inode, struct file *filp)
335{
336 MOD_DEC_USE_COUNT;
337 return 0;
338}
339
340module_init(pcf8563_init);
341module_exit(pcf8563_exit);
diff --git a/arch/cris/arch-v32/drivers/pci/Makefile b/arch/cris/arch-v32/drivers/pci/Makefile
new file mode 100644
index 000000000000..bff7482f2444
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pci/Makefile
@@ -0,0 +1,5 @@
1#
2# Makefile for Etrax cardbus driver
3#
4
5obj-$(CONFIG_ETRAX_CARDBUS) += bios.o dma.o
diff --git a/arch/cris/arch-v32/drivers/pci/bios.c b/arch/cris/arch-v32/drivers/pci/bios.c
new file mode 100644
index 000000000000..24bc149889b6
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pci/bios.c
@@ -0,0 +1,131 @@
1#include <linux/pci.h>
2#include <linux/kernel.h>
3#include <asm/arch/hwregs/intr_vect.h>
4
5void __devinit pcibios_fixup_bus(struct pci_bus *b)
6{
7}
8
9char * __devinit pcibios_setup(char *str)
10{
11 return NULL;
12}
13
14void pcibios_set_master(struct pci_dev *dev)
15{
16 u8 lat;
17 pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat);
18 printk(KERN_DEBUG "PCI: Setting latency timer of device %s to %d\n", pci_name(dev), lat);
19 pci_write_config_byte(dev, PCI_LATENCY_TIMER, lat);
20}
21
22int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma,
23 enum pci_mmap_state mmap_state, int write_combine)
24{
25 unsigned long prot;
26
27 /* Leave vm_pgoff as-is, the PCI space address is the physical
28 * address on this platform.
29 */
30 vma->vm_flags |= (VM_SHM | VM_LOCKED | VM_IO);
31
32 prot = pgprot_val(vma->vm_page_prot);
33 vma->vm_page_prot = __pgprot(prot);
34
35 /* Write-combine setting is ignored, it is changed via the mtrr
36 * interfaces on this platform.
37 */
38 if (remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
39 vma->vm_end - vma->vm_start,
40 vma->vm_page_prot))
41 return -EAGAIN;
42
43 return 0;
44}
45
46void
47pcibios_align_resource(void *data, struct resource *res,
48 unsigned long size, unsigned long align)
49{
50 if (res->flags & IORESOURCE_IO) {
51 unsigned long start = res->start;
52
53 if (start & 0x300) {
54 start = (start + 0x3ff) & ~0x3ff;
55 res->start = start;
56 }
57 }
58}
59
60int pcibios_enable_resources(struct pci_dev *dev, int mask)
61{
62 u16 cmd, old_cmd;
63 int idx;
64 struct resource *r;
65
66 pci_read_config_word(dev, PCI_COMMAND, &cmd);
67 old_cmd = cmd;
68 for(idx=0; idx<6; idx++) {
69 /* Only set up the requested stuff */
70 if (!(mask & (1<<idx)))
71 continue;
72
73 r = &dev->resource[idx];
74 if (!r->start && r->end) {
75 printk(KERN_ERR "PCI: Device %s not available because of resource collisions\n", pci_name(dev));
76 return -EINVAL;
77 }
78 if (r->flags & IORESOURCE_IO)
79 cmd |= PCI_COMMAND_IO;
80 if (r->flags & IORESOURCE_MEM)
81 cmd |= PCI_COMMAND_MEMORY;
82 }
83 if (dev->resource[PCI_ROM_RESOURCE].start)
84 cmd |= PCI_COMMAND_MEMORY;
85 if (cmd != old_cmd) {
86 printk("PCI: Enabling device %s (%04x -> %04x)\n", pci_name(dev), old_cmd, cmd);
87 pci_write_config_word(dev, PCI_COMMAND, cmd);
88 }
89 return 0;
90}
91
92int pcibios_enable_irq(struct pci_dev *dev)
93{
94 dev->irq = EXT_INTR_VECT;
95 return 0;
96}
97
98int pcibios_enable_device(struct pci_dev *dev, int mask)
99{
100 int err;
101
102 if ((err = pcibios_enable_resources(dev, mask)) < 0)
103 return err;
104
105 return pcibios_enable_irq(dev);
106}
107
108int pcibios_assign_resources(void)
109{
110 struct pci_dev *dev = NULL;
111 int idx;
112 struct resource *r;
113
114 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
115 int class = dev->class >> 8;
116
117 /* Don't touch classless devices and host bridges */
118 if (!class || class == PCI_CLASS_BRIDGE_HOST)
119 continue;
120
121 for(idx=0; idx<6; idx++) {
122 r = &dev->resource[idx];
123
124 if (!r->start && r->end)
125 pci_assign_resource(dev, idx);
126 }
127 }
128 return 0;
129}
130
131EXPORT_SYMBOL(pcibios_assign_resources);
diff --git a/arch/cris/arch-v32/drivers/pci/dma.c b/arch/cris/arch-v32/drivers/pci/dma.c
new file mode 100644
index 000000000000..10329306d23c
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/pci/dma.c
@@ -0,0 +1,149 @@
1/*
2 * Dynamic DMA mapping support.
3 *
4 * On cris there is no hardware dynamic DMA address translation,
5 * so consistent alloc/free are merely page allocation/freeing.
6 * The rest of the dynamic DMA mapping interface is implemented
7 * in asm/pci.h.
8 *
9 * Borrowed from i386.
10 */
11
12#include <linux/types.h>
13#include <linux/mm.h>
14#include <linux/string.h>
15#include <linux/pci.h>
16#include <asm/io.h>
17
18struct dma_coherent_mem {
19 void *virt_base;
20 u32 device_base;
21 int size;
22 int flags;
23 unsigned long *bitmap;
24};
25
26void *dma_alloc_coherent(struct device *dev, size_t size,
27 dma_addr_t *dma_handle, unsigned int __nocast gfp)
28{
29 void *ret;
30 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
31 int order = get_order(size);
32 /* ignore region specifiers */
33 gfp &= ~(__GFP_DMA | __GFP_HIGHMEM);
34
35 if (mem) {
36 int page = bitmap_find_free_region(mem->bitmap, mem->size,
37 order);
38 if (page >= 0) {
39 *dma_handle = mem->device_base + (page << PAGE_SHIFT);
40 ret = mem->virt_base + (page << PAGE_SHIFT);
41 memset(ret, 0, size);
42 return ret;
43 }
44 if (mem->flags & DMA_MEMORY_EXCLUSIVE)
45 return NULL;
46 }
47
48 if (dev == NULL || (dev->coherent_dma_mask < 0xffffffff))
49 gfp |= GFP_DMA;
50
51 ret = (void *)__get_free_pages(gfp, order);
52
53 if (ret != NULL) {
54 memset(ret, 0, size);
55 *dma_handle = virt_to_phys(ret);
56 }
57 return ret;
58}
59
60void dma_free_coherent(struct device *dev, size_t size,
61 void *vaddr, dma_addr_t dma_handle)
62{
63 struct dma_coherent_mem *mem = dev ? dev->dma_mem : NULL;
64 int order = get_order(size);
65
66 if (mem && vaddr >= mem->virt_base && vaddr < (mem->virt_base + (mem->size << PAGE_SHIFT))) {
67 int page = (vaddr - mem->virt_base) >> PAGE_SHIFT;
68
69 bitmap_release_region(mem->bitmap, page, order);
70 } else
71 free_pages((unsigned long)vaddr, order);
72}
73
74int dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
75 dma_addr_t device_addr, size_t size, int flags)
76{
77 void __iomem *mem_base;
78 int pages = size >> PAGE_SHIFT;
79 int bitmap_size = (pages + 31)/32;
80
81 if ((flags & (DMA_MEMORY_MAP | DMA_MEMORY_IO)) == 0)
82 goto out;
83 if (!size)
84 goto out;
85 if (dev->dma_mem)
86 goto out;
87
88 /* FIXME: this routine just ignores DMA_MEMORY_INCLUDES_CHILDREN */
89
90 mem_base = ioremap(bus_addr, size);
91 if (!mem_base)
92 goto out;
93
94 dev->dma_mem = kmalloc(sizeof(struct dma_coherent_mem), GFP_KERNEL);
95 if (!dev->dma_mem)
96 goto out;
97 memset(dev->dma_mem, 0, sizeof(struct dma_coherent_mem));
98 dev->dma_mem->bitmap = kmalloc(bitmap_size, GFP_KERNEL);
99 if (!dev->dma_mem->bitmap)
100 goto free1_out;
101 memset(dev->dma_mem->bitmap, 0, bitmap_size);
102
103 dev->dma_mem->virt_base = mem_base;
104 dev->dma_mem->device_base = device_addr;
105 dev->dma_mem->size = pages;
106 dev->dma_mem->flags = flags;
107
108 if (flags & DMA_MEMORY_MAP)
109 return DMA_MEMORY_MAP;
110
111 return DMA_MEMORY_IO;
112
113 free1_out:
114 kfree(dev->dma_mem->bitmap);
115 out:
116 return 0;
117}
118EXPORT_SYMBOL(dma_declare_coherent_memory);
119
120void dma_release_declared_memory(struct device *dev)
121{
122 struct dma_coherent_mem *mem = dev->dma_mem;
123
124 if(!mem)
125 return;
126 dev->dma_mem = NULL;
127 iounmap(mem->virt_base);
128 kfree(mem->bitmap);
129 kfree(mem);
130}
131EXPORT_SYMBOL(dma_release_declared_memory);
132
133void *dma_mark_declared_memory_occupied(struct device *dev,
134 dma_addr_t device_addr, size_t size)
135{
136 struct dma_coherent_mem *mem = dev->dma_mem;
137 int pages = (size + (device_addr & ~PAGE_MASK) + PAGE_SIZE - 1) >> PAGE_SHIFT;
138 int pos, err;
139
140 if (!mem)
141 return ERR_PTR(-EINVAL);
142
143 pos = (device_addr - mem->device_base) >> PAGE_SHIFT;
144 err = bitmap_allocate_region(mem->bitmap, pos, get_order(pages));
145 if (err != 0)
146 return ERR_PTR(err);
147 return mem->virt_base + (pos << PAGE_SHIFT);
148}
149EXPORT_SYMBOL(dma_mark_declared_memory_occupied);
diff --git a/arch/cris/arch-v32/drivers/sync_serial.c b/arch/cris/arch-v32/drivers/sync_serial.c
new file mode 100644
index 000000000000..c85a6df8558f
--- /dev/null
+++ b/arch/cris/arch-v32/drivers/sync_serial.c
@@ -0,0 +1,1283 @@
1/*
2 * Simple synchronous serial port driver for ETRAX FS.
3 *
4 * Copyright (c) 2005 Axis Communications AB
5 *
6 * Author: Mikael Starvik
7 *
8 */
9
10#include <linux/module.h>
11#include <linux/kernel.h>
12#include <linux/config.h>
13#include <linux/types.h>
14#include <linux/errno.h>
15#include <linux/major.h>
16#include <linux/sched.h>
17#include <linux/slab.h>
18#include <linux/interrupt.h>
19#include <linux/poll.h>
20#include <linux/init.h>
21#include <linux/timer.h>
22#include <linux/spinlock.h>
23
24#include <asm/io.h>
25#include <asm/arch/dma.h>
26#include <asm/arch/pinmux.h>
27#include <asm/arch/hwregs/reg_rdwr.h>
28#include <asm/arch/hwregs/sser_defs.h>
29#include <asm/arch/hwregs/dma_defs.h>
30#include <asm/arch/hwregs/dma.h>
31#include <asm/arch/hwregs/intr_vect_defs.h>
32#include <asm/arch/hwregs/intr_vect.h>
33#include <asm/arch/hwregs/reg_map.h>
34#include <asm/sync_serial.h>
35
36/* The receiver is a bit tricky beacuse of the continuous stream of data.*/
37/* */
38/* Three DMA descriptors are linked together. Each DMA descriptor is */
39/* responsible for port->bufchunk of a common buffer. */
40/* */
41/* +---------------------------------------------+ */
42/* | +----------+ +----------+ +----------+ | */
43/* +-> | Descr[0] |-->| Descr[1] |-->| Descr[2] |-+ */
44/* +----------+ +----------+ +----------+ */
45/* | | | */
46/* v v v */
47/* +-------------------------------------+ */
48/* | BUFFER | */
49/* +-------------------------------------+ */
50/* |<- data_avail ->| */
51/* readp writep */
52/* */
53/* If the application keeps up the pace readp will be right after writep.*/
54/* If the application can't keep the pace we have to throw away data. */
55/* The idea is that readp should be ready with the data pointed out by */
56/* Descr[i] when the DMA has filled in Descr[i+1]. */
57/* Otherwise we will discard */
58/* the rest of the data pointed out by Descr1 and set readp to the start */
59/* of Descr2 */
60
61#define SYNC_SERIAL_MAJOR 125
62
63/* IN_BUFFER_SIZE should be a multiple of 6 to make sure that 24 bit */
64/* words can be handled */
65#define IN_BUFFER_SIZE 12288
66#define IN_DESCR_SIZE 256
67#define NUM_IN_DESCR (IN_BUFFER_SIZE/IN_DESCR_SIZE)
68#define OUT_BUFFER_SIZE 4096
69
70#define DEFAULT_FRAME_RATE 0
71#define DEFAULT_WORD_RATE 7
72
73/* NOTE: Enabling some debug will likely cause overrun or underrun,
74 * especially if manual mode is use.
75 */
76#define DEBUG(x)
77#define DEBUGREAD(x)
78#define DEBUGWRITE(x)
79#define DEBUGPOLL(x)
80#define DEBUGRXINT(x)
81#define DEBUGTXINT(x)
82
83typedef struct sync_port
84{
85 reg_scope_instances regi_sser;
86 reg_scope_instances regi_dmain;
87 reg_scope_instances regi_dmaout;
88
89 char started; /* 1 if port has been started */
90 char port_nbr; /* Port 0 or 1 */
91 char busy; /* 1 if port is busy */
92
93 char enabled; /* 1 if port is enabled */
94 char use_dma; /* 1 if port uses dma */
95 char tr_running;
96
97 char init_irqs;
98 int output;
99 int input;
100
101 volatile unsigned int out_count; /* Remaining bytes for current transfer */
102 unsigned char* outp; /* Current position in out_buffer */
103 volatile unsigned char* volatile readp; /* Next byte to be read by application */
104 volatile unsigned char* volatile writep; /* Next byte to be written by etrax */
105 unsigned int in_buffer_size;
106 unsigned int inbufchunk;
107 unsigned char out_buffer[OUT_BUFFER_SIZE] __attribute__ ((aligned(32)));
108 unsigned char in_buffer[IN_BUFFER_SIZE]__attribute__ ((aligned(32)));
109 unsigned char flip[IN_BUFFER_SIZE] __attribute__ ((aligned(32)));
110 struct dma_descr_data* next_rx_desc;
111 struct dma_descr_data* prev_rx_desc;
112 int full;
113
114 dma_descr_data in_descr[NUM_IN_DESCR] __attribute__ ((__aligned__(16)));
115 dma_descr_context in_context __attribute__ ((__aligned__(32)));
116 dma_descr_data out_descr __attribute__ ((__aligned__(16)));
117 dma_descr_context out_context __attribute__ ((__aligned__(32)));
118 wait_queue_head_t out_wait_q;
119 wait_queue_head_t in_wait_q;
120
121 spinlock_t lock;
122} sync_port;
123
124static int etrax_sync_serial_init(void);
125static void initialize_port(int portnbr);
126static inline int sync_data_avail(struct sync_port *port);
127
128static int sync_serial_open(struct inode *, struct file*);
129static int sync_serial_release(struct inode*, struct file*);
130static unsigned int sync_serial_poll(struct file *filp, poll_table *wait);
131
132static int sync_serial_ioctl(struct inode*, struct file*,
133 unsigned int cmd, unsigned long arg);
134static ssize_t sync_serial_write(struct file * file, const char * buf,
135 size_t count, loff_t *ppos);
136static ssize_t sync_serial_read(struct file *file, char *buf,
137 size_t count, loff_t *ppos);
138
139#if (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0) && \
140 defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA)) || \
141 (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) && \
142 defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA))
143#define SYNC_SER_DMA
144#endif
145
146static void send_word(sync_port* port);
147static void start_dma(struct sync_port *port, const char* data, int count);
148static void start_dma_in(sync_port* port);
149#ifdef SYNC_SER_DMA
150static irqreturn_t tr_interrupt(int irq, void *dev_id, struct pt_regs * regs);
151static irqreturn_t rx_interrupt(int irq, void *dev_id, struct pt_regs * regs);
152#endif
153
154#if (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0) && \
155 !defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA)) || \
156 (defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1) && \
157 !defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA))
158#define SYNC_SER_MANUAL
159#endif
160#ifdef SYNC_SER_MANUAL
161static irqreturn_t manual_interrupt(int irq, void *dev_id, struct pt_regs * regs);
162#endif
163
164/* The ports */
165static struct sync_port ports[]=
166{
167 {
168 .regi_sser = regi_sser0,
169 .regi_dmaout = regi_dma4,
170 .regi_dmain = regi_dma5,
171#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL0_DMA)
172 .use_dma = 1,
173#else
174 .use_dma = 0,
175#endif
176 },
177 {
178 .regi_sser = regi_sser1,
179 .regi_dmaout = regi_dma6,
180 .regi_dmain = regi_dma7,
181#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL1_DMA)
182 .use_dma = 1,
183#else
184 .use_dma = 0,
185#endif
186 }
187};
188
189#define NUMBER_OF_PORTS (sizeof(ports)/sizeof(sync_port))
190
191static struct file_operations sync_serial_fops = {
192 .owner = THIS_MODULE,
193 .write = sync_serial_write,
194 .read = sync_serial_read,
195 .poll = sync_serial_poll,
196 .ioctl = sync_serial_ioctl,
197 .open = sync_serial_open,
198 .release = sync_serial_release
199};
200
201static int __init etrax_sync_serial_init(void)
202{
203 ports[0].enabled = 0;
204 ports[1].enabled = 0;
205
206 if (register_chrdev(SYNC_SERIAL_MAJOR,"sync serial", &sync_serial_fops) <0 )
207 {
208 printk("unable to get major for synchronous serial port\n");
209 return -EBUSY;
210 }
211
212 /* Initialize Ports */
213#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT0)
214 if (crisv32_pinmux_alloc_fixed(pinmux_sser0))
215 {
216 printk("Unable to allocate pins for syncrhronous serial port 0\n");
217 return -EIO;
218 }
219 ports[0].enabled = 1;
220 initialize_port(0);
221#endif
222
223#if defined(CONFIG_ETRAX_SYNCHRONOUS_SERIAL_PORT1)
224 if (crisv32_pinmux_alloc_fixed(pinmux_sser1))
225 {
226 printk("Unable to allocate pins for syncrhronous serial port 0\n");
227 return -EIO;
228 }
229 ports[1].enabled = 1;
230 initialize_port(1);
231#endif
232
233 printk("ETRAX FS synchronous serial port driver\n");
234 return 0;
235}
236
237static void __init initialize_port(int portnbr)
238{
239 struct sync_port* port = &ports[portnbr];
240 reg_sser_rw_cfg cfg = {0};
241 reg_sser_rw_frm_cfg frm_cfg = {0};
242 reg_sser_rw_tr_cfg tr_cfg = {0};
243 reg_sser_rw_rec_cfg rec_cfg = {0};
244
245 DEBUG(printk("Init sync serial port %d\n", portnbr));
246
247 port->port_nbr = portnbr;
248 port->init_irqs = 1;
249
250 port->outp = port->out_buffer;
251 port->output = 1;
252 port->input = 0;
253
254 port->readp = port->flip;
255 port->writep = port->flip;
256 port->in_buffer_size = IN_BUFFER_SIZE;
257 port->inbufchunk = IN_DESCR_SIZE;
258 port->next_rx_desc = &port->in_descr[0];
259 port->prev_rx_desc = &port->in_descr[NUM_IN_DESCR-1];
260 port->prev_rx_desc->eol = 1;
261
262 init_waitqueue_head(&port->out_wait_q);
263 init_waitqueue_head(&port->in_wait_q);
264
265 spin_lock_init(&port->lock);
266
267 cfg.out_clk_src = regk_sser_intern_clk;
268 cfg.out_clk_pol = regk_sser_pos;
269 cfg.clk_od_mode = regk_sser_no;
270 cfg.clk_dir = regk_sser_out;
271 cfg.gate_clk = regk_sser_no;
272 cfg.base_freq = regk_sser_f29_493;
273 cfg.clk_div = 256;
274 REG_WR(sser, port->regi_sser, rw_cfg, cfg);
275
276 frm_cfg.wordrate = DEFAULT_WORD_RATE;
277 frm_cfg.type = regk_sser_edge;
278 frm_cfg.frame_pin_dir = regk_sser_out;
279 frm_cfg.frame_pin_use = regk_sser_frm;
280 frm_cfg.status_pin_dir = regk_sser_in;
281 frm_cfg.status_pin_use = regk_sser_hold;
282 frm_cfg.out_on = regk_sser_tr;
283 frm_cfg.tr_delay = 1;
284 REG_WR(sser, port->regi_sser, rw_frm_cfg, frm_cfg);
285
286 tr_cfg.urun_stop = regk_sser_no;
287 tr_cfg.sample_size = 7;
288 tr_cfg.sh_dir = regk_sser_msbfirst;
289 tr_cfg.use_dma = port->use_dma ? regk_sser_yes : regk_sser_no;
290 tr_cfg.rate_ctrl = regk_sser_bulk;
291 tr_cfg.data_pin_use = regk_sser_dout;
292 tr_cfg.bulk_wspace = 1;
293 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
294
295 rec_cfg.sample_size = 7;
296 rec_cfg.sh_dir = regk_sser_msbfirst;
297 rec_cfg.use_dma = port->use_dma ? regk_sser_yes : regk_sser_no;
298 rec_cfg.fifo_thr = regk_sser_inf;
299 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
300}
301
302static inline int sync_data_avail(struct sync_port *port)
303{
304 int avail;
305 unsigned char *start;
306 unsigned char *end;
307
308 start = (unsigned char*)port->readp; /* cast away volatile */
309 end = (unsigned char*)port->writep; /* cast away volatile */
310 /* 0123456789 0123456789
311 * ----- - -----
312 * ^rp ^wp ^wp ^rp
313 */
314
315 if (end >= start)
316 avail = end - start;
317 else
318 avail = port->in_buffer_size - (start - end);
319 return avail;
320}
321
322static inline int sync_data_avail_to_end(struct sync_port *port)
323{
324 int avail;
325 unsigned char *start;
326 unsigned char *end;
327
328 start = (unsigned char*)port->readp; /* cast away volatile */
329 end = (unsigned char*)port->writep; /* cast away volatile */
330 /* 0123456789 0123456789
331 * ----- -----
332 * ^rp ^wp ^wp ^rp
333 */
334
335 if (end >= start)
336 avail = end - start;
337 else
338 avail = port->flip + port->in_buffer_size - start;
339 return avail;
340}
341
342static int sync_serial_open(struct inode *inode, struct file *file)
343{
344 int dev = MINOR(inode->i_rdev);
345 sync_port* port;
346 reg_dma_rw_cfg cfg = {.en = regk_dma_yes};
347 reg_dma_rw_intr_mask intr_mask = {.data = regk_dma_yes};
348
349 DEBUG(printk("Open sync serial port %d\n", dev));
350
351 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
352 {
353 DEBUG(printk("Invalid minor %d\n", dev));
354 return -ENODEV;
355 }
356 port = &ports[dev];
357 /* Allow open this device twice (assuming one reader and one writer) */
358 if (port->busy == 2)
359 {
360 DEBUG(printk("Device is busy.. \n"));
361 return -EBUSY;
362 }
363 if (port->init_irqs) {
364 if (port->use_dma) {
365 if (port == &ports[0]){
366#ifdef SYNC_SER_DMA
367 if(request_irq(DMA4_INTR_VECT,
368 tr_interrupt,
369 0,
370 "synchronous serial 0 dma tr",
371 &ports[0])) {
372 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
373 return -EBUSY;
374 } else if(request_irq(DMA5_INTR_VECT,
375 rx_interrupt,
376 0,
377 "synchronous serial 1 dma rx",
378 &ports[0])) {
379 free_irq(DMA4_INTR_VECT, &port[0]);
380 printk(KERN_CRIT "Can't allocate sync serial port 0 IRQ");
381 return -EBUSY;
382 } else if (crisv32_request_dma(SYNC_SER0_TX_DMA_NBR,
383 "synchronous serial 0 dma tr",
384 DMA_VERBOSE_ON_ERROR,
385 0,
386 dma_sser0)) {
387 free_irq(DMA4_INTR_VECT, &port[0]);
388 free_irq(DMA5_INTR_VECT, &port[0]);
389 printk(KERN_CRIT "Can't allocate sync serial port 0 TX DMA channel");
390 return -EBUSY;
391 } else if (crisv32_request_dma(SYNC_SER0_RX_DMA_NBR,
392 "synchronous serial 0 dma rec",
393 DMA_VERBOSE_ON_ERROR,
394 0,
395 dma_sser0)) {
396 crisv32_free_dma(SYNC_SER0_TX_DMA_NBR);
397 free_irq(DMA4_INTR_VECT, &port[0]);
398 free_irq(DMA5_INTR_VECT, &port[0]);
399 printk(KERN_CRIT "Can't allocate sync serial port 1 RX DMA channel");
400 return -EBUSY;
401 }
402#endif
403 }
404 else if (port == &ports[1]){
405#ifdef SYNC_SER_DMA
406 if (request_irq(DMA6_INTR_VECT,
407 tr_interrupt,
408 0,
409 "synchronous serial 1 dma tr",
410 &ports[1])) {
411 printk(KERN_CRIT "Can't allocate sync serial port 1 IRQ");
412 return -EBUSY;
413 } else if (request_irq(DMA7_INTR_VECT,
414 rx_interrupt,
415 0,
416 "synchronous serial 1 dma rx",
417 &ports[1])) {
418 free_irq(DMA6_INTR_VECT, &ports[1]);
419 printk(KERN_CRIT "Can't allocate sync serial port 3 IRQ");
420 return -EBUSY;
421 } else if (crisv32_request_dma(SYNC_SER1_TX_DMA_NBR,
422 "synchronous serial 1 dma tr",
423 DMA_VERBOSE_ON_ERROR,
424 0,
425 dma_sser1)) {
426 free_irq(21, &ports[1]);
427 free_irq(20, &ports[1]);
428 printk(KERN_CRIT "Can't allocate sync serial port 3 TX DMA channel");
429 return -EBUSY;
430 } else if (crisv32_request_dma(SYNC_SER1_RX_DMA_NBR,
431 "synchronous serial 3 dma rec",
432 DMA_VERBOSE_ON_ERROR,
433 0,
434 dma_sser1)) {
435 crisv32_free_dma(SYNC_SER1_TX_DMA_NBR);
436 free_irq(DMA6_INTR_VECT, &ports[1]);
437 free_irq(DMA7_INTR_VECT, &ports[1]);
438 printk(KERN_CRIT "Can't allocate sync serial port 3 RX DMA channel");
439 return -EBUSY;
440 }
441#endif
442 }
443
444 /* Enable DMAs */
445 REG_WR(dma, port->regi_dmain, rw_cfg, cfg);
446 REG_WR(dma, port->regi_dmaout, rw_cfg, cfg);
447 /* Enable DMA IRQs */
448 REG_WR(dma, port->regi_dmain, rw_intr_mask, intr_mask);
449 REG_WR(dma, port->regi_dmaout, rw_intr_mask, intr_mask);
450 /* Set up wordsize = 2 for DMAs. */
451 DMA_WR_CMD (port->regi_dmain, regk_dma_set_w_size1);
452 DMA_WR_CMD (port->regi_dmaout, regk_dma_set_w_size1);
453
454 start_dma_in(port);
455 port->init_irqs = 0;
456 } else { /* !port->use_dma */
457#ifdef SYNC_SER_MANUAL
458 if (port == &ports[0]) {
459 if (request_irq(SSER0_INTR_VECT,
460 manual_interrupt,
461 0,
462 "synchronous serial manual irq",
463 &ports[0])) {
464 printk("Can't allocate sync serial manual irq");
465 return -EBUSY;
466 }
467 } else if (port == &ports[1]) {
468 if (request_irq(SSER1_INTR_VECT,
469 manual_interrupt,
470 0,
471 "synchronous serial manual irq",
472 &ports[1])) {
473 printk(KERN_CRIT "Can't allocate sync serial manual irq");
474 return -EBUSY;
475 }
476 }
477 port->init_irqs = 0;
478#else
479 panic("sync_serial: Manual mode not supported.\n");
480#endif /* SYNC_SER_MANUAL */
481 }
482 } /* port->init_irqs */
483
484 port->busy++;
485 return 0;
486}
487
488static int sync_serial_release(struct inode *inode, struct file *file)
489{
490 int dev = MINOR(inode->i_rdev);
491 sync_port* port;
492
493 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
494 {
495 DEBUG(printk("Invalid minor %d\n", dev));
496 return -ENODEV;
497 }
498 port = &ports[dev];
499 if (port->busy)
500 port->busy--;
501 if (!port->busy)
502 /* XXX */ ;
503 return 0;
504}
505
506static unsigned int sync_serial_poll(struct file *file, poll_table *wait)
507{
508 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
509 unsigned int mask = 0;
510 sync_port* port;
511 DEBUGPOLL( static unsigned int prev_mask = 0; );
512
513 port = &ports[dev];
514 poll_wait(file, &port->out_wait_q, wait);
515 poll_wait(file, &port->in_wait_q, wait);
516 /* Some room to write */
517 if (port->out_count < OUT_BUFFER_SIZE)
518 mask |= POLLOUT | POLLWRNORM;
519 /* At least an inbufchunk of data */
520 if (sync_data_avail(port) >= port->inbufchunk)
521 mask |= POLLIN | POLLRDNORM;
522
523 DEBUGPOLL(if (mask != prev_mask)
524 printk("sync_serial_poll: mask 0x%08X %s %s\n", mask,
525 mask&POLLOUT?"POLLOUT":"", mask&POLLIN?"POLLIN":"");
526 prev_mask = mask;
527 );
528 return mask;
529}
530
531static int sync_serial_ioctl(struct inode *inode, struct file *file,
532 unsigned int cmd, unsigned long arg)
533{
534 int return_val = 0;
535 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
536 sync_port* port;
537 reg_sser_rw_tr_cfg tr_cfg;
538 reg_sser_rw_rec_cfg rec_cfg;
539 reg_sser_rw_frm_cfg frm_cfg;
540 reg_sser_rw_cfg gen_cfg;
541 reg_sser_rw_intr_mask intr_mask;
542
543 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
544 {
545 DEBUG(printk("Invalid minor %d\n", dev));
546 return -1;
547 }
548 port = &ports[dev];
549 spin_lock_irq(&port->lock);
550
551 tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
552 rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
553 frm_cfg = REG_RD(sser, port->regi_sser, rw_frm_cfg);
554 gen_cfg = REG_RD(sser, port->regi_sser, rw_cfg);
555 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
556
557 switch(cmd)
558 {
559 case SSP_SPEED:
560 if (GET_SPEED(arg) == CODEC)
561 {
562 gen_cfg.base_freq = regk_sser_f32;
563 /* FREQ = 0 => 4 MHz => clk_div = 7*/
564 gen_cfg.clk_div = 6 + (1 << GET_FREQ(arg));
565 }
566 else
567 {
568 gen_cfg.base_freq = regk_sser_f29_493;
569 switch (GET_SPEED(arg))
570 {
571 case SSP150:
572 gen_cfg.clk_div = 29493000 / (150 * 8) - 1;
573 break;
574 case SSP300:
575 gen_cfg.clk_div = 29493000 / (300 * 8) - 1;
576 break;
577 case SSP600:
578 gen_cfg.clk_div = 29493000 / (600 * 8) - 1;
579 break;
580 case SSP1200:
581 gen_cfg.clk_div = 29493000 / (1200 * 8) - 1;
582 break;
583 case SSP2400:
584 gen_cfg.clk_div = 29493000 / (2400 * 8) - 1;
585 break;
586 case SSP4800:
587 gen_cfg.clk_div = 29493000 / (4800 * 8) - 1;
588 break;
589 case SSP9600:
590 gen_cfg.clk_div = 29493000 / (9600 * 8) - 1;
591 break;
592 case SSP19200:
593 gen_cfg.clk_div = 29493000 / (19200 * 8) - 1;
594 break;
595 case SSP28800:
596 gen_cfg.clk_div = 29493000 / (28800 * 8) - 1;
597 break;
598 case SSP57600:
599 gen_cfg.clk_div = 29493000 / (57600 * 8) - 1;
600 break;
601 case SSP115200:
602 gen_cfg.clk_div = 29493000 / (115200 * 8) - 1;
603 break;
604 case SSP230400:
605 gen_cfg.clk_div = 29493000 / (230400 * 8) - 1;
606 break;
607 case SSP460800:
608 gen_cfg.clk_div = 29493000 / (460800 * 8) - 1;
609 break;
610 case SSP921600:
611 gen_cfg.clk_div = 29493000 / (921600 * 8) - 1;
612 break;
613 case SSP3125000:
614 gen_cfg.base_freq = regk_sser_f100;
615 gen_cfg.clk_div = 100000000 / (3125000 * 8) - 1;
616 break;
617
618 }
619 }
620 frm_cfg.wordrate = GET_WORD_RATE(arg);
621
622 break;
623 case SSP_MODE:
624 switch(arg)
625 {
626 case MASTER_OUTPUT:
627 port->output = 1;
628 port->input = 0;
629 gen_cfg.clk_dir = regk_sser_out;
630 break;
631 case SLAVE_OUTPUT:
632 port->output = 1;
633 port->input = 0;
634 gen_cfg.clk_dir = regk_sser_in;
635 break;
636 case MASTER_INPUT:
637 port->output = 0;
638 port->input = 1;
639 gen_cfg.clk_dir = regk_sser_out;
640 break;
641 case SLAVE_INPUT:
642 port->output = 0;
643 port->input = 1;
644 gen_cfg.clk_dir = regk_sser_in;
645 break;
646 case MASTER_BIDIR:
647 port->output = 1;
648 port->input = 1;
649 gen_cfg.clk_dir = regk_sser_out;
650 break;
651 case SLAVE_BIDIR:
652 port->output = 1;
653 port->input = 1;
654 gen_cfg.clk_dir = regk_sser_in;
655 break;
656 default:
657 spin_unlock_irq(&port->lock);
658 return -EINVAL;
659
660 }
661 if (!port->use_dma || (arg == MASTER_OUTPUT || arg == SLAVE_OUTPUT))
662 intr_mask.rdav = regk_sser_yes;
663 break;
664 case SSP_FRAME_SYNC:
665 if (arg & NORMAL_SYNC)
666 frm_cfg.tr_delay = 1;
667 else if (arg & EARLY_SYNC)
668 frm_cfg.tr_delay = 0;
669
670 tr_cfg.bulk_wspace = frm_cfg.tr_delay;
671 frm_cfg.early_wend = regk_sser_yes;
672 if (arg & BIT_SYNC)
673 frm_cfg.type = regk_sser_edge;
674 else if (arg & WORD_SYNC)
675 frm_cfg.type = regk_sser_level;
676 else if (arg & EXTENDED_SYNC)
677 frm_cfg.early_wend = regk_sser_no;
678
679 if (arg & SYNC_ON)
680 frm_cfg.frame_pin_use = regk_sser_frm;
681 else if (arg & SYNC_OFF)
682 frm_cfg.frame_pin_use = regk_sser_gio0;
683
684 if (arg & WORD_SIZE_8)
685 rec_cfg.sample_size = tr_cfg.sample_size = 7;
686 else if (arg & WORD_SIZE_12)
687 rec_cfg.sample_size = tr_cfg.sample_size = 11;
688 else if (arg & WORD_SIZE_16)
689 rec_cfg.sample_size = tr_cfg.sample_size = 15;
690 else if (arg & WORD_SIZE_24)
691 rec_cfg.sample_size = tr_cfg.sample_size = 23;
692 else if (arg & WORD_SIZE_32)
693 rec_cfg.sample_size = tr_cfg.sample_size = 31;
694
695 if (arg & BIT_ORDER_MSB)
696 rec_cfg.sh_dir = tr_cfg.sh_dir = regk_sser_msbfirst;
697 else if (arg & BIT_ORDER_LSB)
698 rec_cfg.sh_dir = tr_cfg.sh_dir = regk_sser_lsbfirst;
699
700 if (arg & FLOW_CONTROL_ENABLE)
701 rec_cfg.fifo_thr = regk_sser_thr16;
702 else if (arg & FLOW_CONTROL_DISABLE)
703 rec_cfg.fifo_thr = regk_sser_inf;
704
705 if (arg & CLOCK_NOT_GATED)
706 gen_cfg.gate_clk = regk_sser_no;
707 else if (arg & CLOCK_GATED)
708 gen_cfg.gate_clk = regk_sser_yes;
709
710 break;
711 case SSP_IPOLARITY:
712 /* NOTE!! negedge is considered NORMAL */
713 if (arg & CLOCK_NORMAL)
714 rec_cfg.clk_pol = regk_sser_neg;
715 else if (arg & CLOCK_INVERT)
716 rec_cfg.clk_pol = regk_sser_pos;
717
718 if (arg & FRAME_NORMAL)
719 frm_cfg.level = regk_sser_pos_hi;
720 else if (arg & FRAME_INVERT)
721 frm_cfg.level = regk_sser_neg_lo;
722
723 if (arg & STATUS_NORMAL)
724 gen_cfg.hold_pol = regk_sser_pos;
725 else if (arg & STATUS_INVERT)
726 gen_cfg.hold_pol = regk_sser_neg;
727 break;
728 case SSP_OPOLARITY:
729 if (arg & CLOCK_NORMAL)
730 gen_cfg.out_clk_pol = regk_sser_neg;
731 else if (arg & CLOCK_INVERT)
732 gen_cfg.out_clk_pol = regk_sser_pos;
733
734 if (arg & FRAME_NORMAL)
735 frm_cfg.level = regk_sser_pos_hi;
736 else if (arg & FRAME_INVERT)
737 frm_cfg.level = regk_sser_neg_lo;
738
739 if (arg & STATUS_NORMAL)
740 gen_cfg.hold_pol = regk_sser_pos;
741 else if (arg & STATUS_INVERT)
742 gen_cfg.hold_pol = regk_sser_neg;
743 break;
744 case SSP_SPI:
745 rec_cfg.fifo_thr = regk_sser_inf;
746 rec_cfg.sh_dir = tr_cfg.sh_dir = regk_sser_msbfirst;
747 rec_cfg.sample_size = tr_cfg.sample_size = 7;
748 frm_cfg.frame_pin_use = regk_sser_frm;
749 frm_cfg.type = regk_sser_level;
750 frm_cfg.tr_delay = 1;
751 frm_cfg.level = regk_sser_neg_lo;
752 if (arg & SPI_SLAVE)
753 {
754 rec_cfg.clk_pol = regk_sser_neg;
755 gen_cfg.clk_dir = regk_sser_in;
756 port->input = 1;
757 port->output = 0;
758 }
759 else
760 {
761 gen_cfg.out_clk_pol = regk_sser_pos;
762 port->input = 0;
763 port->output = 1;
764 gen_cfg.clk_dir = regk_sser_out;
765 }
766 break;
767 case SSP_INBUFCHUNK:
768 break;
769 default:
770 return_val = -1;
771 }
772
773
774 if (port->started)
775 {
776 tr_cfg.tr_en = port->output;
777 rec_cfg.rec_en = port->input;
778 }
779
780 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
781 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
782 REG_WR(sser, port->regi_sser, rw_frm_cfg, frm_cfg);
783 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
784 REG_WR(sser, port->regi_sser, rw_cfg, gen_cfg);
785
786 spin_unlock_irq(&port->lock);
787 return return_val;
788}
789
790static ssize_t sync_serial_write(struct file * file, const char * buf,
791 size_t count, loff_t *ppos)
792{
793 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
794 DECLARE_WAITQUEUE(wait, current);
795 sync_port *port;
796 unsigned long c, c1;
797 unsigned long free_outp;
798 unsigned long outp;
799 unsigned long out_buffer;
800 unsigned long flags;
801
802 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
803 {
804 DEBUG(printk("Invalid minor %d\n", dev));
805 return -ENODEV;
806 }
807 port = &ports[dev];
808
809 DEBUGWRITE(printk("W d%d c %lu (%d/%d)\n", port->port_nbr, count, port->out_count, OUT_BUFFER_SIZE));
810 /* Space to end of buffer */
811 /*
812 * out_buffer <c1>012345<- c ->OUT_BUFFER_SIZE
813 * outp^ +out_count
814 ^free_outp
815 * out_buffer 45<- c ->0123OUT_BUFFER_SIZE
816 * +out_count outp^
817 * free_outp
818 *
819 */
820
821 /* Read variables that may be updated by interrupts */
822 spin_lock_irqsave(&port->lock, flags);
823 count = count > OUT_BUFFER_SIZE - port->out_count ? OUT_BUFFER_SIZE - port->out_count : count;
824 outp = (unsigned long)port->outp;
825 free_outp = outp + port->out_count;
826 spin_unlock_irqrestore(&port->lock, flags);
827 out_buffer = (unsigned long)port->out_buffer;
828
829 /* Find out where and how much to write */
830 if (free_outp >= out_buffer + OUT_BUFFER_SIZE)
831 free_outp -= OUT_BUFFER_SIZE;
832 if (free_outp >= outp)
833 c = out_buffer + OUT_BUFFER_SIZE - free_outp;
834 else
835 c = outp - free_outp;
836 if (c > count)
837 c = count;
838
839// DEBUGWRITE(printk("w op %08lX fop %08lX c %lu\n", outp, free_outp, c));
840 if (copy_from_user((void*)free_outp, buf, c))
841 return -EFAULT;
842
843 if (c != count) {
844 buf += c;
845 c1 = count - c;
846 DEBUGWRITE(printk("w2 fi %lu c %lu c1 %lu\n", free_outp-out_buffer, c, c1));
847 if (copy_from_user((void*)out_buffer, buf, c1))
848 return -EFAULT;
849 }
850 spin_lock_irqsave(&port->lock, flags);
851 port->out_count += count;
852 spin_unlock_irqrestore(&port->lock, flags);
853
854 /* Make sure transmitter/receiver is running */
855 if (!port->started)
856 {
857 reg_sser_rw_cfg cfg = REG_RD(sser, port->regi_sser, rw_cfg);
858 reg_sser_rw_tr_cfg tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
859 reg_sser_rw_rec_cfg rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
860 cfg.en = regk_sser_yes;
861 tr_cfg.tr_en = port->output;
862 rec_cfg.rec_en = port->input;
863 REG_WR(sser, port->regi_sser, rw_cfg, cfg);
864 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
865 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
866 port->started = 1;
867 }
868
869 if (file->f_flags & O_NONBLOCK) {
870 spin_lock_irqsave(&port->lock, flags);
871 if (!port->tr_running) {
872 if (!port->use_dma) {
873 reg_sser_rw_intr_mask intr_mask;
874 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
875 /* Start sender by writing data */
876 send_word(port);
877 /* and enable transmitter ready IRQ */
878 intr_mask.trdy = 1;
879 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
880 } else {
881 start_dma(port, (unsigned char* volatile )port->outp, c);
882 }
883 }
884 spin_unlock_irqrestore(&port->lock, flags);
885 DEBUGWRITE(printk("w d%d c %lu NB\n",
886 port->port_nbr, count));
887 return count;
888 }
889
890 /* Sleep until all sent */
891
892 add_wait_queue(&port->out_wait_q, &wait);
893 set_current_state(TASK_INTERRUPTIBLE);
894 spin_lock_irqsave(&port->lock, flags);
895 if (!port->tr_running) {
896 if (!port->use_dma) {
897 reg_sser_rw_intr_mask intr_mask;
898 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
899 /* Start sender by writing data */
900 send_word(port);
901 /* and enable transmitter ready IRQ */
902 intr_mask.trdy = 1;
903 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
904 } else {
905 start_dma(port, port->outp, c);
906 }
907 }
908 spin_unlock_irqrestore(&port->lock, flags);
909 schedule();
910 set_current_state(TASK_RUNNING);
911 remove_wait_queue(&port->out_wait_q, &wait);
912 if (signal_pending(current))
913 {
914 return -EINTR;
915 }
916 DEBUGWRITE(printk("w d%d c %lu\n", port->port_nbr, count));
917 return count;
918}
919
920static ssize_t sync_serial_read(struct file * file, char * buf,
921 size_t count, loff_t *ppos)
922{
923 int dev = MINOR(file->f_dentry->d_inode->i_rdev);
924 int avail;
925 sync_port *port;
926 unsigned char* start;
927 unsigned char* end;
928 unsigned long flags;
929
930 if (dev < 0 || dev >= NUMBER_OF_PORTS || !ports[dev].enabled)
931 {
932 DEBUG(printk("Invalid minor %d\n", dev));
933 return -ENODEV;
934 }
935 port = &ports[dev];
936
937 DEBUGREAD(printk("R%d c %d ri %lu wi %lu /%lu\n", dev, count, port->readp - port->flip, port->writep - port->flip, port->in_buffer_size));
938
939 if (!port->started)
940 {
941 reg_sser_rw_cfg cfg = REG_RD(sser, port->regi_sser, rw_cfg);
942 reg_sser_rw_tr_cfg tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
943 reg_sser_rw_rec_cfg rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
944 cfg.en = regk_sser_yes;
945 tr_cfg.tr_en = regk_sser_yes;
946 rec_cfg.rec_en = regk_sser_yes;
947 REG_WR(sser, port->regi_sser, rw_cfg, cfg);
948 REG_WR(sser, port->regi_sser, rw_tr_cfg, tr_cfg);
949 REG_WR(sser, port->regi_sser, rw_rec_cfg, rec_cfg);
950 port->started = 1;
951 }
952
953
954 /* Calculate number of available bytes */
955 /* Save pointers to avoid that they are modified by interrupt */
956 spin_lock_irqsave(&port->lock, flags);
957 start = (unsigned char*)port->readp; /* cast away volatile */
958 end = (unsigned char*)port->writep; /* cast away volatile */
959 spin_unlock_irqrestore(&port->lock, flags);
960 while ((start == end) && !port->full) /* No data */
961 {
962 if (file->f_flags & O_NONBLOCK)
963 {
964 return -EAGAIN;
965 }
966
967 interruptible_sleep_on(&port->in_wait_q);
968 if (signal_pending(current))
969 {
970 return -EINTR;
971 }
972 spin_lock_irqsave(&port->lock, flags);
973 start = (unsigned char*)port->readp; /* cast away volatile */
974 end = (unsigned char*)port->writep; /* cast away volatile */
975 spin_unlock_irqrestore(&port->lock, flags);
976 }
977
978 /* Lazy read, never return wrapped data. */
979 if (port->full)
980 avail = port->in_buffer_size;
981 else if (end > start)
982 avail = end - start;
983 else
984 avail = port->flip + port->in_buffer_size - start;
985
986 count = count > avail ? avail : count;
987 if (copy_to_user(buf, start, count))
988 return -EFAULT;
989 /* Disable interrupts while updating readp */
990 spin_lock_irqsave(&port->lock, flags);
991 port->readp += count;
992 if (port->readp >= port->flip + port->in_buffer_size) /* Wrap? */
993 port->readp = port->flip;
994 port->full = 0;
995 spin_unlock_irqrestore(&port->lock, flags);
996 DEBUGREAD(printk("r %d\n", count));
997 return count;
998}
999
1000static void send_word(sync_port* port)
1001{
1002 reg_sser_rw_tr_cfg tr_cfg = REG_RD(sser, port->regi_sser, rw_tr_cfg);
1003 reg_sser_rw_tr_data tr_data = {0};
1004
1005 switch(tr_cfg.sample_size)
1006 {
1007 case 8:
1008 port->out_count--;
1009 tr_data.data = *port->outp++;
1010 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1011 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1012 port->outp = port->out_buffer;
1013 break;
1014 case 12:
1015 {
1016 int data = (*port->outp++) << 8;
1017 data |= *port->outp++;
1018 port->out_count-=2;
1019 tr_data.data = data;
1020 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1021 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1022 port->outp = port->out_buffer;
1023 }
1024 break;
1025 case 16:
1026 port->out_count-=2;
1027 tr_data.data = *(unsigned short *)port->outp;
1028 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1029 port->outp+=2;
1030 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1031 port->outp = port->out_buffer;
1032 break;
1033 case 24:
1034 port->out_count-=3;
1035 tr_data.data = *(unsigned short *)port->outp;
1036 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1037 port->outp+=2;
1038 tr_data.data = *port->outp++;
1039 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1040 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1041 port->outp = port->out_buffer;
1042 break;
1043 case 32:
1044 port->out_count-=4;
1045 tr_data.data = *(unsigned short *)port->outp;
1046 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1047 port->outp+=2;
1048 tr_data.data = *(unsigned short *)port->outp;
1049 REG_WR(sser, port->regi_sser, rw_tr_data, tr_data);
1050 port->outp+=2;
1051 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1052 port->outp = port->out_buffer;
1053 break;
1054 }
1055}
1056
1057
1058static void start_dma(struct sync_port* port, const char* data, int count)
1059{
1060 port->tr_running = 1;
1061 port->out_descr.buf = (char*)virt_to_phys((char*)data);
1062 port->out_descr.after = port->out_descr.buf + count;
1063 port->out_descr.eol = port->out_descr.intr = 1;
1064
1065 port->out_context.saved_data = (dma_descr_data*)virt_to_phys(&port->out_descr);
1066 port->out_context.saved_data_buf = port->out_descr.buf;
1067
1068 DMA_START_CONTEXT(port->regi_dmaout, virt_to_phys((char*)&port->out_context));
1069 DEBUGTXINT(printk("dma %08lX c %d\n", (unsigned long)data, count));
1070}
1071
1072static void start_dma_in(sync_port* port)
1073{
1074 int i;
1075 char* buf;
1076 port->writep = port->flip;
1077
1078 if (port->writep > port->flip + port->in_buffer_size)
1079 {
1080 panic("Offset too large in sync serial driver\n");
1081 return;
1082 }
1083 buf = (char*)virt_to_phys(port->in_buffer);
1084 for (i = 0; i < NUM_IN_DESCR; i++) {
1085 port->in_descr[i].buf = buf;
1086 port->in_descr[i].after = buf + port->inbufchunk;
1087 port->in_descr[i].intr = 1;
1088 port->in_descr[i].next = (dma_descr_data*)virt_to_phys(&port->in_descr[i+1]);
1089 port->in_descr[i].buf = buf;
1090 buf += port->inbufchunk;
1091 }
1092 /* Link the last descriptor to the first */
1093 port->in_descr[i-1].next = (dma_descr_data*)virt_to_phys(&port->in_descr[0]);
1094 port->in_descr[i-1].eol = regk_sser_yes;
1095 port->next_rx_desc = &port->in_descr[0];
1096 port->prev_rx_desc = &port->in_descr[NUM_IN_DESCR - 1];
1097 port->in_context.saved_data = (dma_descr_data*)virt_to_phys(&port->in_descr[0]);
1098 port->in_context.saved_data_buf = port->in_descr[0].buf;
1099 DMA_START_CONTEXT(port->regi_dmain, virt_to_phys(&port->in_context));
1100}
1101
1102#ifdef SYNC_SER_DMA
1103static irqreturn_t tr_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1104{
1105 reg_dma_r_masked_intr masked;
1106 reg_dma_rw_ack_intr ack_intr = {.data = regk_dma_yes};
1107 int i;
1108 struct dma_descr_data *descr;
1109 unsigned int sentl;
1110 int found = 0;
1111
1112 for (i = 0; i < NUMBER_OF_PORTS; i++)
1113 {
1114 sync_port *port = &ports[i];
1115 if (!port->enabled || !port->use_dma )
1116 continue;
1117
1118 masked = REG_RD(dma, port->regi_dmaout, r_masked_intr);
1119
1120 if (masked.data) /* IRQ active for the port? */
1121 {
1122 found = 1;
1123 /* Clear IRQ */
1124 REG_WR(dma, port->regi_dmaout, rw_ack_intr, ack_intr);
1125 descr = &port->out_descr;
1126 sentl = descr->after - descr->buf;
1127 port->out_count -= sentl;
1128 port->outp += sentl;
1129 if (port->outp >= port->out_buffer + OUT_BUFFER_SIZE)
1130 port->outp = port->out_buffer;
1131 if (port->out_count) {
1132 int c;
1133 c = port->out_buffer + OUT_BUFFER_SIZE - port->outp;
1134 if (c > port->out_count)
1135 c = port->out_count;
1136 DEBUGTXINT(printk("tx_int DMAWRITE %i %i\n", sentl, c));
1137 start_dma(port, port->outp, c);
1138 } else {
1139 DEBUGTXINT(printk("tx_int DMA stop %i\n", sentl));
1140 port->tr_running = 0;
1141 }
1142 wake_up_interruptible(&port->out_wait_q); /* wake up the waiting process */
1143 }
1144 }
1145 return IRQ_RETVAL(found);
1146} /* tr_interrupt */
1147
1148static irqreturn_t rx_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1149{
1150 reg_dma_r_masked_intr masked;
1151 reg_dma_rw_ack_intr ack_intr = {.data = regk_dma_yes};
1152
1153 int i;
1154 int found = 0;
1155
1156 for (i = 0; i < NUMBER_OF_PORTS; i++)
1157 {
1158 sync_port *port = &ports[i];
1159
1160 if (!port->enabled || !port->use_dma )
1161 continue;
1162
1163 masked = REG_RD(dma, port->regi_dmain, r_masked_intr);
1164
1165 if (masked.data) /* Descriptor interrupt */
1166 {
1167 found = 1;
1168 while (REG_RD(dma, port->regi_dmain, rw_data) !=
1169 virt_to_phys(port->next_rx_desc)) {
1170
1171 if (port->writep + port->inbufchunk > port->flip + port->in_buffer_size) {
1172 int first_size = port->flip + port->in_buffer_size - port->writep;
1173 memcpy((char*)port->writep, phys_to_virt((unsigned)port->next_rx_desc->buf), first_size);
1174 memcpy(port->flip, phys_to_virt((unsigned)port->next_rx_desc->buf+first_size), port->inbufchunk - first_size);
1175 port->writep = port->flip + port->inbufchunk - first_size;
1176 } else {
1177 memcpy((char*)port->writep,
1178 phys_to_virt((unsigned)port->next_rx_desc->buf),
1179 port->inbufchunk);
1180 port->writep += port->inbufchunk;
1181 if (port->writep >= port->flip + port->in_buffer_size)
1182 port->writep = port->flip;
1183 }
1184 if (port->writep == port->readp)
1185 {
1186 port->full = 1;
1187 }
1188
1189 port->next_rx_desc->eol = 0;
1190 port->prev_rx_desc->eol = 1;
1191 port->prev_rx_desc = phys_to_virt((unsigned)port->next_rx_desc);
1192 port->next_rx_desc = phys_to_virt((unsigned)port->next_rx_desc->next);
1193 wake_up_interruptible(&port->in_wait_q); /* wake up the waiting process */
1194 DMA_CONTINUE(port->regi_dmain);
1195 REG_WR(dma, port->regi_dmain, rw_ack_intr, ack_intr);
1196
1197 }
1198 }
1199 }
1200 return IRQ_RETVAL(found);
1201} /* rx_interrupt */
1202#endif /* SYNC_SER_DMA */
1203
1204#ifdef SYNC_SER_MANUAL
1205static irqreturn_t manual_interrupt(int irq, void *dev_id, struct pt_regs * regs)
1206{
1207 int i;
1208 int found = 0;
1209 reg_sser_r_masked_intr masked;
1210
1211 for (i = 0; i < NUMBER_OF_PORTS; i++)
1212 {
1213 sync_port* port = &ports[i];
1214
1215 if (!port->enabled || port->use_dma)
1216 {
1217 continue;
1218 }
1219
1220 masked = REG_RD(sser, port->regi_sser, r_masked_intr);
1221 if (masked.rdav) /* Data received? */
1222 {
1223 reg_sser_rw_rec_cfg rec_cfg = REG_RD(sser, port->regi_sser, rw_rec_cfg);
1224 reg_sser_r_rec_data data = REG_RD(sser, port->regi_sser, r_rec_data);
1225 found = 1;
1226 /* Read data */
1227 switch(rec_cfg.sample_size)
1228 {
1229 case 8:
1230 *port->writep++ = data.data & 0xff;
1231 break;
1232 case 12:
1233 *port->writep = (data.data & 0x0ff0) >> 4;
1234 *(port->writep + 1) = data.data & 0x0f;
1235 port->writep+=2;
1236 break;
1237 case 16:
1238 *(unsigned short*)port->writep = data.data;
1239 port->writep+=2;
1240 break;
1241 case 24:
1242 *(unsigned int*)port->writep = data.data;
1243 port->writep+=3;
1244 break;
1245 case 32:
1246 *(unsigned int*)port->writep = data.data;
1247 port->writep+=4;
1248 break;
1249 }
1250
1251 if (port->writep >= port->flip + port->in_buffer_size) /* Wrap? */
1252 port->writep = port->flip;
1253 if (port->writep == port->readp) {
1254 /* receive buffer overrun, discard oldest data
1255 */
1256 port->readp++;
1257 if (port->readp >= port->flip + port->in_buffer_size) /* Wrap? */
1258 port->readp = port->flip;
1259 }
1260 if (sync_data_avail(port) >= port->inbufchunk)
1261 wake_up_interruptible(&port->in_wait_q); /* Wake up application */
1262 }
1263
1264 if (masked.trdy) /* Transmitter ready? */
1265 {
1266 found = 1;
1267 if (port->out_count > 0) /* More data to send */
1268 send_word(port);
1269 else /* transmission finished */
1270 {
1271 reg_sser_rw_intr_mask intr_mask;
1272 intr_mask = REG_RD(sser, port->regi_sser, rw_intr_mask);
1273 intr_mask.trdy = 0;
1274 REG_WR(sser, port->regi_sser, rw_intr_mask, intr_mask);
1275 wake_up_interruptible(&port->out_wait_q); /* Wake up application */
1276 }
1277 }
1278 }
1279 return IRQ_RETVAL(found);
1280}
1281#endif
1282
1283module_init(etrax_sync_serial_init);
diff --git a/arch/cris/arch-v32/kernel/Makefile b/arch/cris/arch-v32/kernel/Makefile
new file mode 100644
index 000000000000..5d5b613cde8c
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/Makefile
@@ -0,0 +1,21 @@
1# $Id: Makefile,v 1.11 2004/12/17 10:16:13 starvik Exp $
2#
3# Makefile for the linux kernel.
4#
5
6extra-y := head.o
7
8
9obj-y := entry.o traps.o irq.o debugport.o dma.o pinmux.o \
10 process.o ptrace.o setup.o signal.o traps.o time.o \
11 arbiter.o io.o
12
13obj-$(CONFIG_ETRAXFS_SIM) += vcs_hook.o
14
15obj-$(CONFIG_SMP) += smp.o
16obj-$(CONFIG_ETRAX_KGDB) += kgdb.o kgdb_asm.o
17obj-$(CONFIG_ETRAX_FAST_TIMER) += fasttimer.o
18obj-$(CONFIG_MODULES) += crisksyms.o
19
20clean:
21
diff --git a/arch/cris/arch-v32/kernel/arbiter.c b/arch/cris/arch-v32/kernel/arbiter.c
new file mode 100644
index 000000000000..3870d2fd5160
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/arbiter.c
@@ -0,0 +1,297 @@
1/*
2 * Memory arbiter functions. Allocates bandwith through the
3 * arbiter and sets up arbiter breakpoints.
4 *
5 * The algorithm first assigns slots to the clients that has specified
6 * bandwith (e.g. ethernet) and then the remaining slots are divided
7 * on all the active clients.
8 *
9 * Copyright (c) 2004, 2005 Axis Communications AB.
10 */
11
12#include <linux/config.h>
13#include <asm/arch/hwregs/reg_map.h>
14#include <asm/arch/hwregs/reg_rdwr.h>
15#include <asm/arch/hwregs/marb_defs.h>
16#include <asm/arch/arbiter.h>
17#include <asm/arch/hwregs/intr_vect.h>
18#include <linux/interrupt.h>
19#include <linux/signal.h>
20#include <linux/errno.h>
21#include <linux/spinlock.h>
22#include <asm/io.h>
23
24struct crisv32_watch_entry
25{
26 unsigned long instance;
27 watch_callback* cb;
28 unsigned long start;
29 unsigned long end;
30 int used;
31};
32
33#define NUMBER_OF_BP 4
34#define NBR_OF_CLIENTS 14
35#define NBR_OF_SLOTS 64
36#define SDRAM_BANDWIDTH 100000000 /* Some kind of expected value */
37#define INTMEM_BANDWIDTH 400000000
38#define NBR_OF_REGIONS 2
39
40static struct crisv32_watch_entry watches[NUMBER_OF_BP] =
41{
42 {regi_marb_bp0},
43 {regi_marb_bp1},
44 {regi_marb_bp2},
45 {regi_marb_bp3}
46};
47
48static int requested_slots[NBR_OF_REGIONS][NBR_OF_CLIENTS];
49static int active_clients[NBR_OF_REGIONS][NBR_OF_CLIENTS];
50static int max_bandwidth[NBR_OF_REGIONS] = {SDRAM_BANDWIDTH, INTMEM_BANDWIDTH};
51
52DEFINE_SPINLOCK(arbiter_lock);
53
54static irqreturn_t
55crisv32_arbiter_irq(int irq, void* dev_id, struct pt_regs* regs);
56
57static void crisv32_arbiter_config(int region)
58{
59 int slot;
60 int client;
61 int interval = 0;
62 int val[NBR_OF_SLOTS];
63
64 for (slot = 0; slot < NBR_OF_SLOTS; slot++)
65 val[slot] = NBR_OF_CLIENTS + 1;
66
67 for (client = 0; client < NBR_OF_CLIENTS; client++)
68 {
69 int pos;
70 if (!requested_slots[region][client])
71 continue;
72 interval = NBR_OF_SLOTS / requested_slots[region][client];
73 pos = 0;
74 while (pos < NBR_OF_SLOTS)
75 {
76 if (val[pos] != NBR_OF_CLIENTS + 1)
77 pos++;
78 else
79 {
80 val[pos] = client;
81 pos += interval;
82 }
83 }
84 }
85
86 client = 0;
87 for (slot = 0; slot < NBR_OF_SLOTS; slot++)
88 {
89 if (val[slot] == NBR_OF_CLIENTS + 1)
90 {
91 int first = client;
92 while(!active_clients[region][client]) {
93 client = (client + 1) % NBR_OF_CLIENTS;
94 if (client == first)
95 break;
96 }
97 val[slot] = client;
98 client = (client + 1) % NBR_OF_CLIENTS;
99 }
100 if (region == EXT_REGION)
101 REG_WR_INT_VECT(marb, regi_marb, rw_ext_slots, slot, val[slot]);
102 else if (region == INT_REGION)
103 REG_WR_INT_VECT(marb, regi_marb, rw_int_slots, slot, val[slot]);
104 }
105}
106
107extern char _stext, _etext;
108
109static void crisv32_arbiter_init(void)
110{
111 static int initialized = 0;
112
113 if (initialized)
114 return;
115
116 initialized = 1;
117
118 /* CPU caches are active. */
119 active_clients[EXT_REGION][10] = active_clients[EXT_REGION][11] = 1;
120 crisv32_arbiter_config(EXT_REGION);
121 crisv32_arbiter_config(INT_REGION);
122
123 if (request_irq(MEMARB_INTR_VECT, crisv32_arbiter_irq, SA_INTERRUPT,
124 "arbiter", NULL))
125 printk(KERN_ERR "Couldn't allocate arbiter IRQ\n");
126
127#ifndef CONFIG_ETRAX_KGDB
128 /* Global watch for writes to kernel text segment. */
129 crisv32_arbiter_watch(virt_to_phys(&_stext), &_etext - &_stext,
130 arbiter_all_clients, arbiter_all_write, NULL);
131#endif
132}
133
134
135
136int crisv32_arbiter_allocate_bandwith(int client, int region,
137 unsigned long bandwidth)
138{
139 int i;
140 int total_assigned = 0;
141 int total_clients = 0;
142 int req;
143
144 crisv32_arbiter_init();
145
146 for (i = 0; i < NBR_OF_CLIENTS; i++)
147 {
148 total_assigned += requested_slots[region][i];
149 total_clients += active_clients[region][i];
150 }
151 req = NBR_OF_SLOTS / (max_bandwidth[region] / bandwidth);
152
153 if (total_assigned + total_clients + req + 1 > NBR_OF_SLOTS)
154 return -ENOMEM;
155
156 active_clients[region][client] = 1;
157 requested_slots[region][client] = req;
158 crisv32_arbiter_config(region);
159
160 return 0;
161}
162
163int crisv32_arbiter_watch(unsigned long start, unsigned long size,
164 unsigned long clients, unsigned long accesses,
165 watch_callback* cb)
166{
167 int i;
168
169 crisv32_arbiter_init();
170
171 if (start > 0x80000000) {
172 printk("Arbiter: %lX doesn't look like a physical address", start);
173 return -EFAULT;
174 }
175
176 spin_lock(&arbiter_lock);
177
178 for (i = 0; i < NUMBER_OF_BP; i++) {
179 if (!watches[i].used) {
180 reg_marb_rw_intr_mask intr_mask = REG_RD(marb, regi_marb, rw_intr_mask);
181
182 watches[i].used = 1;
183 watches[i].start = start;
184 watches[i].end = start + size;
185 watches[i].cb = cb;
186
187 REG_WR_INT(marb_bp, watches[i].instance, rw_first_addr, watches[i].start);
188 REG_WR_INT(marb_bp, watches[i].instance, rw_last_addr, watches[i].end);
189 REG_WR_INT(marb_bp, watches[i].instance, rw_op, accesses);
190 REG_WR_INT(marb_bp, watches[i].instance, rw_clients, clients);
191
192 if (i == 0)
193 intr_mask.bp0 = regk_marb_yes;
194 else if (i == 1)
195 intr_mask.bp1 = regk_marb_yes;
196 else if (i == 2)
197 intr_mask.bp2 = regk_marb_yes;
198 else if (i == 3)
199 intr_mask.bp3 = regk_marb_yes;
200
201 REG_WR(marb, regi_marb, rw_intr_mask, intr_mask);
202 spin_unlock(&arbiter_lock);
203
204 return i;
205 }
206 }
207 spin_unlock(&arbiter_lock);
208 return -ENOMEM;
209}
210
211int crisv32_arbiter_unwatch(int id)
212{
213 reg_marb_rw_intr_mask intr_mask = REG_RD(marb, regi_marb, rw_intr_mask);
214
215 crisv32_arbiter_init();
216
217 spin_lock(&arbiter_lock);
218
219 if ((id < 0) || (id >= NUMBER_OF_BP) || (!watches[id].used)) {
220 spin_unlock(&arbiter_lock);
221 return -EINVAL;
222 }
223
224 memset(&watches[id], 0, sizeof(struct crisv32_watch_entry));
225
226 if (id == 0)
227 intr_mask.bp0 = regk_marb_no;
228 else if (id == 1)
229 intr_mask.bp2 = regk_marb_no;
230 else if (id == 2)
231 intr_mask.bp2 = regk_marb_no;
232 else if (id == 3)
233 intr_mask.bp3 = regk_marb_no;
234
235 REG_WR(marb, regi_marb, rw_intr_mask, intr_mask);
236
237 spin_unlock(&arbiter_lock);
238 return 0;
239}
240
241extern void show_registers(struct pt_regs *regs);
242
243static irqreturn_t
244crisv32_arbiter_irq(int irq, void* dev_id, struct pt_regs* regs)
245{
246 reg_marb_r_masked_intr masked_intr = REG_RD(marb, regi_marb, r_masked_intr);
247 reg_marb_bp_r_brk_clients r_clients;
248 reg_marb_bp_r_brk_addr r_addr;
249 reg_marb_bp_r_brk_op r_op;
250 reg_marb_bp_r_brk_first_client r_first;
251 reg_marb_bp_r_brk_size r_size;
252 reg_marb_bp_rw_ack ack = {0};
253 reg_marb_rw_ack_intr ack_intr = {.bp0=1,.bp1=1,.bp2=1,.bp3=1};
254 struct crisv32_watch_entry* watch;
255
256 if (masked_intr.bp0) {
257 watch = &watches[0];
258 ack_intr.bp0 = regk_marb_yes;
259 } else if (masked_intr.bp1) {
260 watch = &watches[1];
261 ack_intr.bp1 = regk_marb_yes;
262 } else if (masked_intr.bp2) {
263 watch = &watches[2];
264 ack_intr.bp2 = regk_marb_yes;
265 } else if (masked_intr.bp3) {
266 watch = &watches[3];
267 ack_intr.bp3 = regk_marb_yes;
268 } else {
269 return IRQ_NONE;
270 }
271
272 /* Retrieve all useful information and print it. */
273 r_clients = REG_RD(marb_bp, watch->instance, r_brk_clients);
274 r_addr = REG_RD(marb_bp, watch->instance, r_brk_addr);
275 r_op = REG_RD(marb_bp, watch->instance, r_brk_op);
276 r_first = REG_RD(marb_bp, watch->instance, r_brk_first_client);
277 r_size = REG_RD(marb_bp, watch->instance, r_brk_size);
278
279 printk("Arbiter IRQ\n");
280 printk("Clients %X addr %X op %X first %X size %X\n",
281 REG_TYPE_CONV(int, reg_marb_bp_r_brk_clients, r_clients),
282 REG_TYPE_CONV(int, reg_marb_bp_r_brk_addr, r_addr),
283 REG_TYPE_CONV(int, reg_marb_bp_r_brk_op, r_op),
284 REG_TYPE_CONV(int, reg_marb_bp_r_brk_first_client, r_first),
285 REG_TYPE_CONV(int, reg_marb_bp_r_brk_size, r_size));
286
287 REG_WR(marb_bp, watch->instance, rw_ack, ack);
288 REG_WR(marb, regi_marb, rw_ack_intr, ack_intr);
289
290 printk("IRQ occured at %lX\n", regs->erp);
291
292 if (watch->cb)
293 watch->cb();
294
295
296 return IRQ_HANDLED;
297}
diff --git a/arch/cris/arch-v32/kernel/asm-offsets.c b/arch/cris/arch-v32/kernel/asm-offsets.c
new file mode 100644
index 000000000000..15b3d93a0496
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/asm-offsets.c
@@ -0,0 +1,49 @@
1#include <linux/sched.h>
2#include <asm/thread_info.h>
3
4/*
5 * Generate definitions needed by assembly language modules.
6 * This code generates raw asm output which is post-processed to extract
7 * and format the required data.
8 */
9
10#define DEFINE(sym, val) \
11 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
12
13#define BLANK() asm volatile("\n->" : : )
14
15int main(void)
16{
17#define ENTRY(entry) DEFINE(PT_ ## entry, offsetof(struct pt_regs, entry))
18 ENTRY(orig_r10);
19 ENTRY(r13);
20 ENTRY(r12);
21 ENTRY(r11);
22 ENTRY(r10);
23 ENTRY(r9);
24 ENTRY(acr);
25 ENTRY(srs);
26 ENTRY(mof);
27 ENTRY(ccs);
28 ENTRY(srp);
29 BLANK();
30#undef ENTRY
31#define ENTRY(entry) DEFINE(TI_ ## entry, offsetof(struct thread_info, entry))
32 ENTRY(task);
33 ENTRY(flags);
34 ENTRY(preempt_count);
35 BLANK();
36#undef ENTRY
37#define ENTRY(entry) DEFINE(THREAD_ ## entry, offsetof(struct thread_struct, entry))
38 ENTRY(ksp);
39 ENTRY(usp);
40 ENTRY(ccs);
41 BLANK();
42#undef ENTRY
43#define ENTRY(entry) DEFINE(TASK_ ## entry, offsetof(struct task_struct, entry))
44 ENTRY(pid);
45 BLANK();
46 DEFINE(LCLONE_VM, CLONE_VM);
47 DEFINE(LCLONE_UNTRACED, CLONE_UNTRACED);
48 return 0;
49}
diff --git a/arch/cris/arch-v32/kernel/crisksyms.c b/arch/cris/arch-v32/kernel/crisksyms.c
new file mode 100644
index 000000000000..2c3bb9a0afe2
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/crisksyms.c
@@ -0,0 +1,24 @@
1#include <linux/config.h>
2#include <linux/module.h>
3#include <linux/irq.h>
4#include <asm/arch/dma.h>
5#include <asm/arch/intmem.h>
6#include <asm/arch/pinmux.h>
7
8/* Functions for allocating DMA channels */
9EXPORT_SYMBOL(crisv32_request_dma);
10EXPORT_SYMBOL(crisv32_free_dma);
11
12/* Functions for handling internal RAM */
13EXPORT_SYMBOL(crisv32_intmem_alloc);
14EXPORT_SYMBOL(crisv32_intmem_free);
15EXPORT_SYMBOL(crisv32_intmem_phys_to_virt);
16EXPORT_SYMBOL(crisv32_intmem_virt_to_phys);
17
18/* Functions for handling pinmux */
19EXPORT_SYMBOL(crisv32_pinmux_alloc);
20EXPORT_SYMBOL(crisv32_pinmux_dealloc);
21
22/* Functions masking/unmasking interrupts */
23EXPORT_SYMBOL(mask_irq);
24EXPORT_SYMBOL(unmask_irq);
diff --git a/arch/cris/arch-v32/kernel/debugport.c b/arch/cris/arch-v32/kernel/debugport.c
new file mode 100644
index 000000000000..ffc1ebf2dfee
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/debugport.c
@@ -0,0 +1,461 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <linux/config.h>
6#include <linux/console.h>
7#include <linux/init.h>
8#include <linux/major.h>
9#include <linux/delay.h>
10#include <linux/tty.h>
11#include <asm/system.h>
12#include <asm/io.h>
13#include <asm/arch/hwregs/ser_defs.h>
14#include <asm/arch/hwregs/dma_defs.h>
15#include <asm/arch/pinmux.h>
16
17#include <asm/irq.h>
18#include <asm/arch/hwregs/intr_vect_defs.h>
19
20struct dbg_port
21{
22 unsigned char nbr;
23 unsigned long instance;
24 unsigned int started;
25 unsigned long baudrate;
26 unsigned char parity;
27 unsigned int bits;
28};
29
30struct dbg_port ports[] =
31{
32 {
33 0,
34 regi_ser0,
35 0,
36 115200,
37 'N',
38 8
39 },
40 {
41 1,
42 regi_ser1,
43 0,
44 115200,
45 'N',
46 8
47 },
48 {
49 2,
50 regi_ser2,
51 0,
52 115200,
53 'N',
54 8
55 },
56 {
57 3,
58 regi_ser3,
59 0,
60 115200,
61 'N',
62 8
63 }
64};
65static struct dbg_port *port =
66#if defined(CONFIG_ETRAX_DEBUG_PORT0)
67&ports[0];
68#elif defined(CONFIG_ETRAX_DEBUG_PORT1)
69&ports[1];
70#elif defined(CONFIG_ETRAX_DEBUG_PORT2)
71&ports[2];
72#elif defined(CONFIG_ETRAX_DEBUG_PORT3)
73&ports[3];
74#else
75NULL;
76#endif
77
78#ifdef CONFIG_ETRAX_KGDB
79static struct dbg_port *kgdb_port =
80#if defined(CONFIG_ETRAX_KGDB_PORT0)
81&ports[0];
82#elif defined(CONFIG_ETRAX_KGDB_PORT1)
83&ports[1];
84#elif defined(CONFIG_ETRAX_KGDB_PORT2)
85&ports[2];
86#elif defined(CONFIG_ETRAX_KGDB_PORT3)
87&ports[3];
88#else
89NULL;
90#endif
91#endif
92
93#ifdef CONFIG_ETRAXFS_SIM
94extern void print_str( const char *str );
95static char buffer[1024];
96static char msg[] = "Debug: ";
97static int buffer_pos = sizeof(msg) - 1;
98#endif
99
100extern struct tty_driver *serial_driver;
101
102static void
103start_port(struct dbg_port* p)
104{
105 if (!p)
106 return;
107
108 if (p->started)
109 return;
110 p->started = 1;
111
112 if (p->nbr == 1)
113 crisv32_pinmux_alloc_fixed(pinmux_ser1);
114 else if (p->nbr == 2)
115 crisv32_pinmux_alloc_fixed(pinmux_ser2);
116 else if (p->nbr == 3)
117 crisv32_pinmux_alloc_fixed(pinmux_ser3);
118
119 /* Set up serial port registers */
120 reg_ser_rw_tr_ctrl tr_ctrl = {0};
121 reg_ser_rw_tr_dma_en tr_dma_en = {0};
122
123 reg_ser_rw_rec_ctrl rec_ctrl = {0};
124 reg_ser_rw_tr_baud_div tr_baud_div = {0};
125 reg_ser_rw_rec_baud_div rec_baud_div = {0};
126
127 tr_ctrl.base_freq = rec_ctrl.base_freq = regk_ser_f29_493;
128 tr_dma_en.en = rec_ctrl.dma_mode = regk_ser_no;
129 tr_baud_div.div = rec_baud_div.div = 29493000 / p->baudrate / 8;
130 tr_ctrl.en = rec_ctrl.en = 1;
131
132 if (p->parity == 'O')
133 {
134 tr_ctrl.par_en = regk_ser_yes;
135 tr_ctrl.par = regk_ser_odd;
136 rec_ctrl.par_en = regk_ser_yes;
137 rec_ctrl.par = regk_ser_odd;
138 }
139 else if (p->parity == 'E')
140 {
141 tr_ctrl.par_en = regk_ser_yes;
142 tr_ctrl.par = regk_ser_even;
143 rec_ctrl.par_en = regk_ser_yes;
144 rec_ctrl.par = regk_ser_odd;
145 }
146
147 if (p->bits == 7)
148 {
149 tr_ctrl.data_bits = regk_ser_bits7;
150 rec_ctrl.data_bits = regk_ser_bits7;
151 }
152
153 REG_WR (ser, p->instance, rw_tr_baud_div, tr_baud_div);
154 REG_WR (ser, p->instance, rw_rec_baud_div, rec_baud_div);
155 REG_WR (ser, p->instance, rw_tr_dma_en, tr_dma_en);
156 REG_WR (ser, p->instance, rw_tr_ctrl, tr_ctrl);
157 REG_WR (ser, p->instance, rw_rec_ctrl, rec_ctrl);
158}
159
160/* No debug */
161#ifdef CONFIG_ETRAX_DEBUG_PORT_NULL
162
163static void
164console_write(struct console *co, const char *buf, unsigned int len)
165{
166 return;
167}
168
169/* Target debug */
170#elif !defined(CONFIG_ETRAXFS_SIM)
171
172static void
173console_write_direct(struct console *co, const char *buf, unsigned int len)
174{
175 int i;
176 reg_ser_r_stat_din stat;
177 reg_ser_rw_tr_dma_en tr_dma_en, old;
178
179 /* Switch to manual mode */
180 tr_dma_en = old = REG_RD (ser, port->instance, rw_tr_dma_en);
181 if (tr_dma_en.en == regk_ser_yes) {
182 tr_dma_en.en = regk_ser_no;
183 REG_WR(ser, port->instance, rw_tr_dma_en, tr_dma_en);
184 }
185
186 /* Send data */
187 for (i = 0; i < len; i++) {
188 /* LF -> CRLF */
189 if (buf[i] == '\n') {
190 do {
191 stat = REG_RD (ser, port->instance, r_stat_din);
192 } while (!stat.tr_rdy);
193 REG_WR_INT (ser, port->instance, rw_dout, '\r');
194 }
195 /* Wait until transmitter is ready and send.*/
196 do {
197 stat = REG_RD (ser, port->instance, r_stat_din);
198 } while (!stat.tr_rdy);
199 REG_WR_INT (ser, port->instance, rw_dout, buf[i]);
200 }
201
202 /* Restore mode */
203 if (tr_dma_en.en != old.en)
204 REG_WR(ser, port->instance, rw_tr_dma_en, old);
205}
206
207static void
208console_write(struct console *co, const char *buf, unsigned int len)
209{
210 if (!port)
211 return;
212 console_write_direct(co, buf, len);
213}
214
215
216
217#else
218
219/* VCS debug */
220
221static void
222console_write(struct console *co, const char *buf, unsigned int len)
223{
224 char* pos;
225 pos = memchr(buf, '\n', len);
226 if (pos) {
227 int l = ++pos - buf;
228 memcpy(buffer + buffer_pos, buf, l);
229 memcpy(buffer, msg, sizeof(msg) - 1);
230 buffer[buffer_pos + l] = '\0';
231 print_str(buffer);
232 buffer_pos = sizeof(msg) - 1;
233 if (pos - buf != len) {
234 memcpy(buffer + buffer_pos, pos, len - l);
235 buffer_pos += len - l;
236 }
237 } else {
238 memcpy(buffer + buffer_pos, buf, len);
239 buffer_pos += len;
240 }
241}
242
243#endif
244
245int raw_printk(const char *fmt, ...)
246{
247 static char buf[1024];
248 int printed_len;
249 va_list args;
250 va_start(args, fmt);
251 printed_len = vsnprintf(buf, sizeof(buf), fmt, args);
252 va_end(args);
253 console_write(NULL, buf, strlen(buf));
254 return printed_len;
255}
256
257void
258stupid_debug(char* buf)
259{
260 console_write(NULL, buf, strlen(buf));
261}
262
263#ifdef CONFIG_ETRAX_KGDB
264/* Use polling to get a single character from the kernel debug port */
265int
266getDebugChar(void)
267{
268 reg_ser_rs_status_data stat;
269 reg_ser_rw_ack_intr ack_intr = { 0 };
270
271 do {
272 stat = REG_RD(ser, kgdb_instance, rs_status_data);
273 } while (!stat.data_avail);
274
275 /* Ack the data_avail interrupt. */
276 ack_intr.data_avail = 1;
277 REG_WR(ser, kgdb_instance, rw_ack_intr, ack_intr);
278
279 return stat.data;
280}
281
282/* Use polling to put a single character to the kernel debug port */
283void
284putDebugChar(int val)
285{
286 reg_ser_r_status_data stat;
287 do {
288 stat = REG_RD (ser, kgdb_instance, r_status_data);
289 } while (!stat.tr_ready);
290 REG_WR (ser, kgdb_instance, rw_data_out, REG_TYPE_CONV(reg_ser_rw_data_out, int, val));
291}
292#endif /* CONFIG_ETRAX_KGDB */
293
294static int __init
295console_setup(struct console *co, char *options)
296{
297 char* s;
298
299 if (options) {
300 port = &ports[co->index];
301 port->baudrate = 115200;
302 port->parity = 'N';
303 port->bits = 8;
304 port->baudrate = simple_strtoul(options, NULL, 10);
305 s = options;
306 while(*s >= '0' && *s <= '9')
307 s++;
308 if (*s) port->parity = *s++;
309 if (*s) port->bits = *s++ - '0';
310 port->started = 0;
311 start_port(port);
312 }
313 return 0;
314}
315
316/* This is a dummy serial device that throws away anything written to it.
317 * This is used when no debug output is wanted.
318 */
319static struct tty_driver dummy_driver;
320
321static int dummy_open(struct tty_struct *tty, struct file * filp)
322{
323 return 0;
324}
325
326static void dummy_close(struct tty_struct *tty, struct file * filp)
327{
328}
329
330static int dummy_write(struct tty_struct * tty,
331 const unsigned char *buf, int count)
332{
333 return count;
334}
335
336static int
337dummy_write_room(struct tty_struct *tty)
338{
339 return 8192;
340}
341
342void __init
343init_dummy_console(void)
344{
345 memset(&dummy_driver, 0, sizeof(struct tty_driver));
346 dummy_driver.driver_name = "serial";
347 dummy_driver.name = "ttyS";
348 dummy_driver.major = TTY_MAJOR;
349 dummy_driver.minor_start = 68;
350 dummy_driver.num = 1; /* etrax100 has 4 serial ports */
351 dummy_driver.type = TTY_DRIVER_TYPE_SERIAL;
352 dummy_driver.subtype = SERIAL_TYPE_NORMAL;
353 dummy_driver.init_termios = tty_std_termios;
354 dummy_driver.init_termios.c_cflag =
355 B115200 | CS8 | CREAD | HUPCL | CLOCAL; /* is normally B9600 default... */
356 dummy_driver.flags = TTY_DRIVER_REAL_RAW | TTY_DRIVER_NO_DEVFS;
357
358 dummy_driver.open = dummy_open;
359 dummy_driver.close = dummy_close;
360 dummy_driver.write = dummy_write;
361 dummy_driver.write_room = dummy_write_room;
362 if (tty_register_driver(&dummy_driver))
363 panic("Couldn't register dummy serial driver\n");
364}
365
366static struct tty_driver*
367crisv32_console_device(struct console* co, int *index)
368{
369 if (port)
370 *index = port->nbr;
371 return port ? serial_driver : &dummy_driver;
372}
373
374static struct console sercons = {
375 name : "ttyS",
376 write: console_write,
377 read : NULL,
378 device : crisv32_console_device,
379 unblank : NULL,
380 setup : console_setup,
381 flags : CON_PRINTBUFFER,
382 index : -1,
383 cflag : 0,
384 next : NULL
385};
386static struct console sercons0 = {
387 name : "ttyS",
388 write: console_write,
389 read : NULL,
390 device : crisv32_console_device,
391 unblank : NULL,
392 setup : console_setup,
393 flags : CON_PRINTBUFFER,
394 index : 0,
395 cflag : 0,
396 next : NULL
397};
398
399static struct console sercons1 = {
400 name : "ttyS",
401 write: console_write,
402 read : NULL,
403 device : crisv32_console_device,
404 unblank : NULL,
405 setup : console_setup,
406 flags : CON_PRINTBUFFER,
407 index : 1,
408 cflag : 0,
409 next : NULL
410};
411static struct console sercons2 = {
412 name : "ttyS",
413 write: console_write,
414 read : NULL,
415 device : crisv32_console_device,
416 unblank : NULL,
417 setup : console_setup,
418 flags : CON_PRINTBUFFER,
419 index : 2,
420 cflag : 0,
421 next : NULL
422};
423static struct console sercons3 = {
424 name : "ttyS",
425 write: console_write,
426 read : NULL,
427 device : crisv32_console_device,
428 unblank : NULL,
429 setup : console_setup,
430 flags : CON_PRINTBUFFER,
431 index : 3,
432 cflag : 0,
433 next : NULL
434};
435
436/* Register console for printk's, etc. */
437int __init
438init_etrax_debug(void)
439{
440 static int first = 1;
441
442 if (!first) {
443 unregister_console(&sercons);
444 register_console(&sercons0);
445 register_console(&sercons1);
446 register_console(&sercons2);
447 register_console(&sercons3);
448 init_dummy_console();
449 return 0;
450 }
451 first = 0;
452 register_console(&sercons);
453 start_port(port);
454
455#ifdef CONFIG_ETRAX_KGDB
456 start_port(kgdb_port);
457#endif /* CONFIG_ETRAX_KGDB */
458 return 0;
459}
460
461__initcall(init_etrax_debug);
diff --git a/arch/cris/arch-v32/kernel/dma.c b/arch/cris/arch-v32/kernel/dma.c
new file mode 100644
index 000000000000..b92e85799b44
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/dma.c
@@ -0,0 +1,224 @@
1/* Wrapper for DMA channel allocator that starts clocks etc */
2
3#include <linux/kernel.h>
4#include <linux/spinlock.h>
5#include <asm/dma.h>
6#include <asm/arch/hwregs/reg_map.h>
7#include <asm/arch/hwregs/reg_rdwr.h>
8#include <asm/arch/hwregs/marb_defs.h>
9#include <asm/arch/hwregs/config_defs.h>
10#include <asm/arch/hwregs/strmux_defs.h>
11#include <linux/errno.h>
12#include <asm/system.h>
13#include <asm/arch/arbiter.h>
14
15static char used_dma_channels[MAX_DMA_CHANNELS];
16static const char * used_dma_channels_users[MAX_DMA_CHANNELS];
17
18static DEFINE_SPINLOCK(dma_lock);
19
20int crisv32_request_dma(unsigned int dmanr, const char * device_id,
21 unsigned options, unsigned int bandwidth,
22 enum dma_owner owner)
23{
24 unsigned long flags;
25 reg_config_rw_clk_ctrl clk_ctrl;
26 reg_strmux_rw_cfg strmux_cfg;
27
28 if (crisv32_arbiter_allocate_bandwith(dmanr,
29 options & DMA_INT_MEM ? INT_REGION : EXT_REGION,
30 bandwidth))
31 return -ENOMEM;
32
33 spin_lock_irqsave(&dma_lock, flags);
34
35 if (used_dma_channels[dmanr]) {
36 spin_unlock_irqrestore(&dma_lock, flags);
37 if (options & DMA_VERBOSE_ON_ERROR) {
38 printk("Failed to request DMA %i for %s, already allocated by %s\n", dmanr, device_id, used_dma_channels_users[dmanr]);
39 }
40 if (options & DMA_PANIC_ON_ERROR)
41 panic("request_dma error!");
42 return -EBUSY;
43 }
44 clk_ctrl = REG_RD(config, regi_config, rw_clk_ctrl);
45 strmux_cfg = REG_RD(strmux, regi_strmux, rw_cfg);
46
47 switch(dmanr)
48 {
49 case 0:
50 case 1:
51 clk_ctrl.dma01_eth0 = 1;
52 break;
53 case 2:
54 case 3:
55 clk_ctrl.dma23 = 1;
56 break;
57 case 4:
58 case 5:
59 clk_ctrl.dma45 = 1;
60 break;
61 case 6:
62 case 7:
63 clk_ctrl.dma67 = 1;
64 break;
65 case 8:
66 case 9:
67 clk_ctrl.dma89_strcop = 1;
68 break;
69#if MAX_DMA_CHANNELS-1 != 9
70#error Check dma.c
71#endif
72 default:
73 spin_unlock_irqrestore(&dma_lock, flags);
74 if (options & DMA_VERBOSE_ON_ERROR) {
75 printk("Failed to request DMA %i for %s, only 0-%i valid)\n", dmanr, device_id, MAX_DMA_CHANNELS-1);
76 }
77
78 if (options & DMA_PANIC_ON_ERROR)
79 panic("request_dma error!");
80 return -EINVAL;
81 }
82
83 switch(owner)
84 {
85 case dma_eth0:
86 if (dmanr == 0)
87 strmux_cfg.dma0 = regk_strmux_eth0;
88 else if (dmanr == 1)
89 strmux_cfg.dma1 = regk_strmux_eth0;
90 else
91 panic("Invalid DMA channel for eth0\n");
92 break;
93 case dma_eth1:
94 if (dmanr == 6)
95 strmux_cfg.dma6 = regk_strmux_eth1;
96 else if (dmanr == 7)
97 strmux_cfg.dma7 = regk_strmux_eth1;
98 else
99 panic("Invalid DMA channel for eth1\n");
100 break;
101 case dma_iop0:
102 if (dmanr == 2)
103 strmux_cfg.dma2 = regk_strmux_iop0;
104 else if (dmanr == 3)
105 strmux_cfg.dma3 = regk_strmux_iop0;
106 else
107 panic("Invalid DMA channel for iop0\n");
108 break;
109 case dma_iop1:
110 if (dmanr == 4)
111 strmux_cfg.dma4 = regk_strmux_iop1;
112 else if (dmanr == 5)
113 strmux_cfg.dma5 = regk_strmux_iop1;
114 else
115 panic("Invalid DMA channel for iop1\n");
116 break;
117 case dma_ser0:
118 if (dmanr == 6)
119 strmux_cfg.dma6 = regk_strmux_ser0;
120 else if (dmanr == 7)
121 strmux_cfg.dma7 = regk_strmux_ser0;
122 else
123 panic("Invalid DMA channel for ser0\n");
124 break;
125 case dma_ser1:
126 if (dmanr == 4)
127 strmux_cfg.dma4 = regk_strmux_ser1;
128 else if (dmanr == 5)
129 strmux_cfg.dma5 = regk_strmux_ser1;
130 else
131 panic("Invalid DMA channel for ser1\n");
132 break;
133 case dma_ser2:
134 if (dmanr == 2)
135 strmux_cfg.dma2 = regk_strmux_ser2;
136 else if (dmanr == 3)
137 strmux_cfg.dma3 = regk_strmux_ser2;
138 else
139 panic("Invalid DMA channel for ser2\n");
140 break;
141 case dma_ser3:
142 if (dmanr == 8)
143 strmux_cfg.dma8 = regk_strmux_ser3;
144 else if (dmanr == 9)
145 strmux_cfg.dma9 = regk_strmux_ser3;
146 else
147 panic("Invalid DMA channel for ser3\n");
148 break;
149 case dma_sser0:
150 if (dmanr == 4)
151 strmux_cfg.dma4 = regk_strmux_sser0;
152 else if (dmanr == 5)
153 strmux_cfg.dma5 = regk_strmux_sser0;
154 else
155 panic("Invalid DMA channel for sser0\n");
156 break;
157 case dma_sser1:
158 if (dmanr == 6)
159 strmux_cfg.dma6 = regk_strmux_sser1;
160 else if (dmanr == 7)
161 strmux_cfg.dma7 = regk_strmux_sser1;
162 else
163 panic("Invalid DMA channel for sser1\n");
164 break;
165 case dma_ata:
166 if (dmanr == 2)
167 strmux_cfg.dma2 = regk_strmux_ata;
168 else if (dmanr == 3)
169 strmux_cfg.dma3 = regk_strmux_ata;
170 else
171 panic("Invalid DMA channel for ata\n");
172 break;
173 case dma_strp:
174 if (dmanr == 8)
175 strmux_cfg.dma8 = regk_strmux_strcop;
176 else if (dmanr == 9)
177 strmux_cfg.dma9 = regk_strmux_strcop;
178 else
179 panic("Invalid DMA channel for strp\n");
180 break;
181 case dma_ext0:
182 if (dmanr == 6)
183 strmux_cfg.dma6 = regk_strmux_ext0;
184 else
185 panic("Invalid DMA channel for ext0\n");
186 break;
187 case dma_ext1:
188 if (dmanr == 7)
189 strmux_cfg.dma7 = regk_strmux_ext1;
190 else
191 panic("Invalid DMA channel for ext1\n");
192 break;
193 case dma_ext2:
194 if (dmanr == 2)
195 strmux_cfg.dma2 = regk_strmux_ext2;
196 else if (dmanr == 8)
197 strmux_cfg.dma8 = regk_strmux_ext2;
198 else
199 panic("Invalid DMA channel for ext2\n");
200 break;
201 case dma_ext3:
202 if (dmanr == 3)
203 strmux_cfg.dma3 = regk_strmux_ext3;
204 else if (dmanr == 9)
205 strmux_cfg.dma9 = regk_strmux_ext2;
206 else
207 panic("Invalid DMA channel for ext2\n");
208 break;
209 }
210
211 used_dma_channels[dmanr] = 1;
212 used_dma_channels_users[dmanr] = device_id;
213 REG_WR(config, regi_config, rw_clk_ctrl, clk_ctrl);
214 REG_WR(strmux, regi_strmux, rw_cfg, strmux_cfg);
215 spin_unlock_irqrestore(&dma_lock,flags);
216 return 0;
217}
218
219void crisv32_free_dma(unsigned int dmanr)
220{
221 spin_lock(&dma_lock);
222 used_dma_channels[dmanr] = 0;
223 spin_unlock(&dma_lock);
224}
diff --git a/arch/cris/arch-v32/kernel/entry.S b/arch/cris/arch-v32/kernel/entry.S
new file mode 100644
index 000000000000..a8ed55e5b403
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/entry.S
@@ -0,0 +1,820 @@
1/*
2 * Copyright (C) 2000-2003 Axis Communications AB
3 *
4 * Authors: Bjorn Wesen (bjornw@axis.com)
5 * Tobias Anderberg (tobiasa@axis.com), CRISv32 port.
6 *
7 * Code for the system-call and fault low-level handling routines.
8 *
9 * NOTE: This code handles signal-recognition, which happens every time
10 * after a timer-interrupt and after each system call.
11 *
12 * Stack layout in 'ret_from_system_call':
13 * ptrace needs to have all regs on the stack.
14 * if the order here is changed, it needs to be
15 * updated in fork.c:copy_process, signal.c:do_signal,
16 * ptrace.c and ptrace.h
17 *
18 */
19
20#include <linux/config.h>
21#include <linux/linkage.h>
22#include <linux/sys.h>
23#include <asm/unistd.h>
24#include <asm/errno.h>
25#include <asm/thread_info.h>
26#include <asm/arch/offset.h>
27
28#include <asm/arch/hwregs/asm/reg_map_asm.h>
29#include <asm/arch/hwregs/asm/intr_vect_defs_asm.h>
30
31 ;; Exported functions.
32 .globl system_call
33 .globl ret_from_intr
34 .globl ret_from_fork
35 .globl resume
36 .globl multiple_interrupt
37 .globl nmi_interrupt
38 .globl spurious_interrupt
39 .globl do_sigtrap
40 .globl gdb_handle_exception
41 .globl sys_call_table
42
43 ; Check if preemptive kernel scheduling should be done.
44#ifdef CONFIG_PREEMPT
45_resume_kernel:
46 di
47 ; Load current task struct.
48 movs.w -8192, $r0 ; THREAD_SIZE = 8192
49 and.d $sp, $r0
50
51 addoq +TI_preempt_count, $r0, $acr
52 move.d [$acr], $r10 ; Preemption disabled?
53 bne _Rexit
54 nop
55
56_need_resched:
57 addoq +TI_flags, $r0, $acr
58 move.d [$acr], $r10
59 btstq TIF_NEED_RESCHED, $r10 ; Check if need_resched is set.
60 bpl _Rexit
61 nop
62
63 ; Do preemptive kernel scheduling.
64 jsr preempt_schedule_irq
65 nop
66
67 ; Load new task struct.
68 movs.w -8192, $r0 ; THREAD_SIZE = 8192.
69 and.d $sp, $r0
70
71 ; One more time with new task.
72 ba _need_resched
73 nop
74#else
75#define _resume_kernel _Rexit
76#endif
77
78 ; Called at exit from fork. schedule_tail must be called to drop
79 ; spinlock if CONFIG_PREEMPT.
80ret_from_fork:
81 jsr schedule_tail
82 nop
83 ba ret_from_sys_call
84 nop
85
86ret_from_intr:
87 ;; Check for resched if preemptive kernel, or if we're going back to
88 ;; user-mode. This test matches the user_regs(regs) macro. Don't simply
89 ;; test CCS since that doesn't necessarily reflect what mode we'll
90 ;; return into.
91 addoq +PT_ccs, $sp, $acr
92 move.d [$acr], $r0
93 btstq 16, $r0 ; User-mode flag.
94 bpl _resume_kernel
95
96 ; Note that di below is in delay slot.
97
98_resume_userspace:
99 di ; So need_resched and sigpending don't change.
100
101 movs.w -8192, $r0 ; THREAD_SIZE == 8192
102 and.d $sp, $r0
103
104 addoq +TI_flags, $r0, $acr ; current->work
105 move.d [$acr], $r10
106 and.d _TIF_WORK_MASK, $r10 ; Work to be done on return?
107 bne _work_pending
108 nop
109 ba _Rexit
110 nop
111
112 ;; The system_call is called by a BREAK instruction, which looks pretty
113 ;; much like any other exception.
114 ;;
115 ;; System calls can't be made from interrupts but we still stack ERP
116 ;; to have a complete stack frame.
117 ;;
118 ;; In r9 we have the wanted syscall number. Arguments come in r10,r11,r12,
119 ;; r13,mof,srp
120 ;;
121 ;; This function looks on the _surface_ like spaghetti programming, but it's
122 ;; really designed so that the fast-path does not force cache-loading of
123 ;; non-used instructions. Only the non-common cases cause the outlined code
124 ;; to run..
125
126system_call:
127 ;; Stack-frame similar to the irq heads, which is reversed in
128 ;; ret_from_sys_call.
129 subq 12, $sp ; Skip EXS, EDA.
130 move $erp, [$sp]
131 subq 4, $sp
132 move $srp, [$sp]
133 subq 4, $sp
134 move $ccs, [$sp]
135 subq 4, $sp
136 ei ; Allow IRQs while handling system call
137 move $spc, [$sp]
138 subq 4, $sp
139 move $mof, [$sp]
140 subq 4, $sp
141 move $srs, [$sp]
142 subq 4, $sp
143 move.d $acr, [$sp]
144 subq 14*4, $sp ; Make room for R0-R13.
145 movem $r13, [$sp] ; Push R0-R13
146 subq 4, $sp
147 move.d $r10, [$sp] ; Push orig_r10.
148
149; Set S-bit when kernel debugging to keep hardware breakpoints active.
150#ifdef CONFIG_ETRAX_KGDB
151 move $ccs, $r0
152 or.d (1<<9), $r0
153 move $r0, $ccs
154#endif
155
156 movs.w -ENOSYS, $r0
157 addoq +PT_r10, $sp, $acr
158 move.d $r0, [$acr]
159
160 ;; Check if this process is syscall-traced.
161 movs.w -8192, $r0 ; THREAD_SIZE == 8192
162 and.d $sp, $r0
163
164 addoq +TI_flags, $r0, $acr
165 move.d [$acr], $r0
166 btstq TIF_SYSCALL_TRACE, $r0
167 bmi _syscall_trace_entry
168 nop
169
170_syscall_traced:
171 ;; Check for sanity in the requested syscall number.
172 cmpu.w NR_syscalls, $r9
173 bhs ret_from_sys_call
174 lslq 2, $r9 ; Multiply by 4, in the delay slot.
175
176 ;; The location on the stack for the register structure is passed as a
177 ;; seventh argument. Some system calls need this.
178 move.d $sp, $r0
179 subq 4, $sp
180 move.d $r0, [$sp]
181
182 ;; The registers carrying parameters (R10-R13) are intact. The optional
183 ;; fifth and sixth parameters is in MOF and SRP respectivly. Put them
184 ;; back on the stack.
185 subq 4, $sp
186 move $srp, [$sp]
187 subq 4, $sp
188 move $mof, [$sp]
189
190 ;; Actually to the system call.
191 addo.d +sys_call_table, $r9, $acr
192 move.d [$acr], $acr
193 jsr $acr
194 nop
195
196 addq 3*4, $sp ; Pop the mof, srp and regs parameters.
197 addoq +PT_r10, $sp, $acr
198 move.d $r10, [$acr] ; Save the return value.
199
200 moveq 1, $r9 ; "Parameter" to ret_from_sys_call to
201 ; show it was a sys call.
202
203 ;; Fall through into ret_from_sys_call to return.
204
205ret_from_sys_call:
206 ;; R9 is a parameter:
207 ;; >= 1 from syscall
208 ;; 0 from irq
209
210 ;; Get the current task-struct pointer.
211 movs.w -8192, $r0 ; THREAD_SIZE == 8192
212 and.d $sp, $r0
213
214 di ; Make sure need_resched and sigpending don't change.
215
216 addoq +TI_flags, $r0, $acr
217 move.d [$acr], $r1
218 and.d _TIF_ALLWORK_MASK, $r1
219 bne _syscall_exit_work
220 nop
221
222_Rexit:
223 ;; This epilogue MUST match the prologues in multiple_interrupt, irq.h
224 ;; and ptregs.h.
225 addq 4, $sp ; Skip orig_r10.
226 movem [$sp+], $r13 ; Registers R0-R13.
227 move.d [$sp+], $acr
228 move [$sp], $srs
229 addq 4, $sp
230 move [$sp+], $mof
231 move [$sp+], $spc
232 move [$sp+], $ccs
233 move [$sp+], $srp
234 move [$sp+], $erp
235 addq 8, $sp ; Skip EXS, EDA.
236 jump $erp
237 rfe ; Restore condition code stack in delay-slot.
238
239 ;; We get here after doing a syscall if extra work might need to be done
240 ;; perform syscall exit tracing if needed.
241
242_syscall_exit_work:
243 ;; R0 contains current at this point and irq's are disabled.
244
245 addoq +TI_flags, $r0, $acr
246 move.d [$acr], $r1
247 btstq TIF_SYSCALL_TRACE, $r1
248 bpl _work_pending
249 nop
250 ei
251 move.d $r9, $r1 ; Preserve R9.
252 jsr do_syscall_trace
253 nop
254 move.d $r1, $r9
255 ba _resume_userspace
256 nop
257
258_work_pending:
259 addoq +TI_flags, $r0, $acr
260 move.d [$acr], $r10
261 btstq TIF_NEED_RESCHED, $r10 ; Need resched?
262 bpl _work_notifysig ; No, must be signal/notify.
263 nop
264
265_work_resched:
266 move.d $r9, $r1 ; Preserve R9.
267 jsr schedule
268 nop
269 move.d $r1, $r9
270 di
271
272 addoq +TI_flags, $r0, $acr
273 move.d [$acr], $r1
274 and.d _TIF_WORK_MASK, $r1 ; Ignore sycall trace counter.
275 beq _Rexit
276 nop
277 btstq TIF_NEED_RESCHED, $r1
278 bmi _work_resched ; current->work.need_resched.
279 nop
280
281_work_notifysig:
282 ;; Deal with pending signals and notify-resume requests.
283
284 addoq +TI_flags, $r0, $acr
285 move.d [$acr], $r13 ; The thread_info_flags parameter.
286 move.d $r9, $r10 ; do_notify_resume syscall/irq param.
287 moveq 0, $r11 ; oldset param - 0 in this case.
288 move.d $sp, $r12 ; The regs param.
289 jsr do_notify_resume
290 nop
291
292 ba _Rexit
293 nop
294
295 ;; We get here as a sidetrack when we've entered a syscall with the
296 ;; trace-bit set. We need to call do_syscall_trace and then continue
297 ;; with the call.
298
299_syscall_trace_entry:
300 ;; PT_r10 in the frame contains -ENOSYS as required, at this point.
301
302 jsr do_syscall_trace
303 nop
304
305 ;; Now re-enter the syscall code to do the syscall itself. We need to
306 ;; restore R9 here to contain the wanted syscall, and the other
307 ;; parameter-bearing registers.
308 addoq +PT_r9, $sp, $acr
309 move.d [$acr], $r9
310 addoq +PT_orig_r10, $sp, $acr
311 move.d [$acr], $r10 ; PT_r10 is already -ENOSYS.
312 addoq +PT_r11, $sp, $acr
313 move.d [$acr], $r11
314 addoq +PT_r12, $sp, $acr
315 move.d [$acr], $r12
316 addoq +PT_r13, $sp, $acr
317 move.d [$acr], $r13
318 addoq +PT_mof, $sp, $acr
319 move [$acr], $mof
320 addoq +PT_srp, $sp, $acr
321 move [$acr], $srp
322
323 ba _syscall_traced
324 nop
325
326 ;; Resume performs the actual task-switching, by switching stack
327 ;; pointers. Input arguments are:
328 ;;
329 ;; R10 = prev
330 ;; R11 = next
331 ;; R12 = thread offset in task struct.
332 ;;
333 ;; Returns old current in R10.
334
335resume:
336 subq 4, $sp
337 move $srp, [$sp] ; Keep old/new PC on the stack.
338 add.d $r12, $r10 ; R10 = current tasks tss.
339 addoq +THREAD_ccs, $r10, $acr
340 move $ccs, [$acr] ; Save IRQ enable state.
341 di
342
343 addoq +THREAD_usp, $r10, $acr
344 move $usp, [$acr] ; Save user-mode stackpointer.
345
346 ;; See copy_thread for the reason why register R9 is saved.
347 subq 10*4, $sp
348 movem $r9, [$sp] ; Save non-scratch registers and R9.
349
350 addoq +THREAD_ksp, $r10, $acr
351 move.d $sp, [$acr] ; Save kernel SP for old task.
352
353 move.d $sp, $r10 ; Return last running task in R10.
354 and.d -8192, $r10 ; Get thread_info from stackpointer.
355 addoq +TI_task, $r10, $acr
356 move.d [$acr], $r10 ; Get task.
357 add.d $r12, $r11 ; Find the new tasks tss.
358 addoq +THREAD_ksp, $r11, $acr
359 move.d [$acr], $sp ; Switch to new stackframe.
360 movem [$sp+], $r9 ; Restore non-scratch registers and R9.
361
362 addoq +THREAD_usp, $r11, $acr
363 move [$acr], $usp ; Restore user-mode stackpointer.
364
365 addoq +THREAD_ccs, $r11, $acr
366 move [$acr], $ccs ; Restore IRQ enable status.
367 move.d [$sp+], $acr
368 jump $acr ; Restore PC.
369 nop
370
371nmi_interrupt:
372
373;; If we receive a watchdog interrupt while it is not expected, then set
374;; up a canonical frame and dump register contents before dying.
375
376 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
377 subq 12, $sp ; Skip EXS, EDA.
378 move $nrp, [$sp]
379 subq 4, $sp
380 move $srp, [$sp]
381 subq 4, $sp
382 move $ccs, [$sp]
383 subq 4, $sp
384 move $spc, [$sp]
385 subq 4, $sp
386 move $mof, [$sp]
387 subq 4, $sp
388 move $srs, [$sp]
389 subq 4, $sp
390 move.d $acr, [$sp]
391 subq 14*4, $sp ; Make room for R0-R13.
392 movem $r13, [$sp] ; Push R0-R13.
393 subq 4, $sp
394 move.d $r10, [$sp] ; Push orig_r10.
395 move.d REG_ADDR(intr_vect, regi_irq, r_nmi), $r0
396 move.d [$r0], $r0
397 btstq REG_BIT(intr_vect, r_nmi, watchdog), $r0
398 bpl 1f
399 nop
400 jsr handle_watchdog_bite ; In time.c.
401 move.d $sp, $r10 ; Pointer to registers
4021: btstq REG_BIT(intr_vect, r_nmi, ext), $r0
403 bpl 1f
404 nop
405 jsr handle_nmi
406 move.d $sp, $r10 ; Pointer to registers
4071: addq 4, $sp ; Skip orig_r10
408 movem [$sp+], $r13
409 move.d [$sp+], $acr
410 move [$sp], $srs
411 addq 4, $sp
412 move [$sp+], $mof
413 move [$sp+], $spc
414 move [$sp+], $ccs
415 move [$sp+], $srp
416 move [$sp+], $nrp
417 addq 8, $sp ; Skip EXS, EDA.
418 jump $nrp
419 rfn
420
421 .comm cause_of_death, 4 ;; Don't declare this anywhere.
422
423spurious_interrupt:
424 di
425 jump hard_reset_now
426 nop
427
428 ;; This handles the case when multiple interrupts arrive at the same
429 ;; time. Jump to the first set interrupt bit in a priotiry fashion. The
430 ;; hardware will call the unserved interrupts after the handler
431 ;; finishes.
432multiple_interrupt:
433 ;; This prologue MUST match the one in irq.h and the struct in ptregs.h!
434 subq 12, $sp ; Skip EXS, EDA.
435 move $erp, [$sp]
436 subq 4, $sp
437 move $srp, [$sp]
438 subq 4, $sp
439 move $ccs, [$sp]
440 subq 4, $sp
441 move $spc, [$sp]
442 subq 4, $sp
443 move $mof, [$sp]
444 subq 4, $sp
445 move $srs, [$sp]
446 subq 4, $sp
447 move.d $acr, [$sp]
448 subq 14*4, $sp ; Make room for R0-R13.
449 movem $r13, [$sp] ; Push R0-R13.
450 subq 4, $sp
451 move.d $r10, [$sp] ; Push orig_r10.
452
453; Set S-bit when kernel debugging to keep hardware breakpoints active.
454#ifdef CONFIG_ETRAX_KGDB
455 move $ccs, $r0
456 or.d (1<<9), $r0
457 move $r0, $ccs
458#endif
459
460 jsr crisv32_do_multiple
461 move.d $sp, $r10
462 jump ret_from_intr
463 nop
464
465do_sigtrap:
466 ;; Sigtraps the process that executed the BREAK instruction. Creates a
467 ;; frame that Rexit expects.
468 subq 4, $sp
469 move $eda, [$sp]
470 subq 4, $sp
471 move $exs, [$sp]
472 subq 4, $sp
473 move $erp, [$sp]
474 subq 4, $sp
475 move $srp, [$sp]
476 subq 4, $sp
477 move $ccs, [$sp]
478 subq 4, $sp
479 move $spc, [$sp]
480 subq 4, $sp
481 move $mof, [$sp]
482 subq 4, $sp
483 move $srs, [$sp]
484 subq 4, $sp
485 move.d $acr, [$sp]
486 di ; Need to disable irq's at this point.
487 subq 14*4, $sp ; Make room for r0-r13.
488 movem $r13, [$sp] ; Push the r0-r13 registers.
489 subq 4, $sp
490 move.d $r10, [$sp] ; Push orig_r10.
491
492 movs.w -8192, $r9 ; THREAD_SIZE == 8192
493 and.d $sp, $r9
494
495 ;; thread_info as first parameter
496 move.d $r9, $r10
497 moveq 5, $r11 ; SIGTRAP as second argument.
498 jsr ugdb_trap_user
499 nop
500 jump ret_from_intr ; Use the return routine for interrupts.
501 nop
502
503gdb_handle_exception:
504 subq 4, $sp
505 move.d $r0, [$sp]
506#ifdef CONFIG_ETRAX_KGDB
507 move $ccs, $r0 ; U-flag not affected by previous insns.
508 btstq 16, $r0 ; Test the U-flag.
509 bmi _ugdb_handle_exception ; Go to user mode debugging.
510 nop ; Empty delay-slot (cannot pop R0 here).
511 ba kgdb_handle_exception ; Go to kernel debugging.
512 move.d [$sp+], $r0 ; Restore R0 in delay slot.
513#endif
514
515_ugdb_handle_exception:
516 ba do_sigtrap ; SIGTRAP the offending process.
517 move.d [$sp+], $r0 ; Restore R0 in delay slot.
518
519 .data
520
521 .section .rodata,"a"
522sys_call_table:
523 .long sys_restart_syscall ; 0 - old "setup()" system call, used
524 ; for restarting.
525 .long sys_exit
526 .long sys_fork
527 .long sys_read
528 .long sys_write
529 .long sys_open /* 5 */
530 .long sys_close
531 .long sys_waitpid
532 .long sys_creat
533 .long sys_link
534 .long sys_unlink /* 10 */
535 .long sys_execve
536 .long sys_chdir
537 .long sys_time
538 .long sys_mknod
539 .long sys_chmod /* 15 */
540 .long sys_lchown16
541 .long sys_ni_syscall /* old break syscall holder */
542 .long sys_stat
543 .long sys_lseek
544 .long sys_getpid /* 20 */
545 .long sys_mount
546 .long sys_oldumount
547 .long sys_setuid16
548 .long sys_getuid16
549 .long sys_stime /* 25 */
550 .long sys_ptrace
551 .long sys_alarm
552 .long sys_fstat
553 .long sys_pause
554 .long sys_utime /* 30 */
555 .long sys_ni_syscall /* old stty syscall holder */
556 .long sys_ni_syscall /* old gtty syscall holder */
557 .long sys_access
558 .long sys_nice
559 .long sys_ni_syscall /* 35 old ftime syscall holder */
560 .long sys_sync
561 .long sys_kill
562 .long sys_rename
563 .long sys_mkdir
564 .long sys_rmdir /* 40 */
565 .long sys_dup
566 .long sys_pipe
567 .long sys_times
568 .long sys_ni_syscall /* old prof syscall holder */
569 .long sys_brk /* 45 */
570 .long sys_setgid16
571 .long sys_getgid16
572 .long sys_signal
573 .long sys_geteuid16
574 .long sys_getegid16 /* 50 */
575 .long sys_acct
576 .long sys_umount /* recycled never used phys( */
577 .long sys_ni_syscall /* old lock syscall holder */
578 .long sys_ioctl
579 .long sys_fcntl /* 55 */
580 .long sys_ni_syscall /* old mpx syscall holder */
581 .long sys_setpgid
582 .long sys_ni_syscall /* old ulimit syscall holder */
583 .long sys_ni_syscall /* old sys_olduname holder */
584 .long sys_umask /* 60 */
585 .long sys_chroot
586 .long sys_ustat
587 .long sys_dup2
588 .long sys_getppid
589 .long sys_getpgrp /* 65 */
590 .long sys_setsid
591 .long sys_sigaction
592 .long sys_sgetmask
593 .long sys_ssetmask
594 .long sys_setreuid16 /* 70 */
595 .long sys_setregid16
596 .long sys_sigsuspend
597 .long sys_sigpending
598 .long sys_sethostname
599 .long sys_setrlimit /* 75 */
600 .long sys_old_getrlimit
601 .long sys_getrusage
602 .long sys_gettimeofday
603 .long sys_settimeofday
604 .long sys_getgroups16 /* 80 */
605 .long sys_setgroups16
606 .long sys_select /* was old_select in Linux/E100 */
607 .long sys_symlink
608 .long sys_lstat
609 .long sys_readlink /* 85 */
610 .long sys_uselib
611 .long sys_swapon
612 .long sys_reboot
613 .long old_readdir
614 .long old_mmap /* 90 */
615 .long sys_munmap
616 .long sys_truncate
617 .long sys_ftruncate
618 .long sys_fchmod
619 .long sys_fchown16 /* 95 */
620 .long sys_getpriority
621 .long sys_setpriority
622 .long sys_ni_syscall /* old profil syscall holder */
623 .long sys_statfs
624 .long sys_fstatfs /* 100 */
625 .long sys_ni_syscall /* sys_ioperm in i386 */
626 .long sys_socketcall
627 .long sys_syslog
628 .long sys_setitimer
629 .long sys_getitimer /* 105 */
630 .long sys_newstat
631 .long sys_newlstat
632 .long sys_newfstat
633 .long sys_ni_syscall /* old sys_uname holder */
634 .long sys_ni_syscall /* sys_iopl in i386 */
635 .long sys_vhangup
636 .long sys_ni_syscall /* old "idle" system call */
637 .long sys_ni_syscall /* vm86old in i386 */
638 .long sys_wait4
639 .long sys_swapoff /* 115 */
640 .long sys_sysinfo
641 .long sys_ipc
642 .long sys_fsync
643 .long sys_sigreturn
644 .long sys_clone /* 120 */
645 .long sys_setdomainname
646 .long sys_newuname
647 .long sys_ni_syscall /* sys_modify_ldt */
648 .long sys_adjtimex
649 .long sys_mprotect /* 125 */
650 .long sys_sigprocmask
651 .long sys_ni_syscall /* old "create_module" */
652 .long sys_init_module
653 .long sys_delete_module
654 .long sys_ni_syscall /* 130: old "get_kernel_syms" */
655 .long sys_quotactl
656 .long sys_getpgid
657 .long sys_fchdir
658 .long sys_bdflush
659 .long sys_sysfs /* 135 */
660 .long sys_personality
661 .long sys_ni_syscall /* for afs_syscall */
662 .long sys_setfsuid16
663 .long sys_setfsgid16
664 .long sys_llseek /* 140 */
665 .long sys_getdents
666 .long sys_select
667 .long sys_flock
668 .long sys_msync
669 .long sys_readv /* 145 */
670 .long sys_writev
671 .long sys_getsid
672 .long sys_fdatasync
673 .long sys_sysctl
674 .long sys_mlock /* 150 */
675 .long sys_munlock
676 .long sys_mlockall
677 .long sys_munlockall
678 .long sys_sched_setparam
679 .long sys_sched_getparam /* 155 */
680 .long sys_sched_setscheduler
681 .long sys_sched_getscheduler
682 .long sys_sched_yield
683 .long sys_sched_get_priority_max
684 .long sys_sched_get_priority_min /* 160 */
685 .long sys_sched_rr_get_interval
686 .long sys_nanosleep
687 .long sys_mremap
688 .long sys_setresuid16
689 .long sys_getresuid16 /* 165 */
690 .long sys_ni_syscall /* sys_vm86 */
691 .long sys_ni_syscall /* Old sys_query_module */
692 .long sys_poll
693 .long sys_nfsservctl
694 .long sys_setresgid16 /* 170 */
695 .long sys_getresgid16
696 .long sys_prctl
697 .long sys_rt_sigreturn
698 .long sys_rt_sigaction
699 .long sys_rt_sigprocmask /* 175 */
700 .long sys_rt_sigpending
701 .long sys_rt_sigtimedwait
702 .long sys_rt_sigqueueinfo
703 .long sys_rt_sigsuspend
704 .long sys_pread64 /* 180 */
705 .long sys_pwrite64
706 .long sys_chown16
707 .long sys_getcwd
708 .long sys_capget
709 .long sys_capset /* 185 */
710 .long sys_sigaltstack
711 .long sys_sendfile
712 .long sys_ni_syscall /* streams1 */
713 .long sys_ni_syscall /* streams2 */
714 .long sys_vfork /* 190 */
715 .long sys_getrlimit
716 .long sys_mmap2
717 .long sys_truncate64
718 .long sys_ftruncate64
719 .long sys_stat64 /* 195 */
720 .long sys_lstat64
721 .long sys_fstat64
722 .long sys_lchown
723 .long sys_getuid
724 .long sys_getgid /* 200 */
725 .long sys_geteuid
726 .long sys_getegid
727 .long sys_setreuid
728 .long sys_setregid
729 .long sys_getgroups /* 205 */
730 .long sys_setgroups
731 .long sys_fchown
732 .long sys_setresuid
733 .long sys_getresuid
734 .long sys_setresgid /* 210 */
735 .long sys_getresgid
736 .long sys_chown
737 .long sys_setuid
738 .long sys_setgid
739 .long sys_setfsuid /* 215 */
740 .long sys_setfsgid
741 .long sys_pivot_root
742 .long sys_mincore
743 .long sys_madvise
744 .long sys_getdents64 /* 220 */
745 .long sys_fcntl64
746 .long sys_ni_syscall /* reserved for TUX */
747 .long sys_ni_syscall
748 .long sys_gettid
749 .long sys_readahead /* 225 */
750 .long sys_setxattr
751 .long sys_lsetxattr
752 .long sys_fsetxattr
753 .long sys_getxattr
754 .long sys_lgetxattr /* 230 */
755 .long sys_fgetxattr
756 .long sys_listxattr
757 .long sys_llistxattr
758 .long sys_flistxattr
759 .long sys_removexattr /* 235 */
760 .long sys_lremovexattr
761 .long sys_fremovexattr
762 .long sys_tkill
763 .long sys_sendfile64
764 .long sys_futex /* 240 */
765 .long sys_sched_setaffinity
766 .long sys_sched_getaffinity
767 .long sys_ni_syscall /* sys_set_thread_area */
768 .long sys_ni_syscall /* sys_get_thread_area */
769 .long sys_io_setup /* 245 */
770 .long sys_io_destroy
771 .long sys_io_getevents
772 .long sys_io_submit
773 .long sys_io_cancel
774 .long sys_fadvise64 /* 250 */
775 .long sys_ni_syscall
776 .long sys_exit_group
777 .long sys_lookup_dcookie
778 .long sys_epoll_create
779 .long sys_epoll_ctl /* 255 */
780 .long sys_epoll_wait
781 .long sys_remap_file_pages
782 .long sys_set_tid_address
783 .long sys_timer_create
784 .long sys_timer_settime /* 260 */
785 .long sys_timer_gettime
786 .long sys_timer_getoverrun
787 .long sys_timer_delete
788 .long sys_clock_settime
789 .long sys_clock_gettime /* 265 */
790 .long sys_clock_getres
791 .long sys_clock_nanosleep
792 .long sys_statfs64
793 .long sys_fstatfs64
794 .long sys_tgkill /* 270 */
795 .long sys_utimes
796 .long sys_fadvise64_64
797 .long sys_ni_syscall /* sys_vserver */
798 .long sys_ni_syscall /* sys_mbind */
799 .long sys_ni_syscall /* 275 sys_get_mempolicy */
800 .long sys_ni_syscall /* sys_set_mempolicy */
801 .long sys_mq_open
802 .long sys_mq_unlink
803 .long sys_mq_timedsend
804 .long sys_mq_timedreceive /* 280 */
805 .long sys_mq_notify
806 .long sys_mq_getsetattr
807 .long sys_ni_syscall /* reserved for kexec */
808 .long sys_waitid
809
810 /*
811 * NOTE!! This doesn't have to be exact - we just have
812 * to make sure we have _enough_ of the "sys_ni_syscall"
813 * entries. Don't panic if you notice that this hasn't
814 * been shrunk every time we add a new system call.
815 */
816
817 .rept NR_syscalls - (.-sys_call_table) / 4
818 .long sys_ni_syscall
819 .endr
820
diff --git a/arch/cris/arch-v32/kernel/fasttimer.c b/arch/cris/arch-v32/kernel/fasttimer.c
new file mode 100644
index 000000000000..ea2b4a97c8c7
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/fasttimer.c
@@ -0,0 +1,996 @@
1/* $Id: fasttimer.c,v 1.11 2005/01/04 11:15:46 starvik Exp $
2 * linux/arch/cris/kernel/fasttimer.c
3 *
4 * Fast timers for ETRAX FS
5 * This may be useful in other OS than Linux so use 2 space indentation...
6 *
7 * $Log: fasttimer.c,v $
8 * Revision 1.11 2005/01/04 11:15:46 starvik
9 * Don't share timer IRQ.
10 *
11 * Revision 1.10 2004/12/07 09:19:38 starvik
12 * Corrected includes.
13 * Use correct interrupt macros.
14 *
15 * Revision 1.9 2004/05/14 10:18:58 starvik
16 * Export fast_timer_list
17 *
18 * Revision 1.8 2004/05/14 07:58:03 starvik
19 * Merge of changes from 2.4
20 *
21 * Revision 1.7 2003/07/10 12:06:14 starvik
22 * Return IRQ_NONE if irq wasn't handled
23 *
24 * Revision 1.6 2003/07/04 08:27:49 starvik
25 * Merge of Linux 2.5.74
26 *
27 * Revision 1.5 2003/06/05 10:16:22 johana
28 * New INTR_VECT macros.
29 *
30 * Revision 1.4 2003/06/03 08:49:45 johana
31 * Fixed typo.
32 *
33 * Revision 1.3 2003/06/02 12:51:27 johana
34 * Now compiles.
35 * Commented some include files that probably can be removed.
36 *
37 * Revision 1.2 2003/06/02 12:09:41 johana
38 * Ported to ETRAX FS using the trig interrupt instead of timer1.
39 *
40 * Revision 1.3 2002/12/12 08:26:32 starvik
41 * Don't use C-comments inside CVS comments
42 *
43 * Revision 1.2 2002/12/11 15:42:02 starvik
44 * Extracted v10 (ETRAX 100LX) specific stuff from arch/cris/kernel/
45 *
46 * Revision 1.1 2002/11/18 07:58:06 starvik
47 * Fast timers (from Linux 2.4)
48 *
49 * Revision 1.5 2002/10/15 06:21:39 starvik
50 * Added call to init_waitqueue_head
51 *
52 * Revision 1.4 2002/05/28 17:47:59 johana
53 * Added del_fast_timer()
54 *
55 * Revision 1.3 2002/05/28 16:16:07 johana
56 * Handle empty fast_timer_list
57 *
58 * Revision 1.2 2002/05/27 15:38:42 johana
59 * Made it compile without warnings on Linux 2.4.
60 * (includes, wait_queue, PROC_FS and snprintf)
61 *
62 * Revision 1.1 2002/05/27 15:32:25 johana
63 * arch/etrax100/kernel/fasttimer.c v1.8 from the elinux tree.
64 *
65 * Revision 1.8 2001/11/27 13:50:40 pkj
66 * Disable interrupts while stopping the timer and while modifying the
67 * list of active timers in timer1_handler() as it may be interrupted
68 * by other interrupts (e.g., the serial interrupt) which may add fast
69 * timers.
70 *
71 * Revision 1.7 2001/11/22 11:50:32 pkj
72 * * Only store information about the last 16 timers.
73 * * proc_fasttimer_read() now uses an allocated buffer, since it
74 * requires more space than just a page even for only writing the
75 * last 16 timers. The buffer is only allocated on request, so
76 * unless /proc/fasttimer is read, it is never allocated.
77 * * Renamed fast_timer_started to fast_timers_started to match
78 * fast_timers_added and fast_timers_expired.
79 * * Some clean-up.
80 *
81 * Revision 1.6 2000/12/13 14:02:08 johana
82 * Removed volatile for fast_timer_list
83 *
84 * Revision 1.5 2000/12/13 13:55:35 johana
85 * Added DEBUG_LOG, added som cli() and cleanup
86 *
87 * Revision 1.4 2000/12/05 13:48:50 johana
88 * Added range check when writing proc file, modified timer int handling
89 *
90 * Revision 1.3 2000/11/23 10:10:20 johana
91 * More debug/logging possibilities.
92 * Moved GET_JIFFIES_USEC() to timex.h and time.c
93 *
94 * Revision 1.2 2000/11/01 13:41:04 johana
95 * Clean up and bugfixes.
96 * Created new do_gettimeofday_fast() that gets a timeval struct
97 * with time based on jiffies and *R_TIMER0_DATA, uses a table
98 * for fast conversion of timer value to microseconds.
99 * (Much faster the standard do_gettimeofday() and we don't really
100 * wan't to use the true time - we wan't the "uptime" so timers don't screw up
101 * when we change the time.
102 * TODO: Add efficient support for continuous timers as well.
103 *
104 * Revision 1.1 2000/10/26 15:49:16 johana
105 * Added fasttimer, highresolution timers.
106 *
107 * Copyright (C) 2000,2001 2002, 2003 Axis Communications AB, Lund, Sweden
108 */
109
110#include <linux/errno.h>
111#include <linux/sched.h>
112#include <linux/kernel.h>
113#include <linux/param.h>
114#include <linux/string.h>
115#include <linux/vmalloc.h>
116#include <linux/interrupt.h>
117#include <linux/time.h>
118#include <linux/delay.h>
119
120#include <asm/irq.h>
121#include <asm/system.h>
122
123#include <linux/config.h>
124#include <linux/version.h>
125
126#include <asm/arch/hwregs/reg_map.h>
127#include <asm/arch/hwregs/reg_rdwr.h>
128#include <asm/arch/hwregs/timer_defs.h>
129#include <asm/fasttimer.h>
130#include <linux/proc_fs.h>
131
132/*
133 * timer0 is running at 100MHz and generating jiffies timer ticks
134 * at 100 or 1000 HZ.
135 * fasttimer gives an API that gives timers that expire "between" the jiffies
136 * giving microsecond resolution (10 ns).
137 * fasttimer uses reg_timer_rw_trig register to get interrupt when
138 * r_time reaches a certain value.
139 */
140
141
142#define DEBUG_LOG_INCLUDED
143#define FAST_TIMER_LOG
144//#define FAST_TIMER_TEST
145
146#define FAST_TIMER_SANITY_CHECKS
147
148#ifdef FAST_TIMER_SANITY_CHECKS
149#define SANITYCHECK(x) x
150static int sanity_failed = 0;
151#else
152#define SANITYCHECK(x)
153#endif
154
155#define D1(x)
156#define D2(x)
157#define DP(x)
158
159#define __INLINE__ inline
160
161static int fast_timer_running = 0;
162static int fast_timers_added = 0;
163static int fast_timers_started = 0;
164static int fast_timers_expired = 0;
165static int fast_timers_deleted = 0;
166static int fast_timer_is_init = 0;
167static int fast_timer_ints = 0;
168
169struct fast_timer *fast_timer_list = NULL;
170
171#ifdef DEBUG_LOG_INCLUDED
172#define DEBUG_LOG_MAX 128
173static const char * debug_log_string[DEBUG_LOG_MAX];
174static unsigned long debug_log_value[DEBUG_LOG_MAX];
175static int debug_log_cnt = 0;
176static int debug_log_cnt_wrapped = 0;
177
178#define DEBUG_LOG(string, value) \
179{ \
180 unsigned long log_flags; \
181 local_irq_save(log_flags); \
182 debug_log_string[debug_log_cnt] = (string); \
183 debug_log_value[debug_log_cnt] = (unsigned long)(value); \
184 if (++debug_log_cnt >= DEBUG_LOG_MAX) \
185 { \
186 debug_log_cnt = debug_log_cnt % DEBUG_LOG_MAX; \
187 debug_log_cnt_wrapped = 1; \
188 } \
189 local_irq_restore(log_flags); \
190}
191#else
192#define DEBUG_LOG(string, value)
193#endif
194
195
196#define NUM_TIMER_STATS 16
197#ifdef FAST_TIMER_LOG
198struct fast_timer timer_added_log[NUM_TIMER_STATS];
199struct fast_timer timer_started_log[NUM_TIMER_STATS];
200struct fast_timer timer_expired_log[NUM_TIMER_STATS];
201#endif
202
203int timer_div_settings[NUM_TIMER_STATS];
204int timer_delay_settings[NUM_TIMER_STATS];
205
206
207static void
208timer_trig_handler(void);
209
210
211
212/* Not true gettimeofday, only checks the jiffies (uptime) + useconds */
213void __INLINE__ do_gettimeofday_fast(struct timeval *tv)
214{
215 unsigned long sec = jiffies;
216 unsigned long usec = GET_JIFFIES_USEC();
217
218 usec += (sec % HZ) * (1000000 / HZ);
219 sec = sec / HZ;
220
221 if (usec > 1000000)
222 {
223 usec -= 1000000;
224 sec++;
225 }
226 tv->tv_sec = sec;
227 tv->tv_usec = usec;
228}
229
230int __INLINE__ timeval_cmp(struct timeval *t0, struct timeval *t1)
231{
232 if (t0->tv_sec < t1->tv_sec)
233 {
234 return -1;
235 }
236 else if (t0->tv_sec > t1->tv_sec)
237 {
238 return 1;
239 }
240 if (t0->tv_usec < t1->tv_usec)
241 {
242 return -1;
243 }
244 else if (t0->tv_usec > t1->tv_usec)
245 {
246 return 1;
247 }
248 return 0;
249}
250
251/* Called with ints off */
252void __INLINE__ start_timer_trig(unsigned long delay_us)
253{
254 reg_timer_rw_ack_intr ack_intr = { 0 };
255 reg_timer_rw_intr_mask intr_mask;
256 reg_timer_rw_trig trig;
257 reg_timer_rw_trig_cfg trig_cfg = { 0 };
258 reg_timer_r_time r_time;
259
260 r_time = REG_RD(timer, regi_timer, r_time);
261
262 D1(printk("start_timer_trig : %d us freq: %i div: %i\n",
263 delay_us, freq_index, div));
264 /* Clear trig irq */
265 intr_mask = REG_RD(timer, regi_timer, rw_intr_mask);
266 intr_mask.trig = 0;
267 REG_WR(timer, regi_timer, rw_intr_mask, intr_mask);
268
269 /* Set timer values */
270 /* r_time is 100MHz (10 ns resolution) */
271 trig = r_time + delay_us*(1000/10);
272
273 timer_div_settings[fast_timers_started % NUM_TIMER_STATS] = trig;
274 timer_delay_settings[fast_timers_started % NUM_TIMER_STATS] = delay_us;
275
276 /* Ack interrupt */
277 ack_intr.trig = 1;
278 REG_WR(timer, regi_timer, rw_ack_intr, ack_intr);
279
280 /* Start timer */
281 REG_WR(timer, regi_timer, rw_trig, trig);
282 trig_cfg.tmr = regk_timer_time;
283 REG_WR(timer, regi_timer, rw_trig_cfg, trig_cfg);
284
285 /* Check if we have already passed the trig time */
286 r_time = REG_RD(timer, regi_timer, r_time);
287 if (r_time < trig) {
288 /* No, Enable trig irq */
289 intr_mask = REG_RD(timer, regi_timer, rw_intr_mask);
290 intr_mask.trig = 1;
291 REG_WR(timer, regi_timer, rw_intr_mask, intr_mask);
292 fast_timers_started++;
293 fast_timer_running = 1;
294 }
295 else
296 {
297 /* We have passed the time, disable trig point, ack intr */
298 trig_cfg.tmr = regk_timer_off;
299 REG_WR(timer, regi_timer, rw_trig_cfg, trig_cfg);
300 REG_WR(timer, regi_timer, rw_ack_intr, ack_intr);
301 /* call the int routine directly */
302 timer_trig_handler();
303 }
304
305}
306
307/* In version 1.4 this function takes 27 - 50 us */
308void start_one_shot_timer(struct fast_timer *t,
309 fast_timer_function_type *function,
310 unsigned long data,
311 unsigned long delay_us,
312 const char *name)
313{
314 unsigned long flags;
315 struct fast_timer *tmp;
316
317 D1(printk("sft %s %d us\n", name, delay_us));
318
319 local_irq_save(flags);
320
321 do_gettimeofday_fast(&t->tv_set);
322 tmp = fast_timer_list;
323
324 SANITYCHECK({ /* Check so this is not in the list already... */
325 while (tmp != NULL)
326 {
327 if (tmp == t)
328 {
329 printk("timer name: %s data: 0x%08lX already in list!\n", name, data);
330 sanity_failed++;
331 return;
332 }
333 else
334 {
335 tmp = tmp->next;
336 }
337 }
338 tmp = fast_timer_list;
339 });
340
341 t->delay_us = delay_us;
342 t->function = function;
343 t->data = data;
344 t->name = name;
345
346 t->tv_expires.tv_usec = t->tv_set.tv_usec + delay_us % 1000000;
347 t->tv_expires.tv_sec = t->tv_set.tv_sec + delay_us / 1000000;
348 if (t->tv_expires.tv_usec > 1000000)
349 {
350 t->tv_expires.tv_usec -= 1000000;
351 t->tv_expires.tv_sec++;
352 }
353#ifdef FAST_TIMER_LOG
354 timer_added_log[fast_timers_added % NUM_TIMER_STATS] = *t;
355#endif
356 fast_timers_added++;
357
358 /* Check if this should timeout before anything else */
359 if (tmp == NULL || timeval_cmp(&t->tv_expires, &tmp->tv_expires) < 0)
360 {
361 /* Put first in list and modify the timer value */
362 t->prev = NULL;
363 t->next = fast_timer_list;
364 if (fast_timer_list)
365 {
366 fast_timer_list->prev = t;
367 }
368 fast_timer_list = t;
369#ifdef FAST_TIMER_LOG
370 timer_started_log[fast_timers_started % NUM_TIMER_STATS] = *t;
371#endif
372 start_timer_trig(delay_us);
373 } else {
374 /* Put in correct place in list */
375 while (tmp->next &&
376 timeval_cmp(&t->tv_expires, &tmp->next->tv_expires) > 0)
377 {
378 tmp = tmp->next;
379 }
380 /* Insert t after tmp */
381 t->prev = tmp;
382 t->next = tmp->next;
383 if (tmp->next)
384 {
385 tmp->next->prev = t;
386 }
387 tmp->next = t;
388 }
389
390 D2(printk("start_one_shot_timer: %d us done\n", delay_us));
391
392 local_irq_restore(flags);
393} /* start_one_shot_timer */
394
395static inline int fast_timer_pending (const struct fast_timer * t)
396{
397 return (t->next != NULL) || (t->prev != NULL) || (t == fast_timer_list);
398}
399
400static inline int detach_fast_timer (struct fast_timer *t)
401{
402 struct fast_timer *next, *prev;
403 if (!fast_timer_pending(t))
404 return 0;
405 next = t->next;
406 prev = t->prev;
407 if (next)
408 next->prev = prev;
409 if (prev)
410 prev->next = next;
411 else
412 fast_timer_list = next;
413 fast_timers_deleted++;
414 return 1;
415}
416
417int del_fast_timer(struct fast_timer * t)
418{
419 unsigned long flags;
420 int ret;
421
422 local_irq_save(flags);
423 ret = detach_fast_timer(t);
424 t->next = t->prev = NULL;
425 local_irq_restore(flags);
426 return ret;
427} /* del_fast_timer */
428
429
430/* Interrupt routines or functions called in interrupt context */
431
432/* Timer interrupt handler for trig interrupts */
433
434static irqreturn_t
435timer_trig_interrupt(int irq, void *dev_id, struct pt_regs *regs)
436{
437 reg_timer_r_masked_intr masked_intr;
438
439 /* Check if the timer interrupt is for us (a trig int) */
440 masked_intr = REG_RD(timer, regi_timer, r_masked_intr);
441 if (!masked_intr.trig)
442 return IRQ_NONE;
443 timer_trig_handler();
444 return IRQ_HANDLED;
445}
446
447static void timer_trig_handler(void)
448{
449 reg_timer_rw_ack_intr ack_intr = { 0 };
450 reg_timer_rw_intr_mask intr_mask;
451 reg_timer_rw_trig_cfg trig_cfg = { 0 };
452 struct fast_timer *t;
453 unsigned long flags;
454
455 local_irq_save(flags);
456
457 /* Clear timer trig interrupt */
458 intr_mask = REG_RD(timer, regi_timer, rw_intr_mask);
459 intr_mask.trig = 0;
460 REG_WR(timer, regi_timer, rw_intr_mask, intr_mask);
461
462 /* First stop timer, then ack interrupt */
463 /* Stop timer */
464 trig_cfg.tmr = regk_timer_off;
465 REG_WR(timer, regi_timer, rw_trig_cfg, trig_cfg);
466
467 /* Ack interrupt */
468 ack_intr.trig = 1;
469 REG_WR(timer, regi_timer, rw_ack_intr, ack_intr);
470
471 fast_timer_running = 0;
472 fast_timer_ints++;
473
474 local_irq_restore(flags);
475
476 t = fast_timer_list;
477 while (t)
478 {
479 struct timeval tv;
480
481 /* Has it really expired? */
482 do_gettimeofday_fast(&tv);
483 D1(printk("t: %is %06ius\n", tv.tv_sec, tv.tv_usec));
484
485 if (timeval_cmp(&t->tv_expires, &tv) <= 0)
486 {
487 /* Yes it has expired */
488#ifdef FAST_TIMER_LOG
489 timer_expired_log[fast_timers_expired % NUM_TIMER_STATS] = *t;
490#endif
491 fast_timers_expired++;
492
493 /* Remove this timer before call, since it may reuse the timer */
494 local_irq_save(flags);
495 if (t->prev)
496 {
497 t->prev->next = t->next;
498 }
499 else
500 {
501 fast_timer_list = t->next;
502 }
503 if (t->next)
504 {
505 t->next->prev = t->prev;
506 }
507 t->prev = NULL;
508 t->next = NULL;
509 local_irq_restore(flags);
510
511 if (t->function != NULL)
512 {
513 t->function(t->data);
514 }
515 else
516 {
517 DEBUG_LOG("!trimertrig %i function==NULL!\n", fast_timer_ints);
518 }
519 }
520 else
521 {
522 /* Timer is to early, let's set it again using the normal routines */
523 D1(printk(".\n"));
524 }
525
526 local_irq_save(flags);
527 if ((t = fast_timer_list) != NULL)
528 {
529 /* Start next timer.. */
530 long us;
531 struct timeval tv;
532
533 do_gettimeofday_fast(&tv);
534 us = ((t->tv_expires.tv_sec - tv.tv_sec) * 1000000 +
535 t->tv_expires.tv_usec - tv.tv_usec);
536 if (us > 0)
537 {
538 if (!fast_timer_running)
539 {
540#ifdef FAST_TIMER_LOG
541 timer_started_log[fast_timers_started % NUM_TIMER_STATS] = *t;
542#endif
543 start_timer_trig(us);
544 }
545 local_irq_restore(flags);
546 break;
547 }
548 else
549 {
550 /* Timer already expired, let's handle it better late than never.
551 * The normal loop handles it
552 */
553 D1(printk("e! %d\n", us));
554 }
555 }
556 local_irq_restore(flags);
557 }
558
559 if (!t)
560 {
561 D1(printk("ttrig stop!\n"));
562 }
563}
564
565static void wake_up_func(unsigned long data)
566{
567#ifdef DECLARE_WAITQUEUE
568 wait_queue_head_t *sleep_wait_p = (wait_queue_head_t*)data;
569#else
570 struct wait_queue **sleep_wait_p = (struct wait_queue **)data;
571#endif
572 wake_up(sleep_wait_p);
573}
574
575
576/* Useful API */
577
578void schedule_usleep(unsigned long us)
579{
580 struct fast_timer t;
581#ifdef DECLARE_WAITQUEUE
582 wait_queue_head_t sleep_wait;
583 init_waitqueue_head(&sleep_wait);
584 {
585 DECLARE_WAITQUEUE(wait, current);
586#else
587 struct wait_queue *sleep_wait = NULL;
588 struct wait_queue wait = { current, NULL };
589#endif
590
591 D1(printk("schedule_usleep(%d)\n", us));
592 add_wait_queue(&sleep_wait, &wait);
593 set_current_state(TASK_INTERRUPTIBLE);
594 start_one_shot_timer(&t, wake_up_func, (unsigned long)&sleep_wait, us,
595 "usleep");
596 schedule();
597 set_current_state(TASK_RUNNING);
598 remove_wait_queue(&sleep_wait, &wait);
599 D1(printk("done schedule_usleep(%d)\n", us));
600#ifdef DECLARE_WAITQUEUE
601 }
602#endif
603}
604
605#ifdef CONFIG_PROC_FS
606static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
607#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
608 ,int *eof, void *data_unused
609#else
610 ,int unused
611#endif
612 );
613#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
614static struct proc_dir_entry *fasttimer_proc_entry;
615#else
616static struct proc_dir_entry fasttimer_proc_entry =
617{
618 0, 9, "fasttimer",
619 S_IFREG | S_IRUGO, 1, 0, 0,
620 0, NULL /* ops -- default to array */,
621 &proc_fasttimer_read /* get_info */,
622};
623#endif
624#endif /* CONFIG_PROC_FS */
625
626#ifdef CONFIG_PROC_FS
627
628/* This value is very much based on testing */
629#define BIG_BUF_SIZE (500 + NUM_TIMER_STATS * 300)
630
631static int proc_fasttimer_read(char *buf, char **start, off_t offset, int len
632#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
633 ,int *eof, void *data_unused
634#else
635 ,int unused
636#endif
637 )
638{
639 unsigned long flags;
640 int i = 0;
641 int num_to_show;
642 struct timeval tv;
643 struct fast_timer *t, *nextt;
644 static char *bigbuf = NULL;
645 static unsigned long used;
646
647 if (!bigbuf && !(bigbuf = vmalloc(BIG_BUF_SIZE)))
648 {
649 used = 0;
650 bigbuf[0] = '\0';
651 return 0;
652 }
653
654 if (!offset || !used)
655 {
656 do_gettimeofday_fast(&tv);
657
658 used = 0;
659 used += sprintf(bigbuf + used, "Fast timers added: %i\n",
660 fast_timers_added);
661 used += sprintf(bigbuf + used, "Fast timers started: %i\n",
662 fast_timers_started);
663 used += sprintf(bigbuf + used, "Fast timer interrupts: %i\n",
664 fast_timer_ints);
665 used += sprintf(bigbuf + used, "Fast timers expired: %i\n",
666 fast_timers_expired);
667 used += sprintf(bigbuf + used, "Fast timers deleted: %i\n",
668 fast_timers_deleted);
669 used += sprintf(bigbuf + used, "Fast timer running: %s\n",
670 fast_timer_running ? "yes" : "no");
671 used += sprintf(bigbuf + used, "Current time: %lu.%06lu\n",
672 (unsigned long)tv.tv_sec,
673 (unsigned long)tv.tv_usec);
674#ifdef FAST_TIMER_SANITY_CHECKS
675 used += sprintf(bigbuf + used, "Sanity failed: %i\n",
676 sanity_failed);
677#endif
678 used += sprintf(bigbuf + used, "\n");
679
680#ifdef DEBUG_LOG_INCLUDED
681 {
682 int end_i = debug_log_cnt;
683 i = 0;
684
685 if (debug_log_cnt_wrapped)
686 {
687 i = debug_log_cnt;
688 }
689
690 while ((i != end_i || (debug_log_cnt_wrapped && !used)) &&
691 used+100 < BIG_BUF_SIZE)
692 {
693 used += sprintf(bigbuf + used, debug_log_string[i],
694 debug_log_value[i]);
695 i = (i+1) % DEBUG_LOG_MAX;
696 }
697 }
698 used += sprintf(bigbuf + used, "\n");
699#endif
700
701 num_to_show = (fast_timers_started < NUM_TIMER_STATS ? fast_timers_started:
702 NUM_TIMER_STATS);
703 used += sprintf(bigbuf + used, "Timers started: %i\n", fast_timers_started);
704 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE) ; i++)
705 {
706 int cur = (fast_timers_started - i - 1) % NUM_TIMER_STATS;
707
708#if 1 //ndef FAST_TIMER_LOG
709 used += sprintf(bigbuf + used, "div: %i delay: %i"
710 "\n",
711 timer_div_settings[cur],
712 timer_delay_settings[cur]
713 );
714#endif
715#ifdef FAST_TIMER_LOG
716 t = &timer_started_log[cur];
717 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
718 "d: %6li us data: 0x%08lX"
719 "\n",
720 t->name,
721 (unsigned long)t->tv_set.tv_sec,
722 (unsigned long)t->tv_set.tv_usec,
723 (unsigned long)t->tv_expires.tv_sec,
724 (unsigned long)t->tv_expires.tv_usec,
725 t->delay_us,
726 t->data
727 );
728#endif
729 }
730 used += sprintf(bigbuf + used, "\n");
731
732#ifdef FAST_TIMER_LOG
733 num_to_show = (fast_timers_added < NUM_TIMER_STATS ? fast_timers_added:
734 NUM_TIMER_STATS);
735 used += sprintf(bigbuf + used, "Timers added: %i\n", fast_timers_added);
736 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
737 {
738 t = &timer_added_log[(fast_timers_added - i - 1) % NUM_TIMER_STATS];
739 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
740 "d: %6li us data: 0x%08lX"
741 "\n",
742 t->name,
743 (unsigned long)t->tv_set.tv_sec,
744 (unsigned long)t->tv_set.tv_usec,
745 (unsigned long)t->tv_expires.tv_sec,
746 (unsigned long)t->tv_expires.tv_usec,
747 t->delay_us,
748 t->data
749 );
750 }
751 used += sprintf(bigbuf + used, "\n");
752
753 num_to_show = (fast_timers_expired < NUM_TIMER_STATS ? fast_timers_expired:
754 NUM_TIMER_STATS);
755 used += sprintf(bigbuf + used, "Timers expired: %i\n", fast_timers_expired);
756 for (i = 0; i < num_to_show && (used+100 < BIG_BUF_SIZE); i++)
757 {
758 t = &timer_expired_log[(fast_timers_expired - i - 1) % NUM_TIMER_STATS];
759 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
760 "d: %6li us data: 0x%08lX"
761 "\n",
762 t->name,
763 (unsigned long)t->tv_set.tv_sec,
764 (unsigned long)t->tv_set.tv_usec,
765 (unsigned long)t->tv_expires.tv_sec,
766 (unsigned long)t->tv_expires.tv_usec,
767 t->delay_us,
768 t->data
769 );
770 }
771 used += sprintf(bigbuf + used, "\n");
772#endif
773
774 used += sprintf(bigbuf + used, "Active timers:\n");
775 local_irq_save(flags);
776 local_irq_save(flags);
777 t = fast_timer_list;
778 while (t != NULL && (used+100 < BIG_BUF_SIZE))
779 {
780 nextt = t->next;
781 local_irq_restore(flags);
782 used += sprintf(bigbuf + used, "%-14s s: %6lu.%06lu e: %6lu.%06lu "
783 "d: %6li us data: 0x%08lX"
784/* " func: 0x%08lX" */
785 "\n",
786 t->name,
787 (unsigned long)t->tv_set.tv_sec,
788 (unsigned long)t->tv_set.tv_usec,
789 (unsigned long)t->tv_expires.tv_sec,
790 (unsigned long)t->tv_expires.tv_usec,
791 t->delay_us,
792 t->data
793/* , t->function */
794 );
795 local_irq_disable();
796 if (t->next != nextt)
797 {
798 printk("timer removed!\n");
799 }
800 t = nextt;
801 }
802 local_irq_restore(flags);
803 }
804
805 if (used - offset < len)
806 {
807 len = used - offset;
808 }
809
810 memcpy(buf, bigbuf + offset, len);
811 *start = buf;
812#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
813 *eof = 1;
814#endif
815
816 return len;
817}
818#endif /* PROC_FS */
819
820#ifdef FAST_TIMER_TEST
821static volatile unsigned long i = 0;
822static volatile int num_test_timeout = 0;
823static struct fast_timer tr[10];
824static int exp_num[10];
825
826static struct timeval tv_exp[100];
827
828static void test_timeout(unsigned long data)
829{
830 do_gettimeofday_fast(&tv_exp[data]);
831 exp_num[data] = num_test_timeout;
832
833 num_test_timeout++;
834}
835
836static void test_timeout1(unsigned long data)
837{
838 do_gettimeofday_fast(&tv_exp[data]);
839 exp_num[data] = num_test_timeout;
840 if (data < 7)
841 {
842 start_one_shot_timer(&tr[i], test_timeout1, i, 1000, "timeout1");
843 i++;
844 }
845 num_test_timeout++;
846}
847
848DP(
849static char buf0[2000];
850static char buf1[2000];
851static char buf2[2000];
852static char buf3[2000];
853static char buf4[2000];
854);
855
856static char buf5[6000];
857static int j_u[1000];
858
859static void fast_timer_test(void)
860{
861 int prev_num;
862 int j;
863
864 struct timeval tv, tv0, tv1, tv2;
865
866 printk("fast_timer_test() start\n");
867 do_gettimeofday_fast(&tv);
868
869 for (j = 0; j < 1000; j++)
870 {
871 j_u[j] = GET_JIFFIES_USEC();
872 }
873 for (j = 0; j < 100; j++)
874 {
875 do_gettimeofday_fast(&tv_exp[j]);
876 }
877 printk("fast_timer_test() %is %06i\n", tv.tv_sec, tv.tv_usec);
878
879 for (j = 0; j < 1000; j++)
880 {
881 printk("%i %i %i %i %i\n",j_u[j], j_u[j+1], j_u[j+2], j_u[j+3], j_u[j+4]);
882 j += 4;
883 }
884 for (j = 0; j < 100; j++)
885 {
886 printk("%i.%i %i.%i %i.%i %i.%i %i.%i\n",
887 tv_exp[j].tv_sec,tv_exp[j].tv_usec,
888 tv_exp[j+1].tv_sec,tv_exp[j+1].tv_usec,
889 tv_exp[j+2].tv_sec,tv_exp[j+2].tv_usec,
890 tv_exp[j+3].tv_sec,tv_exp[j+3].tv_usec,
891 tv_exp[j+4].tv_sec,tv_exp[j+4].tv_usec);
892 j += 4;
893 }
894 do_gettimeofday_fast(&tv0);
895 start_one_shot_timer(&tr[i], test_timeout, i, 50000, "test0");
896 DP(proc_fasttimer_read(buf0, NULL, 0, 0, 0));
897 i++;
898 start_one_shot_timer(&tr[i], test_timeout, i, 70000, "test1");
899 DP(proc_fasttimer_read(buf1, NULL, 0, 0, 0));
900 i++;
901 start_one_shot_timer(&tr[i], test_timeout, i, 40000, "test2");
902 DP(proc_fasttimer_read(buf2, NULL, 0, 0, 0));
903 i++;
904 start_one_shot_timer(&tr[i], test_timeout, i, 60000, "test3");
905 DP(proc_fasttimer_read(buf3, NULL, 0, 0, 0));
906 i++;
907 start_one_shot_timer(&tr[i], test_timeout1, i, 55000, "test4xx");
908 DP(proc_fasttimer_read(buf4, NULL, 0, 0, 0));
909 i++;
910 do_gettimeofday_fast(&tv1);
911
912 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
913
914 prev_num = num_test_timeout;
915 while (num_test_timeout < i)
916 {
917 if (num_test_timeout != prev_num)
918 {
919 prev_num = num_test_timeout;
920 }
921 }
922 do_gettimeofday_fast(&tv2);
923 printk("Timers started %is %06i\n", tv0.tv_sec, tv0.tv_usec);
924 printk("Timers started at %is %06i\n", tv1.tv_sec, tv1.tv_usec);
925 printk("Timers done %is %06i\n", tv2.tv_sec, tv2.tv_usec);
926 DP(printk("buf0:\n");
927 printk(buf0);
928 printk("buf1:\n");
929 printk(buf1);
930 printk("buf2:\n");
931 printk(buf2);
932 printk("buf3:\n");
933 printk(buf3);
934 printk("buf4:\n");
935 printk(buf4);
936 );
937 printk("buf5:\n");
938 printk(buf5);
939
940 printk("timers set:\n");
941 for(j = 0; j<i; j++)
942 {
943 struct fast_timer *t = &tr[j];
944 printk("%-10s set: %6is %06ius exp: %6is %06ius "
945 "data: 0x%08X func: 0x%08X\n",
946 t->name,
947 t->tv_set.tv_sec,
948 t->tv_set.tv_usec,
949 t->tv_expires.tv_sec,
950 t->tv_expires.tv_usec,
951 t->data,
952 t->function
953 );
954
955 printk(" del: %6ius did exp: %6is %06ius as #%i error: %6li\n",
956 t->delay_us,
957 tv_exp[j].tv_sec,
958 tv_exp[j].tv_usec,
959 exp_num[j],
960 (tv_exp[j].tv_sec - t->tv_expires.tv_sec)*1000000 + tv_exp[j].tv_usec - t->tv_expires.tv_usec);
961 }
962 proc_fasttimer_read(buf5, NULL, 0, 0, 0);
963 printk("buf5 after all done:\n");
964 printk(buf5);
965 printk("fast_timer_test() done\n");
966}
967#endif
968
969
970void fast_timer_init(void)
971{
972 /* For some reason, request_irq() hangs when called froom time_init() */
973 if (!fast_timer_is_init)
974 {
975 printk("fast_timer_init()\n");
976
977#ifdef CONFIG_PROC_FS
978#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,2,0)
979 if ((fasttimer_proc_entry = create_proc_entry( "fasttimer", 0, 0 )))
980 fasttimer_proc_entry->read_proc = proc_fasttimer_read;
981#else
982 proc_register_dynamic(&proc_root, &fasttimer_proc_entry);
983#endif
984#endif /* PROC_FS */
985 if(request_irq(TIMER_INTR_VECT, timer_trig_interrupt, SA_INTERRUPT,
986 "fast timer int", NULL))
987 {
988 printk("err: timer1 irq\n");
989 }
990 fast_timer_is_init = 1;
991#ifdef FAST_TIMER_TEST
992 printk("do test\n");
993 fast_timer_test();
994#endif
995 }
996}
diff --git a/arch/cris/arch-v32/kernel/head.S b/arch/cris/arch-v32/kernel/head.S
new file mode 100644
index 000000000000..3cfe57dc391d
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/head.S
@@ -0,0 +1,448 @@
1/*
2 * CRISv32 kernel startup code.
3 *
4 * Copyright (C) 2003, Axis Communications AB
5 */
6
7#include <linux/config.h>
8
9#define ASSEMBLER_MACROS_ONLY
10
11/*
12 * The macros found in mmu_defs_asm.h uses the ## concatenation operator, so
13 * -traditional must not be used when assembling this file.
14 */
15#include <asm/arch/hwregs/reg_rdwr.h>
16#include <asm/arch/hwregs/asm/mmu_defs_asm.h>
17#include <asm/arch/hwregs/asm/reg_map_asm.h>
18#include <asm/arch/hwregs/asm/config_defs_asm.h>
19#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
20
21#define CRAMFS_MAGIC 0x28cd3d45
22#define RAM_INIT_MAGIC 0x56902387
23#define COMMAND_LINE_MAGIC 0x87109563
24
25 ;; NOTE: R8 and R9 carry information from the decompressor (if the
26 ;; kernel was compressed). They must not be used in the code below
27 ;; until they are read!
28
29 ;; Exported symbols.
30 .global etrax_irv
31 .global romfs_start
32 .global romfs_length
33 .global romfs_in_flash
34 .global swapper_pg_dir
35 .global crisv32_nand_boot
36 .global crisv32_nand_cramfs_offset
37
38 ;; Dummy section to make it bootable with current VCS simulator
39#ifdef CONFIG_ETRAXFS_SIM
40 .section ".boot", "ax"
41 ba tstart
42 nop
43#endif
44
45 .text
46tstart:
47 ;; This is the entry point of the kernel. The CPU is currently in
48 ;; supervisor mode.
49 ;;
50 ;; 0x00000000 if flash.
51 ;; 0x40004000 if DRAM.
52 ;;
53 di
54
55 ;; Start clocks for used blocks.
56 move.d REG_ADDR(config, regi_config, rw_clk_ctrl), $r1
57 move.d [$r1], $r0
58 or.d REG_STATE(config, rw_clk_ctrl, cpu, yes) | \
59 REG_STATE(config, rw_clk_ctrl, bif, yes) | \
60 REG_STATE(config, rw_clk_ctrl, fix_io, yes), $r0
61 move.d $r0, [$r1]
62
63 ;; Set up waitstates etc
64 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r0
65 move.d CONFIG_ETRAX_MEM_GRP1_CONFIG, $r1
66 move.d $r1, [$r0]
67 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp2_cfg), $r0
68 move.d CONFIG_ETRAX_MEM_GRP2_CONFIG, $r1
69 move.d $r1, [$r0]
70 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r0
71 move.d CONFIG_ETRAX_MEM_GRP3_CONFIG, $r1
72 move.d $r1, [$r0]
73 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp4_cfg), $r0
74 move.d CONFIG_ETRAX_MEM_GRP4_CONFIG, $r1
75 move.d $r1, [$r0]
76
77#ifdef CONFIG_ETRAXFS_SIM
78 ;; Set up minimal flash waitstates
79 move.d 0, $r10
80 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg), $r11
81 move.d $r10, [$r11]
82#endif
83
84 ;; Setup and enable the MMU. Use same configuration for both the data
85 ;; and the instruction MMU.
86 ;;
87 ;; Note; 3 cycles is needed for a bank-select to take effect. Further;
88 ;; bank 1 is the instruction MMU, bank 2 is the data MMU.
89#ifndef CONFIG_ETRAXFS_SIM
90 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \
91 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 4) \
92 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb), $r0
93#else
94 ;; Map the virtual DRAM to the RW eprom area at address 0.
95 ;; Also map 0xa for the hook calls,
96 move.d REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 8) \
97 | REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0) \
98 | REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) \
99 | REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa), $r0
100#endif
101
102 ;; Temporary map of 0x40 -> 0x40 and 0x00 -> 0x00.
103 move.d REG_FIELD(mmu, rw_mm_kbase_lo, base_4, 4) \
104 | REG_FIELD(mmu, rw_mm_kbase_lo, base_0, 0), $r1
105
106 ;; Enable certain page protections and setup linear mapping
107 ;; for f,e,c,b,4,0.
108#ifndef CONFIG_ETRAXFS_SIM
109 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \
110 | REG_STATE(mmu, rw_mm_cfg, acc, on) \
111 | REG_STATE(mmu, rw_mm_cfg, ex, on) \
112 | REG_STATE(mmu, rw_mm_cfg, inv, on) \
113 | REG_STATE(mmu, rw_mm_cfg, seg_f, linear) \
114 | REG_STATE(mmu, rw_mm_cfg, seg_e, linear) \
115 | REG_STATE(mmu, rw_mm_cfg, seg_d, page) \
116 | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \
117 | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \
118 | REG_STATE(mmu, rw_mm_cfg, seg_a, page) \
119 | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \
120 | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \
121 | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \
122 | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \
123 | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \
124 | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \
125 | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \
126 | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \
127 | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \
128 | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2
129#else
130 move.d REG_STATE(mmu, rw_mm_cfg, we, on) \
131 | REG_STATE(mmu, rw_mm_cfg, acc, on) \
132 | REG_STATE(mmu, rw_mm_cfg, ex, on) \
133 | REG_STATE(mmu, rw_mm_cfg, inv, on) \
134 | REG_STATE(mmu, rw_mm_cfg, seg_f, linear) \
135 | REG_STATE(mmu, rw_mm_cfg, seg_e, linear) \
136 | REG_STATE(mmu, rw_mm_cfg, seg_d, page) \
137 | REG_STATE(mmu, rw_mm_cfg, seg_c, linear) \
138 | REG_STATE(mmu, rw_mm_cfg, seg_b, linear) \
139 | REG_STATE(mmu, rw_mm_cfg, seg_a, linear) \
140 | REG_STATE(mmu, rw_mm_cfg, seg_9, page) \
141 | REG_STATE(mmu, rw_mm_cfg, seg_8, page) \
142 | REG_STATE(mmu, rw_mm_cfg, seg_7, page) \
143 | REG_STATE(mmu, rw_mm_cfg, seg_6, page) \
144 | REG_STATE(mmu, rw_mm_cfg, seg_5, page) \
145 | REG_STATE(mmu, rw_mm_cfg, seg_4, linear) \
146 | REG_STATE(mmu, rw_mm_cfg, seg_3, page) \
147 | REG_STATE(mmu, rw_mm_cfg, seg_2, page) \
148 | REG_STATE(mmu, rw_mm_cfg, seg_1, page) \
149 | REG_STATE(mmu, rw_mm_cfg, seg_0, linear), $r2
150#endif
151
152 ;; Update instruction MMU.
153 move 1, $srs
154 nop
155 nop
156 nop
157 move $r0, $s2 ; kbase_hi.
158 move $r1, $s1 ; kbase_lo.
159 move $r2, $s0 ; mm_cfg, virtual memory configuration.
160
161 ;; Update data MMU.
162 move 2, $srs
163 nop
164 nop
165 nop
166 move $r0, $s2 ; kbase_hi.
167 move $r1, $s1 ; kbase_lo
168 move $r2, $s0 ; mm_cfg, virtual memory configuration.
169
170 ;; Enable data and instruction MMU.
171 move 0, $srs
172 moveq 0xf, $r0 ; IMMU, DMMU, DCache, Icache on
173 nop
174 nop
175 nop
176 move $r0, $s0
177 nop
178 nop
179 nop
180
181#ifdef CONFIG_SMP
182 ;; Read CPU ID
183 move 0, $srs
184 nop
185 nop
186 nop
187 move $s10, $r0
188 cmpq 0, $r0
189 beq master_cpu
190 nop
191slave_cpu:
192 ; A slave waits for cpu_now_booting to be equal to CPU ID.
193 move.d cpu_now_booting, $r1
194slave_wait:
195 cmp.d [$r1], $r0
196 bne slave_wait
197 nop
198 ; Time to boot-up. Get stack location provided by master CPU.
199 move.d smp_init_current_idle_thread, $r1
200 move.d [$r1], $sp
201 add.d 8192, $sp
202 move.d ebp_start, $r0 ; Defined in linker-script.
203 move $r0, $ebp
204 jsr smp_callin
205 nop
206master_cpu:
207#endif
208#ifndef CONFIG_ETRAXFS_SIM
209 ;; Check if starting from DRAM or flash.
210 lapcq ., $r0
211 and.d 0x7fffffff, $r0 ; Mask off the non-cache bit.
212 cmp.d 0x10000, $r0 ; Arbitrary, something above this code.
213 blo _inflash0
214 nop
215#endif
216
217 jump _inram ; Jump to cached RAM.
218 nop
219
220 ;; Jumpgate.
221_inflash0:
222 jump _inflash
223 nop
224
225 ;; Put the following in a section so that storage for it can be
226 ;; reclaimed after init is finished.
227 .section ".init.text", "ax"
228
229_inflash:
230
231 ;; Initialize DRAM.
232 cmp.d RAM_INIT_MAGIC, $r8 ; Already initialized?
233 beq _dram_initialized
234 nop
235
236#include "../lib/dram_init.S"
237
238_dram_initialized:
239 ;; Copy the text and data section to DRAM. This depends on that the
240 ;; variables used below are correctly set up by the linker script.
241 ;; The calculated value stored in R4 is used below.
242 moveq 0, $r0 ; Source.
243 move.d text_start, $r1 ; Destination.
244 move.d __vmlinux_end, $r2
245 move.d $r2, $r4
246 sub.d $r1, $r4
2471: move.w [$r0+], $r3
248 move.w $r3, [$r1+]
249 cmp.d $r2, $r1
250 blo 1b
251 nop
252
253 ;; Keep CRAMFS in flash.
254 moveq 0, $r0
255 move.d romfs_length, $r1
256 move.d $r0, [$r1]
257 move.d [$r4], $r0 ; cramfs_super.magic
258 cmp.d CRAMFS_MAGIC, $r0
259 bne 1f
260 nop
261
262 addoq +4, $r4, $acr
263 move.d [$acr], $r0
264 move.d romfs_length, $r1
265 move.d $r0, [$r1]
266 add.d 0xf0000000, $r4 ; Add cached flash start in virtual memory.
267 move.d romfs_start, $r1
268 move.d $r4, [$r1]
2691: moveq 1, $r0
270 move.d romfs_in_flash, $r1
271 move.d $r0, [$r1]
272
273 jump _start_it ; Jump to cached code.
274 nop
275
276_inram:
277 ;; Check if booting from NAND flash (in that case we just remember the offset
278 ;; into the flash where cramfs should be).
279 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
280 move.d [$r0], $r0
281 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
282 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
283 bne move_cramfs
284 moveq 1,$r0
285 move.d crisv32_nand_boot, $r1
286 move.d $r0, [$r1]
287 move.d crisv32_nand_cramfs_offset, $r1
288 move.d $r9, [$r1]
289 moveq 1, $r0
290 move.d romfs_in_flash, $r1
291 move.d $r0, [$r1]
292 jump _start_it
293 nop
294
295move_cramfs:
296 ;; Move the cramfs after BSS.
297 moveq 0, $r0
298 move.d romfs_length, $r1
299 move.d $r0, [$r1]
300
301#ifndef CONFIG_ETRAXFS_SIM
302 ;; The kernel could have been unpacked to DRAM by the loader, but
303 ;; the cramfs image could still be inte the flash immediately
304 ;; following the compressed kernel image. The loaded passes the address
305 ;; of the bute succeeding the last compressed byte in the flash in
306 ;; register R9 when starting the kernel.
307 cmp.d 0x0ffffff8, $r9
308 bhs _no_romfs_in_flash ; R9 points outside the flash area.
309 nop
310#else
311 ba _no_romfs_in_flash
312 nop
313#endif
314 move.d [$r9], $r0 ; cramfs_super.magic
315 cmp.d CRAMFS_MAGIC, $r0
316 bne _no_romfs_in_flash
317 nop
318
319 addoq +4, $r9, $acr
320 move.d [$acr], $r0
321 move.d romfs_length, $r1
322 move.d $r0, [$r1]
323 add.d 0xf0000000, $r9 ; Add cached flash start in virtual memory.
324 move.d romfs_start, $r1
325 move.d $r9, [$r1]
326 moveq 1, $r0
327 move.d romfs_in_flash, $r1
328 move.d $r0, [$r1]
329
330 jump _start_it ; Jump to cached code.
331 nop
332
333_no_romfs_in_flash:
334 ;; Look for cramfs.
335#ifndef CONFIG_ETRAXFS_SIM
336 move.d __vmlinux_end, $r0
337#else
338 move.d __end, $r0
339#endif
340 move.d [$r0], $r1
341 cmp.d CRAMFS_MAGIC, $r1
342 bne 2f
343 nop
344
345 addoq +4, $r0, $acr
346 move.d [$acr], $r2
347 move.d _end, $r1
348 move.d romfs_start, $r3
349 move.d $r1, [$r3]
350 move.d romfs_length, $r3
351 move.d $r2, [$r3]
352
353#ifndef CONFIG_ETRAXFS_SIM
354 add.d $r2, $r0
355 add.d $r2, $r1
356
357 lsrq 1, $r2 ; Size is in bytes, we copy words.
358 addq 1, $r2
3591:
360 move.w [$r0], $r3
361 move.w $r3, [$r1]
362 subq 2, $r0
363 subq 2, $r1
364 subq 1, $r2
365 bne 1b
366 nop
367#endif
368
3692:
370 moveq 0, $r0
371 move.d romfs_in_flash, $r1
372 move.d $r0, [$r1]
373
374 jump _start_it ; Jump to cached code.
375 nop
376
377_start_it:
378
379 ;; Check if kernel command line is supplied
380 cmp.d COMMAND_LINE_MAGIC, $r10
381 bne no_command_line
382 nop
383
384 move.d 256, $r13
385 move.d cris_command_line, $r10
386 or.d 0x80000000, $r11 ; Make it virtual
3871:
388 move.b [$r11+], $r12
389 move.b $r12, [$r10+]
390 subq 1, $r13
391 bne 1b
392 nop
393
394no_command_line:
395
396 ;; The kernel stack contains a task structure for each task. This
397 ;; the initial kernel stack is in the same page as the init_task,
398 ;; but starts at the top of the page, i.e. + 8192 bytes.
399 move.d init_thread_union + 8192, $sp
400 move.d ebp_start, $r0 ; Defined in linker-script.
401 move $r0, $ebp
402 move.d etrax_irv, $r1 ; Set the exception base register and pointer.
403 move.d $r0, [$r1]
404
405#ifndef CONFIG_ETRAXFS_SIM
406 ;; Clear the BSS region from _bss_start to _end.
407 move.d __bss_start, $r0
408 move.d _end, $r1
4091: clear.d [$r0+]
410 cmp.d $r1, $r0
411 blo 1b
412 nop
413#endif
414
415#ifdef CONFIG_ETRAXFS_SIM
416 /* Set the watchdog timeout to something big. Will be removed when */
417 /* watchdog can be disabled with command line option */
418 move.d 0x7fffffff, $r10
419 jsr CPU_WATCHDOG_TIMEOUT
420 nop
421#endif
422
423 ; Initialize registers to increase determinism
424 move.d __bss_start, $r0
425 movem [$r0], $r13
426
427 jump start_kernel ; Jump to start_kernel() in init/main.c.
428 nop
429
430 .data
431etrax_irv:
432 .dword 0
433romfs_start:
434 .dword 0
435romfs_length:
436 .dword 0
437romfs_in_flash:
438 .dword 0
439crisv32_nand_boot:
440 .dword 0
441crisv32_nand_cramfs_offset:
442 .dword 0
443
444swapper_pg_dir = 0xc0002000
445
446 .section ".init.data", "aw"
447
448#include "../lib/hw_settings.S"
diff --git a/arch/cris/arch-v32/kernel/io.c b/arch/cris/arch-v32/kernel/io.c
new file mode 100644
index 000000000000..6bc9f263c3d6
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/io.c
@@ -0,0 +1,154 @@
1/*
2 * Helper functions for I/O pins.
3 *
4 * Copyright (c) 2004 Axis Communications AB.
5 */
6
7#include <linux/config.h>
8#include <linux/types.h>
9#include <linux/errno.h>
10#include <linux/init.h>
11#include <linux/string.h>
12#include <linux/ctype.h>
13#include <linux/kernel.h>
14#include <linux/module.h>
15#include <asm/io.h>
16#include <asm/arch/pinmux.h>
17#include <asm/arch/hwregs/gio_defs.h>
18
19struct crisv32_ioport crisv32_ioports[] =
20{
21 {
22 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pa_oe),
23 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pa_dout),
24 (unsigned long*)REG_ADDR(gio, regi_gio, r_pa_din),
25 8
26 },
27 {
28 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pb_oe),
29 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pb_dout),
30 (unsigned long*)REG_ADDR(gio, regi_gio, r_pb_din),
31 18
32 },
33 {
34 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pc_oe),
35 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pc_dout),
36 (unsigned long*)REG_ADDR(gio, regi_gio, r_pc_din),
37 18
38 },
39 {
40 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pd_oe),
41 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pd_dout),
42 (unsigned long*)REG_ADDR(gio, regi_gio, r_pd_din),
43 18
44 },
45 {
46 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pe_oe),
47 (unsigned long*)REG_ADDR(gio, regi_gio, rw_pe_dout),
48 (unsigned long*)REG_ADDR(gio, regi_gio, r_pe_din),
49 18
50 }
51};
52
53#define NBR_OF_PORTS sizeof(crisv32_ioports)/sizeof(struct crisv32_ioport)
54
55struct crisv32_iopin crisv32_led1_green;
56struct crisv32_iopin crisv32_led1_red;
57struct crisv32_iopin crisv32_led2_green;
58struct crisv32_iopin crisv32_led2_red;
59struct crisv32_iopin crisv32_led3_green;
60struct crisv32_iopin crisv32_led3_red;
61
62/* Dummy port used when green LED and red LED is on the same bit */
63static unsigned long io_dummy;
64static struct crisv32_ioport dummy_port =
65{
66 &io_dummy,
67 &io_dummy,
68 &io_dummy,
69 18
70};
71static struct crisv32_iopin dummy_led =
72{
73 &dummy_port,
74 0
75};
76
77static int __init crisv32_io_init(void)
78{
79 int ret = 0;
80 /* Initialize LEDs */
81 ret += crisv32_io_get_name(&crisv32_led1_green, CONFIG_ETRAX_LED1G);
82 ret += crisv32_io_get_name(&crisv32_led1_red, CONFIG_ETRAX_LED1R);
83 ret += crisv32_io_get_name(&crisv32_led2_green, CONFIG_ETRAX_LED2G);
84 ret += crisv32_io_get_name(&crisv32_led2_red, CONFIG_ETRAX_LED2R);
85 ret += crisv32_io_get_name(&crisv32_led3_green, CONFIG_ETRAX_LED3G);
86 ret += crisv32_io_get_name(&crisv32_led3_red, CONFIG_ETRAX_LED3R);
87 crisv32_io_set_dir(&crisv32_led1_green, crisv32_io_dir_out);
88 crisv32_io_set_dir(&crisv32_led1_red, crisv32_io_dir_out);
89 crisv32_io_set_dir(&crisv32_led2_green, crisv32_io_dir_out);
90 crisv32_io_set_dir(&crisv32_led2_red, crisv32_io_dir_out);
91 crisv32_io_set_dir(&crisv32_led3_green, crisv32_io_dir_out);
92 crisv32_io_set_dir(&crisv32_led3_red, crisv32_io_dir_out);
93
94 if (!strcmp(CONFIG_ETRAX_LED1G, CONFIG_ETRAX_LED1R))
95 crisv32_led1_red = dummy_led;
96 if (!strcmp(CONFIG_ETRAX_LED2G, CONFIG_ETRAX_LED2R))
97 crisv32_led2_red = dummy_led;
98
99 return ret;
100}
101
102__initcall(crisv32_io_init);
103
104int crisv32_io_get(struct crisv32_iopin* iopin,
105 unsigned int port, unsigned int pin)
106{
107 if (port > NBR_OF_PORTS)
108 return -EINVAL;
109 if (port > crisv32_ioports[port].pin_count)
110 return -EINVAL;
111
112 iopin->bit = 1 << pin;
113 iopin->port = &crisv32_ioports[port];
114
115 if (crisv32_pinmux_alloc(port, pin, pin, pinmux_gpio))
116 return -EIO;
117
118 return 0;
119}
120
121int crisv32_io_get_name(struct crisv32_iopin* iopin,
122 char* name)
123{
124 int port;
125 int pin;
126
127 if (toupper(*name) == 'P')
128 name++;
129
130 if (toupper(*name) < 'A' || toupper(*name) > 'E')
131 return -EINVAL;
132
133 port = toupper(*name) - 'A';
134 name++;
135 pin = simple_strtoul(name, NULL, 10);
136
137 if (pin < 0 || pin > crisv32_ioports[port].pin_count)
138 return -EINVAL;
139
140 iopin->bit = 1 << pin;
141 iopin->port = &crisv32_ioports[port];
142
143 if (crisv32_pinmux_alloc(port, pin, pin, pinmux_gpio))
144 return -EIO;
145
146 return 0;
147}
148
149#ifdef CONFIG_PCI
150/* PCI I/O access stuff */
151struct cris_io_operations* cris_iops = NULL;
152EXPORT_SYMBOL(cris_iops);
153#endif
154
diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c
new file mode 100644
index 000000000000..c78cc2685133
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/irq.c
@@ -0,0 +1,413 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <asm/irq.h>
6#include <linux/irq.h>
7#include <linux/interrupt.h>
8#include <linux/smp.h>
9#include <linux/config.h>
10#include <linux/kernel.h>
11#include <linux/errno.h>
12#include <linux/init.h>
13#include <linux/profile.h>
14#include <linux/proc_fs.h>
15#include <linux/seq_file.h>
16#include <linux/threads.h>
17#include <linux/spinlock.h>
18#include <linux/kernel_stat.h>
19#include <asm/arch/hwregs/reg_map.h>
20#include <asm/arch/hwregs/reg_rdwr.h>
21#include <asm/arch/hwregs/intr_vect.h>
22#include <asm/arch/hwregs/intr_vect_defs.h>
23
24#define CPU_FIXED -1
25
26/* IRQ masks (refer to comment for crisv32_do_multiple) */
27#define TIMER_MASK (1 << (TIMER_INTR_VECT - FIRST_IRQ))
28#ifdef CONFIG_ETRAX_KGDB
29#if defined(CONFIG_ETRAX_KGDB_PORT0)
30#define IGNOREMASK (1 << (SER0_INTR_VECT - FIRST_IRQ))
31#elif defined(CONFIG_ETRAX_KGDB_PORT1)
32#define IGNOREMASK (1 << (SER1_INTR_VECT - FIRST_IRQ))
33#elif defined(CONFIG_ETRAX_KGB_PORT2)
34#define IGNOREMASK (1 << (SER2_INTR_VECT - FIRST_IRQ))
35#elif defined(CONFIG_ETRAX_KGDB_PORT3)
36#define IGNOREMASK (1 << (SER3_INTR_VECT - FIRST_IRQ))
37#endif
38#endif
39
40DEFINE_SPINLOCK(irq_lock);
41
42struct cris_irq_allocation
43{
44 int cpu; /* The CPU to which the IRQ is currently allocated. */
45 cpumask_t mask; /* The CPUs to which the IRQ may be allocated. */
46};
47
48struct cris_irq_allocation irq_allocations[NR_IRQS] =
49 {[0 ... NR_IRQS - 1] = {0, CPU_MASK_ALL}};
50
51static unsigned long irq_regs[NR_CPUS] =
52{
53 regi_irq,
54#ifdef CONFIG_SMP
55 regi_irq2,
56#endif
57};
58
59unsigned long cpu_irq_counters[NR_CPUS];
60unsigned long irq_counters[NR_REAL_IRQS];
61
62/* From irq.c. */
63extern void weird_irq(void);
64
65/* From entry.S. */
66extern void system_call(void);
67extern void nmi_interrupt(void);
68extern void multiple_interrupt(void);
69extern void gdb_handle_exception(void);
70extern void i_mmu_refill(void);
71extern void i_mmu_invalid(void);
72extern void i_mmu_access(void);
73extern void i_mmu_execute(void);
74extern void d_mmu_refill(void);
75extern void d_mmu_invalid(void);
76extern void d_mmu_access(void);
77extern void d_mmu_write(void);
78
79/* From kgdb.c. */
80extern void kgdb_init(void);
81extern void breakpoint(void);
82
83/*
84 * Build the IRQ handler stubs using macros from irq.h. First argument is the
85 * IRQ number, the second argument is the corresponding bit in
86 * intr_rw_vect_mask found in asm/arch/hwregs/intr_vect_defs.h.
87 */
88BUILD_IRQ(0x31, (1 << 0)) /* memarb */
89BUILD_IRQ(0x32, (1 << 1)) /* gen_io */
90BUILD_IRQ(0x33, (1 << 2)) /* iop0 */
91BUILD_IRQ(0x34, (1 << 3)) /* iop1 */
92BUILD_IRQ(0x35, (1 << 4)) /* iop2 */
93BUILD_IRQ(0x36, (1 << 5)) /* iop3 */
94BUILD_IRQ(0x37, (1 << 6)) /* dma0 */
95BUILD_IRQ(0x38, (1 << 7)) /* dma1 */
96BUILD_IRQ(0x39, (1 << 8)) /* dma2 */
97BUILD_IRQ(0x3a, (1 << 9)) /* dma3 */
98BUILD_IRQ(0x3b, (1 << 10)) /* dma4 */
99BUILD_IRQ(0x3c, (1 << 11)) /* dma5 */
100BUILD_IRQ(0x3d, (1 << 12)) /* dma6 */
101BUILD_IRQ(0x3e, (1 << 13)) /* dma7 */
102BUILD_IRQ(0x3f, (1 << 14)) /* dma8 */
103BUILD_IRQ(0x40, (1 << 15)) /* dma9 */
104BUILD_IRQ(0x41, (1 << 16)) /* ata */
105BUILD_IRQ(0x42, (1 << 17)) /* sser0 */
106BUILD_IRQ(0x43, (1 << 18)) /* sser1 */
107BUILD_IRQ(0x44, (1 << 19)) /* ser0 */
108BUILD_IRQ(0x45, (1 << 20)) /* ser1 */
109BUILD_IRQ(0x46, (1 << 21)) /* ser2 */
110BUILD_IRQ(0x47, (1 << 22)) /* ser3 */
111BUILD_IRQ(0x48, (1 << 23))
112BUILD_IRQ(0x49, (1 << 24)) /* eth0 */
113BUILD_IRQ(0x4a, (1 << 25)) /* eth1 */
114BUILD_TIMER_IRQ(0x4b, (1 << 26))/* timer */
115BUILD_IRQ(0x4c, (1 << 27)) /* bif_arb */
116BUILD_IRQ(0x4d, (1 << 28)) /* bif_dma */
117BUILD_IRQ(0x4e, (1 << 29)) /* ext */
118BUILD_IRQ(0x4f, (1 << 29)) /* ipi */
119
120/* Pointers to the low-level handlers. */
121static void (*interrupt[NR_IRQS])(void) = {
122 IRQ0x31_interrupt, IRQ0x32_interrupt, IRQ0x33_interrupt,
123 IRQ0x34_interrupt, IRQ0x35_interrupt, IRQ0x36_interrupt,
124 IRQ0x37_interrupt, IRQ0x38_interrupt, IRQ0x39_interrupt,
125 IRQ0x3a_interrupt, IRQ0x3b_interrupt, IRQ0x3c_interrupt,
126 IRQ0x3d_interrupt, IRQ0x3e_interrupt, IRQ0x3f_interrupt,
127 IRQ0x40_interrupt, IRQ0x41_interrupt, IRQ0x42_interrupt,
128 IRQ0x43_interrupt, IRQ0x44_interrupt, IRQ0x45_interrupt,
129 IRQ0x46_interrupt, IRQ0x47_interrupt, IRQ0x48_interrupt,
130 IRQ0x49_interrupt, IRQ0x4a_interrupt, IRQ0x4b_interrupt,
131 IRQ0x4c_interrupt, IRQ0x4d_interrupt, IRQ0x4e_interrupt,
132 IRQ0x4f_interrupt
133};
134
135void
136block_irq(int irq, int cpu)
137{
138 int intr_mask;
139 unsigned long flags;
140
141 spin_lock_irqsave(&irq_lock, flags);
142 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
143
144 /* Remember; 1 let thru, 0 block. */
145 intr_mask &= ~(1 << (irq - FIRST_IRQ));
146
147 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask);
148 spin_unlock_irqrestore(&irq_lock, flags);
149}
150
151void
152unblock_irq(int irq, int cpu)
153{
154 int intr_mask;
155 unsigned long flags;
156
157 spin_lock_irqsave(&irq_lock, flags);
158 intr_mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
159
160 /* Remember; 1 let thru, 0 block. */
161 intr_mask |= (1 << (irq - FIRST_IRQ));
162
163 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, intr_mask);
164 spin_unlock_irqrestore(&irq_lock, flags);
165}
166
167/* Find out which CPU the irq should be allocated to. */
168static int irq_cpu(int irq)
169{
170 int cpu;
171 unsigned long flags;
172
173 spin_lock_irqsave(&irq_lock, flags);
174 cpu = irq_allocations[irq - FIRST_IRQ].cpu;
175
176 /* Fixed interrupts stay on the local CPU. */
177 if (cpu == CPU_FIXED)
178 {
179 spin_unlock_irqrestore(&irq_lock, flags);
180 return smp_processor_id();
181 }
182
183
184 /* Let the interrupt stay if possible */
185 if (cpu_isset(cpu, irq_allocations[irq - FIRST_IRQ].mask))
186 goto out;
187
188 /* IRQ must be moved to another CPU. */
189 cpu = first_cpu(irq_allocations[irq - FIRST_IRQ].mask);
190 irq_allocations[irq - FIRST_IRQ].cpu = cpu;
191out:
192 spin_unlock_irqrestore(&irq_lock, flags);
193 return cpu;
194}
195
196void
197mask_irq(int irq)
198{
199 int cpu;
200
201 for (cpu = 0; cpu < NR_CPUS; cpu++)
202 block_irq(irq, cpu);
203}
204
205void
206unmask_irq(int irq)
207{
208 unblock_irq(irq, irq_cpu(irq));
209}
210
211
212static unsigned int startup_crisv32_irq(unsigned int irq)
213{
214 unmask_irq(irq);
215 return 0;
216}
217
218static void shutdown_crisv32_irq(unsigned int irq)
219{
220 mask_irq(irq);
221}
222
223static void enable_crisv32_irq(unsigned int irq)
224{
225 unmask_irq(irq);
226}
227
228static void disable_crisv32_irq(unsigned int irq)
229{
230 mask_irq(irq);
231}
232
233static void ack_crisv32_irq(unsigned int irq)
234{
235}
236
237static void end_crisv32_irq(unsigned int irq)
238{
239}
240
241void set_affinity_crisv32_irq(unsigned int irq, cpumask_t dest)
242{
243 unsigned long flags;
244 spin_lock_irqsave(&irq_lock, flags);
245 irq_allocations[irq - FIRST_IRQ].mask = dest;
246 spin_unlock_irqrestore(&irq_lock, flags);
247}
248
249static struct hw_interrupt_type crisv32_irq_type = {
250 .typename = "CRISv32",
251 .startup = startup_crisv32_irq,
252 .shutdown = shutdown_crisv32_irq,
253 .enable = enable_crisv32_irq,
254 .disable = disable_crisv32_irq,
255 .ack = ack_crisv32_irq,
256 .end = end_crisv32_irq,
257 .set_affinity = set_affinity_crisv32_irq
258};
259
260void
261set_exception_vector(int n, irqvectptr addr)
262{
263 etrax_irv->v[n] = (irqvectptr) addr;
264}
265
266extern void do_IRQ(int irq, struct pt_regs * regs);
267
268void
269crisv32_do_IRQ(int irq, int block, struct pt_regs* regs)
270{
271 /* Interrupts that may not be moved to another CPU and
272 * are SA_INTERRUPT may skip blocking. This is currently
273 * only valid for the timer IRQ and the IPI and is used
274 * for the timer interrupt to avoid watchdog starvation.
275 */
276 if (!block) {
277 do_IRQ(irq, regs);
278 return;
279 }
280
281 block_irq(irq, smp_processor_id());
282 do_IRQ(irq, regs);
283
284 unblock_irq(irq, irq_cpu(irq));
285}
286
287/* If multiple interrupts occur simultaneously we get a multiple
288 * interrupt from the CPU and software has to sort out which
289 * interrupts that happened. There are two special cases here:
290 *
291 * 1. Timer interrupts may never be blocked because of the
292 * watchdog (refer to comment in include/asr/arch/irq.h)
293 * 2. GDB serial port IRQs are unhandled here and will be handled
294 * as a single IRQ when it strikes again because the GDB
295 * stubb wants to save the registers in its own fashion.
296 */
297void
298crisv32_do_multiple(struct pt_regs* regs)
299{
300 int cpu;
301 int mask;
302 int masked;
303 int bit;
304
305 cpu = smp_processor_id();
306
307 /* An extra irq_enter here to prevent softIRQs to run after
308 * each do_IRQ. This will decrease the interrupt latency.
309 */
310 irq_enter();
311
312 /* Get which IRQs that happend. */
313 masked = REG_RD_INT(intr_vect, irq_regs[cpu], r_masked_vect);
314
315 /* Calculate new IRQ mask with these IRQs disabled. */
316 mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
317 mask &= ~masked;
318
319 /* Timer IRQ is never masked */
320 if (masked & TIMER_MASK)
321 mask |= TIMER_MASK;
322
323 /* Block all the IRQs */
324 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, mask);
325
326 /* Check for timer IRQ and handle it special. */
327 if (masked & TIMER_MASK) {
328 masked &= ~TIMER_MASK;
329 do_IRQ(TIMER_INTR_VECT, regs);
330 }
331
332#ifdef IGNORE_MASK
333 /* Remove IRQs that can't be handled as multiple. */
334 masked &= ~IGNORE_MASK;
335#endif
336
337 /* Handle the rest of the IRQs. */
338 for (bit = 0; bit < 32; bit++)
339 {
340 if (masked & (1 << bit))
341 do_IRQ(bit + FIRST_IRQ, regs);
342 }
343
344 /* Unblock all the IRQs. */
345 mask = REG_RD_INT(intr_vect, irq_regs[cpu], rw_mask);
346 mask |= masked;
347 REG_WR_INT(intr_vect, irq_regs[cpu], rw_mask, mask);
348
349 /* This irq_exit() will trigger the soft IRQs. */
350 irq_exit();
351}
352
353/*
354 * This is called by start_kernel. It fixes the IRQ masks and setup the
355 * interrupt vector table to point to bad_interrupt pointers.
356 */
357void __init
358init_IRQ(void)
359{
360 int i;
361 int j;
362 reg_intr_vect_rw_mask vect_mask = {0};
363
364 /* Clear all interrupts masks. */
365 REG_WR(intr_vect, regi_irq, rw_mask, vect_mask);
366
367 for (i = 0; i < 256; i++)
368 etrax_irv->v[i] = weird_irq;
369
370 /* Point all IRQ's to bad handlers. */
371 for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) {
372 irq_desc[j].handler = &crisv32_irq_type;
373 set_exception_vector(i, interrupt[j]);
374 }
375
376 /* Mark Timer and IPI IRQs as CPU local */
377 irq_allocations[TIMER_INTR_VECT - FIRST_IRQ].cpu = CPU_FIXED;
378 irq_desc[TIMER_INTR_VECT].status |= IRQ_PER_CPU;
379 irq_allocations[IPI_INTR_VECT - FIRST_IRQ].cpu = CPU_FIXED;
380 irq_desc[IPI_INTR_VECT].status |= IRQ_PER_CPU;
381
382 set_exception_vector(0x00, nmi_interrupt);
383 set_exception_vector(0x30, multiple_interrupt);
384
385 /* Set up handler for various MMU bus faults. */
386 set_exception_vector(0x04, i_mmu_refill);
387 set_exception_vector(0x05, i_mmu_invalid);
388 set_exception_vector(0x06, i_mmu_access);
389 set_exception_vector(0x07, i_mmu_execute);
390 set_exception_vector(0x08, d_mmu_refill);
391 set_exception_vector(0x09, d_mmu_invalid);
392 set_exception_vector(0x0a, d_mmu_access);
393 set_exception_vector(0x0b, d_mmu_write);
394
395 /* The system-call trap is reached by "break 13". */
396 set_exception_vector(0x1d, system_call);
397
398 /* Exception handlers for debugging, both user-mode and kernel-mode. */
399
400 /* Break 8. */
401 set_exception_vector(0x18, gdb_handle_exception);
402 /* Hardware single step. */
403 set_exception_vector(0x3, gdb_handle_exception);
404 /* Hardware breakpoint. */
405 set_exception_vector(0xc, gdb_handle_exception);
406
407#ifdef CONFIG_ETRAX_KGDB
408 kgdb_init();
409 /* Everything is set up; now trap the kernel. */
410 breakpoint();
411#endif
412}
413
diff --git a/arch/cris/arch-v32/kernel/kgdb.c b/arch/cris/arch-v32/kernel/kgdb.c
new file mode 100644
index 000000000000..480e56348be2
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/kgdb.c
@@ -0,0 +1,1660 @@
1/*
2 * arch/cris/arch-v32/kernel/kgdb.c
3 *
4 * CRIS v32 version by Orjan Friberg, Axis Communications AB.
5 *
6 * S390 version
7 * Copyright (C) 1999 IBM Deutschland Entwicklung GmbH, IBM Corporation
8 * Author(s): Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com),
9 *
10 * Originally written by Glenn Engel, Lake Stevens Instrument Division
11 *
12 * Contributed by HP Systems
13 *
14 * Modified for SPARC by Stu Grossman, Cygnus Support.
15 *
16 * Modified for Linux/MIPS (and MIPS in general) by Andreas Busse
17 * Send complaints, suggestions etc. to <andy@waldorf-gmbh.de>
18 *
19 * Copyright (C) 1995 Andreas Busse
20 */
21
22/* FIXME: Check the documentation. */
23
24/*
25 * kgdb usage notes:
26 * -----------------
27 *
28 * If you select CONFIG_ETRAX_KGDB in the configuration, the kernel will be
29 * built with different gcc flags: "-g" is added to get debug infos, and
30 * "-fomit-frame-pointer" is omitted to make debugging easier. Since the
31 * resulting kernel will be quite big (approx. > 7 MB), it will be stripped
32 * before compresion. Such a kernel will behave just as usually, except if
33 * given a "debug=<device>" command line option. (Only serial devices are
34 * allowed for <device>, i.e. no printers or the like; possible values are
35 * machine depedend and are the same as for the usual debug device, the one
36 * for logging kernel messages.) If that option is given and the device can be
37 * initialized, the kernel will connect to the remote gdb in trap_init(). The
38 * serial parameters are fixed to 8N1 and 115200 bps, for easyness of
39 * implementation.
40 *
41 * To start a debugging session, start that gdb with the debugging kernel
42 * image (the one with the symbols, vmlinux.debug) named on the command line.
43 * This file will be used by gdb to get symbol and debugging infos about the
44 * kernel. Next, select remote debug mode by
45 * target remote <device>
46 * where <device> is the name of the serial device over which the debugged
47 * machine is connected. Maybe you have to adjust the baud rate by
48 * set remotebaud <rate>
49 * or also other parameters with stty:
50 * shell stty ... </dev/...
51 * If the kernel to debug has already booted, it waited for gdb and now
52 * connects, and you'll see a breakpoint being reported. If the kernel isn't
53 * running yet, start it now. The order of gdb and the kernel doesn't matter.
54 * Another thing worth knowing about in the getting-started phase is how to
55 * debug the remote protocol itself. This is activated with
56 * set remotedebug 1
57 * gdb will then print out each packet sent or received. You'll also get some
58 * messages about the gdb stub on the console of the debugged machine.
59 *
60 * If all that works, you can use lots of the usual debugging techniques on
61 * the kernel, e.g. inspecting and changing variables/memory, setting
62 * breakpoints, single stepping and so on. It's also possible to interrupt the
63 * debugged kernel by pressing C-c in gdb. Have fun! :-)
64 *
65 * The gdb stub is entered (and thus the remote gdb gets control) in the
66 * following situations:
67 *
68 * - If breakpoint() is called. This is just after kgdb initialization, or if
69 * a breakpoint() call has been put somewhere into the kernel source.
70 * (Breakpoints can of course also be set the usual way in gdb.)
71 * In eLinux, we call breakpoint() in init/main.c after IRQ initialization.
72 *
73 * - If there is a kernel exception, i.e. bad_super_trap() or die_if_kernel()
74 * are entered. All the CPU exceptions are mapped to (more or less..., see
75 * the hard_trap_info array below) appropriate signal, which are reported
76 * to gdb. die_if_kernel() is usually called after some kind of access
77 * error and thus is reported as SIGSEGV.
78 *
79 * - When panic() is called. This is reported as SIGABRT.
80 *
81 * - If C-c is received over the serial line, which is treated as
82 * SIGINT.
83 *
84 * Of course, all these signals are just faked for gdb, since there is no
85 * signal concept as such for the kernel. It also isn't possible --obviously--
86 * to set signal handlers from inside gdb, or restart the kernel with a
87 * signal.
88 *
89 * Current limitations:
90 *
91 * - While the kernel is stopped, interrupts are disabled for safety reasons
92 * (i.e., variables not changing magically or the like). But this also
93 * means that the clock isn't running anymore, and that interrupts from the
94 * hardware may get lost/not be served in time. This can cause some device
95 * errors...
96 *
97 * - When single-stepping, only one instruction of the current thread is
98 * executed, but interrupts are allowed for that time and will be serviced
99 * if pending. Be prepared for that.
100 *
101 * - All debugging happens in kernel virtual address space. There's no way to
102 * access physical memory not mapped in kernel space, or to access user
103 * space. A way to work around this is using get_user_long & Co. in gdb
104 * expressions, but only for the current process.
105 *
106 * - Interrupting the kernel only works if interrupts are currently allowed,
107 * and the interrupt of the serial line isn't blocked by some other means
108 * (IPL too high, disabled, ...)
109 *
110 * - The gdb stub is currently not reentrant, i.e. errors that happen therein
111 * (e.g. accessing invalid memory) may not be caught correctly. This could
112 * be removed in future by introducing a stack of struct registers.
113 *
114 */
115
116/*
117 * To enable debugger support, two things need to happen. One, a
118 * call to kgdb_init() is necessary in order to allow any breakpoints
119 * or error conditions to be properly intercepted and reported to gdb.
120 * Two, a breakpoint needs to be generated to begin communication. This
121 * is most easily accomplished by a call to breakpoint().
122 *
123 * The following gdb commands are supported:
124 *
125 * command function Return value
126 *
127 * g return the value of the CPU registers hex data or ENN
128 * G set the value of the CPU registers OK or ENN
129 *
130 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
131 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
132 *
133 * c Resume at current address SNN ( signal NN)
134 * cAA..AA Continue at address AA..AA SNN
135 *
136 * s Step one instruction SNN
137 * sAA..AA Step one instruction from AA..AA SNN
138 *
139 * k kill
140 *
141 * ? What was the last sigval ? SNN (signal NN)
142 *
143 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
144 * baud rate
145 *
146 * All commands and responses are sent with a packet which includes a
147 * checksum. A packet consists of
148 *
149 * $<packet info>#<checksum>.
150 *
151 * where
152 * <packet info> :: <characters representing the command or response>
153 * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
154 *
155 * When a packet is received, it is first acknowledged with either '+' or '-'.
156 * '+' indicates a successful transfer. '-' indicates a failed transfer.
157 *
158 * Example:
159 *
160 * Host: Reply:
161 * $m0,10#2a +$00010203040506070809101112131415#42
162 *
163 */
164
165
166#include <linux/string.h>
167#include <linux/signal.h>
168#include <linux/kernel.h>
169#include <linux/delay.h>
170#include <linux/linkage.h>
171#include <linux/reboot.h>
172
173#include <asm/setup.h>
174#include <asm/ptrace.h>
175
176#include <asm/irq.h>
177#include <asm/arch/hwregs/reg_map.h>
178#include <asm/arch/hwregs/reg_rdwr.h>
179#include <asm/arch/hwregs/intr_vect_defs.h>
180#include <asm/arch/hwregs/ser_defs.h>
181
182/* From entry.S. */
183extern void gdb_handle_exception(void);
184/* From kgdb_asm.S. */
185extern void kgdb_handle_exception(void);
186
187static int kgdb_started = 0;
188
189/********************************* Register image ****************************/
190
191typedef
192struct register_image
193{
194 /* Offset */
195 unsigned int r0; /* 0x00 */
196 unsigned int r1; /* 0x04 */
197 unsigned int r2; /* 0x08 */
198 unsigned int r3; /* 0x0C */
199 unsigned int r4; /* 0x10 */
200 unsigned int r5; /* 0x14 */
201 unsigned int r6; /* 0x18 */
202 unsigned int r7; /* 0x1C */
203 unsigned int r8; /* 0x20; Frame pointer (if any) */
204 unsigned int r9; /* 0x24 */
205 unsigned int r10; /* 0x28 */
206 unsigned int r11; /* 0x2C */
207 unsigned int r12; /* 0x30 */
208 unsigned int r13; /* 0x34 */
209 unsigned int sp; /* 0x38; R14, Stack pointer */
210 unsigned int acr; /* 0x3C; R15, Address calculation register. */
211
212 unsigned char bz; /* 0x40; P0, 8-bit zero register */
213 unsigned char vr; /* 0x41; P1, Version register (8-bit) */
214 unsigned int pid; /* 0x42; P2, Process ID */
215 unsigned char srs; /* 0x46; P3, Support register select (8-bit) */
216 unsigned short wz; /* 0x47; P4, 16-bit zero register */
217 unsigned int exs; /* 0x49; P5, Exception status */
218 unsigned int eda; /* 0x4D; P6, Exception data address */
219 unsigned int mof; /* 0x51; P7, Multiply overflow register */
220 unsigned int dz; /* 0x55; P8, 32-bit zero register */
221 unsigned int ebp; /* 0x59; P9, Exception base pointer */
222 unsigned int erp; /* 0x5D; P10, Exception return pointer. Contains the PC we are interested in. */
223 unsigned int srp; /* 0x61; P11, Subroutine return pointer */
224 unsigned int nrp; /* 0x65; P12, NMI return pointer */
225 unsigned int ccs; /* 0x69; P13, Condition code stack */
226 unsigned int usp; /* 0x6D; P14, User mode stack pointer */
227 unsigned int spc; /* 0x71; P15, Single step PC */
228 unsigned int pc; /* 0x75; Pseudo register (for the most part set to ERP). */
229
230} registers;
231
232typedef
233struct bp_register_image
234{
235 /* Support register bank 0. */
236 unsigned int s0_0;
237 unsigned int s1_0;
238 unsigned int s2_0;
239 unsigned int s3_0;
240 unsigned int s4_0;
241 unsigned int s5_0;
242 unsigned int s6_0;
243 unsigned int s7_0;
244 unsigned int s8_0;
245 unsigned int s9_0;
246 unsigned int s10_0;
247 unsigned int s11_0;
248 unsigned int s12_0;
249 unsigned int s13_0;
250 unsigned int s14_0;
251 unsigned int s15_0;
252
253 /* Support register bank 1. */
254 unsigned int s0_1;
255 unsigned int s1_1;
256 unsigned int s2_1;
257 unsigned int s3_1;
258 unsigned int s4_1;
259 unsigned int s5_1;
260 unsigned int s6_1;
261 unsigned int s7_1;
262 unsigned int s8_1;
263 unsigned int s9_1;
264 unsigned int s10_1;
265 unsigned int s11_1;
266 unsigned int s12_1;
267 unsigned int s13_1;
268 unsigned int s14_1;
269 unsigned int s15_1;
270
271 /* Support register bank 2. */
272 unsigned int s0_2;
273 unsigned int s1_2;
274 unsigned int s2_2;
275 unsigned int s3_2;
276 unsigned int s4_2;
277 unsigned int s5_2;
278 unsigned int s6_2;
279 unsigned int s7_2;
280 unsigned int s8_2;
281 unsigned int s9_2;
282 unsigned int s10_2;
283 unsigned int s11_2;
284 unsigned int s12_2;
285 unsigned int s13_2;
286 unsigned int s14_2;
287 unsigned int s15_2;
288
289 /* Support register bank 3. */
290 unsigned int s0_3; /* BP_CTRL */
291 unsigned int s1_3; /* BP_I0_START */
292 unsigned int s2_3; /* BP_I0_END */
293 unsigned int s3_3; /* BP_D0_START */
294 unsigned int s4_3; /* BP_D0_END */
295 unsigned int s5_3; /* BP_D1_START */
296 unsigned int s6_3; /* BP_D1_END */
297 unsigned int s7_3; /* BP_D2_START */
298 unsigned int s8_3; /* BP_D2_END */
299 unsigned int s9_3; /* BP_D3_START */
300 unsigned int s10_3; /* BP_D3_END */
301 unsigned int s11_3; /* BP_D4_START */
302 unsigned int s12_3; /* BP_D4_END */
303 unsigned int s13_3; /* BP_D5_START */
304 unsigned int s14_3; /* BP_D5_END */
305 unsigned int s15_3; /* BP_RESERVED */
306
307} support_registers;
308
309enum register_name
310{
311 R0, R1, R2, R3,
312 R4, R5, R6, R7,
313 R8, R9, R10, R11,
314 R12, R13, SP, ACR,
315
316 BZ, VR, PID, SRS,
317 WZ, EXS, EDA, MOF,
318 DZ, EBP, ERP, SRP,
319 NRP, CCS, USP, SPC,
320 PC,
321
322 S0, S1, S2, S3,
323 S4, S5, S6, S7,
324 S8, S9, S10, S11,
325 S12, S13, S14, S15
326
327};
328
329/* The register sizes of the registers in register_name. An unimplemented register
330 is designated by size 0 in this array. */
331static int register_size[] =
332{
333 4, 4, 4, 4,
334 4, 4, 4, 4,
335 4, 4, 4, 4,
336 4, 4, 4, 4,
337
338 1, 1, 4, 1,
339 2, 4, 4, 4,
340 4, 4, 4, 4,
341 4, 4, 4, 4,
342
343 4,
344
345 4, 4, 4, 4,
346 4, 4, 4, 4,
347 4, 4, 4, 4,
348 4, 4, 4
349
350};
351
352/* Contains the register image of the kernel.
353 (Global so that they can be reached from assembler code.) */
354registers reg;
355support_registers sreg;
356
357/************** Prototypes for local library functions ***********************/
358
359/* Copy of strcpy from libc. */
360static char *gdb_cris_strcpy(char *s1, const char *s2);
361
362/* Copy of strlen from libc. */
363static int gdb_cris_strlen(const char *s);
364
365/* Copy of memchr from libc. */
366static void *gdb_cris_memchr(const void *s, int c, int n);
367
368/* Copy of strtol from libc. Does only support base 16. */
369static int gdb_cris_strtol(const char *s, char **endptr, int base);
370
371/********************** Prototypes for local functions. **********************/
372
373/* Write a value to a specified register regno in the register image
374 of the current thread. */
375static int write_register(int regno, char *val);
376
377/* Read a value from a specified register in the register image. Returns the
378 status of the read operation. The register value is returned in valptr. */
379static int read_register(char regno, unsigned int *valptr);
380
381/* Serial port, reads one character. ETRAX 100 specific. from debugport.c */
382int getDebugChar(void);
383
384#ifdef CONFIG_ETRAXFS_SIM
385int getDebugChar(void)
386{
387 return socketread();
388}
389#endif
390
391/* Serial port, writes one character. ETRAX 100 specific. from debugport.c */
392void putDebugChar(int val);
393
394#ifdef CONFIG_ETRAXFS_SIM
395void putDebugChar(int val)
396{
397 socketwrite((char *)&val, 1);
398}
399#endif
400
401/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
402 represented by int x. */
403static char highhex(int x);
404
405/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
406 represented by int x. */
407static char lowhex(int x);
408
409/* Returns the integer equivalent of a hexadecimal character. */
410static int hex(char ch);
411
412/* Convert the memory, pointed to by mem into hexadecimal representation.
413 Put the result in buf, and return a pointer to the last character
414 in buf (null). */
415static char *mem2hex(char *buf, unsigned char *mem, int count);
416
417/* Convert the array, in hexadecimal representation, pointed to by buf into
418 binary representation. Put the result in mem, and return a pointer to
419 the character after the last byte written. */
420static unsigned char *hex2mem(unsigned char *mem, char *buf, int count);
421
422/* Put the content of the array, in binary representation, pointed to by buf
423 into memory pointed to by mem, and return a pointer to
424 the character after the last byte written. */
425static unsigned char *bin2mem(unsigned char *mem, unsigned char *buf, int count);
426
427/* Await the sequence $<data>#<checksum> and store <data> in the array buffer
428 returned. */
429static void getpacket(char *buffer);
430
431/* Send $<data>#<checksum> from the <data> in the array buffer. */
432static void putpacket(char *buffer);
433
434/* Build and send a response packet in order to inform the host the
435 stub is stopped. */
436static void stub_is_stopped(int sigval);
437
438/* All expected commands are sent from remote.c. Send a response according
439 to the description in remote.c. Not static since it needs to be reached
440 from assembler code. */
441void handle_exception(int sigval);
442
443/* Performs a complete re-start from scratch. ETRAX specific. */
444static void kill_restart(void);
445
446/******************** Prototypes for global functions. ***********************/
447
448/* The string str is prepended with the GDB printout token and sent. */
449void putDebugString(const unsigned char *str, int len);
450
451/* A static breakpoint to be used at startup. */
452void breakpoint(void);
453
454/* Avoid warning as the internal_stack is not used in the C-code. */
455#define USEDVAR(name) { if (name) { ; } }
456#define USEDFUN(name) { void (*pf)(void) = (void *)name; USEDVAR(pf) }
457
458/********************************** Packet I/O ******************************/
459/* BUFMAX defines the maximum number of characters in
460 inbound/outbound buffers */
461/* FIXME: How do we know it's enough? */
462#define BUFMAX 512
463
464/* Run-length encoding maximum length. Send 64 at most. */
465#define RUNLENMAX 64
466
467/* Definition of all valid hexadecimal characters */
468static const char hexchars[] = "0123456789abcdef";
469
470/* The inbound/outbound buffers used in packet I/O */
471static char input_buffer[BUFMAX];
472static char output_buffer[BUFMAX];
473
474/* Error and warning messages. */
475enum error_type
476{
477 SUCCESS, E01, E02, E03, E04, E05, E06,
478};
479
480static char *error_message[] =
481{
482 "",
483 "E01 Set current or general thread - H[c,g] - internal error.",
484 "E02 Change register content - P - cannot change read-only register.",
485 "E03 Thread is not alive.", /* T, not used. */
486 "E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
487 "E05 Change register content - P - the register is not implemented..",
488 "E06 Change memory content - M - internal error.",
489};
490
491/********************************** Breakpoint *******************************/
492/* Use an internal stack in the breakpoint and interrupt response routines.
493 FIXME: How do we know the size of this stack is enough?
494 Global so it can be reached from assembler code. */
495#define INTERNAL_STACK_SIZE 1024
496char internal_stack[INTERNAL_STACK_SIZE];
497
498/* Due to the breakpoint return pointer, a state variable is needed to keep
499 track of whether it is a static (compiled) or dynamic (gdb-invoked)
500 breakpoint to be handled. A static breakpoint uses the content of register
501 ERP as it is whereas a dynamic breakpoint requires subtraction with 2
502 in order to execute the instruction. The first breakpoint is static; all
503 following are assumed to be dynamic. */
504static int dynamic_bp = 0;
505
506/********************************* String library ****************************/
507/* Single-step over library functions creates trap loops. */
508
509/* Copy char s2[] to s1[]. */
510static char*
511gdb_cris_strcpy(char *s1, const char *s2)
512{
513 char *s = s1;
514
515 for (s = s1; (*s++ = *s2++) != '\0'; )
516 ;
517 return s1;
518}
519
520/* Find length of s[]. */
521static int
522gdb_cris_strlen(const char *s)
523{
524 const char *sc;
525
526 for (sc = s; *sc != '\0'; sc++)
527 ;
528 return (sc - s);
529}
530
531/* Find first occurrence of c in s[n]. */
532static void*
533gdb_cris_memchr(const void *s, int c, int n)
534{
535 const unsigned char uc = c;
536 const unsigned char *su;
537
538 for (su = s; 0 < n; ++su, --n)
539 if (*su == uc)
540 return (void *)su;
541 return NULL;
542}
543/******************************* Standard library ****************************/
544/* Single-step over library functions creates trap loops. */
545/* Convert string to long. */
546static int
547gdb_cris_strtol(const char *s, char **endptr, int base)
548{
549 char *s1;
550 char *sd;
551 int x = 0;
552
553 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1)
554 x = x * base + (sd - hexchars);
555
556 if (endptr) {
557 /* Unconverted suffix is stored in endptr unless endptr is NULL. */
558 *endptr = s1;
559 }
560
561 return x;
562}
563
564/********************************* Register image ****************************/
565
566/* Write a value to a specified register in the register image of the current
567 thread. Returns status code SUCCESS, E02 or E05. */
568static int
569write_register(int regno, char *val)
570{
571 int status = SUCCESS;
572
573 if (regno >= R0 && regno <= ACR) {
574 /* Consecutive 32-bit registers. */
575 hex2mem((unsigned char *)&reg.r0 + (regno - R0) * sizeof(unsigned int),
576 val, sizeof(unsigned int));
577
578 } else if (regno == BZ || regno == VR || regno == WZ || regno == DZ) {
579 /* Read-only registers. */
580 status = E02;
581
582 } else if (regno == PID) {
583 /* 32-bit register. (Even though we already checked SRS and WZ, we cannot
584 combine this with the EXS - SPC write since SRS and WZ have different size.) */
585 hex2mem((unsigned char *)&reg.pid, val, sizeof(unsigned int));
586
587 } else if (regno == SRS) {
588 /* 8-bit register. */
589 hex2mem((unsigned char *)&reg.srs, val, sizeof(unsigned char));
590
591 } else if (regno >= EXS && regno <= SPC) {
592 /* Consecutive 32-bit registers. */
593 hex2mem((unsigned char *)&reg.exs + (regno - EXS) * sizeof(unsigned int),
594 val, sizeof(unsigned int));
595
596 } else if (regno == PC) {
597 /* Pseudo-register. Treat as read-only. */
598 status = E02;
599
600 } else if (regno >= S0 && regno <= S15) {
601 /* 32-bit registers. */
602 hex2mem((unsigned char *)&sreg.s0_0 + (reg.srs * 16 * sizeof(unsigned int)) + (regno - S0) * sizeof(unsigned int), val, sizeof(unsigned int));
603 } else {
604 /* Non-existing register. */
605 status = E05;
606 }
607 return status;
608}
609
610/* Read a value from a specified register in the register image. Returns the
611 value in the register or -1 for non-implemented registers. */
612static int
613read_register(char regno, unsigned int *valptr)
614{
615 int status = SUCCESS;
616
617 /* We read the zero registers from the register struct (instead of just returning 0)
618 to catch errors. */
619
620 if (regno >= R0 && regno <= ACR) {
621 /* Consecutive 32-bit registers. */
622 *valptr = *(unsigned int *)((char *)&reg.r0 + (regno - R0) * sizeof(unsigned int));
623
624 } else if (regno == BZ || regno == VR) {
625 /* Consecutive 8-bit registers. */
626 *valptr = (unsigned int)(*(unsigned char *)
627 ((char *)&reg.bz + (regno - BZ) * sizeof(char)));
628
629 } else if (regno == PID) {
630 /* 32-bit register. */
631 *valptr = *(unsigned int *)((char *)&reg.pid);
632
633 } else if (regno == SRS) {
634 /* 8-bit register. */
635 *valptr = (unsigned int)(*(unsigned char *)((char *)&reg.srs));
636
637 } else if (regno == WZ) {
638 /* 16-bit register. */
639 *valptr = (unsigned int)(*(unsigned short *)(char *)&reg.wz);
640
641 } else if (regno >= EXS && regno <= PC) {
642 /* Consecutive 32-bit registers. */
643 *valptr = *(unsigned int *)((char *)&reg.exs + (regno - EXS) * sizeof(unsigned int));
644
645 } else if (regno >= S0 && regno <= S15) {
646 /* Consecutive 32-bit registers, located elsewhere. */
647 *valptr = *(unsigned int *)((char *)&sreg.s0_0 + (reg.srs * 16 * sizeof(unsigned int)) + (regno - S0) * sizeof(unsigned int));
648
649 } else {
650 /* Non-existing register. */
651 status = E05;
652 }
653 return status;
654
655}
656
657/********************************** Packet I/O ******************************/
658/* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
659 represented by int x. */
660static inline char
661highhex(int x)
662{
663 return hexchars[(x >> 4) & 0xf];
664}
665
666/* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
667 represented by int x. */
668static inline char
669lowhex(int x)
670{
671 return hexchars[x & 0xf];
672}
673
674/* Returns the integer equivalent of a hexadecimal character. */
675static int
676hex(char ch)
677{
678 if ((ch >= 'a') && (ch <= 'f'))
679 return (ch - 'a' + 10);
680 if ((ch >= '0') && (ch <= '9'))
681 return (ch - '0');
682 if ((ch >= 'A') && (ch <= 'F'))
683 return (ch - 'A' + 10);
684 return -1;
685}
686
687/* Convert the memory, pointed to by mem into hexadecimal representation.
688 Put the result in buf, and return a pointer to the last character
689 in buf (null). */
690
691static char *
692mem2hex(char *buf, unsigned char *mem, int count)
693{
694 int i;
695 int ch;
696
697 if (mem == NULL) {
698 /* Invalid address, caught by 'm' packet handler. */
699 for (i = 0; i < count; i++) {
700 *buf++ = '0';
701 *buf++ = '0';
702 }
703 } else {
704 /* Valid mem address. */
705 for (i = 0; i < count; i++) {
706 ch = *mem++;
707 *buf++ = highhex (ch);
708 *buf++ = lowhex (ch);
709 }
710 }
711 /* Terminate properly. */
712 *buf = '\0';
713 return buf;
714}
715
716/* Same as mem2hex, but puts it in network byte order. */
717static char *
718mem2hex_nbo(char *buf, unsigned char *mem, int count)
719{
720 int i;
721 int ch;
722
723 mem += count - 1;
724 for (i = 0; i < count; i++) {
725 ch = *mem--;
726 *buf++ = highhex (ch);
727 *buf++ = lowhex (ch);
728 }
729
730 /* Terminate properly. */
731 *buf = '\0';
732 return buf;
733}
734
735/* Convert the array, in hexadecimal representation, pointed to by buf into
736 binary representation. Put the result in mem, and return a pointer to
737 the character after the last byte written. */
738static unsigned char*
739hex2mem(unsigned char *mem, char *buf, int count)
740{
741 int i;
742 unsigned char ch;
743 for (i = 0; i < count; i++) {
744 ch = hex (*buf++) << 4;
745 ch = ch + hex (*buf++);
746 *mem++ = ch;
747 }
748 return mem;
749}
750
751/* Put the content of the array, in binary representation, pointed to by buf
752 into memory pointed to by mem, and return a pointer to the character after
753 the last byte written.
754 Gdb will escape $, #, and the escape char (0x7d). */
755static unsigned char*
756bin2mem(unsigned char *mem, unsigned char *buf, int count)
757{
758 int i;
759 unsigned char *next;
760 for (i = 0; i < count; i++) {
761 /* Check for any escaped characters. Be paranoid and
762 only unescape chars that should be escaped. */
763 if (*buf == 0x7d) {
764 next = buf + 1;
765 if (*next == 0x3 || *next == 0x4 || *next == 0x5D) {
766 /* #, $, ESC */
767 buf++;
768 *buf += 0x20;
769 }
770 }
771 *mem++ = *buf++;
772 }
773 return mem;
774}
775
776/* Await the sequence $<data>#<checksum> and store <data> in the array buffer
777 returned. */
778static void
779getpacket(char *buffer)
780{
781 unsigned char checksum;
782 unsigned char xmitcsum;
783 int i;
784 int count;
785 char ch;
786
787 do {
788 while((ch = getDebugChar ()) != '$')
789 /* Wait for the start character $ and ignore all other characters */;
790 checksum = 0;
791 xmitcsum = -1;
792 count = 0;
793 /* Read until a # or the end of the buffer is reached */
794 while (count < BUFMAX) {
795 ch = getDebugChar();
796 if (ch == '#')
797 break;
798 checksum = checksum + ch;
799 buffer[count] = ch;
800 count = count + 1;
801 }
802
803 if (count >= BUFMAX)
804 continue;
805
806 buffer[count] = 0;
807
808 if (ch == '#') {
809 xmitcsum = hex(getDebugChar()) << 4;
810 xmitcsum += hex(getDebugChar());
811 if (checksum != xmitcsum) {
812 /* Wrong checksum */
813 putDebugChar('-');
814 } else {
815 /* Correct checksum */
816 putDebugChar('+');
817 /* If sequence characters are received, reply with them */
818 if (buffer[2] == ':') {
819 putDebugChar(buffer[0]);
820 putDebugChar(buffer[1]);
821 /* Remove the sequence characters from the buffer */
822 count = gdb_cris_strlen(buffer);
823 for (i = 3; i <= count; i++)
824 buffer[i - 3] = buffer[i];
825 }
826 }
827 }
828 } while (checksum != xmitcsum);
829}
830
831/* Send $<data>#<checksum> from the <data> in the array buffer. */
832
833static void
834putpacket(char *buffer)
835{
836 int checksum;
837 int runlen;
838 int encode;
839
840 do {
841 char *src = buffer;
842 putDebugChar('$');
843 checksum = 0;
844 while (*src) {
845 /* Do run length encoding */
846 putDebugChar(*src);
847 checksum += *src;
848 runlen = 0;
849 while (runlen < RUNLENMAX && *src == src[runlen]) {
850 runlen++;
851 }
852 if (runlen > 3) {
853 /* Got a useful amount */
854 putDebugChar ('*');
855 checksum += '*';
856 encode = runlen + ' ' - 4;
857 putDebugChar(encode);
858 checksum += encode;
859 src += runlen;
860 } else {
861 src++;
862 }
863 }
864 putDebugChar('#');
865 putDebugChar(highhex (checksum));
866 putDebugChar(lowhex (checksum));
867 } while(kgdb_started && (getDebugChar() != '+'));
868}
869
870/* The string str is prepended with the GDB printout token and sent. Required
871 in traditional implementations. */
872void
873putDebugString(const unsigned char *str, int len)
874{
875 /* Move SPC forward if we are single-stepping. */
876 asm("spchere:");
877 asm("move $spc, $r10");
878 asm("cmp.d spchere, $r10");
879 asm("bne nosstep");
880 asm("nop");
881 asm("move.d spccont, $r10");
882 asm("move $r10, $spc");
883 asm("nosstep:");
884
885 output_buffer[0] = 'O';
886 mem2hex(&output_buffer[1], (unsigned char *)str, len);
887 putpacket(output_buffer);
888
889 asm("spccont:");
890}
891
892/********************************** Handle exceptions ************************/
893/* Build and send a response packet in order to inform the host the
894 stub is stopped. TAAn...:r...;n...:r...;n...:r...;
895 AA = signal number
896 n... = register number (hex)
897 r... = register contents
898 n... = `thread'
899 r... = thread process ID. This is a hex integer.
900 n... = other string not starting with valid hex digit.
901 gdb should ignore this n,r pair and go on to the next.
902 This way we can extend the protocol. */
903static void
904stub_is_stopped(int sigval)
905{
906 char *ptr = output_buffer;
907 unsigned int reg_cont;
908
909 /* Send trap type (converted to signal) */
910
911 *ptr++ = 'T';
912 *ptr++ = highhex(sigval);
913 *ptr++ = lowhex(sigval);
914
915 if (((reg.exs & 0xff00) >> 8) == 0xc) {
916
917 /* Some kind of hardware watchpoint triggered. Find which one
918 and determine its type (read/write/access). */
919 int S, bp, trig_bits = 0, rw_bits = 0;
920 int trig_mask = 0;
921 unsigned int *bp_d_regs = &sreg.s3_3;
922 /* In a lot of cases, the stopped data address will simply be EDA.
923 In some cases, we adjust it to match the watched data range.
924 (We don't want to change the actual EDA though). */
925 unsigned int stopped_data_address;
926 /* The S field of EXS. */
927 S = (reg.exs & 0xffff0000) >> 16;
928
929 if (S & 1) {
930 /* Instruction watchpoint. */
931 /* FIXME: Check against, and possibly adjust reported EDA. */
932 } else {
933 /* Data watchpoint. Find the one that triggered. */
934 for (bp = 0; bp < 6; bp++) {
935
936 /* Dx_RD, Dx_WR in the S field of EXS for this BP. */
937 int bitpos_trig = 1 + bp * 2;
938 /* Dx_BPRD, Dx_BPWR in BP_CTRL for this BP. */
939 int bitpos_config = 2 + bp * 4;
940
941 /* Get read/write trig bits for this BP. */
942 trig_bits = (S & (3 << bitpos_trig)) >> bitpos_trig;
943
944 /* Read/write config bits for this BP. */
945 rw_bits = (sreg.s0_3 & (3 << bitpos_config)) >> bitpos_config;
946 if (trig_bits) {
947 /* Sanity check: the BP shouldn't trigger for accesses
948 that it isn't configured for. */
949 if ((rw_bits == 0x1 && trig_bits != 0x1) ||
950 (rw_bits == 0x2 && trig_bits != 0x2))
951 panic("Invalid r/w trigging for this BP");
952
953 /* Mark this BP as trigged for future reference. */
954 trig_mask |= (1 << bp);
955
956 if (reg.eda >= bp_d_regs[bp * 2] &&
957 reg.eda <= bp_d_regs[bp * 2 + 1]) {
958 /* EDA withing range for this BP; it must be the one
959 we're looking for. */
960 stopped_data_address = reg.eda;
961 break;
962 }
963 }
964 }
965 if (bp < 6) {
966 /* Found a trigged BP with EDA within its configured data range. */
967 } else if (trig_mask) {
968 /* Something triggered, but EDA doesn't match any BP's range. */
969 for (bp = 0; bp < 6; bp++) {
970 /* Dx_BPRD, Dx_BPWR in BP_CTRL for this BP. */
971 int bitpos_config = 2 + bp * 4;
972
973 /* Read/write config bits for this BP (needed later). */
974 rw_bits = (sreg.s0_3 & (3 << bitpos_config)) >> bitpos_config;
975
976 if (trig_mask & (1 << bp)) {
977 /* EDA within 31 bytes of the configured start address? */
978 if (reg.eda + 31 >= bp_d_regs[bp * 2]) {
979 /* Changing the reported address to match
980 the start address of the first applicable BP. */
981 stopped_data_address = bp_d_regs[bp * 2];
982 break;
983 } else {
984 /* We continue since we might find another useful BP. */
985 printk("EDA doesn't match trigged BP's range");
986 }
987 }
988 }
989 }
990
991 /* No match yet? */
992 BUG_ON(bp >= 6);
993 /* Note that we report the type according to what the BP is configured
994 for (otherwise we'd never report an 'awatch'), not according to how
995 it trigged. We did check that the trigged bits match what the BP is
996 configured for though. */
997 if (rw_bits == 0x1) {
998 /* read */
999 strncpy(ptr, "rwatch", 6);
1000 ptr += 6;
1001 } else if (rw_bits == 0x2) {
1002 /* write */
1003 strncpy(ptr, "watch", 5);
1004 ptr += 5;
1005 } else if (rw_bits == 0x3) {
1006 /* access */
1007 strncpy(ptr, "awatch", 6);
1008 ptr += 6;
1009 } else {
1010 panic("Invalid r/w bits for this BP.");
1011 }
1012
1013 *ptr++ = ':';
1014 /* Note that we don't read_register(EDA, ...) */
1015 ptr = mem2hex_nbo(ptr, (unsigned char *)&stopped_data_address, register_size[EDA]);
1016 *ptr++ = ';';
1017 }
1018 }
1019 /* Only send PC, frame and stack pointer. */
1020 read_register(PC, &reg_cont);
1021 *ptr++ = highhex(PC);
1022 *ptr++ = lowhex(PC);
1023 *ptr++ = ':';
1024 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[PC]);
1025 *ptr++ = ';';
1026
1027 read_register(R8, &reg_cont);
1028 *ptr++ = highhex(R8);
1029 *ptr++ = lowhex(R8);
1030 *ptr++ = ':';
1031 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[R8]);
1032 *ptr++ = ';';
1033
1034 read_register(SP, &reg_cont);
1035 *ptr++ = highhex(SP);
1036 *ptr++ = lowhex(SP);
1037 *ptr++ = ':';
1038 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[SP]);
1039 *ptr++ = ';';
1040
1041 /* Send ERP as well; this will save us an entire register fetch in some cases. */
1042 read_register(ERP, &reg_cont);
1043 *ptr++ = highhex(ERP);
1044 *ptr++ = lowhex(ERP);
1045 *ptr++ = ':';
1046 ptr = mem2hex(ptr, (unsigned char *)&reg_cont, register_size[ERP]);
1047 *ptr++ = ';';
1048
1049 /* null-terminate and send it off */
1050 *ptr = 0;
1051 putpacket(output_buffer);
1052}
1053
1054/* Returns the size of an instruction that has a delay slot. */
1055
1056int insn_size(unsigned long pc)
1057{
1058 unsigned short opcode = *(unsigned short *)pc;
1059 int size = 0;
1060
1061 switch ((opcode & 0x0f00) >> 8) {
1062 case 0x0:
1063 case 0x9:
1064 case 0xb:
1065 size = 2;
1066 break;
1067 case 0xe:
1068 case 0xf:
1069 size = 6;
1070 break;
1071 case 0xd:
1072 /* Could be 4 or 6; check more bits. */
1073 if ((opcode & 0xff) == 0xff)
1074 size = 4;
1075 else
1076 size = 6;
1077 break;
1078 default:
1079 panic("Couldn't find size of opcode 0x%x at 0x%lx\n", opcode, pc);
1080 }
1081
1082 return size;
1083}
1084
1085void register_fixup(int sigval)
1086{
1087 /* Compensate for ACR push at the beginning of exception handler. */
1088 reg.sp += 4;
1089
1090 /* Standard case. */
1091 reg.pc = reg.erp;
1092 if (reg.erp & 0x1) {
1093 /* Delay slot bit set. Report as stopped on proper instruction. */
1094 if (reg.spc) {
1095 /* Rely on SPC if set. */
1096 reg.pc = reg.spc;
1097 } else {
1098 /* Calculate the PC from the size of the instruction
1099 that the delay slot we're in belongs to. */
1100 reg.pc += insn_size(reg.erp & ~1) - 1 ;
1101 }
1102 }
1103
1104 if ((reg.exs & 0x3) == 0x0) {
1105 /* Bits 1 - 0 indicate the type of memory operation performed
1106 by the interrupted instruction. 0 means no memory operation,
1107 and EDA is undefined in that case. We zero it to avoid confusion. */
1108 reg.eda = 0;
1109 }
1110
1111 if (sigval == SIGTRAP) {
1112 /* Break 8, single step or hardware breakpoint exception. */
1113
1114 /* Check IDX field of EXS. */
1115 if (((reg.exs & 0xff00) >> 8) == 0x18) {
1116
1117 /* Break 8. */
1118
1119 /* Static (compiled) breakpoints must return to the next instruction
1120 in order to avoid infinite loops (default value of ERP). Dynamic
1121 (gdb-invoked) must subtract the size of the break instruction from
1122 the ERP so that the instruction that was originally in the break
1123 instruction's place will be run when we return from the exception. */
1124 if (!dynamic_bp) {
1125 /* Assuming that all breakpoints are dynamic from now on. */
1126 dynamic_bp = 1;
1127 } else {
1128
1129 /* Only if not in a delay slot. */
1130 if (!(reg.erp & 0x1)) {
1131 reg.erp -= 2;
1132 reg.pc -= 2;
1133 }
1134 }
1135
1136 } else if (((reg.exs & 0xff00) >> 8) == 0x3) {
1137 /* Single step. */
1138 /* Don't fiddle with S1. */
1139
1140 } else if (((reg.exs & 0xff00) >> 8) == 0xc) {
1141
1142 /* Hardware watchpoint exception. */
1143
1144 /* SPC has been updated so that we will get a single step exception
1145 when we return, but we don't want that. */
1146 reg.spc = 0;
1147
1148 /* Don't fiddle with S1. */
1149 }
1150
1151 } else if (sigval == SIGINT) {
1152 /* Nothing special. */
1153 }
1154}
1155
1156static void insert_watchpoint(char type, int addr, int len)
1157{
1158 /* Breakpoint/watchpoint types (GDB terminology):
1159 0 = memory breakpoint for instructions
1160 (not supported; done via memory write instead)
1161 1 = hardware breakpoint for instructions (supported)
1162 2 = write watchpoint (supported)
1163 3 = read watchpoint (supported)
1164 4 = access watchpoint (supported) */
1165
1166 if (type < '1' || type > '4') {
1167 output_buffer[0] = 0;
1168 return;
1169 }
1170
1171 /* Read watchpoints are set as access watchpoints, because of GDB's
1172 inability to deal with pure read watchpoints. */
1173 if (type == '3')
1174 type = '4';
1175
1176 if (type == '1') {
1177 /* Hardware (instruction) breakpoint. */
1178 /* Bit 0 in BP_CTRL holds the configuration for I0. */
1179 if (sreg.s0_3 & 0x1) {
1180 /* Already in use. */
1181 gdb_cris_strcpy(output_buffer, error_message[E04]);
1182 return;
1183 }
1184 /* Configure. */
1185 sreg.s1_3 = addr;
1186 sreg.s2_3 = (addr + len - 1);
1187 sreg.s0_3 |= 1;
1188 } else {
1189 int bp;
1190 unsigned int *bp_d_regs = &sreg.s3_3;
1191
1192 /* The watchpoint allocation scheme is the simplest possible.
1193 For example, if a region is watched for read and
1194 a write watch is requested, a new watchpoint will
1195 be used. Also, if a watch for a region that is already
1196 covered by one or more existing watchpoints, a new
1197 watchpoint will be used. */
1198
1199 /* First, find a free data watchpoint. */
1200 for (bp = 0; bp < 6; bp++) {
1201 /* Each data watchpoint's control registers occupy 2 bits
1202 (hence the 3), starting at bit 2 for D0 (hence the 2)
1203 with 4 bits between for each watchpoint (yes, the 4). */
1204 if (!(sreg.s0_3 & (0x3 << (2 + (bp * 4))))) {
1205 break;
1206 }
1207 }
1208
1209 if (bp > 5) {
1210 /* We're out of watchpoints. */
1211 gdb_cris_strcpy(output_buffer, error_message[E04]);
1212 return;
1213 }
1214
1215 /* Configure the control register first. */
1216 if (type == '3' || type == '4') {
1217 /* Trigger on read. */
1218 sreg.s0_3 |= (1 << (2 + bp * 4));
1219 }
1220 if (type == '2' || type == '4') {
1221 /* Trigger on write. */
1222 sreg.s0_3 |= (2 << (2 + bp * 4));
1223 }
1224
1225 /* Ugly pointer arithmetics to configure the watched range. */
1226 bp_d_regs[bp * 2] = addr;
1227 bp_d_regs[bp * 2 + 1] = (addr + len - 1);
1228 }
1229
1230 /* Set the S1 flag to enable watchpoints. */
1231 reg.ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
1232 gdb_cris_strcpy(output_buffer, "OK");
1233}
1234
1235static void remove_watchpoint(char type, int addr, int len)
1236{
1237 /* Breakpoint/watchpoint types:
1238 0 = memory breakpoint for instructions
1239 (not supported; done via memory write instead)
1240 1 = hardware breakpoint for instructions (supported)
1241 2 = write watchpoint (supported)
1242 3 = read watchpoint (supported)
1243 4 = access watchpoint (supported) */
1244 if (type < '1' || type > '4') {
1245 output_buffer[0] = 0;
1246 return;
1247 }
1248
1249 /* Read watchpoints are set as access watchpoints, because of GDB's
1250 inability to deal with pure read watchpoints. */
1251 if (type == '3')
1252 type = '4';
1253
1254 if (type == '1') {
1255 /* Hardware breakpoint. */
1256 /* Bit 0 in BP_CTRL holds the configuration for I0. */
1257 if (!(sreg.s0_3 & 0x1)) {
1258 /* Not in use. */
1259 gdb_cris_strcpy(output_buffer, error_message[E04]);
1260 return;
1261 }
1262 /* Deconfigure. */
1263 sreg.s1_3 = 0;
1264 sreg.s2_3 = 0;
1265 sreg.s0_3 &= ~1;
1266 } else {
1267 int bp;
1268 unsigned int *bp_d_regs = &sreg.s3_3;
1269 /* Try to find a watchpoint that is configured for the
1270 specified range, then check that read/write also matches. */
1271
1272 /* Ugly pointer arithmetic, since I cannot rely on a
1273 single switch (addr) as there may be several watchpoints with
1274 the same start address for example. */
1275
1276 for (bp = 0; bp < 6; bp++) {
1277 if (bp_d_regs[bp * 2] == addr &&
1278 bp_d_regs[bp * 2 + 1] == (addr + len - 1)) {
1279 /* Matching range. */
1280 int bitpos = 2 + bp * 4;
1281 int rw_bits;
1282
1283 /* Read/write bits for this BP. */
1284 rw_bits = (sreg.s0_3 & (0x3 << bitpos)) >> bitpos;
1285
1286 if ((type == '3' && rw_bits == 0x1) ||
1287 (type == '2' && rw_bits == 0x2) ||
1288 (type == '4' && rw_bits == 0x3)) {
1289 /* Read/write matched. */
1290 break;
1291 }
1292 }
1293 }
1294
1295 if (bp > 5) {
1296 /* No watchpoint matched. */
1297 gdb_cris_strcpy(output_buffer, error_message[E04]);
1298 return;
1299 }
1300
1301 /* Found a matching watchpoint. Now, deconfigure it by
1302 both disabling read/write in bp_ctrl and zeroing its
1303 start/end addresses. */
1304 sreg.s0_3 &= ~(3 << (2 + (bp * 4)));
1305 bp_d_regs[bp * 2] = 0;
1306 bp_d_regs[bp * 2 + 1] = 0;
1307 }
1308
1309 /* Note that we don't clear the S1 flag here. It's done when continuing. */
1310 gdb_cris_strcpy(output_buffer, "OK");
1311}
1312
1313
1314
1315/* All expected commands are sent from remote.c. Send a response according
1316 to the description in remote.c. */
1317void
1318handle_exception(int sigval)
1319{
1320 /* Avoid warning of not used. */
1321
1322 USEDFUN(handle_exception);
1323 USEDVAR(internal_stack[0]);
1324
1325 register_fixup(sigval);
1326
1327 /* Send response. */
1328 stub_is_stopped(sigval);
1329
1330 for (;;) {
1331 output_buffer[0] = '\0';
1332 getpacket(input_buffer);
1333 switch (input_buffer[0]) {
1334 case 'g':
1335 /* Read registers: g
1336 Success: Each byte of register data is described by two hex digits.
1337 Registers are in the internal order for GDB, and the bytes
1338 in a register are in the same order the machine uses.
1339 Failure: void. */
1340 {
1341 char *buf;
1342 /* General and special registers. */
1343 buf = mem2hex(output_buffer, (char *)&reg, sizeof(registers));
1344 /* Support registers. */
1345 /* -1 because of the null termination that mem2hex adds. */
1346 mem2hex(buf,
1347 (char *)&sreg + (reg.srs * 16 * sizeof(unsigned int)),
1348 16 * sizeof(unsigned int));
1349 break;
1350 }
1351 case 'G':
1352 /* Write registers. GXX..XX
1353 Each byte of register data is described by two hex digits.
1354 Success: OK
1355 Failure: void. */
1356 /* General and special registers. */
1357 hex2mem((char *)&reg, &input_buffer[1], sizeof(registers));
1358 /* Support registers. */
1359 hex2mem((char *)&sreg + (reg.srs * 16 * sizeof(unsigned int)),
1360 &input_buffer[1] + sizeof(registers),
1361 16 * sizeof(unsigned int));
1362 gdb_cris_strcpy(output_buffer, "OK");
1363 break;
1364
1365 case 'P':
1366 /* Write register. Pn...=r...
1367 Write register n..., hex value without 0x, with value r...,
1368 which contains a hex value without 0x and two hex digits
1369 for each byte in the register (target byte order). P1f=11223344 means
1370 set register 31 to 44332211.
1371 Success: OK
1372 Failure: E02, E05 */
1373 {
1374 char *suffix;
1375 int regno = gdb_cris_strtol(&input_buffer[1], &suffix, 16);
1376 int status;
1377
1378 status = write_register(regno, suffix+1);
1379
1380 switch (status) {
1381 case E02:
1382 /* Do not support read-only registers. */
1383 gdb_cris_strcpy(output_buffer, error_message[E02]);
1384 break;
1385 case E05:
1386 /* Do not support non-existing registers. */
1387 gdb_cris_strcpy(output_buffer, error_message[E05]);
1388 break;
1389 default:
1390 /* Valid register number. */
1391 gdb_cris_strcpy(output_buffer, "OK");
1392 break;
1393 }
1394 }
1395 break;
1396
1397 case 'm':
1398 /* Read from memory. mAA..AA,LLLL
1399 AA..AA is the address and LLLL is the length.
1400 Success: XX..XX is the memory content. Can be fewer bytes than
1401 requested if only part of the data may be read. m6000120a,6c means
1402 retrieve 108 byte from base address 6000120a.
1403 Failure: void. */
1404 {
1405 char *suffix;
1406 unsigned char *addr = (unsigned char *)gdb_cris_strtol(&input_buffer[1],
1407 &suffix, 16);
1408 int len = gdb_cris_strtol(suffix+1, 0, 16);
1409
1410 /* Bogus read (i.e. outside the kernel's
1411 segment)? . */
1412 if (!((unsigned int)addr >= 0xc0000000 &&
1413 (unsigned int)addr < 0xd0000000))
1414 addr = NULL;
1415
1416 mem2hex(output_buffer, addr, len);
1417 }
1418 break;
1419
1420 case 'X':
1421 /* Write to memory. XAA..AA,LLLL:XX..XX
1422 AA..AA is the start address, LLLL is the number of bytes, and
1423 XX..XX is the binary data.
1424 Success: OK
1425 Failure: void. */
1426 case 'M':
1427 /* Write to memory. MAA..AA,LLLL:XX..XX
1428 AA..AA is the start address, LLLL is the number of bytes, and
1429 XX..XX is the hexadecimal data.
1430 Success: OK
1431 Failure: void. */
1432 {
1433 char *lenptr;
1434 char *dataptr;
1435 unsigned char *addr = (unsigned char *)gdb_cris_strtol(&input_buffer[1],
1436 &lenptr, 16);
1437 int len = gdb_cris_strtol(lenptr+1, &dataptr, 16);
1438 if (*lenptr == ',' && *dataptr == ':') {
1439 if (input_buffer[0] == 'M') {
1440 hex2mem(addr, dataptr + 1, len);
1441 } else /* X */ {
1442 bin2mem(addr, dataptr + 1, len);
1443 }
1444 gdb_cris_strcpy(output_buffer, "OK");
1445 }
1446 else {
1447 gdb_cris_strcpy(output_buffer, error_message[E06]);
1448 }
1449 }
1450 break;
1451
1452 case 'c':
1453 /* Continue execution. cAA..AA
1454 AA..AA is the address where execution is resumed. If AA..AA is
1455 omitted, resume at the present address.
1456 Success: return to the executing thread.
1457 Failure: will never know. */
1458
1459 if (input_buffer[1] != '\0') {
1460 /* FIXME: Doesn't handle address argument. */
1461 gdb_cris_strcpy(output_buffer, error_message[E04]);
1462 break;
1463 }
1464
1465 /* Before continuing, make sure everything is set up correctly. */
1466
1467 /* Set the SPC to some unlikely value. */
1468 reg.spc = 0;
1469 /* Set the S1 flag to 0 unless some watchpoint is enabled (since setting
1470 S1 to 0 would also disable watchpoints). (Note that bits 26-31 in BP_CTRL
1471 are reserved, so don't check against those). */
1472 if ((sreg.s0_3 & 0x3fff) == 0) {
1473 reg.ccs &= ~(1 << (S_CCS_BITNR + CCS_SHIFT));
1474 }
1475
1476 return;
1477
1478 case 's':
1479 /* Step. sAA..AA
1480 AA..AA is the address where execution is resumed. If AA..AA is
1481 omitted, resume at the present address. Success: return to the
1482 executing thread. Failure: will never know. */
1483
1484 if (input_buffer[1] != '\0') {
1485 /* FIXME: Doesn't handle address argument. */
1486 gdb_cris_strcpy(output_buffer, error_message[E04]);
1487 break;
1488 }
1489
1490 /* Set the SPC to PC, which is where we'll return
1491 (deduced previously). */
1492 reg.spc = reg.pc;
1493
1494 /* Set the S1 (first stacked, not current) flag, which will
1495 kick into action when we rfe. */
1496 reg.ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
1497 return;
1498
1499 case 'Z':
1500
1501 /* Insert breakpoint or watchpoint, Ztype,addr,length.
1502 Remote protocol says: A remote target shall return an empty string
1503 for an unrecognized breakpoint or watchpoint packet type. */
1504 {
1505 char *lenptr;
1506 char *dataptr;
1507 int addr = gdb_cris_strtol(&input_buffer[3], &lenptr, 16);
1508 int len = gdb_cris_strtol(lenptr + 1, &dataptr, 16);
1509 char type = input_buffer[1];
1510
1511 insert_watchpoint(type, addr, len);
1512 break;
1513 }
1514
1515 case 'z':
1516 /* Remove breakpoint or watchpoint, Ztype,addr,length.
1517 Remote protocol says: A remote target shall return an empty string
1518 for an unrecognized breakpoint or watchpoint packet type. */
1519 {
1520 char *lenptr;
1521 char *dataptr;
1522 int addr = gdb_cris_strtol(&input_buffer[3], &lenptr, 16);
1523 int len = gdb_cris_strtol(lenptr + 1, &dataptr, 16);
1524 char type = input_buffer[1];
1525
1526 remove_watchpoint(type, addr, len);
1527 break;
1528 }
1529
1530
1531 case '?':
1532 /* The last signal which caused a stop. ?
1533 Success: SAA, where AA is the signal number.
1534 Failure: void. */
1535 output_buffer[0] = 'S';
1536 output_buffer[1] = highhex(sigval);
1537 output_buffer[2] = lowhex(sigval);
1538 output_buffer[3] = 0;
1539 break;
1540
1541 case 'D':
1542 /* Detach from host. D
1543 Success: OK, and return to the executing thread.
1544 Failure: will never know */
1545 putpacket("OK");
1546 return;
1547
1548 case 'k':
1549 case 'r':
1550 /* kill request or reset request.
1551 Success: restart of target.
1552 Failure: will never know. */
1553 kill_restart();
1554 break;
1555
1556 case 'C':
1557 case 'S':
1558 case '!':
1559 case 'R':
1560 case 'd':
1561 /* Continue with signal sig. Csig;AA..AA
1562 Step with signal sig. Ssig;AA..AA
1563 Use the extended remote protocol. !
1564 Restart the target system. R0
1565 Toggle debug flag. d
1566 Search backwards. tAA:PP,MM
1567 Not supported: E04 */
1568
1569 /* FIXME: What's the difference between not supported
1570 and ignored (below)? */
1571 gdb_cris_strcpy(output_buffer, error_message[E04]);
1572 break;
1573
1574 default:
1575 /* The stub should ignore other request and send an empty
1576 response ($#<checksum>). This way we can extend the protocol and GDB
1577 can tell whether the stub it is talking to uses the old or the new. */
1578 output_buffer[0] = 0;
1579 break;
1580 }
1581 putpacket(output_buffer);
1582 }
1583}
1584
1585void
1586kgdb_init(void)
1587{
1588 reg_intr_vect_rw_mask intr_mask;
1589 reg_ser_rw_intr_mask ser_intr_mask;
1590
1591 /* Configure the kgdb serial port. */
1592#if defined(CONFIG_ETRAX_KGDB_PORT0)
1593 /* Note: no shortcut registered (not handled by multiple_interrupt).
1594 See entry.S. */
1595 set_exception_vector(SER0_INTR_VECT, kgdb_handle_exception);
1596 /* Enable the ser irq in the global config. */
1597 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1598 intr_mask.ser0 = 1;
1599 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1600
1601 ser_intr_mask = REG_RD(ser, regi_ser0, rw_intr_mask);
1602 ser_intr_mask.data_avail = regk_ser_yes;
1603 REG_WR(ser, regi_ser0, rw_intr_mask, ser_intr_mask);
1604#elif defined(CONFIG_ETRAX_KGDB_PORT1)
1605 /* Note: no shortcut registered (not handled by multiple_interrupt).
1606 See entry.S. */
1607 set_exception_vector(SER1_INTR_VECT, kgdb_handle_exception);
1608 /* Enable the ser irq in the global config. */
1609 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1610 intr_mask.ser1 = 1;
1611 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1612
1613 ser_intr_mask = REG_RD(ser, regi_ser1, rw_intr_mask);
1614 ser_intr_mask.data_avail = regk_ser_yes;
1615 REG_WR(ser, regi_ser1, rw_intr_mask, ser_intr_mask);
1616#elif defined(CONFIG_ETRAX_KGDB_PORT2)
1617 /* Note: no shortcut registered (not handled by multiple_interrupt).
1618 See entry.S. */
1619 set_exception_vector(SER2_INTR_VECT, kgdb_handle_exception);
1620 /* Enable the ser irq in the global config. */
1621 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1622 intr_mask.ser2 = 1;
1623 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1624
1625 ser_intr_mask = REG_RD(ser, regi_ser2, rw_intr_mask);
1626 ser_intr_mask.data_avail = regk_ser_yes;
1627 REG_WR(ser, regi_ser2, rw_intr_mask, ser_intr_mask);
1628#elif defined(CONFIG_ETRAX_KGDB_PORT3)
1629 /* Note: no shortcut registered (not handled by multiple_interrupt).
1630 See entry.S. */
1631 set_exception_vector(SER3_INTR_VECT, kgdb_handle_exception);
1632 /* Enable the ser irq in the global config. */
1633 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
1634 intr_mask.ser3 = 1;
1635 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
1636
1637 ser_intr_mask = REG_RD(ser, regi_ser3, rw_intr_mask);
1638 ser_intr_mask.data_avail = regk_ser_yes;
1639 REG_WR(ser, regi_ser3, rw_intr_mask, ser_intr_mask);
1640#endif
1641
1642}
1643/* Performs a complete re-start from scratch. */
1644static void
1645kill_restart(void)
1646{
1647 machine_restart("");
1648}
1649
1650/* Use this static breakpoint in the start-up only. */
1651
1652void
1653breakpoint(void)
1654{
1655 kgdb_started = 1;
1656 dynamic_bp = 0; /* This is a static, not a dynamic breakpoint. */
1657 __asm__ volatile ("break 8"); /* Jump to kgdb_handle_breakpoint. */
1658}
1659
1660/****************************** End of file **********************************/
diff --git a/arch/cris/arch-v32/kernel/kgdb_asm.S b/arch/cris/arch-v32/kernel/kgdb_asm.S
new file mode 100644
index 000000000000..b350dd279ed2
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/kgdb_asm.S
@@ -0,0 +1,552 @@
1/*
2 * Copyright (C) 2004 Axis Communications AB
3 *
4 * Code for handling break 8, hardware breakpoint, single step, and serial
5 * port exceptions for kernel debugging purposes.
6 */
7
8#include <linux/config.h>
9#include <asm/arch/hwregs/intr_vect.h>
10
11 ;; Exported functions.
12 .globl kgdb_handle_exception
13
14kgdb_handle_exception:
15
16;; Create a register image of the caller.
17;;
18;; First of all, save the ACR on the stack since we need it for address calculations.
19;; We put it into the register struct later.
20
21 subq 4, $sp
22 move.d $acr, [$sp]
23
24;; Now we are free to use ACR all we want.
25;; If we were running this handler with interrupts on, we would have to be careful
26;; to save and restore CCS manually, but since we aren't we treat it like every other
27;; register.
28
29 move.d reg, $acr
30 move.d $r0, [$acr] ; Save R0 (start of register struct)
31 addq 4, $acr
32 move.d $r1, [$acr] ; Save R1
33 addq 4, $acr
34 move.d $r2, [$acr] ; Save R2
35 addq 4, $acr
36 move.d $r3, [$acr] ; Save R3
37 addq 4, $acr
38 move.d $r4, [$acr] ; Save R4
39 addq 4, $acr
40 move.d $r5, [$acr] ; Save R5
41 addq 4, $acr
42 move.d $r6, [$acr] ; Save R6
43 addq 4, $acr
44 move.d $r7, [$acr] ; Save R7
45 addq 4, $acr
46 move.d $r8, [$acr] ; Save R8
47 addq 4, $acr
48 move.d $r9, [$acr] ; Save R9
49 addq 4, $acr
50 move.d $r10, [$acr] ; Save R10
51 addq 4, $acr
52 move.d $r11, [$acr] ; Save R11
53 addq 4, $acr
54 move.d $r12, [$acr] ; Save R12
55 addq 4, $acr
56 move.d $r13, [$acr] ; Save R13
57 addq 4, $acr
58 move.d $sp, [$acr] ; Save SP (R14)
59 addq 4, $acr
60
61 ;; The ACR register is already saved on the stack, so pop it from there.
62 move.d [$sp],$r0
63 move.d $r0, [$acr]
64 addq 4, $acr
65
66 move $bz, [$acr]
67 addq 1, $acr
68 move $vr, [$acr]
69 addq 1, $acr
70 move $pid, [$acr]
71 addq 4, $acr
72 move $srs, [$acr]
73 addq 1, $acr
74 move $wz, [$acr]
75 addq 2, $acr
76 move $exs, [$acr]
77 addq 4, $acr
78 move $eda, [$acr]
79 addq 4, $acr
80 move $mof, [$acr]
81 addq 4, $acr
82 move $dz, [$acr]
83 addq 4, $acr
84 move $ebp, [$acr]
85 addq 4, $acr
86 move $erp, [$acr]
87 addq 4, $acr
88 move $srp, [$acr]
89 addq 4, $acr
90 move $nrp, [$acr]
91 addq 4, $acr
92 move $ccs, [$acr]
93 addq 4, $acr
94 move $usp, [$acr]
95 addq 4, $acr
96 move $spc, [$acr]
97 addq 4, $acr
98
99;; Skip the pseudo-PC.
100 addq 4, $acr
101
102;; Save the support registers in bank 0 - 3.
103 clear.d $r1 ; Bank counter
104 move.d sreg, $acr
105
106;; Bank 0
107 move $r1, $srs
108 nop
109 nop
110 nop
111 move $s0, $r0
112 move.d $r0, [$acr]
113 addq 4, $acr
114 move $s1, $r0
115 move.d $r0, [$acr]
116 addq 4, $acr
117 move $s2, $r0
118 move.d $r0, [$acr]
119 addq 4, $acr
120 move $s3, $r0
121 move.d $r0, [$acr]
122 addq 4, $acr
123 move $s4, $r0
124 move.d $r0, [$acr]
125 addq 4, $acr
126 move $s5, $r0
127 move.d $r0, [$acr]
128 addq 4, $acr
129 move $s6, $r0
130 move.d $r0, [$acr]
131 addq 4, $acr
132 move $s7, $r0
133 move.d $r0, [$acr]
134 addq 4, $acr
135 move $s8, $r0
136 move.d $r0, [$acr]
137 addq 4, $acr
138 move $s9, $r0
139 move.d $r0, [$acr]
140 addq 4, $acr
141 move $s10, $r0
142 move.d $r0, [$acr]
143 addq 4, $acr
144 move $s11, $r0
145 move.d $r0, [$acr]
146 addq 4, $acr
147 move $s12, $r0
148 move.d $r0, [$acr]
149 addq 4, $acr
150
151 ;; Nothing in S13 - S15, bank 0
152 clear.d [$acr]
153 addq 4, $acr
154 clear.d [$acr]
155 addq 4, $acr
156 clear.d [$acr]
157 addq 4, $acr
158
159;; Bank 1 and bank 2 have the same layout, hence the loop.
160 addq 1, $r1
1611:
162 move $r1, $srs
163 nop
164 nop
165 nop
166 move $s0, $r0
167 move.d $r0, [$acr]
168 addq 4, $acr
169 move $s1, $r0
170 move.d $r0, [$acr]
171 addq 4, $acr
172 move $s2, $r0
173 move.d $r0, [$acr]
174 addq 4, $acr
175 move $s3, $r0
176 move.d $r0, [$acr]
177 addq 4, $acr
178 move $s4, $r0
179 move.d $r0, [$acr]
180 addq 4, $acr
181 move $s5, $r0
182 move.d $r0, [$acr]
183 addq 4, $acr
184 move $s6, $r0
185 move.d $r0, [$acr]
186 addq 4, $acr
187
188 ;; Nothing in S7 - S15, bank 1 and 2
189 clear.d [$acr]
190 addq 4, $acr
191 clear.d [$acr]
192 addq 4, $acr
193 clear.d [$acr]
194 addq 4, $acr
195 clear.d [$acr]
196 addq 4, $acr
197 clear.d [$acr]
198 addq 4, $acr
199 clear.d [$acr]
200 addq 4, $acr
201 clear.d [$acr]
202 addq 4, $acr
203 clear.d [$acr]
204 addq 4, $acr
205 clear.d [$acr]
206 addq 4, $acr
207
208 addq 1, $r1
209 cmpq 3, $r1
210 bne 1b
211 nop
212
213;; Bank 3
214 move $r1, $srs
215 nop
216 nop
217 nop
218 move $s0, $r0
219 move.d $r0, [$acr]
220 addq 4, $acr
221 move $s1, $r0
222 move.d $r0, [$acr]
223 addq 4, $acr
224 move $s2, $r0
225 move.d $r0, [$acr]
226 addq 4, $acr
227 move $s3, $r0
228 move.d $r0, [$acr]
229 addq 4, $acr
230 move $s4, $r0
231 move.d $r0, [$acr]
232 addq 4, $acr
233 move $s5, $r0
234 move.d $r0, [$acr]
235 addq 4, $acr
236 move $s6, $r0
237 move.d $r0, [$acr]
238 addq 4, $acr
239 move $s7, $r0
240 move.d $r0, [$acr]
241 addq 4, $acr
242 move $s8, $r0
243 move.d $r0, [$acr]
244 addq 4, $acr
245 move $s9, $r0
246 move.d $r0, [$acr]
247 addq 4, $acr
248 move $s10, $r0
249 move.d $r0, [$acr]
250 addq 4, $acr
251 move $s11, $r0
252 move.d $r0, [$acr]
253 addq 4, $acr
254 move $s12, $r0
255 move.d $r0, [$acr]
256 addq 4, $acr
257 move $s13, $r0
258 move.d $r0, [$acr]
259 addq 4, $acr
260 move $s14, $r0
261 move.d $r0, [$acr]
262 addq 4, $acr
263;; Nothing in S15, bank 3
264 clear.d [$acr]
265 addq 4, $acr
266
267;; Check what got us here: get IDX field of EXS.
268 move $exs, $r10
269 and.d 0xff00, $r10
270 lsrq 8, $r10
271#if defined(CONFIG_ETRAX_KGDB_PORT0)
272 cmp.d SER0_INTR_VECT, $r10 ; IRQ for serial port 0
273 beq sigint
274 nop
275#elif defined(CONFIG_ETRAX_KGDB_PORT1)
276 cmp.d SER1_INTR_VECT, $r10 ; IRQ for serial port 1
277 beq sigint
278 nop
279#elif defined(CONFIG_ETRAX_KGDB_PORT2)
280 cmp.d SER2_INTR_VECT, $r10 ; IRQ for serial port 2
281 beq sigint
282 nop
283#elif defined(CONFIG_ETRAX_KGDB_PORT3)
284 cmp.d SER3_INTR_VECT, $r10 ; IRQ for serial port 3
285 beq sigint
286 nop
287#endif
288;; Multiple interrupt must be due to serial break.
289 cmp.d 0x30, $r10 ; Multiple interrupt
290 beq sigint
291 nop
292;; Neither of those? Then it's a sigtrap.
293 ba handle_comm
294 moveq 5, $r10 ; Set SIGTRAP (delay slot)
295
296sigint:
297 ;; Serial interrupt; get character
298 jsr getDebugChar
299 nop ; Delay slot
300 cmp.b 3, $r10 ; \003 (Ctrl-C)?
301 bne return ; No, get out of here
302 nop
303 moveq 2, $r10 ; Set SIGINT
304
305;;
306;; Handle the communication
307;;
308handle_comm:
309 move.d internal_stack+1020, $sp ; Use the internal stack which grows upwards
310 jsr handle_exception ; Interactive routine
311 nop
312
313;;
314;; Return to the caller
315;;
316return:
317
318;; First of all, write the support registers.
319 clear.d $r1 ; Bank counter
320 move.d sreg, $acr
321
322;; Bank 0
323 move $r1, $srs
324 nop
325 nop
326 nop
327 move.d [$acr], $r0
328 move $r0, $s0
329 addq 4, $acr
330 move.d [$acr], $r0
331 move $r0, $s1
332 addq 4, $acr
333 move.d [$acr], $r0
334 move $r0, $s2
335 addq 4, $acr
336 move.d [$acr], $r0
337 move $r0, $s3
338 addq 4, $acr
339 move.d [$acr], $r0
340 move $r0, $s4
341 addq 4, $acr
342 move.d [$acr], $r0
343 move $r0, $s5
344 addq 4, $acr
345
346;; Nothing in S6 - S7, bank 0.
347 addq 4, $acr
348 addq 4, $acr
349
350 move.d [$acr], $r0
351 move $r0, $s8
352 addq 4, $acr
353 move.d [$acr], $r0
354 move $r0, $s9
355 addq 4, $acr
356 move.d [$acr], $r0
357 move $r0, $s10
358 addq 4, $acr
359 move.d [$acr], $r0
360 move $r0, $s11
361 addq 4, $acr
362 move.d [$acr], $r0
363 move $r0, $s12
364 addq 4, $acr
365
366;; Nothing in S13 - S15, bank 0
367 addq 4, $acr
368 addq 4, $acr
369 addq 4, $acr
370
371;; Bank 1 and bank 2 have the same layout, hence the loop.
372 addq 1, $r1
3732:
374 move $r1, $srs
375 nop
376 nop
377 nop
378 move.d [$acr], $r0
379 move $r0, $s0
380 addq 4, $acr
381 move.d [$acr], $r0
382 move $r0, $s1
383 addq 4, $acr
384 move.d [$acr], $r0
385 move $r0, $s2
386 addq 4, $acr
387
388;; S3 (MM_CAUSE) is read-only.
389 addq 4, $acr
390
391 move.d [$acr], $r0
392 move $r0, $s4
393 addq 4, $acr
394
395;; FIXME: Actually write S5/S6? (Affects MM_CAUSE.)
396 addq 4, $acr
397 addq 4, $acr
398
399;; Nothing in S7 - S15, bank 1 and 2
400 addq 4, $acr
401 addq 4, $acr
402 addq 4, $acr
403 addq 4, $acr
404 addq 4, $acr
405 addq 4, $acr
406 addq 4, $acr
407 addq 4, $acr
408 addq 4, $acr
409
410 addq 1, $r1
411 cmpq 3, $r1
412 bne 2b
413 nop
414
415;; Bank 3
416 move $r1, $srs
417 nop
418 nop
419 nop
420 move.d [$acr], $r0
421 move $r0, $s0
422 addq 4, $acr
423 move.d [$acr], $r0
424 move $r0, $s1
425 addq 4, $acr
426 move.d [$acr], $r0
427 move $r0, $s2
428 addq 4, $acr
429 move.d [$acr], $r0
430 move $r0, $s3
431 addq 4, $acr
432 move.d [$acr], $r0
433 move $r0, $s4
434 addq 4, $acr
435 move.d [$acr], $r0
436 move $r0, $s5
437 addq 4, $acr
438 move.d [$acr], $r0
439 move $r0, $s6
440 addq 4, $acr
441 move.d [$acr], $r0
442 move $r0, $s7
443 addq 4, $acr
444 move.d [$acr], $r0
445 move $r0, $s8
446 addq 4, $acr
447 move.d [$acr], $r0
448 move $r0, $s9
449 addq 4, $acr
450 move.d [$acr], $r0
451 move $r0, $s10
452 addq 4, $acr
453 move.d [$acr], $r0
454 move $r0, $s11
455 addq 4, $acr
456 move.d [$acr], $r0
457 move $r0, $s12
458 addq 4, $acr
459 move.d [$acr], $r0
460 move $r0, $s13
461 addq 4, $acr
462 move.d [$acr], $r0
463 move $r0, $s14
464 addq 4, $acr
465
466;; Nothing in S15, bank 3
467 addq 4, $acr
468
469;; Now, move on to the regular register restoration process.
470
471 move.d reg, $acr ; Reset ACR to point at the beginning of the register image
472 move.d [$acr], $r0 ; Restore R0
473 addq 4, $acr
474 move.d [$acr], $r1 ; Restore R1
475 addq 4, $acr
476 move.d [$acr], $r2 ; Restore R2
477 addq 4, $acr
478 move.d [$acr], $r3 ; Restore R3
479 addq 4, $acr
480 move.d [$acr], $r4 ; Restore R4
481 addq 4, $acr
482 move.d [$acr], $r5 ; Restore R5
483 addq 4, $acr
484 move.d [$acr], $r6 ; Restore R6
485 addq 4, $acr
486 move.d [$acr], $r7 ; Restore R7
487 addq 4, $acr
488 move.d [$acr], $r8 ; Restore R8
489 addq 4, $acr
490 move.d [$acr], $r9 ; Restore R9
491 addq 4, $acr
492 move.d [$acr], $r10 ; Restore R10
493 addq 4, $acr
494 move.d [$acr], $r11 ; Restore R11
495 addq 4, $acr
496 move.d [$acr], $r12 ; Restore R12
497 addq 4, $acr
498 move.d [$acr], $r13 ; Restore R13
499
500;;
501;; We restore all registers, even though some of them probably haven't changed.
502;;
503
504 addq 4, $acr
505 move.d [$acr], $sp ; Restore SP (R14)
506
507 ;; ACR cannot be restored just yet.
508 addq 8, $acr
509
510 ;; Skip BZ, VR.
511 addq 2, $acr
512
513 move [$acr], $pid ; Restore PID
514 addq 4, $acr
515 move [$acr], $srs ; Restore SRS
516 nop
517 nop
518 nop
519 addq 1, $acr
520
521 ;; Skip WZ.
522 addq 2, $acr
523
524 move [$acr], $exs ; Restore EXS.
525 addq 4, $acr
526 move [$acr], $eda ; Restore EDA.
527 addq 4, $acr
528 move [$acr], $mof ; Restore MOF.
529
530 ;; Skip DZ.
531 addq 8, $acr
532
533 move [$acr], $ebp ; Restore EBP.
534 addq 4, $acr
535 move [$acr], $erp ; Restore ERP.
536 addq 4, $acr
537 move [$acr], $srp ; Restore SRP.
538 addq 4, $acr
539 move [$acr], $nrp ; Restore NRP.
540 addq 4, $acr
541 move [$acr], $ccs ; Restore CCS like an ordinary register.
542 addq 4, $acr
543 move [$acr], $usp ; Restore USP
544 addq 4, $acr
545 move [$acr], $spc ; Restore SPC
546 ; No restoration of pseudo-PC of course.
547
548 move.d reg, $acr ; Reset ACR to point at the beginning of the register image
549 add.d 15*4, $acr
550 move.d [$acr], $acr ; Finally, restore ACR.
551 rete ; Same as jump ERP
552 rfe ; Shifts CCS
diff --git a/arch/cris/arch-v32/kernel/pinmux.c b/arch/cris/arch-v32/kernel/pinmux.c
new file mode 100644
index 000000000000..a2b8aa37c1bf
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/pinmux.c
@@ -0,0 +1,229 @@
1/*
2 * Allocator for I/O pins. All pins are allocated to GPIO at bootup.
3 * Unassigned pins and GPIO pins can be allocated to a fixed interface
4 * or the I/O processor instead.
5 *
6 * Copyright (c) 2004 Axis Communications AB.
7 */
8
9#include <linux/init.h>
10#include <linux/errno.h>
11#include <linux/kernel.h>
12#include <linux/string.h>
13#include <linux/spinlock.h>
14#include <asm/arch/hwregs/reg_map.h>
15#include <asm/arch/hwregs/reg_rdwr.h>
16#include <asm/arch/pinmux.h>
17#include <asm/arch/hwregs/pinmux_defs.h>
18
19#undef DEBUG
20
21#define PORT_PINS 18
22#define PORTS 4
23
24static char pins[PORTS][PORT_PINS];
25static DEFINE_SPINLOCK(pinmux_lock);
26
27static void crisv32_pinmux_set(int port);
28
29int
30crisv32_pinmux_init(void)
31{
32 static int initialized = 0;
33
34 if (!initialized) {
35 reg_pinmux_rw_pa pa = REG_RD(pinmux, regi_pinmux, rw_pa);
36 initialized = 1;
37 pa.pa0 = pa.pa1 = pa.pa2 = pa.pa3 =
38 pa.pa4 = pa.pa5 = pa.pa6 = pa.pa7 = regk_pinmux_yes;
39 REG_WR(pinmux, regi_pinmux, rw_pa, pa);
40 crisv32_pinmux_alloc(PORT_B, 0, PORT_PINS - 1, pinmux_gpio);
41 crisv32_pinmux_alloc(PORT_C, 0, PORT_PINS - 1, pinmux_gpio);
42 crisv32_pinmux_alloc(PORT_D, 0, PORT_PINS - 1, pinmux_gpio);
43 crisv32_pinmux_alloc(PORT_E, 0, PORT_PINS - 1, pinmux_gpio);
44 }
45
46 return 0;
47}
48
49int
50crisv32_pinmux_alloc(int port, int first_pin, int last_pin, enum pin_mode mode)
51{
52 int i;
53 unsigned long flags;
54
55 crisv32_pinmux_init();
56
57 if (port > PORTS)
58 return -EINVAL;
59
60 spin_lock_irqsave(&pinmux_lock, flags);
61
62 for (i = first_pin; i <= last_pin; i++)
63 {
64 if ((pins[port][i] != pinmux_none) && (pins[port][i] != pinmux_gpio) &&
65 (pins[port][i] != mode))
66 {
67 spin_unlock_irqrestore(&pinmux_lock, flags);
68#ifdef DEBUG
69 panic("Pinmux alloc failed!\n");
70#endif
71 return -EPERM;
72 }
73 }
74
75 for (i = first_pin; i <= last_pin; i++)
76 pins[port][i] = mode;
77
78 crisv32_pinmux_set(port);
79
80 spin_unlock_irqrestore(&pinmux_lock, flags);
81
82 return 0;
83}
84
85int
86crisv32_pinmux_alloc_fixed(enum fixed_function function)
87{
88 int ret = -EINVAL;
89 char saved[sizeof pins];
90 unsigned long flags;
91
92 spin_lock_irqsave(&pinmux_lock, flags);
93
94 /* Save internal data for recovery */
95 memcpy(saved, pins, sizeof pins);
96
97 reg_pinmux_rw_hwprot hwprot = REG_RD(pinmux, regi_pinmux, rw_hwprot);
98
99 switch(function)
100 {
101 case pinmux_ser1:
102 ret = crisv32_pinmux_alloc(PORT_C, 4, 7, pinmux_fixed);
103 hwprot.ser1 = regk_pinmux_yes;
104 break;
105 case pinmux_ser2:
106 ret = crisv32_pinmux_alloc(PORT_C, 8, 11, pinmux_fixed);
107 hwprot.ser2 = regk_pinmux_yes;
108 break;
109 case pinmux_ser3:
110 ret = crisv32_pinmux_alloc(PORT_C, 12, 15, pinmux_fixed);
111 hwprot.ser3 = regk_pinmux_yes;
112 break;
113 case pinmux_sser0:
114 ret = crisv32_pinmux_alloc(PORT_C, 0, 3, pinmux_fixed);
115 ret |= crisv32_pinmux_alloc(PORT_C, 16, 16, pinmux_fixed);
116 hwprot.sser0 = regk_pinmux_yes;
117 break;
118 case pinmux_sser1:
119 ret = crisv32_pinmux_alloc(PORT_D, 0, 4, pinmux_fixed);
120 hwprot.sser1 = regk_pinmux_yes;
121 break;
122 case pinmux_ata0:
123 ret = crisv32_pinmux_alloc(PORT_D, 5, 7, pinmux_fixed);
124 ret |= crisv32_pinmux_alloc(PORT_D, 15, 17, pinmux_fixed);
125 hwprot.ata0 = regk_pinmux_yes;
126 break;
127 case pinmux_ata1:
128 ret = crisv32_pinmux_alloc(PORT_D, 0, 4, pinmux_fixed);
129 ret |= crisv32_pinmux_alloc(PORT_E, 17, 17, pinmux_fixed);
130 hwprot.ata1 = regk_pinmux_yes;
131 break;
132 case pinmux_ata2:
133 ret = crisv32_pinmux_alloc(PORT_C, 11, 15, pinmux_fixed);
134 ret |= crisv32_pinmux_alloc(PORT_E, 3, 3, pinmux_fixed);
135 hwprot.ata2 = regk_pinmux_yes;
136 break;
137 case pinmux_ata3:
138 ret = crisv32_pinmux_alloc(PORT_C, 8, 10, pinmux_fixed);
139 ret |= crisv32_pinmux_alloc(PORT_C, 0, 2, pinmux_fixed);
140 hwprot.ata2 = regk_pinmux_yes;
141 break;
142 case pinmux_ata:
143 ret = crisv32_pinmux_alloc(PORT_B, 0, 15, pinmux_fixed);
144 ret |= crisv32_pinmux_alloc(PORT_D, 8, 15, pinmux_fixed);
145 hwprot.ata = regk_pinmux_yes;
146 break;
147 case pinmux_eth1:
148 ret = crisv32_pinmux_alloc(PORT_E, 0, 17, pinmux_fixed);
149 hwprot.eth1 = regk_pinmux_yes;
150 hwprot.eth1_mgm = regk_pinmux_yes;
151 break;
152 case pinmux_timer:
153 ret = crisv32_pinmux_alloc(PORT_C, 16, 16, pinmux_fixed);
154 hwprot.timer = regk_pinmux_yes;
155 spin_unlock_irqrestore(&pinmux_lock, flags);
156 return ret;
157 }
158
159 if (!ret)
160 REG_WR(pinmux, regi_pinmux, rw_hwprot, hwprot);
161 else
162 memcpy(pins, saved, sizeof pins);
163
164 spin_unlock_irqrestore(&pinmux_lock, flags);
165
166 return ret;
167}
168
169void
170crisv32_pinmux_set(int port)
171{
172 int i;
173 int gpio_val = 0;
174 int iop_val = 0;
175
176 for (i = 0; i < PORT_PINS; i++)
177 {
178 if (pins[port][i] == pinmux_gpio)
179 gpio_val |= (1 << i);
180 else if (pins[port][i] == pinmux_iop)
181 iop_val |= (1 << i);
182 }
183
184 REG_WRITE(int, regi_pinmux + REG_RD_ADDR_pinmux_rw_pb_gio + 8*port, gpio_val);
185 REG_WRITE(int, regi_pinmux + REG_RD_ADDR_pinmux_rw_pb_iop + 8*port, iop_val);
186
187#ifdef DEBUG
188 crisv32_pinmux_dump();
189#endif
190}
191
192int
193crisv32_pinmux_dealloc(int port, int first_pin, int last_pin)
194{
195 int i;
196 unsigned long flags;
197
198 crisv32_pinmux_init();
199
200 if (port > PORTS)
201 return -EINVAL;
202
203 spin_lock_irqsave(&pinmux_lock, flags);
204
205 for (i = first_pin; i <= last_pin; i++)
206 pins[port][i] = pinmux_none;
207
208 crisv32_pinmux_set(port);
209 spin_unlock_irqrestore(&pinmux_lock, flags);
210
211 return 0;
212}
213
214void
215crisv32_pinmux_dump(void)
216{
217 int i, j;
218
219 crisv32_pinmux_init();
220
221 for (i = 0; i < PORTS; i++)
222 {
223 printk("Port %c\n", 'B'+i);
224 for (j = 0; j < PORT_PINS; j++)
225 printk(" Pin %d = %d\n", j, pins[i][j]);
226 }
227}
228
229__initcall(crisv32_pinmux_init);
diff --git a/arch/cris/arch-v32/kernel/process.c b/arch/cris/arch-v32/kernel/process.c
new file mode 100644
index 000000000000..882be42114f7
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/process.c
@@ -0,0 +1,270 @@
1/*
2 * Copyright (C) 2000-2003 Axis Communications AB
3 *
4 * Authors: Bjorn Wesen (bjornw@axis.com)
5 * Mikael Starvik (starvik@axis.com)
6 * Tobias Anderberg (tobiasa@axis.com), CRISv32 port.
7 *
8 * This file handles the architecture-dependent parts of process handling..
9 */
10
11#include <linux/config.h>
12#include <linux/sched.h>
13#include <linux/err.h>
14#include <linux/fs.h>
15#include <linux/slab.h>
16#include <asm/arch/hwregs/reg_rdwr.h>
17#include <asm/arch/hwregs/reg_map.h>
18#include <asm/arch/hwregs/timer_defs.h>
19#include <asm/arch/hwregs/intr_vect_defs.h>
20
21extern void stop_watchdog(void);
22
23#ifdef CONFIG_ETRAX_GPIO
24extern void etrax_gpio_wake_up_check(void); /* Defined in drivers/gpio.c. */
25#endif
26
27extern int cris_hlt_counter;
28
29/* We use this if we don't have any better idle routine. */
30void default_idle(void)
31{
32 local_irq_disable();
33 if (!need_resched() && !cris_hlt_counter) {
34 /* Halt until exception. */
35 __asm__ volatile("ei \n\t"
36 "halt ");
37 }
38 local_irq_enable();
39}
40
41/*
42 * Free current thread data structures etc..
43 */
44
45extern void deconfigure_bp(long pid);
46void exit_thread(void)
47{
48 deconfigure_bp(current->pid);
49}
50
51/*
52 * If the watchdog is enabled, disable interrupts and enter an infinite loop.
53 * The watchdog will reset the CPU after 0.1s. If the watchdog isn't enabled
54 * then enable it and wait.
55 */
56extern void arch_enable_nmi(void);
57
58void
59hard_reset_now(void)
60{
61 /*
62 * Don't declare this variable elsewhere. We don't want any other
63 * code to know about it than the watchdog handler in entry.S and
64 * this code, implementing hard reset through the watchdog.
65 */
66#if defined(CONFIG_ETRAX_WATCHDOG)
67 extern int cause_of_death;
68#endif
69
70 printk("*** HARD RESET ***\n");
71 local_irq_disable();
72
73#if defined(CONFIG_ETRAX_WATCHDOG)
74 cause_of_death = 0xbedead;
75#else
76{
77 reg_timer_rw_wd_ctrl wd_ctrl = {0};
78
79 stop_watchdog();
80
81 wd_ctrl.key = 16; /* Arbitrary key. */
82 wd_ctrl.cnt = 1; /* Minimum time. */
83 wd_ctrl.cmd = regk_timer_start;
84
85 arch_enable_nmi();
86 REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl);
87}
88#endif
89
90 while (1)
91 ; /* Wait for reset. */
92}
93
94/*
95 * Return saved PC of a blocked thread.
96 */
97unsigned long thread_saved_pc(struct task_struct *t)
98{
99 return (unsigned long)user_regs(t->thread_info)->erp;
100}
101
102static void
103kernel_thread_helper(void* dummy, int (*fn)(void *), void * arg)
104{
105 fn(arg);
106 do_exit(-1); /* Should never be called, return bad exit value. */
107}
108
109/* Create a kernel thread. */
110int
111kernel_thread(int (*fn)(void *), void * arg, unsigned long flags)
112{
113 struct pt_regs regs;
114
115 memset(&regs, 0, sizeof(regs));
116
117 /* Don't use r10 since that is set to 0 in copy_thread. */
118 regs.r11 = (unsigned long) fn;
119 regs.r12 = (unsigned long) arg;
120 regs.erp = (unsigned long) kernel_thread_helper;
121 regs.ccs = 1 << (I_CCS_BITNR + CCS_SHIFT);
122
123 /* Create the new process. */
124 return do_fork(flags | CLONE_VM | CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
125}
126
127/*
128 * Setup the child's kernel stack with a pt_regs and call switch_stack() on it.
129 * It will be unnested during _resume and _ret_from_sys_call when the new thread
130 * is scheduled.
131 *
132 * Also setup the thread switching structure which is used to keep
133 * thread-specific data during _resumes.
134 */
135
136extern asmlinkage void ret_from_fork(void);
137
138int
139copy_thread(int nr, unsigned long clone_flags, unsigned long usp,
140 unsigned long unused,
141 struct task_struct *p, struct pt_regs *regs)
142{
143 struct pt_regs *childregs;
144 struct switch_stack *swstack;
145
146 /*
147 * Put the pt_regs structure at the end of the new kernel stack page and
148 * fix it up. Note: the task_struct doubles as the kernel stack for the
149 * task.
150 */
151 childregs = user_regs(p->thread_info);
152 *childregs = *regs; /* Struct copy of pt_regs. */
153 p->set_child_tid = p->clear_child_tid = NULL;
154 childregs->r10 = 0; /* Child returns 0 after a fork/clone. */
155
156 /* Set a new TLS ?
157 * The TLS is in $mof beacuse it is the 5th argument to sys_clone.
158 */
159 if (p->mm && (clone_flags & CLONE_SETTLS)) {
160 p->thread_info->tls = regs->mof;
161 }
162
163 /* Put the switch stack right below the pt_regs. */
164 swstack = ((struct switch_stack *) childregs) - 1;
165
166 /* Paramater to ret_from_sys_call. 0 is don't restart the syscall. */
167 swstack->r9 = 0;
168
169 /*
170 * We want to return into ret_from_sys_call after the _resume.
171 * ret_from_fork will call ret_from_sys_call.
172 */
173 swstack->return_ip = (unsigned long) ret_from_fork;
174
175 /* Fix the user-mode and kernel-mode stackpointer. */
176 p->thread.usp = usp;
177 p->thread.ksp = (unsigned long) swstack;
178
179 return 0;
180}
181
182/*
183 * Be aware of the "magic" 7th argument in the four system-calls below.
184 * They need the latest stackframe, which is put as the 7th argument by
185 * entry.S. The previous arguments are dummies or actually used, but need
186 * to be defined to reach the 7th argument.
187 *
188 * N.B.: Another method to get the stackframe is to use current_regs(). But
189 * it returns the latest stack-frame stacked when going from _user mode_ and
190 * some of these (at least sys_clone) are called from kernel-mode sometimes
191 * (for example during kernel_thread, above) and thus cannot use it. Thus,
192 * to be sure not to get any surprises, we use the method for the other calls
193 * as well.
194 */
195asmlinkage int
196sys_fork(long r10, long r11, long r12, long r13, long mof, long srp,
197 struct pt_regs *regs)
198{
199 return do_fork(SIGCHLD, rdusp(), regs, 0, NULL, NULL);
200}
201
202/* FIXME: Is parent_tid/child_tid really third/fourth argument? Update lib? */
203asmlinkage int
204sys_clone(unsigned long newusp, unsigned long flags, int *parent_tid, int *child_tid,
205 unsigned long tls, long srp, struct pt_regs *regs)
206{
207 if (!newusp)
208 newusp = rdusp();
209
210 return do_fork(flags, newusp, regs, 0, parent_tid, child_tid);
211}
212
213/*
214 * vfork is a system call in i386 because of register-pressure - maybe
215 * we can remove it and handle it in libc but we put it here until then.
216 */
217asmlinkage int
218sys_vfork(long r10, long r11, long r12, long r13, long mof, long srp,
219 struct pt_regs *regs)
220{
221 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, rdusp(), regs, 0, NULL, NULL);
222}
223
224/* sys_execve() executes a new program. */
225asmlinkage int
226sys_execve(const char *fname, char **argv, char **envp, long r13, long mof, long srp,
227 struct pt_regs *regs)
228{
229 int error;
230 char *filename;
231
232 filename = getname(fname);
233 error = PTR_ERR(filename);
234
235 if (IS_ERR(filename))
236 goto out;
237
238 error = do_execve(filename, argv, envp, regs);
239 putname(filename);
240 out:
241 return error;
242}
243
244unsigned long
245get_wchan(struct task_struct *p)
246{
247 /* TODO */
248 return 0;
249}
250#undef last_sched
251#undef first_sched
252
253void show_regs(struct pt_regs * regs)
254{
255 unsigned long usp = rdusp();
256 printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n",
257 regs->erp, regs->srp, regs->ccs, usp, regs->mof);
258
259 printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
260 regs->r0, regs->r1, regs->r2, regs->r3);
261
262 printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
263 regs->r4, regs->r5, regs->r6, regs->r7);
264
265 printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
266 regs->r8, regs->r9, regs->r10, regs->r11);
267
268 printk("r12: %08lx r13: %08lx oR10: %08lx\n",
269 regs->r12, regs->r13, regs->orig_r10);
270}
diff --git a/arch/cris/arch-v32/kernel/ptrace.c b/arch/cris/arch-v32/kernel/ptrace.c
new file mode 100644
index 000000000000..208489da2a87
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/ptrace.c
@@ -0,0 +1,597 @@
1/*
2 * Copyright (C) 2000-2003, Axis Communications AB.
3 */
4
5#include <linux/kernel.h>
6#include <linux/sched.h>
7#include <linux/mm.h>
8#include <linux/smp.h>
9#include <linux/smp_lock.h>
10#include <linux/errno.h>
11#include <linux/ptrace.h>
12#include <linux/user.h>
13#include <linux/signal.h>
14#include <linux/security.h>
15
16#include <asm/uaccess.h>
17#include <asm/page.h>
18#include <asm/pgtable.h>
19#include <asm/system.h>
20#include <asm/processor.h>
21#include <asm/arch/hwregs/supp_reg.h>
22
23/*
24 * Determines which bits in CCS the user has access to.
25 * 1 = access, 0 = no access.
26 */
27#define CCS_MASK 0x00087c00 /* SXNZVC */
28
29#define SBIT_USER (1 << (S_CCS_BITNR + CCS_SHIFT))
30
31static int put_debugreg(long pid, unsigned int regno, long data);
32static long get_debugreg(long pid, unsigned int regno);
33static unsigned long get_pseudo_pc(struct task_struct *child);
34void deconfigure_bp(long pid);
35
36extern unsigned long cris_signal_return_page;
37
38/*
39 * Get contents of register REGNO in task TASK.
40 */
41long get_reg(struct task_struct *task, unsigned int regno)
42{
43 /* USP is a special case, it's not in the pt_regs struct but
44 * in the tasks thread struct
45 */
46 unsigned long ret;
47
48 if (regno <= PT_EDA)
49 ret = ((unsigned long *)user_regs(task->thread_info))[regno];
50 else if (regno == PT_USP)
51 ret = task->thread.usp;
52 else if (regno == PT_PPC)
53 ret = get_pseudo_pc(task);
54 else if (regno <= PT_MAX)
55 ret = get_debugreg(task->pid, regno);
56 else
57 ret = 0;
58
59 return ret;
60}
61
62/*
63 * Write contents of register REGNO in task TASK.
64 */
65int put_reg(struct task_struct *task, unsigned int regno, unsigned long data)
66{
67 if (regno <= PT_EDA)
68 ((unsigned long *)user_regs(task->thread_info))[regno] = data;
69 else if (regno == PT_USP)
70 task->thread.usp = data;
71 else if (regno == PT_PPC) {
72 /* Write pseudo-PC to ERP only if changed. */
73 if (data != get_pseudo_pc(task))
74 ((unsigned long *)user_regs(task->thread_info))[PT_ERP] = data;
75 } else if (regno <= PT_MAX)
76 return put_debugreg(task->pid, regno, data);
77 else
78 return -1;
79 return 0;
80}
81
82/*
83 * Called by kernel/ptrace.c when detaching.
84 *
85 * Make sure the single step bit is not set.
86 */
87void
88ptrace_disable(struct task_struct *child)
89{
90 unsigned long tmp;
91
92 /* Deconfigure SPC and S-bit. */
93 tmp = get_reg(child, PT_CCS) & ~SBIT_USER;
94 put_reg(child, PT_CCS, tmp);
95 put_reg(child, PT_SPC, 0);
96
97 /* Deconfigure any watchpoints associated with the child. */
98 deconfigure_bp(child->pid);
99}
100
101
102asmlinkage int
103sys_ptrace(long request, long pid, long addr, long data)
104{
105 struct task_struct *child;
106 int ret;
107 unsigned long __user *datap = (unsigned long __user *)data;
108
109 lock_kernel();
110 ret = -EPERM;
111
112 if (request == PTRACE_TRACEME) {
113 /* are we already being traced? */
114 if (current->ptrace & PT_PTRACED)
115 goto out;
116 ret = security_ptrace(current->parent, current);
117 if (ret)
118 goto out;
119 /* set the ptrace bit in the process flags. */
120 current->ptrace |= PT_PTRACED;
121 ret = 0;
122 goto out;
123 }
124
125 ret = -ESRCH;
126 read_lock(&tasklist_lock);
127 child = find_task_by_pid(pid);
128
129 if (child)
130 get_task_struct(child);
131
132 read_unlock(&tasklist_lock);
133
134 if (!child)
135 goto out;
136
137 ret = -EPERM;
138
139 if (pid == 1) /* Leave the init process alone! */
140 goto out_tsk;
141
142 if (request == PTRACE_ATTACH) {
143 ret = ptrace_attach(child);
144 goto out_tsk;
145 }
146
147 ret = ptrace_check_attach(child, request == PTRACE_KILL);
148 if (ret < 0)
149 goto out_tsk;
150
151 switch (request) {
152 /* Read word at location address. */
153 case PTRACE_PEEKTEXT:
154 case PTRACE_PEEKDATA: {
155 unsigned long tmp;
156 int copied;
157
158 ret = -EIO;
159
160 /* The signal trampoline page is outside the normal user-addressable
161 * space but still accessible. This is hack to make it possible to
162 * access the signal handler code in GDB.
163 */
164 if ((addr & PAGE_MASK) == cris_signal_return_page) {
165 /* The trampoline page is globally mapped, no page table to traverse.*/
166 tmp = *(unsigned long*)addr;
167 } else {
168 copied = access_process_vm(child, addr, &tmp, sizeof(tmp), 0);
169
170 if (copied != sizeof(tmp))
171 break;
172 }
173
174 ret = put_user(tmp,datap);
175 break;
176 }
177
178 /* Read the word at location address in the USER area. */
179 case PTRACE_PEEKUSR: {
180 unsigned long tmp;
181
182 ret = -EIO;
183 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
184 break;
185
186 tmp = get_reg(child, addr >> 2);
187 ret = put_user(tmp, datap);
188 break;
189 }
190
191 /* Write the word at location address. */
192 case PTRACE_POKETEXT:
193 case PTRACE_POKEDATA:
194 ret = 0;
195
196 if (access_process_vm(child, addr, &data, sizeof(data), 1) == sizeof(data))
197 break;
198
199 ret = -EIO;
200 break;
201
202 /* Write the word at location address in the USER area. */
203 case PTRACE_POKEUSR:
204 ret = -EIO;
205 if ((addr & 3) || addr < 0 || addr > PT_MAX << 2)
206 break;
207
208 addr >>= 2;
209
210 if (addr == PT_CCS) {
211 /* don't allow the tracing process to change stuff like
212 * interrupt enable, kernel/user bit, dma enables etc.
213 */
214 data &= CCS_MASK;
215 data |= get_reg(child, PT_CCS) & ~CCS_MASK;
216 }
217 if (put_reg(child, addr, data))
218 break;
219 ret = 0;
220 break;
221
222 case PTRACE_SYSCALL:
223 case PTRACE_CONT:
224 ret = -EIO;
225
226 if (!valid_signal(data))
227 break;
228
229 /* Continue means no single-step. */
230 put_reg(child, PT_SPC, 0);
231
232 if (!get_debugreg(child->pid, PT_BP_CTRL)) {
233 unsigned long tmp;
234 /* If no h/w bp configured, disable S bit. */
235 tmp = get_reg(child, PT_CCS) & ~SBIT_USER;
236 put_reg(child, PT_CCS, tmp);
237 }
238
239 if (request == PTRACE_SYSCALL) {
240 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
241 }
242 else {
243 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
244 }
245
246 child->exit_code = data;
247
248 /* TODO: make sure any pending breakpoint is killed */
249 wake_up_process(child);
250 ret = 0;
251
252 break;
253
254 /* Make the child exit by sending it a sigkill. */
255 case PTRACE_KILL:
256 ret = 0;
257
258 if (child->exit_state == EXIT_ZOMBIE)
259 break;
260
261 child->exit_code = SIGKILL;
262
263 /* Deconfigure single-step and h/w bp. */
264 ptrace_disable(child);
265
266 /* TODO: make sure any pending breakpoint is killed */
267 wake_up_process(child);
268 break;
269
270 /* Set the trap flag. */
271 case PTRACE_SINGLESTEP: {
272 unsigned long tmp;
273 ret = -EIO;
274
275 /* Set up SPC if not set already (in which case we have
276 no other choice but to trust it). */
277 if (!get_reg(child, PT_SPC)) {
278 /* In case we're stopped in a delay slot. */
279 tmp = get_reg(child, PT_ERP) & ~1;
280 put_reg(child, PT_SPC, tmp);
281 }
282 tmp = get_reg(child, PT_CCS) | SBIT_USER;
283 put_reg(child, PT_CCS, tmp);
284
285 if (!valid_signal(data))
286 break;
287
288 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
289
290 /* TODO: set some clever breakpoint mechanism... */
291
292 child->exit_code = data;
293 wake_up_process(child);
294 ret = 0;
295 break;
296
297 }
298 case PTRACE_DETACH:
299 ret = ptrace_detach(child, data);
300 break;
301
302 /* Get all GP registers from the child. */
303 case PTRACE_GETREGS: {
304 int i;
305 unsigned long tmp;
306
307 for (i = 0; i <= PT_MAX; i++) {
308 tmp = get_reg(child, i);
309
310 if (put_user(tmp, datap)) {
311 ret = -EFAULT;
312 goto out_tsk;
313 }
314
315 datap++;
316 }
317
318 ret = 0;
319 break;
320 }
321
322 /* Set all GP registers in the child. */
323 case PTRACE_SETREGS: {
324 int i;
325 unsigned long tmp;
326
327 for (i = 0; i <= PT_MAX; i++) {
328 if (get_user(tmp, datap)) {
329 ret = -EFAULT;
330 goto out_tsk;
331 }
332
333 if (i == PT_CCS) {
334 tmp &= CCS_MASK;
335 tmp |= get_reg(child, PT_CCS) & ~CCS_MASK;
336 }
337
338 put_reg(child, i, tmp);
339 datap++;
340 }
341
342 ret = 0;
343 break;
344 }
345
346 default:
347 ret = ptrace_request(child, request, addr, data);
348 break;
349 }
350out_tsk:
351 put_task_struct(child);
352out:
353 unlock_kernel();
354 return ret;
355}
356
357void do_syscall_trace(void)
358{
359 if (!test_thread_flag(TIF_SYSCALL_TRACE))
360 return;
361
362 if (!(current->ptrace & PT_PTRACED))
363 return;
364
365 /* the 0x80 provides a way for the tracing parent to distinguish
366 between a syscall stop and SIGTRAP delivery */
367 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
368 ? 0x80 : 0));
369
370 /*
371 * This isn't the same as continuing with a signal, but it will do for
372 * normal use.
373 */
374 if (current->exit_code) {
375 send_sig(current->exit_code, current, 1);
376 current->exit_code = 0;
377 }
378}
379
380/* Returns the size of an instruction that has a delay slot. */
381
382static int insn_size(struct task_struct *child, unsigned long pc)
383{
384 unsigned long opcode;
385 int copied;
386 int opsize = 0;
387
388 /* Read the opcode at pc (do what PTRACE_PEEKTEXT would do). */
389 copied = access_process_vm(child, pc, &opcode, sizeof(opcode), 0);
390 if (copied != sizeof(opcode))
391 return 0;
392
393 switch ((opcode & 0x0f00) >> 8) {
394 case 0x0:
395 case 0x9:
396 case 0xb:
397 opsize = 2;
398 break;
399 case 0xe:
400 case 0xf:
401 opsize = 6;
402 break;
403 case 0xd:
404 /* Could be 4 or 6; check more bits. */
405 if ((opcode & 0xff) == 0xff)
406 opsize = 4;
407 else
408 opsize = 6;
409 break;
410 default:
411 panic("ERROR: Couldn't find size of opcode 0x%lx at 0x%lx\n",
412 opcode, pc);
413 }
414
415 return opsize;
416}
417
418static unsigned long get_pseudo_pc(struct task_struct *child)
419{
420 /* Default value for PC is ERP. */
421 unsigned long pc = get_reg(child, PT_ERP);
422
423 if (pc & 0x1) {
424 unsigned long spc = get_reg(child, PT_SPC);
425 /* Delay slot bit set. Report as stopped on proper
426 instruction. */
427 if (spc) {
428 /* Rely on SPC if set. FIXME: We might want to check
429 that EXS indicates we stopped due to a single-step
430 exception. */
431 pc = spc;
432 } else {
433 /* Calculate the PC from the size of the instruction
434 that the delay slot we're in belongs to. */
435 pc += insn_size(child, pc & ~1) - 1;
436 }
437 }
438 return pc;
439}
440
441static long bp_owner = 0;
442
443/* Reachable from exit_thread in signal.c, so not static. */
444void deconfigure_bp(long pid)
445{
446 int bp;
447
448 /* Only deconfigure if the pid is the owner. */
449 if (bp_owner != pid)
450 return;
451
452 for (bp = 0; bp < 6; bp++) {
453 unsigned long tmp;
454 /* Deconfigure start and end address (also gets rid of ownership). */
455 put_debugreg(pid, PT_BP + 3 + (bp * 2), 0);
456 put_debugreg(pid, PT_BP + 4 + (bp * 2), 0);
457
458 /* Deconfigure relevant bits in control register. */
459 tmp = get_debugreg(pid, PT_BP_CTRL) & ~(3 << (2 + (bp * 4)));
460 put_debugreg(pid, PT_BP_CTRL, tmp);
461 }
462 /* No owner now. */
463 bp_owner = 0;
464}
465
466static int put_debugreg(long pid, unsigned int regno, long data)
467{
468 int ret = 0;
469 register int old_srs;
470
471#ifdef CONFIG_ETRAX_KGDB
472 /* Ignore write, but pretend it was ok if value is 0
473 (we don't want POKEUSR/SETREGS failing unnessecarily). */
474 return (data == 0) ? ret : -1;
475#endif
476
477 /* Simple owner management. */
478 if (!bp_owner)
479 bp_owner = pid;
480 else if (bp_owner != pid) {
481 /* Ignore write, but pretend it was ok if value is 0
482 (we don't want POKEUSR/SETREGS failing unnessecarily). */
483 return (data == 0) ? ret : -1;
484 }
485
486 /* Remember old SRS. */
487 SPEC_REG_RD(SPEC_REG_SRS, old_srs);
488 /* Switch to BP bank. */
489 SUPP_BANK_SEL(BANK_BP);
490
491 switch (regno - PT_BP) {
492 case 0:
493 SUPP_REG_WR(0, data); break;
494 case 1:
495 case 2:
496 if (data)
497 ret = -1;
498 break;
499 case 3:
500 SUPP_REG_WR(3, data); break;
501 case 4:
502 SUPP_REG_WR(4, data); break;
503 case 5:
504 SUPP_REG_WR(5, data); break;
505 case 6:
506 SUPP_REG_WR(6, data); break;
507 case 7:
508 SUPP_REG_WR(7, data); break;
509 case 8:
510 SUPP_REG_WR(8, data); break;
511 case 9:
512 SUPP_REG_WR(9, data); break;
513 case 10:
514 SUPP_REG_WR(10, data); break;
515 case 11:
516 SUPP_REG_WR(11, data); break;
517 case 12:
518 SUPP_REG_WR(12, data); break;
519 case 13:
520 SUPP_REG_WR(13, data); break;
521 case 14:
522 SUPP_REG_WR(14, data); break;
523 default:
524 ret = -1;
525 break;
526 }
527
528 /* Restore SRS. */
529 SPEC_REG_WR(SPEC_REG_SRS, old_srs);
530 /* Just for show. */
531 NOP();
532 NOP();
533 NOP();
534
535 return ret;
536}
537
538static long get_debugreg(long pid, unsigned int regno)
539{
540 register int old_srs;
541 register long data;
542
543 if (pid != bp_owner) {
544 return 0;
545 }
546
547 /* Remember old SRS. */
548 SPEC_REG_RD(SPEC_REG_SRS, old_srs);
549 /* Switch to BP bank. */
550 SUPP_BANK_SEL(BANK_BP);
551
552 switch (regno - PT_BP) {
553 case 0:
554 SUPP_REG_RD(0, data); break;
555 case 1:
556 case 2:
557 /* error return value? */
558 data = 0;
559 break;
560 case 3:
561 SUPP_REG_RD(3, data); break;
562 case 4:
563 SUPP_REG_RD(4, data); break;
564 case 5:
565 SUPP_REG_RD(5, data); break;
566 case 6:
567 SUPP_REG_RD(6, data); break;
568 case 7:
569 SUPP_REG_RD(7, data); break;
570 case 8:
571 SUPP_REG_RD(8, data); break;
572 case 9:
573 SUPP_REG_RD(9, data); break;
574 case 10:
575 SUPP_REG_RD(10, data); break;
576 case 11:
577 SUPP_REG_RD(11, data); break;
578 case 12:
579 SUPP_REG_RD(12, data); break;
580 case 13:
581 SUPP_REG_RD(13, data); break;
582 case 14:
583 SUPP_REG_RD(14, data); break;
584 default:
585 /* error return value? */
586 data = 0;
587 }
588
589 /* Restore SRS. */
590 SPEC_REG_WR(SPEC_REG_SRS, old_srs);
591 /* Just for show. */
592 NOP();
593 NOP();
594 NOP();
595
596 return data;
597}
diff --git a/arch/cris/arch-v32/kernel/setup.c b/arch/cris/arch-v32/kernel/setup.c
new file mode 100644
index 000000000000..b17a39a2e164
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/setup.c
@@ -0,0 +1,118 @@
1/*
2 * Display CPU info in /proc/cpuinfo.
3 *
4 * Copyright (C) 2003, Axis Communications AB.
5 */
6
7#include <linux/config.h>
8#include <linux/seq_file.h>
9#include <linux/proc_fs.h>
10#include <linux/delay.h>
11#include <linux/param.h>
12
13#ifdef CONFIG_PROC_FS
14
15#define HAS_FPU 0x0001
16#define HAS_MMU 0x0002
17#define HAS_ETHERNET100 0x0004
18#define HAS_TOKENRING 0x0008
19#define HAS_SCSI 0x0010
20#define HAS_ATA 0x0020
21#define HAS_USB 0x0040
22#define HAS_IRQ_BUG 0x0080
23#define HAS_MMU_BUG 0x0100
24
25struct cpu_info {
26 char *cpu_model;
27 unsigned short rev;
28 unsigned short cache_size;
29 unsigned short flags;
30};
31
32/* Some of these model are here for historical reasons only. */
33static struct cpu_info cpinfo[] = {
34 {"ETRAX 1", 0, 0, 0},
35 {"ETRAX 2", 1, 0, 0},
36 {"ETRAX 3", 2, 0, 0},
37 {"ETRAX 4", 3, 0, 0},
38 {"Simulator", 7, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
39 {"ETRAX 100", 8, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_IRQ_BUG},
40 {"ETRAX 100", 9, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA},
41
42 {"ETRAX 100LX", 10, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
43 | HAS_MMU | HAS_MMU_BUG},
44
45 {"ETRAX 100LX v2", 11, 8, HAS_ETHERNET100 | HAS_SCSI | HAS_ATA | HAS_USB
46 | HAS_MMU},
47
48 {"ETRAX FS", 32, 32, HAS_ETHERNET100 | HAS_ATA | HAS_MMU},
49
50 {"Unknown", 0, 0, 0}
51};
52
53int
54show_cpuinfo(struct seq_file *m, void *v)
55{
56 int i;
57 int cpu = (int)v - 1;
58 int entries;
59 unsigned long revision;
60 struct cpu_info *info;
61
62 entries = sizeof cpinfo / sizeof(struct cpu_info);
63 info = &cpinfo[entries - 1];
64
65#ifdef CONFIG_SMP
66 if (!cpu_online(cpu))
67 return 0;
68#endif
69
70 revision = rdvr();
71
72 for (i = 0; i < entries; i++) {
73 if (cpinfo[i].rev == revision) {
74 info = &cpinfo[i];
75 break;
76 }
77 }
78
79 return seq_printf(m,
80 "processor\t: %d\n"
81 "cpu\t\t: CRIS\n"
82 "cpu revision\t: %lu\n"
83 "cpu model\t: %s\n"
84 "cache size\t: %d KB\n"
85 "fpu\t\t: %s\n"
86 "mmu\t\t: %s\n"
87 "mmu DMA bug\t: %s\n"
88 "ethernet\t: %s Mbps\n"
89 "token ring\t: %s\n"
90 "scsi\t\t: %s\n"
91 "ata\t\t: %s\n"
92 "usb\t\t: %s\n"
93 "bogomips\t: %lu.%02lu\n\n",
94
95 cpu,
96 revision,
97 info->cpu_model,
98 info->cache_size,
99 info->flags & HAS_FPU ? "yes" : "no",
100 info->flags & HAS_MMU ? "yes" : "no",
101 info->flags & HAS_MMU_BUG ? "yes" : "no",
102 info->flags & HAS_ETHERNET100 ? "10/100" : "10",
103 info->flags & HAS_TOKENRING ? "4/16 Mbps" : "no",
104 info->flags & HAS_SCSI ? "yes" : "no",
105 info->flags & HAS_ATA ? "yes" : "no",
106 info->flags & HAS_USB ? "yes" : "no",
107 (loops_per_jiffy * HZ + 500) / 500000,
108 ((loops_per_jiffy * HZ + 500) / 5000) % 100);
109}
110
111#endif /* CONFIG_PROC_FS */
112
113void
114show_etrax_copyright(void)
115{
116 printk(KERN_INFO
117 "Linux/CRISv32 port on ETRAX FS (C) 2003, 2004 Axis Communications AB\n");
118}
diff --git a/arch/cris/arch-v32/kernel/signal.c b/arch/cris/arch-v32/kernel/signal.c
new file mode 100644
index 000000000000..fb4c79d5b76b
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/signal.c
@@ -0,0 +1,708 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <linux/sched.h>
6#include <linux/mm.h>
7#include <linux/kernel.h>
8#include <linux/signal.h>
9#include <linux/errno.h>
10#include <linux/wait.h>
11#include <linux/ptrace.h>
12#include <linux/unistd.h>
13#include <linux/stddef.h>
14#include <linux/syscalls.h>
15#include <linux/vmalloc.h>
16
17#include <asm/io.h>
18#include <asm/processor.h>
19#include <asm/ucontext.h>
20#include <asm/uaccess.h>
21#include <asm/arch/ptrace.h>
22#include <asm/arch/hwregs/cpu_vect.h>
23
24extern unsigned long cris_signal_return_page;
25
26/* Flag to check if a signal is blockable. */
27#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
28
29/*
30 * A syscall in CRIS is really a "break 13" instruction, which is 2
31 * bytes. The registers is manipulated so upon return the instruction
32 * will be executed again.
33 *
34 * This relies on that PC points to the instruction after the break call.
35 */
36#define RESTART_CRIS_SYS(regs) regs->r10 = regs->orig_r10; regs->erp -= 2;
37
38/* Signal frames. */
39struct signal_frame {
40 struct sigcontext sc;
41 unsigned long extramask[_NSIG_WORDS - 1];
42 unsigned char retcode[8]; /* Trampoline code. */
43};
44
45struct rt_signal_frame {
46 struct siginfo *pinfo;
47 void *puc;
48 struct siginfo info;
49 struct ucontext uc;
50 unsigned char retcode[8]; /* Trampoline code. */
51};
52
53int do_signal(int restart, sigset_t *oldset, struct pt_regs *regs);
54void keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
55 struct pt_regs *regs);
56/*
57 * Swap in the new signal mask, and wait for a signal. Define some
58 * dummy arguments to be able to reach the regs argument.
59 */
60int
61sys_sigsuspend(old_sigset_t mask, long r11, long r12, long r13, long mof,
62 long srp, struct pt_regs *regs)
63{
64 sigset_t saveset;
65
66 mask &= _BLOCKABLE;
67
68 spin_lock_irq(&current->sighand->siglock);
69
70 saveset = current->blocked;
71
72 siginitset(&current->blocked, mask);
73
74 recalc_sigpending();
75 spin_unlock_irq(&current->sighand->siglock);
76
77 regs->r10 = -EINTR;
78
79 while (1) {
80 current->state = TASK_INTERRUPTIBLE;
81 schedule();
82
83 if (do_signal(0, &saveset, regs)) {
84 /*
85 * This point is reached twice: once to call
86 * the signal handler, then again to return
87 * from the sigsuspend system call. When
88 * calling the signal handler, R10 hold the
89 * signal number as set by do_signal(). The
90 * sigsuspend call will always return with
91 * the restored value above; -EINTR.
92 */
93 return regs->r10;
94 }
95 }
96}
97
98/* Define some dummy arguments to be able to reach the regs argument. */
99int
100sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, long r12, long r13,
101 long mof, long srp, struct pt_regs *regs)
102{
103 sigset_t saveset;
104 sigset_t newset;
105
106 if (sigsetsize != sizeof(sigset_t))
107 return -EINVAL;
108
109 if (copy_from_user(&newset, unewset, sizeof(newset)))
110 return -EFAULT;
111
112 sigdelsetmask(&newset, ~_BLOCKABLE);
113 spin_lock_irq(&current->sighand->siglock);
114
115 saveset = current->blocked;
116 current->blocked = newset;
117
118 recalc_sigpending();
119 spin_unlock_irq(&current->sighand->siglock);
120
121 regs->r10 = -EINTR;
122
123 while (1) {
124 current->state = TASK_INTERRUPTIBLE;
125 schedule();
126
127 if (do_signal(0, &saveset, regs)) {
128 /* See comment in function above. */
129 return regs->r10;
130 }
131 }
132}
133
134int
135sys_sigaction(int signal, const struct old_sigaction *act,
136 struct old_sigaction *oact)
137{
138 int retval;
139 struct k_sigaction newk;
140 struct k_sigaction oldk;
141
142 if (act) {
143 old_sigset_t mask;
144
145 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
146 __get_user(newk.sa.sa_handler, &act->sa_handler) ||
147 __get_user(newk.sa.sa_restorer, &act->sa_restorer))
148 return -EFAULT;
149
150 __get_user(newk.sa.sa_flags, &act->sa_flags);
151 __get_user(mask, &act->sa_mask);
152 siginitset(&newk.sa.sa_mask, mask);
153 }
154
155 retval = do_sigaction(signal, act ? &newk : NULL, oact ? &oldk : NULL);
156
157 if (!retval && oact) {
158 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
159 __put_user(oldk.sa.sa_handler, &oact->sa_handler) ||
160 __put_user(oldk.sa.sa_restorer, &oact->sa_restorer))
161 return -EFAULT;
162
163 __put_user(oldk.sa.sa_flags, &oact->sa_flags);
164 __put_user(oldk.sa.sa_mask.sig[0], &oact->sa_mask);
165 }
166
167 return retval;
168}
169
170int
171sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss)
172{
173 return do_sigaltstack(uss, uoss, rdusp());
174}
175
176static int
177restore_sigcontext(struct pt_regs *regs, struct sigcontext __user *sc)
178{
179 unsigned int err = 0;
180 unsigned long old_usp;
181
182 /* Always make any pending restarted system calls return -EINTR */
183 current_thread_info()->restart_block.fn = do_no_restart_syscall;
184
185 /*
186 * Restore the registers from &sc->regs. sc is already checked
187 * for VERIFY_READ since the signal_frame was previously
188 * checked in sys_sigreturn().
189 */
190 if (__copy_from_user(regs, sc, sizeof(struct pt_regs)))
191 goto badframe;
192
193 /* Make that the user-mode flag is set. */
194 regs->ccs |= (1 << (U_CCS_BITNR + CCS_SHIFT));
195
196 /* Restore the old USP. */
197 err |= __get_user(old_usp, &sc->usp);
198 wrusp(old_usp);
199
200 return err;
201
202badframe:
203 return 1;
204}
205
206/* Define some dummy arguments to be able to reach the regs argument. */
207asmlinkage int
208sys_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
209 struct pt_regs *regs)
210{
211 sigset_t set;
212 struct signal_frame __user *frame;
213 unsigned long oldspc = regs->spc;
214 unsigned long oldccs = regs->ccs;
215
216 frame = (struct signal_frame *) rdusp();
217
218 /*
219 * Since the signal is stacked on a dword boundary, the frame
220 * should be dword aligned here as well. It it's not, then the
221 * user is trying some funny business.
222 */
223 if (((long)frame) & 3)
224 goto badframe;
225
226 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
227 goto badframe;
228
229 if (__get_user(set.sig[0], &frame->sc.oldmask) ||
230 (_NSIG_WORDS > 1 && __copy_from_user(&set.sig[1],
231 frame->extramask,
232 sizeof(frame->extramask))))
233 goto badframe;
234
235 sigdelsetmask(&set, ~_BLOCKABLE);
236 spin_lock_irq(&current->sighand->siglock);
237
238 current->blocked = set;
239
240 recalc_sigpending();
241 spin_unlock_irq(&current->sighand->siglock);
242
243 if (restore_sigcontext(regs, &frame->sc))
244 goto badframe;
245
246 keep_debug_flags(oldccs, oldspc, regs);
247
248 return regs->r10;
249
250badframe:
251 force_sig(SIGSEGV, current);
252 return 0;
253}
254
255/* Define some dummy variables to be able to reach the regs argument. */
256asmlinkage int
257sys_rt_sigreturn(long r10, long r11, long r12, long r13, long mof, long srp,
258 struct pt_regs *regs)
259{
260 sigset_t set;
261 struct rt_signal_frame __user *frame;
262 unsigned long oldspc = regs->spc;
263 unsigned long oldccs = regs->ccs;
264
265 frame = (struct rt_signal_frame *) rdusp();
266
267 /*
268 * Since the signal is stacked on a dword boundary, the frame
269 * should be dword aligned here as well. It it's not, then the
270 * user is trying some funny business.
271 */
272 if (((long)frame) & 3)
273 goto badframe;
274
275 if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
276 goto badframe;
277
278 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
279 goto badframe;
280
281 sigdelsetmask(&set, ~_BLOCKABLE);
282 spin_lock_irq(&current->sighand->siglock);
283
284 current->blocked = set;
285
286 recalc_sigpending();
287 spin_unlock_irq(&current->sighand->siglock);
288
289 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
290 goto badframe;
291
292 if (do_sigaltstack(&frame->uc.uc_stack, NULL, rdusp()) == -EFAULT)
293 goto badframe;
294
295 keep_debug_flags(oldccs, oldspc, regs);
296
297 return regs->r10;
298
299badframe:
300 force_sig(SIGSEGV, current);
301 return 0;
302}
303
304/* Setup a signal frame. */
305static int
306setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
307 unsigned long mask)
308{
309 int err;
310 unsigned long usp;
311
312 err = 0;
313 usp = rdusp();
314
315 /*
316 * Copy the registers. They are located first in sc, so it's
317 * possible to use sc directly.
318 */
319 err |= __copy_to_user(sc, regs, sizeof(struct pt_regs));
320
321 err |= __put_user(mask, &sc->oldmask);
322 err |= __put_user(usp, &sc->usp);
323
324 return err;
325}
326
327/* Figure out where to put the new signal frame - usually on the stack. */
328static inline void __user *
329get_sigframe(struct k_sigaction *ka, struct pt_regs * regs, size_t frame_size)
330{
331 unsigned long sp;
332
333 sp = rdusp();
334
335 /* This is the X/Open sanctioned signal stack switching. */
336 if (ka->sa.sa_flags & SA_ONSTACK) {
337 if (!on_sig_stack(sp))
338 sp = current->sas_ss_sp + current->sas_ss_size;
339 }
340
341 /* Make sure the frame is dword-aligned. */
342 sp &= ~3;
343
344 return (void __user *)(sp - frame_size);
345}
346
347/* Grab and setup a signal frame.
348 *
349 * Basically a lot of state-info is stacked, and arranged for the
350 * user-mode program to return to the kernel using either a trampiline
351 * which performs the syscall sigreturn(), or a provided user-mode
352 * trampoline.
353 */
354static void
355setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
356 struct pt_regs * regs)
357{
358 int err;
359 unsigned long return_ip;
360 struct signal_frame __user *frame;
361
362 err = 0;
363 frame = get_sigframe(ka, regs, sizeof(*frame));
364
365 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
366 goto give_sigsegv;
367
368 err |= setup_sigcontext(&frame->sc, regs, set->sig[0]);
369
370 if (err)
371 goto give_sigsegv;
372
373 if (_NSIG_WORDS > 1) {
374 err |= __copy_to_user(frame->extramask, &set->sig[1],
375 sizeof(frame->extramask));
376 }
377
378 if (err)
379 goto give_sigsegv;
380
381 /*
382 * Set up to return from user-space. If provided, use a stub
383 * already located in user-space.
384 */
385 if (ka->sa.sa_flags & SA_RESTORER) {
386 return_ip = (unsigned long)ka->sa.sa_restorer;
387 } else {
388 /* Trampoline - the desired return ip is in the signal return page. */
389 return_ip = cris_signal_return_page;
390
391 /*
392 * This is movu.w __NR_sigreturn, r9; break 13;
393 *
394 * WE DO NOT USE IT ANY MORE! It's only left here for historical
395 * reasons and because gdb uses it as a signature to notice
396 * signal handler stack frames.
397 */
398 err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0));
399 err |= __put_user(__NR_sigreturn, (short __user*)(frame->retcode+2));
400 err |= __put_user(0xe93d, (short __user*)(frame->retcode+4));
401 }
402
403 if (err)
404 goto give_sigsegv;
405
406 /*
407 * Set up registers for signal handler.
408 *
409 * Where the code enters now.
410 * Where the code enter later.
411 * First argument, signo.
412 */
413 regs->erp = (unsigned long) ka->sa.sa_handler;
414 regs->srp = return_ip;
415 regs->r10 = sig;
416
417 /* Actually move the USP to reflect the stacked frame. */
418 wrusp((unsigned long)frame);
419
420 return;
421
422give_sigsegv:
423 if (sig == SIGSEGV)
424 ka->sa.sa_handler = SIG_DFL;
425
426 force_sig(SIGSEGV, current);
427}
428
429static void
430setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
431 sigset_t *set, struct pt_regs * regs)
432{
433 int err;
434 unsigned long return_ip;
435 struct rt_signal_frame __user *frame;
436
437 err = 0;
438 frame = get_sigframe(ka, regs, sizeof(*frame));
439
440 if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
441 goto give_sigsegv;
442
443 /* TODO: what is the current->exec_domain stuff and invmap ? */
444
445 err |= __put_user(&frame->info, &frame->pinfo);
446 err |= __put_user(&frame->uc, &frame->puc);
447 err |= copy_siginfo_to_user(&frame->info, info);
448
449 if (err)
450 goto give_sigsegv;
451
452 /* Clear all the bits of the ucontext we don't use. */
453 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
454 err |= setup_sigcontext(&frame->uc.uc_mcontext, regs, set->sig[0]);
455 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
456
457 if (err)
458 goto give_sigsegv;
459
460 /*
461 * Set up to return from user-space. If provided, use a stub
462 * already located in user-space.
463 */
464 if (ka->sa.sa_flags & SA_RESTORER) {
465 return_ip = (unsigned long) ka->sa.sa_restorer;
466 } else {
467 /* Trampoline - the desired return ip is in the signal return page. */
468 return_ip = cris_signal_return_page + 6;
469
470 /*
471 * This is movu.w __NR_rt_sigreturn, r9; break 13;
472 *
473 * WE DO NOT USE IT ANY MORE! It's only left here for historical
474 * reasons and because gdb uses it as a signature to notice
475 * signal handler stack frames.
476 */
477 err |= __put_user(0x9c5f, (short __user*)(frame->retcode+0));
478
479 err |= __put_user(__NR_rt_sigreturn,
480 (short __user*)(frame->retcode+2));
481
482 err |= __put_user(0xe93d, (short __user*)(frame->retcode+4));
483 }
484
485 if (err)
486 goto give_sigsegv;
487
488 /*
489 * Set up registers for signal handler.
490 *
491 * Where the code enters now.
492 * Where the code enters later.
493 * First argument is signo.
494 * Second argument is (siginfo_t *).
495 * Third argument is unused.
496 */
497 regs->erp = (unsigned long) ka->sa.sa_handler;
498 regs->srp = return_ip;
499 regs->r10 = sig;
500 regs->r11 = (unsigned long) &frame->info;
501 regs->r12 = 0;
502
503 /* Actually move the usp to reflect the stacked frame. */
504 wrusp((unsigned long)frame);
505
506 return;
507
508give_sigsegv:
509 if (sig == SIGSEGV)
510 ka->sa.sa_handler = SIG_DFL;
511
512 force_sig(SIGSEGV, current);
513}
514
515/* Invoke a singal handler to, well, handle the signal. */
516extern inline void
517handle_signal(int canrestart, unsigned long sig,
518 siginfo_t *info, struct k_sigaction *ka,
519 sigset_t *oldset, struct pt_regs * regs)
520{
521 /* Check if this got called from a system call. */
522 if (canrestart) {
523 /* If so, check system call restarting. */
524 switch (regs->r10) {
525 case -ERESTART_RESTARTBLOCK:
526 case -ERESTARTNOHAND:
527 /*
528 * This means that the syscall should
529 * only be restarted if there was no
530 * handler for the signal, and since
531 * this point isn't reached unless
532 * there is a handler, there's no need
533 * to restart.
534 */
535 regs->r10 = -EINTR;
536 break;
537
538 case -ERESTARTSYS:
539 /*
540 * This means restart the syscall if
541 * there is no handler, or the handler
542 * was registered with SA_RESTART.
543 */
544 if (!(ka->sa.sa_flags & SA_RESTART)) {
545 regs->r10 = -EINTR;
546 break;
547 }
548
549 /* Fall through. */
550
551 case -ERESTARTNOINTR:
552 /*
553 * This means that the syscall should
554 * be called again after the signal
555 * handler returns.
556 */
557 RESTART_CRIS_SYS(regs);
558 break;
559 }
560 }
561
562 /* Set up the stack frame. */
563 if (ka->sa.sa_flags & SA_SIGINFO)
564 setup_rt_frame(sig, ka, info, oldset, regs);
565 else
566 setup_frame(sig, ka, oldset, regs);
567
568 if (ka->sa.sa_flags & SA_ONESHOT)
569 ka->sa.sa_handler = SIG_DFL;
570
571 if (!(ka->sa.sa_flags & SA_NODEFER)) {
572 spin_lock_irq(&current->sighand->siglock);
573 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
574 sigaddset(&current->blocked,sig);
575 recalc_sigpending();
576 spin_unlock_irq(&current->sighand->siglock);
577 }
578}
579
580/*
581 * Note that 'init' is a special process: it doesn't get signals it doesn't
582 * want to handle. Thus you cannot kill init even with a SIGKILL even by
583 * mistake.
584 *
585 * Also note that the regs structure given here as an argument, is the latest
586 * pushed pt_regs. It may or may not be the same as the first pushed registers
587 * when the initial usermode->kernelmode transition took place. Therefore
588 * we can use user_mode(regs) to see if we came directly from kernel or user
589 * mode below.
590 */
591int
592do_signal(int canrestart, sigset_t *oldset, struct pt_regs *regs)
593{
594 int signr;
595 siginfo_t info;
596 struct k_sigaction ka;
597
598 /*
599 * The common case should go fast, which is why this point is
600 * reached from kernel-mode. If that's the case, just return
601 * without doing anything.
602 */
603 if (!user_mode(regs))
604 return 1;
605
606 if (!oldset)
607 oldset = &current->blocked;
608
609 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
610
611 if (signr > 0) {
612 /* Deliver the signal. */
613 handle_signal(canrestart, signr, &info, &ka, oldset, regs);
614 return 1;
615 }
616
617 /* Got here from a system call? */
618 if (canrestart) {
619 /* Restart the system call - no handlers present. */
620 if (regs->r10 == -ERESTARTNOHAND ||
621 regs->r10 == -ERESTARTSYS ||
622 regs->r10 == -ERESTARTNOINTR) {
623 RESTART_CRIS_SYS(regs);
624 }
625
626 if (regs->r10 == -ERESTART_RESTARTBLOCK){
627 regs->r10 = __NR_restart_syscall;
628 regs->erp -= 2;
629 }
630 }
631
632 return 0;
633}
634
635asmlinkage void
636ugdb_trap_user(struct thread_info *ti, int sig)
637{
638 if (((user_regs(ti)->exs & 0xff00) >> 8) != SINGLE_STEP_INTR_VECT) {
639 /* Zero single-step PC if the reason we stopped wasn't a single
640 step exception. This is to avoid relying on it when it isn't
641 reliable. */
642 user_regs(ti)->spc = 0;
643 }
644 /* FIXME: Filter out false h/w breakpoint hits (i.e. EDA
645 not withing any configured h/w breakpoint range). Synchronize with
646 what already exists for kernel debugging. */
647 if (((user_regs(ti)->exs & 0xff00) >> 8) == BREAK_8_INTR_VECT) {
648 /* Break 8: subtract 2 from ERP unless in a delay slot. */
649 if (!(user_regs(ti)->erp & 0x1))
650 user_regs(ti)->erp -= 2;
651 }
652 sys_kill(ti->task->pid, sig);
653}
654
655void
656keep_debug_flags(unsigned long oldccs, unsigned long oldspc,
657 struct pt_regs *regs)
658{
659 if (oldccs & (1 << Q_CCS_BITNR)) {
660 /* Pending single step due to single-stepping the break 13
661 in the signal trampoline: keep the Q flag. */
662 regs->ccs |= (1 << Q_CCS_BITNR);
663 /* S flag should be set - complain if it's not. */
664 if (!(oldccs & (1 << (S_CCS_BITNR + CCS_SHIFT)))) {
665 printk("Q flag but no S flag?");
666 }
667 regs->ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
668 /* Assume the SPC is valid and interesting. */
669 regs->spc = oldspc;
670
671 } else if (oldccs & (1 << (S_CCS_BITNR + CCS_SHIFT))) {
672 /* If a h/w bp was set in the signal handler we need
673 to keep the S flag. */
674 regs->ccs |= (1 << (S_CCS_BITNR + CCS_SHIFT));
675 /* Don't keep the old SPC though; if we got here due to
676 a single-step, the Q flag should have been set. */
677 } else if (regs->spc) {
678 /* If we were single-stepping *before* the signal was taken,
679 we don't want to restore that state now, because GDB will
680 have forgotten all about it. */
681 regs->spc = 0;
682 regs->ccs &= ~(1 << (S_CCS_BITNR + CCS_SHIFT));
683 }
684}
685
686/* Set up the trampolines on the signal return page. */
687int __init
688cris_init_signal(void)
689{
690 u16* data = (u16*)kmalloc(PAGE_SIZE, GFP_KERNEL);
691
692 /* This is movu.w __NR_sigreturn, r9; break 13; */
693 data[0] = 0x9c5f;
694 data[1] = __NR_sigreturn;
695 data[2] = 0xe93d;
696 /* This is movu.w __NR_rt_sigreturn, r9; break 13; */
697 data[3] = 0x9c5f;
698 data[4] = __NR_rt_sigreturn;
699 data[5] = 0xe93d;
700
701 /* Map to userspace with appropriate permissions (no write access...) */
702 cris_signal_return_page = (unsigned long)
703 __ioremap_prot(virt_to_phys(data), PAGE_SIZE, PAGE_SIGNAL_TRAMPOLINE);
704
705 return 0;
706}
707
708__initcall(cris_init_signal);
diff --git a/arch/cris/arch-v32/kernel/smp.c b/arch/cris/arch-v32/kernel/smp.c
new file mode 100644
index 000000000000..2c5cae04a95c
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/smp.c
@@ -0,0 +1,348 @@
1#include <asm/delay.h>
2#include <asm/arch/irq.h>
3#include <asm/arch/hwregs/intr_vect.h>
4#include <asm/arch/hwregs/intr_vect_defs.h>
5#include <asm/tlbflush.h>
6#include <asm/mmu_context.h>
7#include <asm/arch/hwregs/mmu_defs_asm.h>
8#include <asm/arch/hwregs/supp_reg.h>
9#include <asm/atomic.h>
10
11#include <linux/err.h>
12#include <linux/init.h>
13#include <linux/timex.h>
14#include <linux/sched.h>
15#include <linux/kernel.h>
16#include <linux/cpumask.h>
17#include <linux/interrupt.h>
18
19#define IPI_SCHEDULE 1
20#define IPI_CALL 2
21#define IPI_FLUSH_TLB 4
22
23#define FLUSH_ALL (void*)0xffffffff
24
25/* Vector of locks used for various atomic operations */
26spinlock_t cris_atomic_locks[] = { [0 ... LOCK_COUNT - 1] = SPIN_LOCK_UNLOCKED};
27
28/* CPU masks */
29cpumask_t cpu_online_map = CPU_MASK_NONE;
30cpumask_t phys_cpu_present_map = CPU_MASK_NONE;
31
32/* Variables used during SMP boot */
33volatile int cpu_now_booting = 0;
34volatile struct thread_info *smp_init_current_idle_thread;
35
36/* Variables used during IPI */
37static DEFINE_SPINLOCK(call_lock);
38static DEFINE_SPINLOCK(tlbstate_lock);
39
40struct call_data_struct {
41 void (*func) (void *info);
42 void *info;
43 int wait;
44};
45
46static struct call_data_struct * call_data;
47
48static struct mm_struct* flush_mm;
49static struct vm_area_struct* flush_vma;
50static unsigned long flush_addr;
51
52extern int setup_irq(int, struct irqaction *);
53
54/* Mode registers */
55static unsigned long irq_regs[NR_CPUS] =
56{
57 regi_irq,
58 regi_irq2
59};
60
61static irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs);
62static int send_ipi(int vector, int wait, cpumask_t cpu_mask);
63static struct irqaction irq_ipi = { crisv32_ipi_interrupt, SA_INTERRUPT,
64 CPU_MASK_NONE, "ipi", NULL, NULL};
65
66extern void cris_mmu_init(void);
67extern void cris_timer_init(void);
68
69/* SMP initialization */
70void __init smp_prepare_cpus(unsigned int max_cpus)
71{
72 int i;
73
74 /* From now on we can expect IPIs so set them up */
75 setup_irq(IPI_INTR_VECT, &irq_ipi);
76
77 /* Mark all possible CPUs as present */
78 for (i = 0; i < max_cpus; i++)
79 cpu_set(i, phys_cpu_present_map);
80}
81
82void __devinit smp_prepare_boot_cpu(void)
83{
84 /* PGD pointer has moved after per_cpu initialization so
85 * update the MMU.
86 */
87 pgd_t **pgd;
88 pgd = (pgd_t**)&per_cpu(current_pgd, smp_processor_id());
89
90 SUPP_BANK_SEL(1);
91 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
92 SUPP_BANK_SEL(2);
93 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
94
95 cpu_set(0, cpu_online_map);
96 cpu_set(0, phys_cpu_present_map);
97}
98
99void __init smp_cpus_done(unsigned int max_cpus)
100{
101}
102
103/* Bring one cpu online.*/
104static int __init
105smp_boot_one_cpu(int cpuid)
106{
107 unsigned timeout;
108 struct task_struct *idle;
109
110 idle = fork_idle(cpuid);
111 if (IS_ERR(idle))
112 panic("SMP: fork failed for CPU:%d", cpuid);
113
114 idle->thread_info->cpu = cpuid;
115
116 /* Information to the CPU that is about to boot */
117 smp_init_current_idle_thread = idle->thread_info;
118 cpu_now_booting = cpuid;
119
120 /* Wait for CPU to come online */
121 for (timeout = 0; timeout < 10000; timeout++) {
122 if(cpu_online(cpuid)) {
123 cpu_now_booting = 0;
124 smp_init_current_idle_thread = NULL;
125 return 0; /* CPU online */
126 }
127 udelay(100);
128 barrier();
129 }
130
131 put_task_struct(idle);
132 idle = NULL;
133
134 printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
135 return -1;
136}
137
138/* Secondary CPUs starts uing C here. Here we need to setup CPU
139 * specific stuff such as the local timer and the MMU. */
140void __init smp_callin(void)
141{
142 extern void cpu_idle(void);
143
144 int cpu = cpu_now_booting;
145 reg_intr_vect_rw_mask vect_mask = {0};
146
147 /* Initialise the idle task for this CPU */
148 atomic_inc(&init_mm.mm_count);
149 current->active_mm = &init_mm;
150
151 /* Set up MMU */
152 cris_mmu_init();
153 __flush_tlb_all();
154
155 /* Setup local timer. */
156 cris_timer_init();
157
158 /* Enable IRQ and idle */
159 REG_WR(intr_vect, irq_regs[cpu], rw_mask, vect_mask);
160 unmask_irq(IPI_INTR_VECT);
161 unmask_irq(TIMER_INTR_VECT);
162 local_irq_enable();
163
164 cpu_set(cpu, cpu_online_map);
165 cpu_idle();
166}
167
168/* Stop execution on this CPU.*/
169void stop_this_cpu(void* dummy)
170{
171 local_irq_disable();
172 asm volatile("halt");
173}
174
175/* Other calls */
176void smp_send_stop(void)
177{
178 smp_call_function(stop_this_cpu, NULL, 1, 0);
179}
180
181int setup_profiling_timer(unsigned int multiplier)
182{
183 return -EINVAL;
184}
185
186
187/* cache_decay_ticks is used by the scheduler to decide if a process
188 * is "hot" on one CPU. A higher value means a higher penalty to move
189 * a process to another CPU. Our cache is rather small so we report
190 * 1 tick.
191 */
192unsigned long cache_decay_ticks = 1;
193
194int __devinit __cpu_up(unsigned int cpu)
195{
196 smp_boot_one_cpu(cpu);
197 return cpu_online(cpu) ? 0 : -ENOSYS;
198}
199
200void smp_send_reschedule(int cpu)
201{
202 cpumask_t cpu_mask = CPU_MASK_NONE;
203 cpu_set(cpu, cpu_mask);
204 send_ipi(IPI_SCHEDULE, 0, cpu_mask);
205}
206
207/* TLB flushing
208 *
209 * Flush needs to be done on the local CPU and on any other CPU that
210 * may have the same mapping. The mm->cpu_vm_mask is used to keep track
211 * of which CPUs that a specific process has been executed on.
212 */
213void flush_tlb_common(struct mm_struct* mm, struct vm_area_struct* vma, unsigned long addr)
214{
215 unsigned long flags;
216 cpumask_t cpu_mask;
217
218 spin_lock_irqsave(&tlbstate_lock, flags);
219 cpu_mask = (mm == FLUSH_ALL ? CPU_MASK_ALL : mm->cpu_vm_mask);
220 cpu_clear(smp_processor_id(), cpu_mask);
221 flush_mm = mm;
222 flush_vma = vma;
223 flush_addr = addr;
224 send_ipi(IPI_FLUSH_TLB, 1, cpu_mask);
225 spin_unlock_irqrestore(&tlbstate_lock, flags);
226}
227
228void flush_tlb_all(void)
229{
230 __flush_tlb_all();
231 flush_tlb_common(FLUSH_ALL, FLUSH_ALL, 0);
232}
233
234void flush_tlb_mm(struct mm_struct *mm)
235{
236 __flush_tlb_mm(mm);
237 flush_tlb_common(mm, FLUSH_ALL, 0);
238 /* No more mappings in other CPUs */
239 cpus_clear(mm->cpu_vm_mask);
240 cpu_set(smp_processor_id(), mm->cpu_vm_mask);
241}
242
243void flush_tlb_page(struct vm_area_struct *vma,
244 unsigned long addr)
245{
246 __flush_tlb_page(vma, addr);
247 flush_tlb_common(vma->vm_mm, vma, addr);
248}
249
250/* Inter processor interrupts
251 *
252 * The IPIs are used for:
253 * * Force a schedule on a CPU
254 * * FLush TLB on other CPUs
255 * * Call a function on other CPUs
256 */
257
258int send_ipi(int vector, int wait, cpumask_t cpu_mask)
259{
260 int i = 0;
261 reg_intr_vect_rw_ipi ipi = REG_RD(intr_vect, irq_regs[i], rw_ipi);
262 int ret = 0;
263
264 /* Calculate CPUs to send to. */
265 cpus_and(cpu_mask, cpu_mask, cpu_online_map);
266
267 /* Send the IPI. */
268 for_each_cpu_mask(i, cpu_mask)
269 {
270 ipi.vector |= vector;
271 REG_WR(intr_vect, irq_regs[i], rw_ipi, ipi);
272 }
273
274 /* Wait for IPI to finish on other CPUS */
275 if (wait) {
276 for_each_cpu_mask(i, cpu_mask) {
277 int j;
278 for (j = 0 ; j < 1000; j++) {
279 ipi = REG_RD(intr_vect, irq_regs[i], rw_ipi);
280 if (!ipi.vector)
281 break;
282 udelay(100);
283 }
284
285 /* Timeout? */
286 if (ipi.vector) {
287 printk("SMP call timeout from %d to %d\n", smp_processor_id(), i);
288 ret = -ETIMEDOUT;
289 dump_stack();
290 }
291 }
292 }
293 return ret;
294}
295
296/*
297 * You must not call this function with disabled interrupts or from a
298 * hardware interrupt handler or from a bottom half handler.
299 */
300int smp_call_function(void (*func)(void *info), void *info,
301 int nonatomic, int wait)
302{
303 cpumask_t cpu_mask = CPU_MASK_ALL;
304 struct call_data_struct data;
305 int ret;
306
307 cpu_clear(smp_processor_id(), cpu_mask);
308
309 WARN_ON(irqs_disabled());
310
311 data.func = func;
312 data.info = info;
313 data.wait = wait;
314
315 spin_lock(&call_lock);
316 call_data = &data;
317 ret = send_ipi(IPI_CALL, wait, cpu_mask);
318 spin_unlock(&call_lock);
319
320 return ret;
321}
322
323irqreturn_t crisv32_ipi_interrupt(int irq, void *dev_id, struct pt_regs *regs)
324{
325 void (*func) (void *info) = call_data->func;
326 void *info = call_data->info;
327 reg_intr_vect_rw_ipi ipi;
328
329 ipi = REG_RD(intr_vect, irq_regs[smp_processor_id()], rw_ipi);
330
331 if (ipi.vector & IPI_CALL) {
332 func(info);
333 }
334 if (ipi.vector & IPI_FLUSH_TLB) {
335 if (flush_mm == FLUSH_ALL)
336 __flush_tlb_all();
337 else if (flush_vma == FLUSH_ALL)
338 __flush_tlb_mm(flush_mm);
339 else
340 __flush_tlb_page(flush_vma, flush_addr);
341 }
342
343 ipi.vector = 0;
344 REG_WR(intr_vect, irq_regs[smp_processor_id()], rw_ipi, ipi);
345
346 return IRQ_HANDLED;
347}
348
diff --git a/arch/cris/arch-v32/kernel/time.c b/arch/cris/arch-v32/kernel/time.c
new file mode 100644
index 000000000000..d48e397f5fa4
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/time.c
@@ -0,0 +1,341 @@
1/* $Id: time.c,v 1.19 2005/04/29 05:40:09 starvik Exp $
2 *
3 * linux/arch/cris/arch-v32/kernel/time.c
4 *
5 * Copyright (C) 2003 Axis Communications AB
6 *
7 */
8
9#include <linux/config.h>
10#include <linux/timex.h>
11#include <linux/time.h>
12#include <linux/jiffies.h>
13#include <linux/interrupt.h>
14#include <linux/swap.h>
15#include <linux/sched.h>
16#include <linux/init.h>
17#include <linux/threads.h>
18#include <asm/types.h>
19#include <asm/signal.h>
20#include <asm/io.h>
21#include <asm/delay.h>
22#include <asm/rtc.h>
23#include <asm/irq.h>
24
25#include <asm/arch/hwregs/reg_map.h>
26#include <asm/arch/hwregs/reg_rdwr.h>
27#include <asm/arch/hwregs/timer_defs.h>
28#include <asm/arch/hwregs/intr_vect_defs.h>
29
30/* Watchdog defines */
31#define ETRAX_WD_KEY_MASK 0x7F /* key is 7 bit */
32#define ETRAX_WD_HZ 763 /* watchdog counts at 763 Hz */
33#define ETRAX_WD_CNT ((2*ETRAX_WD_HZ)/HZ + 1) /* Number of 763 counts before watchdog bites */
34
35unsigned long timer_regs[NR_CPUS] =
36{
37 regi_timer,
38#ifdef CONFIG_SMP
39 regi_timer2
40#endif
41};
42
43extern void update_xtime_from_cmos(void);
44extern int set_rtc_mmss(unsigned long nowtime);
45extern int setup_irq(int, struct irqaction *);
46extern int have_rtc;
47
48unsigned long get_ns_in_jiffie(void)
49{
50 reg_timer_r_tmr0_data data;
51 unsigned long ns;
52
53 data = REG_RD(timer, regi_timer, r_tmr0_data);
54 ns = (TIMER0_DIV - data) * 10;
55 return ns;
56}
57
58unsigned long do_slow_gettimeoffset(void)
59{
60 unsigned long count;
61 unsigned long usec_count = 0;
62
63 static unsigned long count_p = TIMER0_DIV;/* for the first call after boot */
64 static unsigned long jiffies_p = 0;
65
66 /*
67 * cache volatile jiffies temporarily; we have IRQs turned off.
68 */
69 unsigned long jiffies_t;
70
71 /* The timer interrupt comes from Etrax timer 0. In order to get
72 * better precision, we check the current value. It might have
73 * underflowed already though.
74 */
75
76 count = REG_RD(timer, regi_timer, r_tmr0_data);
77 jiffies_t = jiffies;
78
79 /*
80 * avoiding timer inconsistencies (they are rare, but they happen)...
81 * there are one problem that must be avoided here:
82 * 1. the timer counter underflows
83 */
84 if( jiffies_t == jiffies_p ) {
85 if( count > count_p ) {
86 /* Timer wrapped, use new count and prescale
87 * increase the time corresponding to one jiffie
88 */
89 usec_count = 1000000/HZ;
90 }
91 } else
92 jiffies_p = jiffies_t;
93 count_p = count;
94 /* Convert timer value to usec */
95 /* 100 MHz timer, divide by 100 to get usec */
96 usec_count += (TIMER0_DIV - count) / 100;
97 return usec_count;
98}
99
100/* From timer MDS describing the hardware watchdog:
101 * 4.3.1 Watchdog Operation
102 * The watchdog timer is an 8-bit timer with a configurable start value.
103 * Once started the whatchdog counts downwards with a frequency of 763 Hz
104 * (100/131072 MHz). When the watchdog counts down to 1, it generates an
105 * NMI (Non Maskable Interrupt), and when it counts down to 0, it resets the
106 * chip.
107 */
108/* This gives us 1.3 ms to do something useful when the NMI comes */
109
110/* right now, starting the watchdog is the same as resetting it */
111#define start_watchdog reset_watchdog
112
113#if defined(CONFIG_ETRAX_WATCHDOG)
114static short int watchdog_key = 42; /* arbitrary 7 bit number */
115#endif
116
117/* number of pages to consider "out of memory". it is normal that the memory
118 * is used though, so put this really low.
119 */
120
121#define WATCHDOG_MIN_FREE_PAGES 8
122
123void
124reset_watchdog(void)
125{
126#if defined(CONFIG_ETRAX_WATCHDOG)
127 reg_timer_rw_wd_ctrl wd_ctrl = { 0 };
128
129 /* only keep watchdog happy as long as we have memory left! */
130 if(nr_free_pages() > WATCHDOG_MIN_FREE_PAGES) {
131 /* reset the watchdog with the inverse of the old key */
132 watchdog_key ^= ETRAX_WD_KEY_MASK; /* invert key, which is 7 bits */
133 wd_ctrl.cnt = ETRAX_WD_CNT;
134 wd_ctrl.cmd = regk_timer_start;
135 wd_ctrl.key = watchdog_key;
136 REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl);
137 }
138#endif
139}
140
141/* stop the watchdog - we still need the correct key */
142
143void
144stop_watchdog(void)
145{
146#if defined(CONFIG_ETRAX_WATCHDOG)
147 reg_timer_rw_wd_ctrl wd_ctrl = { 0 };
148 watchdog_key ^= ETRAX_WD_KEY_MASK; /* invert key, which is 7 bits */
149 wd_ctrl.cnt = ETRAX_WD_CNT;
150 wd_ctrl.cmd = regk_timer_stop;
151 wd_ctrl.key = watchdog_key;
152 REG_WR(timer, regi_timer, rw_wd_ctrl, wd_ctrl);
153#endif
154}
155
156extern void show_registers(struct pt_regs *regs);
157
158void
159handle_watchdog_bite(struct pt_regs* regs)
160{
161#if defined(CONFIG_ETRAX_WATCHDOG)
162 extern int cause_of_death;
163
164 raw_printk("Watchdog bite\n");
165
166 /* Check if forced restart or unexpected watchdog */
167 if (cause_of_death == 0xbedead) {
168 while(1);
169 }
170
171 /* Unexpected watchdog, stop the watchdog and dump registers*/
172 stop_watchdog();
173 raw_printk("Oops: bitten by watchdog\n");
174 show_registers(regs);
175#ifndef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
176 reset_watchdog();
177#endif
178 while(1) /* nothing */;
179#endif
180}
181
182/* last time the cmos clock got updated */
183static long last_rtc_update = 0;
184
185/*
186 * timer_interrupt() needs to keep up the real-time clock,
187 * as well as call the "do_timer()" routine every clocktick
188 */
189
190//static unsigned short myjiff; /* used by our debug routine print_timestamp */
191
192extern void cris_do_profile(struct pt_regs *regs);
193
194static inline irqreturn_t
195timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
196{
197 int cpu = smp_processor_id();
198 reg_timer_r_masked_intr masked_intr;
199 reg_timer_rw_ack_intr ack_intr = { 0 };
200
201 /* Check if the timer interrupt is for us (a tmr0 int) */
202 masked_intr = REG_RD(timer, timer_regs[cpu], r_masked_intr);
203 if (!masked_intr.tmr0)
204 return IRQ_NONE;
205
206 /* acknowledge the timer irq */
207 ack_intr.tmr0 = 1;
208 REG_WR(timer, timer_regs[cpu], rw_ack_intr, ack_intr);
209
210 /* reset watchdog otherwise it resets us! */
211 reset_watchdog();
212
213 /* Update statistics. */
214 update_process_times(user_mode(regs));
215
216 cris_do_profile(regs); /* Save profiling information */
217
218 /* The master CPU is responsible for the time keeping. */
219 if (cpu != 0)
220 return IRQ_HANDLED;
221
222 /* call the real timer interrupt handler */
223 do_timer(regs);
224
225 /*
226 * If we have an externally synchronized Linux clock, then update
227 * CMOS clock accordingly every ~11 minutes. Set_rtc_mmss() has to be
228 * called as close as possible to 500 ms before the new second starts.
229 *
230 * The division here is not time critical since it will run once in
231 * 11 minutes
232 */
233 if ((time_status & STA_UNSYNC) == 0 &&
234 xtime.tv_sec > last_rtc_update + 660 &&
235 (xtime.tv_nsec / 1000) >= 500000 - (tick_nsec / 1000) / 2 &&
236 (xtime.tv_nsec / 1000) <= 500000 + (tick_nsec / 1000) / 2) {
237 if (set_rtc_mmss(xtime.tv_sec) == 0)
238 last_rtc_update = xtime.tv_sec;
239 else
240 last_rtc_update = xtime.tv_sec - 600; /* do it again in 60 s */
241 }
242 return IRQ_HANDLED;
243}
244
245/* timer is SA_SHIRQ so drivers can add stuff to the timer irq chain
246 * it needs to be SA_INTERRUPT to make the jiffies update work properly
247 */
248
249static struct irqaction irq_timer = { timer_interrupt, SA_SHIRQ | SA_INTERRUPT,
250 CPU_MASK_NONE, "timer", NULL, NULL};
251
252void __init
253cris_timer_init(void)
254{
255 int cpu = smp_processor_id();
256 reg_timer_rw_tmr0_ctrl tmr0_ctrl = { 0 };
257 reg_timer_rw_tmr0_div tmr0_div = TIMER0_DIV;
258 reg_timer_rw_intr_mask timer_intr_mask;
259
260 /* Setup the etrax timers
261 * Base frequency is 100MHz, divider 1000000 -> 100 HZ
262 * We use timer0, so timer1 is free.
263 * The trig timer is used by the fasttimer API if enabled.
264 */
265
266 tmr0_ctrl.op = regk_timer_ld;
267 tmr0_ctrl.freq = regk_timer_f100;
268 REG_WR(timer, timer_regs[cpu], rw_tmr0_div, tmr0_div);
269 REG_WR(timer, timer_regs[cpu], rw_tmr0_ctrl, tmr0_ctrl); /* Load */
270 tmr0_ctrl.op = regk_timer_run;
271 REG_WR(timer, timer_regs[cpu], rw_tmr0_ctrl, tmr0_ctrl); /* Start */
272
273 /* enable the timer irq */
274 timer_intr_mask = REG_RD(timer, timer_regs[cpu], rw_intr_mask);
275 timer_intr_mask.tmr0 = 1;
276 REG_WR(timer, timer_regs[cpu], rw_intr_mask, timer_intr_mask);
277}
278
279void __init
280time_init(void)
281{
282 reg_intr_vect_rw_mask intr_mask;
283
284 /* probe for the RTC and read it if it exists
285 * Before the RTC can be probed the loops_per_usec variable needs
286 * to be initialized to make usleep work. A better value for
287 * loops_per_usec is calculated by the kernel later once the
288 * clock has started.
289 */
290 loops_per_usec = 50;
291
292 if(RTC_INIT() < 0) {
293 /* no RTC, start at 1980 */
294 xtime.tv_sec = 0;
295 xtime.tv_nsec = 0;
296 have_rtc = 0;
297 } else {
298 /* get the current time */
299 have_rtc = 1;
300 update_xtime_from_cmos();
301 }
302
303 /*
304 * Initialize wall_to_monotonic such that adding it to xtime will yield zero, the
305 * tv_nsec field must be normalized (i.e., 0 <= nsec < NSEC_PER_SEC).
306 */
307 set_normalized_timespec(&wall_to_monotonic, -xtime.tv_sec, -xtime.tv_nsec);
308
309 /* Start CPU local timer */
310 cris_timer_init();
311
312 /* enable the timer irq in global config */
313 intr_mask = REG_RD(intr_vect, regi_irq, rw_mask);
314 intr_mask.timer = 1;
315 REG_WR(intr_vect, regi_irq, rw_mask, intr_mask);
316
317 /* now actually register the timer irq handler that calls timer_interrupt() */
318
319 setup_irq(TIMER_INTR_VECT, &irq_timer);
320
321 /* enable watchdog if we should use one */
322
323#if defined(CONFIG_ETRAX_WATCHDOG)
324 printk("Enabling watchdog...\n");
325 start_watchdog();
326
327 /* If we use the hardware watchdog, we want to trap it as an NMI
328 and dump registers before it resets us. For this to happen, we
329 must set the "m" NMI enable flag (which once set, is unset only
330 when an NMI is taken).
331
332 The same goes for the external NMI, but that doesn't have any
333 driver or infrastructure support yet. */
334 {
335 unsigned long flags;
336 local_save_flags(flags);
337 flags |= (1<<30); /* NMI M flag is at bit 30 */
338 local_irq_restore(flags);
339 }
340#endif
341}
diff --git a/arch/cris/arch-v32/kernel/traps.c b/arch/cris/arch-v32/kernel/traps.c
new file mode 100644
index 000000000000..6e3787045560
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/traps.c
@@ -0,0 +1,160 @@
1/*
2 * Copyright (C) 2003, Axis Communications AB.
3 */
4
5#include <linux/config.h>
6#include <linux/ptrace.h>
7#include <asm/uaccess.h>
8
9#include <asm/arch/hwregs/supp_reg.h>
10
11extern void reset_watchdog(void);
12extern void stop_watchdog(void);
13
14extern int raw_printk(const char *fmt, ...);
15
16void
17show_registers(struct pt_regs *regs)
18{
19 /*
20 * It's possible to use either the USP register or current->thread.usp.
21 * USP might not correspond to the current proccess for all cases this
22 * function is called, and current->thread.usp isn't up to date for the
23 * current proccess. Experience shows that using USP is the way to go.
24 */
25 unsigned long usp;
26 unsigned long d_mmu_cause;
27 unsigned long i_mmu_cause;
28
29 usp = rdusp();
30
31 raw_printk("CPU: %d\n", smp_processor_id());
32
33 raw_printk("ERP: %08lx SRP: %08lx CCS: %08lx USP: %08lx MOF: %08lx\n",
34 regs->erp, regs->srp, regs->ccs, usp, regs->mof);
35
36 raw_printk(" r0: %08lx r1: %08lx r2: %08lx r3: %08lx\n",
37 regs->r0, regs->r1, regs->r2, regs->r3);
38
39 raw_printk(" r4: %08lx r5: %08lx r6: %08lx r7: %08lx\n",
40 regs->r4, regs->r5, regs->r6, regs->r7);
41
42 raw_printk(" r8: %08lx r9: %08lx r10: %08lx r11: %08lx\n",
43 regs->r8, regs->r9, regs->r10, regs->r11);
44
45 raw_printk("r12: %08lx r13: %08lx oR10: %08lx acr: %08lx\n",
46 regs->r12, regs->r13, regs->orig_r10, regs->acr);
47
48 raw_printk("sp: %08lx\n", regs);
49
50 SUPP_BANK_SEL(BANK_IM);
51 SUPP_REG_RD(RW_MM_CAUSE, i_mmu_cause);
52
53 SUPP_BANK_SEL(BANK_DM);
54 SUPP_REG_RD(RW_MM_CAUSE, d_mmu_cause);
55
56 raw_printk(" Data MMU Cause: %08lx\n", d_mmu_cause);
57 raw_printk("Instruction MMU Cause: %08lx\n", i_mmu_cause);
58
59 raw_printk("Process %s (pid: %d, stackpage: %08lx)\n",
60 current->comm, current->pid, (unsigned long) current);
61
62 /* Show additional info if in kernel-mode. */
63 if (!user_mode(regs)) {
64 int i;
65 unsigned char c;
66
67 show_stack(NULL, (unsigned long *) usp);
68
69 /*
70 * If the previous stack-dump wasn't a kernel one, dump the
71 * kernel stack now.
72 */
73 if (usp != 0)
74 show_stack(NULL, NULL);
75
76 raw_printk("\nCode: ");
77
78 if (regs->erp < PAGE_OFFSET)
79 goto bad_value;
80
81 /*
82 * Quite often the value at regs->erp doesn't point to the
83 * interesting instruction, which often is the previous
84 * instruction. So dump at an offset large enough that the
85 * instruction decoding should be in sync at the interesting
86 * point, but small enough to fit on a row. The regs->erp
87 * location is pointed out in a ksymoops-friendly way by
88 * wrapping the byte for that address in parenthesis.
89 */
90 for (i = -12; i < 12; i++) {
91 if (__get_user(c, &((unsigned char *) regs->erp)[i])) {
92bad_value:
93 raw_printk(" Bad IP value.");
94 break;
95 }
96
97 if (i == 0)
98 raw_printk("(%02x) ", c);
99 else
100 raw_printk("%02x ", c);
101 }
102
103 raw_printk("\n");
104 }
105}
106
107/*
108 * This gets called from entry.S when the watchdog has bitten. Show something
109 * similiar to an Oops dump, and if the kernel if configured to be a nice doggy;
110 * halt instead of reboot.
111 */
112void
113watchdog_bite_hook(struct pt_regs *regs)
114{
115#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
116 local_irq_disable();
117 stop_watchdog();
118 show_registers(regs);
119
120 while (1)
121 ; /* Do nothing. */
122#else
123 show_registers(regs);
124#endif
125}
126
127/* This is normally the Oops function. */
128void
129die_if_kernel(const char *str, struct pt_regs *regs, long err)
130{
131 if (user_mode(regs))
132 return;
133
134#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
135 /*
136 * This printout might take too long and could trigger
137 * the watchdog normally. If NICE_DOGGY is set, simply
138 * stop the watchdog during the printout.
139 */
140 stop_watchdog();
141#endif
142
143 raw_printk("%s: %04lx\n", str, err & 0xffff);
144
145 show_registers(regs);
146
147#ifdef CONFIG_ETRAX_WATCHDOG_NICE_DOGGY
148 reset_watchdog();
149#endif
150
151 do_exit(SIGSEGV);
152}
153
154void arch_enable_nmi(void)
155{
156 unsigned long flags;
157 local_save_flags(flags);
158 flags |= (1<<30); /* NMI M flag is at bit 30 */
159 local_irq_restore(flags);
160}
diff --git a/arch/cris/arch-v32/kernel/vcs_hook.c b/arch/cris/arch-v32/kernel/vcs_hook.c
new file mode 100644
index 000000000000..64d71c54c22c
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/vcs_hook.c
@@ -0,0 +1,96 @@
1// $Id: vcs_hook.c,v 1.2 2003/08/12 12:01:06 starvik Exp $
2//
3// Call simulator hook. This is the part running in the
4// simulated program.
5//
6
7#include "vcs_hook.h"
8#include <stdarg.h>
9#include <asm/arch-v32/hwregs/reg_map.h>
10#include <asm/arch-v32/hwregs/intr_vect_defs.h>
11
12#define HOOK_TRIG_ADDR 0xb7000000 /* hook cvlog model reg address */
13#define HOOK_MEM_BASE_ADDR 0xa0000000 /* csp4 (shared mem) base addr */
14
15#define HOOK_DATA(offset) ((unsigned*) HOOK_MEM_BASE_ADDR)[offset]
16#define VHOOK_DATA(offset) ((volatile unsigned*) HOOK_MEM_BASE_ADDR)[offset]
17#define HOOK_TRIG(funcid) do { *((unsigned *) HOOK_TRIG_ADDR) = funcid; } while(0)
18#define HOOK_DATA_BYTE(offset) ((unsigned char*) HOOK_MEM_BASE_ADDR)[offset]
19
20
21// ------------------------------------------------------------------ hook_call
22int hook_call( unsigned id, unsigned pcnt, ...) {
23 va_list ap;
24 unsigned i;
25 unsigned ret;
26#ifdef USING_SOS
27 PREEMPT_OFF_SAVE();
28#endif
29
30 // pass parameters
31 HOOK_DATA(0) = id;
32
33 /* Have to make hook_print_str a special case since we call with a
34 parameter of byte type. Should perhaps be a separate
35 hook_call. */
36
37 if (id == hook_print_str) {
38 int i;
39 char *str;
40
41 HOOK_DATA(1) = pcnt;
42
43 va_start(ap, pcnt);
44 str = (char*)va_arg(ap,unsigned);
45
46 for (i=0; i!=pcnt; i++) {
47 HOOK_DATA_BYTE(8+i) = str[i];
48 }
49 HOOK_DATA_BYTE(8+i) = 0; /* null byte */
50 }
51 else {
52 va_start(ap, pcnt);
53 for( i = 1; i <= pcnt; i++ ) HOOK_DATA(i) = va_arg(ap,unsigned);
54 va_end(ap);
55 }
56
57 // read from mem to make sure data has propagated to memory before trigging
58 *((volatile unsigned*) HOOK_MEM_BASE_ADDR);
59
60 // trigger hook
61 HOOK_TRIG(id);
62
63 // wait for call to finish
64 while( VHOOK_DATA(0) > 0 ) {}
65
66 // extract return value
67
68 ret = VHOOK_DATA(1);
69
70#ifdef USING_SOS
71 PREEMPT_RESTORE();
72#endif
73 return ret;
74}
75
76unsigned
77hook_buf(unsigned i)
78{
79 return (HOOK_DATA(i));
80}
81
82void print_str( const char *str ) {
83 int i;
84 for (i=1; str[i]; i++); /* find null at end of string */
85 hook_call(hook_print_str, i, str);
86}
87
88// --------------------------------------------------------------- CPU_KICK_DOG
89void CPU_KICK_DOG(void) {
90 (void) hook_call( hook_kick_dog, 0 );
91}
92
93// ------------------------------------------------------- CPU_WATCHDOG_TIMEOUT
94void CPU_WATCHDOG_TIMEOUT( unsigned t ) {
95 (void) hook_call( hook_dog_timeout, 1, t );
96}
diff --git a/arch/cris/arch-v32/kernel/vcs_hook.h b/arch/cris/arch-v32/kernel/vcs_hook.h
new file mode 100644
index 000000000000..7d73709e3cc6
--- /dev/null
+++ b/arch/cris/arch-v32/kernel/vcs_hook.h
@@ -0,0 +1,42 @@
1// $Id: vcs_hook.h,v 1.1 2003/08/12 12:01:06 starvik Exp $
2//
3// Call simulator hook functions
4
5#ifndef HOOK_H
6#define HOOK_H
7
8int hook_call( unsigned id, unsigned pcnt, ...);
9
10enum hook_ids {
11 hook_debug_on = 1,
12 hook_debug_off,
13 hook_stop_sim_ok,
14 hook_stop_sim_fail,
15 hook_alloc_shared,
16 hook_ptr_shared,
17 hook_free_shared,
18 hook_file2shared,
19 hook_cmp_shared,
20 hook_print_params,
21 hook_sim_time,
22 hook_stop_sim,
23 hook_kick_dog,
24 hook_dog_timeout,
25 hook_rand,
26 hook_srand,
27 hook_rand_range,
28 hook_print_str,
29 hook_print_hex,
30 hook_cmp_offset_shared,
31 hook_fill_random_shared,
32 hook_alloc_random_data,
33 hook_calloc_random_data,
34 hook_print_int,
35 hook_print_uint,
36 hook_fputc,
37 hook_init_fd,
38 hook_sbrk
39
40};
41
42#endif
diff --git a/arch/cris/arch-v32/lib/Makefile b/arch/cris/arch-v32/lib/Makefile
new file mode 100644
index 000000000000..05b3ec6978d6
--- /dev/null
+++ b/arch/cris/arch-v32/lib/Makefile
@@ -0,0 +1,6 @@
1#
2# Makefile for Etrax-specific library files..
3#
4
5lib-y = checksum.o checksumcopy.o string.o usercopy.o memset.o csumcpfruser.o spinlock.o
6
diff --git a/arch/cris/arch-v32/lib/checksum.S b/arch/cris/arch-v32/lib/checksum.S
new file mode 100644
index 000000000000..32e66181b826
--- /dev/null
+++ b/arch/cris/arch-v32/lib/checksum.S
@@ -0,0 +1,111 @@
1/*
2 * A fast checksum routine using movem
3 * Copyright (c) 1998-2001, 2003 Axis Communications AB
4 *
5 * csum_partial(const unsigned char * buff, int len, unsigned int sum)
6 */
7
8 .globl csum_partial
9csum_partial:
10
11 ;; r10 - src
12 ;; r11 - length
13 ;; r12 - checksum
14
15 ;; check for breakeven length between movem and normal word looping versions
16 ;; we also do _NOT_ want to compute a checksum over more than the
17 ;; actual length when length < 40
18
19 cmpu.w 80,$r11
20 blo _word_loop
21 nop
22
23 ;; need to save the registers we use below in the movem loop
24 ;; this overhead is why we have a check above for breakeven length
25 ;; only r0 - r8 have to be saved, the other ones are clobber-able
26 ;; according to the ABI
27
28 subq 9*4,$sp
29 subq 10*4,$r11 ; update length for the first loop
30 movem $r8,[$sp]
31
32 ;; do a movem checksum
33
34_mloop: movem [$r10+],$r9 ; read 10 longwords
35
36 ;; perform dword checksumming on the 10 longwords
37
38 add.d $r0,$r12
39 addc $r1,$r12
40 addc $r2,$r12
41 addc $r3,$r12
42 addc $r4,$r12
43 addc $r5,$r12
44 addc $r6,$r12
45 addc $r7,$r12
46 addc $r8,$r12
47 addc $r9,$r12
48
49 ;; fold the carry into the checksum, to avoid having to loop the carry
50 ;; back into the top
51
52 addc 0,$r12
53 addc 0,$r12 ; do it again, since we might have generated a carry
54
55 subq 10*4,$r11
56 bge _mloop
57 nop
58
59 addq 10*4,$r11 ; compensate for last loop underflowing length
60
61 movem [$sp+],$r8 ; restore regs
62
63_word_loop:
64 ;; only fold if there is anything to fold.
65
66 cmpq 0,$r12
67 beq _no_fold
68
69 ;; fold 32-bit checksum into a 16-bit checksum, to avoid carries below.
70 ;; r9 and r13 can be used as temporaries.
71
72 moveq -1,$r9 ; put 0xffff in r9, faster than move.d 0xffff,r9
73 lsrq 16,$r9
74
75 move.d $r12,$r13
76 lsrq 16,$r13 ; r13 = checksum >> 16
77 and.d $r9,$r12 ; checksum = checksum & 0xffff
78 add.d $r13,$r12 ; checksum += r13
79 move.d $r12,$r13 ; do the same again, maybe we got a carry last add
80 lsrq 16,$r13
81 and.d $r9,$r12
82 add.d $r13,$r12
83
84_no_fold:
85 cmpq 2,$r11
86 blt _no_words
87 nop
88
89 ;; checksum the rest of the words
90
91 subq 2,$r11
92
93_wloop: subq 2,$r11
94 bge _wloop
95 addu.w [$r10+],$r12
96
97 addq 2,$r11
98
99_no_words:
100 ;; see if we have one odd byte more
101 cmpq 1,$r11
102 beq _do_byte
103 nop
104 ret
105 move.d $r12,$r10
106
107_do_byte:
108 ;; copy and checksum the last byte
109 addu.b [$r10],$r12
110 ret
111 move.d $r12,$r10
diff --git a/arch/cris/arch-v32/lib/checksumcopy.S b/arch/cris/arch-v32/lib/checksumcopy.S
new file mode 100644
index 000000000000..9303ccbadc6d
--- /dev/null
+++ b/arch/cris/arch-v32/lib/checksumcopy.S
@@ -0,0 +1,120 @@
1/*
2 * A fast checksum+copy routine using movem
3 * Copyright (c) 1998, 2001, 2003 Axis Communications AB
4 *
5 * Authors: Bjorn Wesen
6 *
7 * csum_partial_copy_nocheck(const char *src, char *dst,
8 * int len, unsigned int sum)
9 */
10
11 .globl csum_partial_copy_nocheck
12csum_partial_copy_nocheck:
13
14 ;; r10 - src
15 ;; r11 - dst
16 ;; r12 - length
17 ;; r13 - checksum
18
19 ;; check for breakeven length between movem and normal word looping versions
20 ;; we also do _NOT_ want to compute a checksum over more than the
21 ;; actual length when length < 40
22
23 cmpu.w 80,$r12
24 blo _word_loop
25 nop
26
27 ;; need to save the registers we use below in the movem loop
28 ;; this overhead is why we have a check above for breakeven length
29 ;; only r0 - r8 have to be saved, the other ones are clobber-able
30 ;; according to the ABI
31
32 subq 9*4,$sp
33 subq 10*4,$r12 ; update length for the first loop
34 movem $r8,[$sp]
35
36 ;; do a movem copy and checksum
37
381: ;; A failing userspace access (the read) will have this as PC.
39_mloop: movem [$r10+],$r9 ; read 10 longwords
40 movem $r9,[$r11+] ; write 10 longwords
41
42 ;; perform dword checksumming on the 10 longwords
43
44 add.d $r0,$r13
45 addc $r1,$r13
46 addc $r2,$r13
47 addc $r3,$r13
48 addc $r4,$r13
49 addc $r5,$r13
50 addc $r6,$r13
51 addc $r7,$r13
52 addc $r8,$r13
53 addc $r9,$r13
54
55 ;; fold the carry into the checksum, to avoid having to loop the carry
56 ;; back into the top
57
58 addc 0,$r13
59 addc 0,$r13 ; do it again, since we might have generated a carry
60
61 subq 10*4,$r12
62 bge _mloop
63 nop
64
65 addq 10*4,$r12 ; compensate for last loop underflowing length
66
67 movem [$sp+],$r8 ; restore regs
68
69_word_loop:
70 ;; only fold if there is anything to fold.
71
72 cmpq 0,$r13
73 beq _no_fold
74
75 ;; fold 32-bit checksum into a 16-bit checksum, to avoid carries below
76 ;; r9 can be used as temporary.
77
78 move.d $r13,$r9
79 lsrq 16,$r9 ; r0 = checksum >> 16
80 and.d 0xffff,$r13 ; checksum = checksum & 0xffff
81 add.d $r9,$r13 ; checksum += r0
82 move.d $r13,$r9 ; do the same again, maybe we got a carry last add
83 lsrq 16,$r9
84 and.d 0xffff,$r13
85 add.d $r9,$r13
86
87_no_fold:
88 cmpq 2,$r12
89 blt _no_words
90 nop
91
92 ;; copy and checksum the rest of the words
93
94 subq 2,$r12
95
962: ;; A failing userspace access for the read below will have this as PC.
97_wloop: move.w [$r10+],$r9
98 addu.w $r9,$r13
99 subq 2,$r12
100 bge _wloop
101 move.w $r9,[$r11+]
102
103 addq 2,$r12
104
105_no_words:
106 ;; see if we have one odd byte more
107 cmpq 1,$r12
108 beq _do_byte
109 nop
110 ret
111 move.d $r13,$r10
112
113_do_byte:
114 ;; copy and checksum the last byte
1153: ;; A failing userspace access for the read below will have this as PC.
116 move.b [$r10],$r9
117 addu.b $r9,$r13
118 move.b $r9,[$r11]
119 ret
120 move.d $r13,$r10
diff --git a/arch/cris/arch-v32/lib/csumcpfruser.S b/arch/cris/arch-v32/lib/csumcpfruser.S
new file mode 100644
index 000000000000..600ec16b9f28
--- /dev/null
+++ b/arch/cris/arch-v32/lib/csumcpfruser.S
@@ -0,0 +1,69 @@
1/*
2 * Add-on to transform csum_partial_copy_nocheck in checksumcopy.S into
3 * csum_partial_copy_from_user by adding exception records.
4 *
5 * Copyright (C) 2001, 2003 Axis Communications AB.
6 *
7 * Author: Hans-Peter Nilsson.
8 */
9
10#include <asm/errno.h>
11
12/* Same function body, but a different name. If we just added exception
13 records to _csum_partial_copy_nocheck and made it generic, we wouldn't
14 know a user fault from a kernel fault and we would have overhead in
15 each kernel caller for the error-pointer argument.
16
17 unsigned int csum_partial_copy_from_user
18 (const char *src, char *dst, int len, unsigned int sum, int *errptr);
19
20 Note that the errptr argument is only set if we encounter an error.
21 It is conveniently located on the stack, so the normal function body
22 does not have to handle it. */
23
24#define csum_partial_copy_nocheck csum_partial_copy_from_user
25
26/* There are local labels numbered 1, 2 and 3 present to mark the
27 different from-user accesses. */
28#include "checksumcopy.S"
29
30 .section .fixup,"ax"
31
32;; Here from the movem loop; restore stack.
334:
34 movem [$sp+],$r8
35;; r12 is already decremented. Add back chunk_size-2.
36 addq 40-2,$r12
37
38;; Here from the word loop; r12 is off by 2; add it back.
395:
40 addq 2,$r12
41
42;; Here from a failing single byte.
436:
44
45;; Signal in *errptr that we had a failing access.
46 move.d [$sp],$acr
47 moveq -EFAULT,$r9
48 subq 4,$sp
49 move.d $r9,[$acr]
50
51;; Clear the rest of the destination area using memset. Preserve the
52;; checksum for the readable bytes.
53 move.d $r13,[$sp]
54 subq 4,$sp
55 move.d $r11,$r10
56 move $srp,[$sp]
57 jsr memset
58 clear.d $r11
59
60 move [$sp+],$srp
61 ret
62 move.d [$sp+],$r10
63
64 .previous
65 .section __ex_table,"a"
66 .dword 1b,4b
67 .dword 2b,5b
68 .dword 3b,6b
69 .previous
diff --git a/arch/cris/arch-v32/lib/dram_init.S b/arch/cris/arch-v32/lib/dram_init.S
new file mode 100644
index 000000000000..47b6cf5f4afd
--- /dev/null
+++ b/arch/cris/arch-v32/lib/dram_init.S
@@ -0,0 +1,120 @@
1/* $Id: dram_init.S,v 1.4 2005/04/24 18:48:32 starvik Exp $
2 *
3 * DRAM/SDRAM initialization - alter with care
4 * This file is intended to be included from other assembler files
5 *
6 * Note: This file may not modify r8 or r9 because they are used to
7 * carry information from the decompresser to the kernel
8 *
9 * Copyright (C) 2000-2003 Axis Communications AB
10 *
11 * Authors: Mikael Starvik (starvik@axis.com)
12 */
13
14/* Just to be certain the config file is included, we include it here
15 * explicitely instead of depending on it being included in the file that
16 * uses this code.
17 */
18
19#include <linux/config.h>
20#include <asm/arch/hwregs/asm/reg_map_asm.h>
21#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
22
23 ;; WARNING! The registers r8 and r9 are used as parameters carrying
24 ;; information from the decompressor (if the kernel was compressed).
25 ;; They should not be used in the code below.
26
27 ; Refer to BIF MDS for a description of SDRAM initialization
28
29 ; Bank configuration
30 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp0), $r0
31 move.d CONFIG_ETRAX_SDRAM_GRP0_CONFIG, $r1
32 move.d $r1, [$r0]
33 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp1), $r0
34 move.d CONFIG_ETRAX_SDRAM_GRP1_CONFIG, $r1
35 move.d $r1, [$r0]
36
37 ; Calculate value of mrs_data
38 ; CAS latency = 2 && bus_width = 32 => 0x40
39 ; CAS latency = 3 && bus_width = 32 => 0x60
40 ; CAS latency = 2 && bus_width = 16 => 0x20
41 ; CAS latency = 3 && bus_width = 16 => 0x30
42
43 ; Check if value is already supplied in kernel config
44 move.d CONFIG_ETRAX_SDRAM_COMMAND, $r2
45 bne _set_timing
46 nop
47
48 move.d 0x40, $r4 ; Assume 32 bits and CAS latency = 2
49 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1
50 and.d 0x07, $r1 ; Get CAS latency
51 cmpq 2, $r1 ; CL = 2 ?
52 beq _bw_check
53 nop
54 move.d 0x60, $r4
55
56_bw_check:
57 ; Assume that group 0 width is equal to group 1. This assumption
58 ; is wrong for a group 1 only hardware (such as the grand old
59 ; StorPoint+).
60 move.d CONFIG_ETRAX_SDRAM_GRP0_CONFIG, $r1
61 and.d 0x200, $r1 ; DRAM width is bit 9
62 beq _set_timing
63 lslq 2, $r4 ; mrs_data starts at bit 2
64 lsrq 1, $r4 ; 16 bits. Shift down value.
65
66 ; Set timing parameters (refresh off to avoid Guinness TR 83)
67_set_timing:
68 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1
69 and.d ~(3 << reg_bif_core_rw_sdram_timing___ref___lsb), $r1
70 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing), $r0
71 move.d $r1, [$r0]
72
73 ; Issue NOP command
74 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_cmd), $r5
75 moveq regk_bif_core_nop, $r1
76 move.d $r1, [$r5]
77
78 ; Wait 200us
79 move.d 10000, $r2
801: bne 1b
81 subq 1, $r2
82
83 ; Issue initialization command sequence
84 move.d _sdram_commands_start, $r2
85 and.d 0x000fffff, $r2 ; Make sure commands are read from flash
86 move.d _sdram_commands_end, $r3
87 and.d 0x000fffff, $r3
881: clear.d $r6
89 move.b [$r2+], $r6 ; Load command
90 or.d $r4, $r6 ; Add calculated mrs
91 move.d $r6, [$r5] ; Write rw_sdram_cmd
92 ; Wait 80 ns between each command
93 move.d 4000, $r7
942: bne 2b
95 subq 1, $r7
96 cmp.d $r2, $r3 ; Last command?
97 bne 1b
98 nop
99
100 ; Start refresh
101 move.d CONFIG_ETRAX_SDRAM_TIMING, $r1
102 move.d REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing), $r0
103 move.d $r1, [$r0]
104
105 ; Initialization finished
106 ba _sdram_commands_end
107 nop
108
109_sdram_commands_start:
110 .byte regk_bif_core_pre ; Precharge
111 .byte regk_bif_core_ref ; refresh
112 .byte regk_bif_core_ref ; refresh
113 .byte regk_bif_core_ref ; refresh
114 .byte regk_bif_core_ref ; refresh
115 .byte regk_bif_core_ref ; refresh
116 .byte regk_bif_core_ref ; refresh
117 .byte regk_bif_core_ref ; refresh
118 .byte regk_bif_core_ref ; refresh
119 .byte regk_bif_core_mrs ; mrs
120_sdram_commands_end:
diff --git a/arch/cris/arch-v32/lib/hw_settings.S b/arch/cris/arch-v32/lib/hw_settings.S
new file mode 100644
index 000000000000..5182e8c2cff2
--- /dev/null
+++ b/arch/cris/arch-v32/lib/hw_settings.S
@@ -0,0 +1,73 @@
1/*
2 * $Id: hw_settings.S,v 1.3 2005/04/24 18:36:57 starvik Exp $
3 *
4 * This table is used by some tools to extract hardware parameters.
5 * The table should be included in the kernel and the decompressor.
6 * Don't forget to update the tools if you change this table.
7 *
8 * Copyright (C) 2001 Axis Communications AB
9 *
10 * Authors: Mikael Starvik (starvik@axis.com)
11 */
12
13#include <linux/config.h>
14#include <asm/arch/hwregs/asm/reg_map_asm.h>
15#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
16#include <asm/arch/hwregs/asm/gio_defs_asm.h>
17
18 .ascii "HW_PARAM_MAGIC" ; Magic number
19 .dword 0xc0004000 ; Kernel start address
20
21 ; Debug port
22#ifdef CONFIG_ETRAX_DEBUG_PORT0
23 .dword 0
24#elif defined(CONFIG_ETRAX_DEBUG_PORT1)
25 .dword 1
26#elif defined(CONFIG_ETRAX_DEBUG_PORT2)
27 .dword 2
28#elif defined(CONFIG_ETRAX_DEBUG_PORT3)
29 .dword 3
30#else
31 .dword 4 ; No debug
32#endif
33
34 ; Register values
35 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp1_cfg)
36 .dword CONFIG_ETRAX_MEM_GRP1_CONFIG
37 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp2_cfg)
38 .dword CONFIG_ETRAX_MEM_GRP2_CONFIG
39 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg)
40 .dword CONFIG_ETRAX_MEM_GRP3_CONFIG
41 .dword REG_ADDR(bif_core, regi_bif_core, rw_grp4_cfg)
42 .dword CONFIG_ETRAX_MEM_GRP4_CONFIG
43 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp0)
44 .dword CONFIG_ETRAX_SDRAM_GRP0_CONFIG
45 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_cfg_grp1)
46 .dword CONFIG_ETRAX_SDRAM_GRP1_CONFIG
47 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_timing)
48 .dword CONFIG_ETRAX_SDRAM_TIMING
49 .dword REG_ADDR(bif_core, regi_bif_core, rw_sdram_cmd)
50 .dword CONFIG_ETRAX_SDRAM_COMMAND
51
52 .dword REG_ADDR(gio, regi_gio, rw_pa_dout)
53 .dword CONFIG_ETRAX_DEF_GIO_PA_OUT
54 .dword REG_ADDR(gio, regi_gio, rw_pa_oe)
55 .dword CONFIG_ETRAX_DEF_GIO_PA_OE
56 .dword REG_ADDR(gio, regi_gio, rw_pb_dout)
57 .dword CONFIG_ETRAX_DEF_GIO_PB_OUT
58 .dword REG_ADDR(gio, regi_gio, rw_pb_oe)
59 .dword CONFIG_ETRAX_DEF_GIO_PB_OE
60 .dword REG_ADDR(gio, regi_gio, rw_pc_dout)
61 .dword CONFIG_ETRAX_DEF_GIO_PC_OUT
62 .dword REG_ADDR(gio, regi_gio, rw_pc_oe)
63 .dword CONFIG_ETRAX_DEF_GIO_PC_OE
64 .dword REG_ADDR(gio, regi_gio, rw_pd_dout)
65 .dword CONFIG_ETRAX_DEF_GIO_PD_OUT
66 .dword REG_ADDR(gio, regi_gio, rw_pd_oe)
67 .dword CONFIG_ETRAX_DEF_GIO_PD_OE
68 .dword REG_ADDR(gio, regi_gio, rw_pe_dout)
69 .dword CONFIG_ETRAX_DEF_GIO_PE_OUT
70 .dword REG_ADDR(gio, regi_gio, rw_pe_oe)
71 .dword CONFIG_ETRAX_DEF_GIO_PE_OE
72
73 .dword 0 ; No more register values
diff --git a/arch/cris/arch-v32/lib/memset.c b/arch/cris/arch-v32/lib/memset.c
new file mode 100644
index 000000000000..ffca1214674e
--- /dev/null
+++ b/arch/cris/arch-v32/lib/memset.c
@@ -0,0 +1,253 @@
1/*#************************************************************************#*/
2/*#-------------------------------------------------------------------------*/
3/*# */
4/*# FUNCTION NAME: memset() */
5/*# */
6/*# PARAMETERS: void* dst; Destination address. */
7/*# int c; Value of byte to write. */
8/*# int len; Number of bytes to write. */
9/*# */
10/*# RETURNS: dst. */
11/*# */
12/*# DESCRIPTION: Sets the memory dst of length len bytes to c, as standard. */
13/*# Framework taken from memcpy. This routine is */
14/*# very sensitive to compiler changes in register allocation. */
15/*# Should really be rewritten to avoid this problem. */
16/*# */
17/*#-------------------------------------------------------------------------*/
18/*# */
19/*# HISTORY */
20/*# */
21/*# DATE NAME CHANGES */
22/*# ---- ---- ------- */
23/*# 990713 HP Tired of watching this function (or */
24/*# really, the nonoptimized generic */
25/*# implementation) take up 90% of simulator */
26/*# output. Measurements needed. */
27/*# */
28/*#-------------------------------------------------------------------------*/
29
30#include <linux/types.h>
31
32/* No, there's no macro saying 12*4, since it is "hard" to get it into
33 the asm in a good way. Thus better to expose the problem everywhere.
34 */
35
36/* Assuming 1 cycle per dword written or read (ok, not really true), and
37 one per instruction, then 43+3*(n/48-1) <= 24+24*(n/48-1)
38 so n >= 45.7; n >= 0.9; we win on the first full 48-byte block to set. */
39
40#define ZERO_BLOCK_SIZE (1*12*4)
41
42void *memset(void *pdst,
43 int c,
44 size_t plen)
45{
46 /* Ok. Now we want the parameters put in special registers.
47 Make sure the compiler is able to make something useful of this. */
48
49 register char *return_dst __asm__ ("r10") = pdst;
50 register int n __asm__ ("r12") = plen;
51 register int lc __asm__ ("r11") = c;
52
53 /* Most apps use memset sanely. Only those memsetting about 3..4
54 bytes or less get penalized compared to the generic implementation
55 - and that's not really sane use. */
56
57 /* Ugh. This is fragile at best. Check with newer GCC releases, if
58 they compile cascaded "x |= x << 8" sanely! */
59 __asm__("movu.b %0,$r13 \n\
60 lslq 8,$r13 \n\
61 move.b %0,$r13 \n\
62 move.d $r13,%0 \n\
63 lslq 16,$r13 \n\
64 or.d $r13,%0"
65 : "=r" (lc) : "0" (lc) : "r13");
66
67 {
68 register char *dst __asm__ ("r13") = pdst;
69
70 /* This is NONPORTABLE, but since this whole routine is */
71 /* grossly nonportable that doesn't matter. */
72
73 if (((unsigned long) pdst & 3) != 0
74 /* Oops! n=0 must be a legal call, regardless of alignment. */
75 && n >= 3)
76 {
77 if ((unsigned long)dst & 1)
78 {
79 *dst = (char) lc;
80 n--;
81 dst++;
82 }
83
84 if ((unsigned long)dst & 2)
85 {
86 *(short *)dst = lc;
87 n -= 2;
88 dst += 2;
89 }
90 }
91
92 /* Now the fun part. For the threshold value of this, check the equation
93 above. */
94 /* Decide which copying method to use. */
95 if (n >= ZERO_BLOCK_SIZE)
96 {
97 /* For large copies we use 'movem' */
98
99 /* It is not optimal to tell the compiler about clobbering any
100 registers; that will move the saving/restoring of those registers
101 to the function prologue/epilogue, and make non-movem sizes
102 suboptimal.
103
104 This method is not foolproof; it assumes that the "asm reg"
105 declarations at the beginning of the function really are used
106 here (beware: they may be moved to temporary registers).
107 This way, we do not have to save/move the registers around into
108 temporaries; we can safely use them straight away.
109
110 If you want to check that the allocation was right; then
111 check the equalities in the first comment. It should say
112 "r13=r13, r12=r12, r11=r11" */
113 __asm__ volatile (" \n\
114 ;; Check that the register asm declaration got right. \n\
115 ;; The GCC manual says it will work, but there *has* been bugs. \n\
116 .ifnc %0-%1-%4,$r13-$r12-$r11 \n\
117 .err \n\
118 .endif \n\
119 \n\
120 ;; Save the registers we'll clobber in the movem process \n\
121 ;; on the stack. Don't mention them to gcc, it will only be \n\
122 ;; upset. \n\
123 subq 11*4,$sp \n\
124 movem $r10,[$sp] \n\
125 \n\
126 move.d $r11,$r0 \n\
127 move.d $r11,$r1 \n\
128 move.d $r11,$r2 \n\
129 move.d $r11,$r3 \n\
130 move.d $r11,$r4 \n\
131 move.d $r11,$r5 \n\
132 move.d $r11,$r6 \n\
133 move.d $r11,$r7 \n\
134 move.d $r11,$r8 \n\
135 move.d $r11,$r9 \n\
136 move.d $r11,$r10 \n\
137 \n\
138 ;; Now we've got this: \n\
139 ;; r13 - dst \n\
140 ;; r12 - n \n\
141 \n\
142 ;; Update n for the first loop \n\
143 subq 12*4,$r12 \n\
1440: \n\
145 subq 12*4,$r12 \n\
146 bge 0b \n\
147 movem $r11,[$r13+] \n\
148 \n\
149 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
150 \n\
151 ;; Restore registers from stack \n\
152 movem [$sp+],$r10"
153
154 /* Outputs */ : "=r" (dst), "=r" (n)
155 /* Inputs */ : "0" (dst), "1" (n), "r" (lc));
156 }
157
158 /* Either we directly starts copying, using dword copying
159 in a loop, or we copy as much as possible with 'movem'
160 and then the last block (<44 bytes) is copied here.
161 This will work since 'movem' will have updated src,dst,n. */
162
163 while ( n >= 16 )
164 {
165 *((long*)dst)++ = lc;
166 *((long*)dst)++ = lc;
167 *((long*)dst)++ = lc;
168 *((long*)dst)++ = lc;
169 n -= 16;
170 }
171
172 /* A switch() is definitely the fastest although it takes a LOT of code.
173 * Particularly if you inline code this.
174 */
175 switch (n)
176 {
177 case 0:
178 break;
179 case 1:
180 *(char*)dst = (char) lc;
181 break;
182 case 2:
183 *(short*)dst = (short) lc;
184 break;
185 case 3:
186 *((short*)dst)++ = (short) lc;
187 *(char*)dst = (char) lc;
188 break;
189 case 4:
190 *((long*)dst)++ = lc;
191 break;
192 case 5:
193 *((long*)dst)++ = lc;
194 *(char*)dst = (char) lc;
195 break;
196 case 6:
197 *((long*)dst)++ = lc;
198 *(short*)dst = (short) lc;
199 break;
200 case 7:
201 *((long*)dst)++ = lc;
202 *((short*)dst)++ = (short) lc;
203 *(char*)dst = (char) lc;
204 break;
205 case 8:
206 *((long*)dst)++ = lc;
207 *((long*)dst)++ = lc;
208 break;
209 case 9:
210 *((long*)dst)++ = lc;
211 *((long*)dst)++ = lc;
212 *(char*)dst = (char) lc;
213 break;
214 case 10:
215 *((long*)dst)++ = lc;
216 *((long*)dst)++ = lc;
217 *(short*)dst = (short) lc;
218 break;
219 case 11:
220 *((long*)dst)++ = lc;
221 *((long*)dst)++ = lc;
222 *((short*)dst)++ = (short) lc;
223 *(char*)dst = (char) lc;
224 break;
225 case 12:
226 *((long*)dst)++ = lc;
227 *((long*)dst)++ = lc;
228 *((long*)dst)++ = lc;
229 break;
230 case 13:
231 *((long*)dst)++ = lc;
232 *((long*)dst)++ = lc;
233 *((long*)dst)++ = lc;
234 *(char*)dst = (char) lc;
235 break;
236 case 14:
237 *((long*)dst)++ = lc;
238 *((long*)dst)++ = lc;
239 *((long*)dst)++ = lc;
240 *(short*)dst = (short) lc;
241 break;
242 case 15:
243 *((long*)dst)++ = lc;
244 *((long*)dst)++ = lc;
245 *((long*)dst)++ = lc;
246 *((short*)dst)++ = (short) lc;
247 *(char*)dst = (char) lc;
248 break;
249 }
250 }
251
252 return return_dst; /* destination pointer. */
253} /* memset() */
diff --git a/arch/cris/arch-v32/lib/nand_init.S b/arch/cris/arch-v32/lib/nand_init.S
new file mode 100644
index 000000000000..aba5c751c282
--- /dev/null
+++ b/arch/cris/arch-v32/lib/nand_init.S
@@ -0,0 +1,179 @@
1##=============================================================================
2##
3## nand_init.S
4##
5## The bootrom copies data from the NAND flash to the internal RAM but
6## due to a bug/feature we can only trust the 256 first bytes. So this
7## code copies more data from NAND flash to internal RAM. Obvioulsy this
8## code must fit in the first 256 bytes so alter with care.
9##
10## Some notes about the bug/feature for future reference:
11## The bootrom copies the first 127 KB from NAND flash to internal
12## memory. The problem is that it does a bytewise copy. NAND flashes
13## does autoincrement on the address so for a 16-bite device each
14## read/write increases the address by two. So the copy loop in the
15## bootrom will discard every second byte. This is solved by inserting
16## zeroes in every second byte in the first erase block.
17##
18## The bootrom also incorrectly assumes that it can read the flash
19## linear with only one read command but the flash will actually
20## switch between normal area and spare area if you do that so we
21## can't trust more than the first 256 bytes.
22##
23##=============================================================================
24
25#include <asm/arch/hwregs/asm/reg_map_asm.h>
26#include <asm/arch/hwregs/asm/gio_defs_asm.h>
27#include <asm/arch/hwregs/asm/pinmux_defs_asm.h>
28#include <asm/arch/hwregs/asm/bif_core_defs_asm.h>
29#include <asm/arch/hwregs/asm/config_defs_asm.h>
30#include <linux/config.h>
31
32;; There are 8-bit NAND flashes and 16-bit NAND flashes.
33;; We need to treat them slightly different.
34#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
35#define PAGE_SIZE 256
36#else
37#error 2
38#define PAGE_SIZE 512
39#endif
40#define ERASE_BLOCK 16384
41
42;; GPIO pins connected to NAND flash
43#define CE 4
44#define CLE 5
45#define ALE 6
46#define BY 7
47
48;; Address space for NAND flash
49#define NAND_RD_ADDR 0x90000000
50#define NAND_WR_ADDR 0x94000000
51
52#define READ_CMD 0x00
53
54;; Readability macros
55#define CSP_MASK \
56 REG_MASK(bif_core, rw_grp3_cfg, gated_csp0) | \
57 REG_MASK(bif_core, rw_grp3_cfg, gated_csp1)
58#define CSP_VAL \
59 REG_STATE(bif_core, rw_grp3_cfg, gated_csp0, rd) | \
60 REG_STATE(bif_core, rw_grp3_cfg, gated_csp1, wr)
61
62;;----------------------------------------------------------------------------
63;; Macros to set/clear GPIO bits
64
65.macro SET x
66 or.b (1<<\x),$r9
67 move.d $r9, [$r2]
68.endm
69
70.macro CLR x
71 and.b ~(1<<\x),$r9
72 move.d $r9, [$r2]
73.endm
74
75;;----------------------------------------------------------------------------
76
77nand_boot:
78 ;; Check if nand boot was selected
79 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
80 move.d [$r0], $r0
81 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
82 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
83 bne normal_boot ; No NAND boot
84 nop
85
86copy_nand_to_ram:
87 ;; copy_nand_to_ram
88 ;; Arguments
89 ;; r10 - destination
90 ;; r11 - source offset
91 ;; r12 - size
92 ;; r13 - Address to jump to after completion
93 ;; Note : r10-r12 are clobbered on return
94 ;; Registers used:
95 ;; r0 - NAND_RD_ADDR
96 ;; r1 - NAND_WR_ADDR
97 ;; r2 - reg_gio_rw_pa_dout
98 ;; r3 - reg_gio_r_pa_din
99 ;; r4 - tmp
100 ;; r5 - byte counter within a page
101 ;; r6 - reg_pinmux_rw_pa
102 ;; r7 - reg_gio_rw_pa_oe
103 ;; r8 - reg_bif_core_rw_grp3_cfg
104 ;; r9 - reg_gio_rw_pa_dout shadow
105 move.d 0x90000000, $r0
106 move.d 0x94000000, $r1
107 move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r2
108 move.d REG_ADDR(gio, regi_gio, r_pa_din), $r3
109 move.d REG_ADDR(pinmux, regi_pinmux, rw_pa), $r6
110 move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r7
111 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r8
112
113#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
114 lsrq 1, $r11
115#endif
116 ;; Set up GPIO
117 move.d [$r2], $r9
118 move.d [$r7], $r4
119 or.b (1<<ALE) | (1 << CLE) | (1<<CE), $r4
120 move.d $r4, [$r7]
121
122 ;; Set up bif
123 move.d [$r8], $r4
124 and.d CSP_MASK, $r4
125 or.d CSP_VAL, $r4
126 move.d $r4, [$r8]
127
1281: ;; Copy one page
129 CLR CE
130 SET CLE
131 moveq READ_CMD, $r4
132 move.b $r4, [$r1]
133 moveq 20, $r4
1342: bne 2b
135 subq 1, $r4
136 CLR CLE
137 SET ALE
138 clear.w [$r1] ; Column address = 0
139 move.d $r11, $r4
140 lsrq 8, $r4
141 move.b $r4, [$r1] ; Row address
142 lsrq 8, $r4
143 move.b $r4, [$r1] ; Row adddress
144 moveq 20, $r4
1452: bne 2b
146 subq 1, $r4
147 CLR ALE
1482: move.d [$r3], $r4
149 and.d 1 << BY, $r4
150 beq 2b
151 movu.w PAGE_SIZE, $r5
1522: ; Copy one byte/word
153#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
154 move.w [$r0], $r4
155#else
156 move.b [$r0], $r4
157#endif
158 subq 1, $r5
159 bne 2b
160#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
161 move.w $r4, [$r10+]
162 subu.w PAGE_SIZE*2, $r12
163#else
164 move.b $r4, [$r10+]
165 subu.w PAGE_SIZE, $r12
166#endif
167 bpl 1b
168 addu.w PAGE_SIZE, $r11
169
170 ;; End of copy
171 jump $r13
172 nop
173
174 ;; This will warn if the code above is too large. If you consider
175 ;; to remove this you don't understand the bug/feature.
176 .org 256
177 .org ERASE_BLOCK
178
179normal_boot:
diff --git a/arch/cris/arch-v32/lib/spinlock.S b/arch/cris/arch-v32/lib/spinlock.S
new file mode 100644
index 000000000000..2437ae7f6ed2
--- /dev/null
+++ b/arch/cris/arch-v32/lib/spinlock.S
@@ -0,0 +1,33 @@
1;; Core of the spinlock implementation
2;;
3;; Copyright (C) 2004 Axis Communications AB.
4;;
5;; Author: Mikael Starvik
6
7
8 .global cris_spin_lock
9 .global cris_spin_trylock
10
11 .text
12
13cris_spin_lock:
14 clearf p
151: test.d [$r10]
16 beq 1b
17 clearf p
18 ax
19 clear.d [$r10]
20 bcs 1b
21 clearf p
22 ret
23 nop
24
25cris_spin_trylock:
26 clearf p
271: move.d [$r10], $r11
28 ax
29 clear.d [$r10]
30 bcs 1b
31 clearf p
32 ret
33 move.d $r11,$r10
diff --git a/arch/cris/arch-v32/lib/string.c b/arch/cris/arch-v32/lib/string.c
new file mode 100644
index 000000000000..98e282ac824a
--- /dev/null
+++ b/arch/cris/arch-v32/lib/string.c
@@ -0,0 +1,219 @@
1/*#************************************************************************#*/
2/*#-------------------------------------------------------------------------*/
3/*# */
4/*# FUNCTION NAME: memcpy() */
5/*# */
6/*# PARAMETERS: void* dst; Destination address. */
7/*# void* src; Source address. */
8/*# int len; Number of bytes to copy. */
9/*# */
10/*# RETURNS: dst. */
11/*# */
12/*# DESCRIPTION: Copies len bytes of memory from src to dst. No guarantees */
13/*# about copying of overlapping memory areas. This routine is */
14/*# very sensitive to compiler changes in register allocation. */
15/*# Should really be rewritten to avoid this problem. */
16/*# */
17/*#-------------------------------------------------------------------------*/
18/*# */
19/*# HISTORY */
20/*# */
21/*# DATE NAME CHANGES */
22/*# ---- ---- ------- */
23/*# 941007 Kenny R Creation */
24/*# 941011 Kenny R Lots of optimizations and inlining. */
25/*# 941129 Ulf A Adapted for use in libc. */
26/*# 950216 HP N==0 forgotten if non-aligned src/dst. */
27/*# Added some optimizations. */
28/*# 001025 HP Make src and dst char *. Align dst to */
29/*# dword, not just word-if-both-src-and-dst- */
30/*# are-misaligned. */
31/*# */
32/*#-------------------------------------------------------------------------*/
33
34#include <linux/types.h>
35
36void *memcpy(void *pdst,
37 const void *psrc,
38 size_t pn)
39{
40 /* Ok. Now we want the parameters put in special registers.
41 Make sure the compiler is able to make something useful of this.
42 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
43
44 If gcc was allright, it really would need no temporaries, and no
45 stack space to save stuff on. */
46
47 register void *return_dst __asm__ ("r10") = pdst;
48 register char *dst __asm__ ("r13") = pdst;
49 register const char *src __asm__ ("r11") = psrc;
50 register int n __asm__ ("r12") = pn;
51
52
53 /* When src is aligned but not dst, this makes a few extra needless
54 cycles. I believe it would take as many to check that the
55 re-alignment was unnecessary. */
56 if (((unsigned long) dst & 3) != 0
57 /* Don't align if we wouldn't copy more than a few bytes; so we
58 don't have to check further for overflows. */
59 && n >= 3)
60 {
61 if ((unsigned long) dst & 1)
62 {
63 n--;
64 *(char*)dst = *(char*)src;
65 src++;
66 dst++;
67 }
68
69 if ((unsigned long) dst & 2)
70 {
71 n -= 2;
72 *(short*)dst = *(short*)src;
73 src += 2;
74 dst += 2;
75 }
76 }
77
78 /* Decide which copying method to use. Movem is dirt cheap, so the
79 overheap is low enough to always use the minimum block size as the
80 threshold. */
81 if (n >= 44)
82 {
83 /* For large copies we use 'movem' */
84
85 /* It is not optimal to tell the compiler about clobbering any
86 registers; that will move the saving/restoring of those registers
87 to the function prologue/epilogue, and make non-movem sizes
88 suboptimal. */
89 __asm__ volatile (" \n\
90 ;; Check that the register asm declaration got right. \n\
91 ;; The GCC manual explicitly says TRT will happen. \n\
92 .ifnc %0-%1-%2,$r13-$r11-$r12 \n\
93 .err \n\
94 .endif \n\
95 \n\
96 ;; Save the registers we'll use in the movem process \n\
97 \n\
98 ;; on the stack. \n\
99 subq 11*4,$sp \n\
100 movem $r10,[$sp] \n\
101 \n\
102 ;; Now we've got this: \n\
103 ;; r11 - src \n\
104 ;; r13 - dst \n\
105 ;; r12 - n \n\
106 \n\
107 ;; Update n for the first loop \n\
108 subq 44,$r12 \n\
1090: \n\
110 movem [$r11+],$r10 \n\
111 subq 44,$r12 \n\
112 bge 0b \n\
113 movem $r10,[$r13+] \n\
114 \n\
115 addq 44,$r12 ;; compensate for last loop underflowing n \n\
116 \n\
117 ;; Restore registers from stack \n\
118 movem [$sp+],$r10"
119
120 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n)
121 /* Inputs */ : "0" (dst), "1" (src), "2" (n));
122
123 }
124
125 /* Either we directly starts copying, using dword copying
126 in a loop, or we copy as much as possible with 'movem'
127 and then the last block (<44 bytes) is copied here.
128 This will work since 'movem' will have updated src,dst,n. */
129
130 while ( n >= 16 )
131 {
132 *((long*)dst)++ = *((long*)src)++;
133 *((long*)dst)++ = *((long*)src)++;
134 *((long*)dst)++ = *((long*)src)++;
135 *((long*)dst)++ = *((long*)src)++;
136 n -= 16;
137 }
138
139 /* A switch() is definitely the fastest although it takes a LOT of code.
140 * Particularly if you inline code this.
141 */
142 switch (n)
143 {
144 case 0:
145 break;
146 case 1:
147 *(char*)dst = *(char*)src;
148 break;
149 case 2:
150 *(short*)dst = *(short*)src;
151 break;
152 case 3:
153 *((short*)dst)++ = *((short*)src)++;
154 *(char*)dst = *(char*)src;
155 break;
156 case 4:
157 *((long*)dst)++ = *((long*)src)++;
158 break;
159 case 5:
160 *((long*)dst)++ = *((long*)src)++;
161 *(char*)dst = *(char*)src;
162 break;
163 case 6:
164 *((long*)dst)++ = *((long*)src)++;
165 *(short*)dst = *(short*)src;
166 break;
167 case 7:
168 *((long*)dst)++ = *((long*)src)++;
169 *((short*)dst)++ = *((short*)src)++;
170 *(char*)dst = *(char*)src;
171 break;
172 case 8:
173 *((long*)dst)++ = *((long*)src)++;
174 *((long*)dst)++ = *((long*)src)++;
175 break;
176 case 9:
177 *((long*)dst)++ = *((long*)src)++;
178 *((long*)dst)++ = *((long*)src)++;
179 *(char*)dst = *(char*)src;
180 break;
181 case 10:
182 *((long*)dst)++ = *((long*)src)++;
183 *((long*)dst)++ = *((long*)src)++;
184 *(short*)dst = *(short*)src;
185 break;
186 case 11:
187 *((long*)dst)++ = *((long*)src)++;
188 *((long*)dst)++ = *((long*)src)++;
189 *((short*)dst)++ = *((short*)src)++;
190 *(char*)dst = *(char*)src;
191 break;
192 case 12:
193 *((long*)dst)++ = *((long*)src)++;
194 *((long*)dst)++ = *((long*)src)++;
195 *((long*)dst)++ = *((long*)src)++;
196 break;
197 case 13:
198 *((long*)dst)++ = *((long*)src)++;
199 *((long*)dst)++ = *((long*)src)++;
200 *((long*)dst)++ = *((long*)src)++;
201 *(char*)dst = *(char*)src;
202 break;
203 case 14:
204 *((long*)dst)++ = *((long*)src)++;
205 *((long*)dst)++ = *((long*)src)++;
206 *((long*)dst)++ = *((long*)src)++;
207 *(short*)dst = *(short*)src;
208 break;
209 case 15:
210 *((long*)dst)++ = *((long*)src)++;
211 *((long*)dst)++ = *((long*)src)++;
212 *((long*)dst)++ = *((long*)src)++;
213 *((short*)dst)++ = *((short*)src)++;
214 *(char*)dst = *(char*)src;
215 break;
216 }
217
218 return return_dst; /* destination pointer. */
219} /* memcpy() */
diff --git a/arch/cris/arch-v32/lib/usercopy.c b/arch/cris/arch-v32/lib/usercopy.c
new file mode 100644
index 000000000000..f0b08460c1be
--- /dev/null
+++ b/arch/cris/arch-v32/lib/usercopy.c
@@ -0,0 +1,470 @@
1/*
2 * User address space access functions.
3 * The non-inlined parts of asm-cris/uaccess.h are here.
4 *
5 * Copyright (C) 2000, 2003 Axis Communications AB.
6 *
7 * Written by Hans-Peter Nilsson.
8 * Pieces used from memcpy, originally by Kenny Ranerup long time ago.
9 */
10
11#include <asm/uaccess.h>
12
13/* Asm:s have been tweaked (within the domain of correctness) to give
14 satisfactory results for "gcc version 3.2.1 Axis release R53/1.53-v32".
15
16 Check regularly...
17
18 Note that for CRISv32, the PC saved at a bus-fault is the address
19 *at* the faulting instruction, with a special case for instructions
20 in delay slots: then it's the address of the branch. Note also that
21 in contrast to v10, a postincrement in the instruction is *not*
22 performed at a bus-fault; the register is seen having the original
23 value in fault handlers. */
24
25
26/* Copy to userspace. This is based on the memcpy used for
27 kernel-to-kernel copying; see "string.c". */
28
29unsigned long
30__copy_user (void __user *pdst, const void *psrc, unsigned long pn)
31{
32 /* We want the parameters put in special registers.
33 Make sure the compiler is able to make something useful of this.
34 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
35
36 FIXME: Comment for old gcc version. Check.
37 If gcc was allright, it really would need no temporaries, and no
38 stack space to save stuff on. */
39
40 register char *dst __asm__ ("r13") = pdst;
41 register const char *src __asm__ ("r11") = psrc;
42 register int n __asm__ ("r12") = pn;
43 register int retn __asm__ ("r10") = 0;
44
45
46 /* When src is aligned but not dst, this makes a few extra needless
47 cycles. I believe it would take as many to check that the
48 re-alignment was unnecessary. */
49 if (((unsigned long) dst & 3) != 0
50 /* Don't align if we wouldn't copy more than a few bytes; so we
51 don't have to check further for overflows. */
52 && n >= 3)
53 {
54 if ((unsigned long) dst & 1)
55 {
56 __asm_copy_to_user_1 (dst, src, retn);
57 n--;
58 }
59
60 if ((unsigned long) dst & 2)
61 {
62 __asm_copy_to_user_2 (dst, src, retn);
63 n -= 2;
64 }
65 }
66
67 /* Movem is dirt cheap. The overheap is low enough to always use the
68 minimum possible block size as the threshold. */
69 if (n >= 44)
70 {
71 /* For large copies we use 'movem'. */
72
73 /* It is not optimal to tell the compiler about clobbering any
74 registers; that will move the saving/restoring of those registers
75 to the function prologue/epilogue, and make non-movem sizes
76 suboptimal. */
77 __asm__ volatile ("\
78 ;; Check that the register asm declaration got right. \n\
79 ;; The GCC manual explicitly says TRT will happen. \n\
80 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
81 .err \n\
82 .endif \n\
83 \n\
84 ;; Save the registers we'll use in the movem process \n\
85 ;; on the stack. \n\
86 subq 11*4,$sp \n\
87 movem $r10,[$sp] \n\
88 \n\
89 ;; Now we've got this: \n\
90 ;; r11 - src \n\
91 ;; r13 - dst \n\
92 ;; r12 - n \n\
93 \n\
94 ;; Update n for the first loop \n\
95 subq 44,$r12 \n\
960: \n\
97 movem [$r11+],$r10 \n\
98 subq 44,$r12 \n\
991: bge 0b \n\
100 movem $r10,[$r13+] \n\
1013: \n\
102 addq 44,$r12 ;; compensate for last loop underflowing n \n\
103 \n\
104 ;; Restore registers from stack \n\
105 movem [$sp+],$r10 \n\
1062: \n\
107 .section .fixup,\"ax\" \n\
1084: \n\
109; When failing on any of the 1..44 bytes in a chunk, we adjust back the \n\
110; source pointer and just drop through to the by-16 and by-4 loops to \n\
111; get the correct number of failing bytes. This necessarily means a \n\
112; few extra exceptions, but invalid user pointers shouldn't happen in \n\
113; time-critical code anyway. \n\
114 jump 3b \n\
115 subq 44,$r11 \n\
116 \n\
117 .previous \n\
118 .section __ex_table,\"a\" \n\
119 .dword 1b,4b \n\
120 .previous"
121
122 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
123 /* Inputs */ : "0" (dst), "1" (src), "2" (n), "3" (retn));
124
125 }
126
127 while (n >= 16)
128 {
129 __asm_copy_to_user_16 (dst, src, retn);
130 n -= 16;
131 }
132
133 /* Having a separate by-four loops cuts down on cache footprint.
134 FIXME: Test with and without; increasing switch to be 0..15. */
135 while (n >= 4)
136 {
137 __asm_copy_to_user_4 (dst, src, retn);
138 n -= 4;
139 }
140
141 switch (n)
142 {
143 case 0:
144 break;
145 case 1:
146 __asm_copy_to_user_1 (dst, src, retn);
147 break;
148 case 2:
149 __asm_copy_to_user_2 (dst, src, retn);
150 break;
151 case 3:
152 __asm_copy_to_user_3 (dst, src, retn);
153 break;
154 }
155
156 return retn;
157}
158
159/* Copy from user to kernel, zeroing the bytes that were inaccessible in
160 userland. The return-value is the number of bytes that were
161 inaccessible. */
162
163unsigned long
164__copy_user_zeroing (void __user *pdst, const void *psrc, unsigned long pn)
165{
166 /* We want the parameters put in special registers.
167 Make sure the compiler is able to make something useful of this.
168 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
169
170 FIXME: Comment for old gcc version. Check.
171 If gcc was allright, it really would need no temporaries, and no
172 stack space to save stuff on. */
173
174 register char *dst __asm__ ("r13") = pdst;
175 register const char *src __asm__ ("r11") = psrc;
176 register int n __asm__ ("r12") = pn;
177 register int retn __asm__ ("r10") = 0;
178
179 /* The best reason to align src is that we then know that a read-fault
180 was for aligned bytes; there's no 1..3 remaining good bytes to
181 pickle. */
182 if (((unsigned long) src & 3) != 0)
183 {
184 if (((unsigned long) src & 1) && n != 0)
185 {
186 __asm_copy_from_user_1 (dst, src, retn);
187 n--;
188 }
189
190 if (((unsigned long) src & 2) && n >= 2)
191 {
192 __asm_copy_from_user_2 (dst, src, retn);
193 n -= 2;
194 }
195
196 /* We only need one check after the unalignment-adjustments, because
197 if both adjustments were done, either both or neither reference
198 had an exception. */
199 if (retn != 0)
200 goto copy_exception_bytes;
201 }
202
203 /* Movem is dirt cheap. The overheap is low enough to always use the
204 minimum possible block size as the threshold. */
205 if (n >= 44)
206 {
207 /* It is not optimal to tell the compiler about clobbering any
208 registers; that will move the saving/restoring of those registers
209 to the function prologue/epilogue, and make non-movem sizes
210 suboptimal. */
211 __asm__ volatile ("\
212 .ifnc %0%1%2%3,$r13$r11$r12$r10 \n\
213 .err \n\
214 .endif \n\
215 \n\
216 ;; Save the registers we'll use in the movem process \n\
217 ;; on the stack. \n\
218 subq 11*4,$sp \n\
219 movem $r10,[$sp] \n\
220 \n\
221 ;; Now we've got this: \n\
222 ;; r11 - src \n\
223 ;; r13 - dst \n\
224 ;; r12 - n \n\
225 \n\
226 ;; Update n for the first loop \n\
227 subq 44,$r12 \n\
2280: \n\
229 movem [$r11+],$r10 \n\
230 \n\
231 subq 44,$r12 \n\
232 bge 0b \n\
233 movem $r10,[$r13+] \n\
234 \n\
2354: \n\
236 addq 44,$r12 ;; compensate for last loop underflowing n \n\
237 \n\
238 ;; Restore registers from stack \n\
239 movem [$sp+],$r10 \n\
240 .section .fixup,\"ax\" \n\
241 \n\
242;; Do not jump back into the loop if we fail. For some uses, we get a \n\
243;; page fault somewhere on the line. Without checking for page limits, \n\
244;; we don't know where, but we need to copy accurately and keep an \n\
245;; accurate count; not just clear the whole line. To do that, we fall \n\
246;; down in the code below, proceeding with smaller amounts. It should \n\
247;; be kept in mind that we have to cater to code like what at one time \n\
248;; was in fs/super.c: \n\
249;; i = size - copy_from_user((void *)page, data, size); \n\
250;; which would cause repeated faults while clearing the remainder of \n\
251;; the SIZE bytes at PAGE after the first fault. \n\
252;; A caveat here is that we must not fall through from a failing page \n\
253;; to a valid page. \n\
254 \n\
2553: \n\
256 jump 4b ;; Fall through, pretending the fault didn't happen. \n\
257 nop \n\
258 \n\
259 .previous \n\
260 .section __ex_table,\"a\" \n\
261 .dword 0b,3b \n\
262 .previous"
263
264 /* Outputs */ : "=r" (dst), "=r" (src), "=r" (n), "=r" (retn)
265 /* Inputs */ : "0" (dst), "1" (src), "2" (n), "3" (retn));
266 }
267
268 /* Either we directly start copying here, using dword copying in a loop,
269 or we copy as much as possible with 'movem' and then the last block
270 (<44 bytes) is copied here. This will work since 'movem' will have
271 updated src, dst and n. (Except with failing src.)
272
273 Since we want to keep src accurate, we can't use
274 __asm_copy_from_user_N with N != (1, 2, 4); it updates dst and
275 retn, but not src (by design; it's value is ignored elsewhere). */
276
277 while (n >= 4)
278 {
279 __asm_copy_from_user_4 (dst, src, retn);
280 n -= 4;
281
282 if (retn)
283 goto copy_exception_bytes;
284 }
285
286 /* If we get here, there were no memory read faults. */
287 switch (n)
288 {
289 /* These copies are at least "naturally aligned" (so we don't have
290 to check each byte), due to the src alignment code before the
291 movem loop. The *_3 case *will* get the correct count for retn. */
292 case 0:
293 /* This case deliberately left in (if you have doubts check the
294 generated assembly code). */
295 break;
296 case 1:
297 __asm_copy_from_user_1 (dst, src, retn);
298 break;
299 case 2:
300 __asm_copy_from_user_2 (dst, src, retn);
301 break;
302 case 3:
303 __asm_copy_from_user_3 (dst, src, retn);
304 break;
305 }
306
307 /* If we get here, retn correctly reflects the number of failing
308 bytes. */
309 return retn;
310
311copy_exception_bytes:
312 /* We already have "retn" bytes cleared, and need to clear the
313 remaining "n" bytes. A non-optimized simple byte-for-byte in-line
314 memset is preferred here, since this isn't speed-critical code and
315 we'd rather have this a leaf-function than calling memset. */
316 {
317 char *endp;
318 for (endp = dst + n; dst < endp; dst++)
319 *dst = 0;
320 }
321
322 return retn + n;
323}
324
325/* Zero userspace. */
326
327unsigned long
328__do_clear_user (void __user *pto, unsigned long pn)
329{
330 /* We want the parameters put in special registers.
331 Make sure the compiler is able to make something useful of this.
332 As it is now: r10 -> r13; r11 -> r11 (nop); r12 -> r12 (nop).
333
334 FIXME: Comment for old gcc version. Check.
335 If gcc was allright, it really would need no temporaries, and no
336 stack space to save stuff on. */
337
338 register char *dst __asm__ ("r13") = pto;
339 register int n __asm__ ("r12") = pn;
340 register int retn __asm__ ("r10") = 0;
341
342
343 if (((unsigned long) dst & 3) != 0
344 /* Don't align if we wouldn't copy more than a few bytes. */
345 && n >= 3)
346 {
347 if ((unsigned long) dst & 1)
348 {
349 __asm_clear_1 (dst, retn);
350 n--;
351 }
352
353 if ((unsigned long) dst & 2)
354 {
355 __asm_clear_2 (dst, retn);
356 n -= 2;
357 }
358 }
359
360 /* Decide which copying method to use.
361 FIXME: This number is from the "ordinary" kernel memset. */
362 if (n >= 48)
363 {
364 /* For large clears we use 'movem' */
365
366 /* It is not optimal to tell the compiler about clobbering any
367 call-saved registers; that will move the saving/restoring of
368 those registers to the function prologue/epilogue, and make
369 non-movem sizes suboptimal.
370
371 This method is not foolproof; it assumes that the "asm reg"
372 declarations at the beginning of the function really are used
373 here (beware: they may be moved to temporary registers).
374 This way, we do not have to save/move the registers around into
375 temporaries; we can safely use them straight away.
376
377 If you want to check that the allocation was right; then
378 check the equalities in the first comment. It should say
379 something like "r13=r13, r11=r11, r12=r12". */
380 __asm__ volatile ("\
381 .ifnc %0%1%2,$r13$r12$r10 \n\
382 .err \n\
383 .endif \n\
384 \n\
385 ;; Save the registers we'll clobber in the movem process \n\
386 ;; on the stack. Don't mention them to gcc, it will only be \n\
387 ;; upset. \n\
388 subq 11*4,$sp \n\
389 movem $r10,[$sp] \n\
390 \n\
391 clear.d $r0 \n\
392 clear.d $r1 \n\
393 clear.d $r2 \n\
394 clear.d $r3 \n\
395 clear.d $r4 \n\
396 clear.d $r5 \n\
397 clear.d $r6 \n\
398 clear.d $r7 \n\
399 clear.d $r8 \n\
400 clear.d $r9 \n\
401 clear.d $r10 \n\
402 clear.d $r11 \n\
403 \n\
404 ;; Now we've got this: \n\
405 ;; r13 - dst \n\
406 ;; r12 - n \n\
407 \n\
408 ;; Update n for the first loop \n\
409 subq 12*4,$r12 \n\
4100: \n\
411 subq 12*4,$r12 \n\
4121: \n\
413 bge 0b \n\
414 movem $r11,[$r13+] \n\
415 \n\
416 addq 12*4,$r12 ;; compensate for last loop underflowing n \n\
417 \n\
418 ;; Restore registers from stack \n\
419 movem [$sp+],$r10 \n\
4202: \n\
421 .section .fixup,\"ax\" \n\
4223: \n\
423 movem [$sp],$r10 \n\
424 addq 12*4,$r10 \n\
425 addq 12*4,$r13 \n\
426 movem $r10,[$sp] \n\
427 jump 0b \n\
428 clear.d $r10 \n\
429 \n\
430 .previous \n\
431 .section __ex_table,\"a\" \n\
432 .dword 1b,3b \n\
433 .previous"
434
435 /* Outputs */ : "=r" (dst), "=r" (n), "=r" (retn)
436 /* Inputs */ : "0" (dst), "1" (n), "2" (retn)
437 /* Clobber */ : "r11");
438 }
439
440 while (n >= 16)
441 {
442 __asm_clear_16 (dst, retn);
443 n -= 16;
444 }
445
446 /* Having a separate by-four loops cuts down on cache footprint.
447 FIXME: Test with and without; increasing switch to be 0..15. */
448 while (n >= 4)
449 {
450 __asm_clear_4 (dst, retn);
451 n -= 4;
452 }
453
454 switch (n)
455 {
456 case 0:
457 break;
458 case 1:
459 __asm_clear_1 (dst, retn);
460 break;
461 case 2:
462 __asm_clear_2 (dst, retn);
463 break;
464 case 3:
465 __asm_clear_3 (dst, retn);
466 break;
467 }
468
469 return retn;
470}
diff --git a/arch/cris/arch-v32/mm/Makefile b/arch/cris/arch-v32/mm/Makefile
new file mode 100644
index 000000000000..9146f88484b1
--- /dev/null
+++ b/arch/cris/arch-v32/mm/Makefile
@@ -0,0 +1,3 @@
1# Makefile for the Linux/cris parts of the memory manager.
2
3obj-y := mmu.o init.o tlb.o intmem.o
diff --git a/arch/cris/arch-v32/mm/init.c b/arch/cris/arch-v32/mm/init.c
new file mode 100644
index 000000000000..f2fba27d822c
--- /dev/null
+++ b/arch/cris/arch-v32/mm/init.c
@@ -0,0 +1,174 @@
1/*
2 * Set up paging and the MMU.
3 *
4 * Copyright (C) 2000-2003, Axis Communications AB.
5 *
6 * Authors: Bjorn Wesen <bjornw@axis.com>
7 * Tobias Anderberg <tobiasa@axis.com>, CRISv32 port.
8 */
9#include <linux/config.h>
10#include <linux/mmzone.h>
11#include <linux/init.h>
12#include <linux/bootmem.h>
13#include <linux/mm.h>
14#include <linux/config.h>
15#include <asm/pgtable.h>
16#include <asm/page.h>
17#include <asm/types.h>
18#include <asm/mmu.h>
19#include <asm/io.h>
20#include <asm/mmu_context.h>
21#include <asm/arch/hwregs/asm/mmu_defs_asm.h>
22#include <asm/arch/hwregs/supp_reg.h>
23
24extern void tlb_init(void);
25
26/*
27 * The kernel is already mapped with linear mapping at kseg_c so there's no
28 * need to map it with a page table. However, head.S also temporarily mapped it
29 * at kseg_4 thus the ksegs are set up again. Also clear the TLB and do various
30 * other paging stuff.
31 */
32void __init
33cris_mmu_init(void)
34{
35 unsigned long mmu_config;
36 unsigned long mmu_kbase_hi;
37 unsigned long mmu_kbase_lo;
38 unsigned short mmu_page_id;
39
40 /*
41 * Make sure the current pgd table points to something sane, even if it
42 * is most probably not used until the next switch_mm.
43 */
44 per_cpu(current_pgd, smp_processor_id()) = init_mm.pgd;
45
46#ifdef CONFIG_SMP
47 {
48 pgd_t **pgd;
49 pgd = (pgd_t**)&per_cpu(current_pgd, smp_processor_id());
50 SUPP_BANK_SEL(1);
51 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
52 SUPP_BANK_SEL(2);
53 SUPP_REG_WR(RW_MM_TLB_PGD, pgd);
54 }
55#endif
56
57 /* Initialise the TLB. Function found in tlb.c. */
58 tlb_init();
59
60 /* Enable exceptions and initialize the kernel segments. */
61 mmu_config = ( REG_STATE(mmu, rw_mm_cfg, we, on) |
62 REG_STATE(mmu, rw_mm_cfg, acc, on) |
63 REG_STATE(mmu, rw_mm_cfg, ex, on) |
64 REG_STATE(mmu, rw_mm_cfg, inv, on) |
65 REG_STATE(mmu, rw_mm_cfg, seg_f, linear) |
66 REG_STATE(mmu, rw_mm_cfg, seg_e, linear) |
67 REG_STATE(mmu, rw_mm_cfg, seg_d, page) |
68 REG_STATE(mmu, rw_mm_cfg, seg_c, linear) |
69 REG_STATE(mmu, rw_mm_cfg, seg_b, linear) |
70#ifndef CONFIG_ETRAXFS_SIM
71 REG_STATE(mmu, rw_mm_cfg, seg_a, page) |
72#else
73 REG_STATE(mmu, rw_mm_cfg, seg_a, linear) |
74#endif
75 REG_STATE(mmu, rw_mm_cfg, seg_9, page) |
76 REG_STATE(mmu, rw_mm_cfg, seg_8, page) |
77 REG_STATE(mmu, rw_mm_cfg, seg_7, page) |
78 REG_STATE(mmu, rw_mm_cfg, seg_6, page) |
79 REG_STATE(mmu, rw_mm_cfg, seg_5, page) |
80 REG_STATE(mmu, rw_mm_cfg, seg_4, page) |
81 REG_STATE(mmu, rw_mm_cfg, seg_3, page) |
82 REG_STATE(mmu, rw_mm_cfg, seg_2, page) |
83 REG_STATE(mmu, rw_mm_cfg, seg_1, page) |
84 REG_STATE(mmu, rw_mm_cfg, seg_0, page));
85
86 mmu_kbase_hi = ( REG_FIELD(mmu, rw_mm_kbase_hi, base_f, 0x0) |
87 REG_FIELD(mmu, rw_mm_kbase_hi, base_e, 0x8) |
88 REG_FIELD(mmu, rw_mm_kbase_hi, base_d, 0x0) |
89#ifndef CONFIG_ETRAXFS_SIM
90 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x4) |
91#else
92 REG_FIELD(mmu, rw_mm_kbase_hi, base_c, 0x0) |
93#endif
94 REG_FIELD(mmu, rw_mm_kbase_hi, base_b, 0xb) |
95#ifndef CONFIG_ETRAXFS_SIM
96 REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0x0) |
97#else
98 REG_FIELD(mmu, rw_mm_kbase_hi, base_a, 0xa) |
99#endif
100 REG_FIELD(mmu, rw_mm_kbase_hi, base_9, 0x0) |
101 REG_FIELD(mmu, rw_mm_kbase_hi, base_8, 0x0));
102
103 mmu_kbase_lo = ( REG_FIELD(mmu, rw_mm_kbase_lo, base_7, 0x0) |
104 REG_FIELD(mmu, rw_mm_kbase_lo, base_6, 0x0) |
105 REG_FIELD(mmu, rw_mm_kbase_lo, base_5, 0x0) |
106 REG_FIELD(mmu, rw_mm_kbase_lo, base_4, 0x0) |
107 REG_FIELD(mmu, rw_mm_kbase_lo, base_3, 0x0) |
108 REG_FIELD(mmu, rw_mm_kbase_lo, base_2, 0x0) |
109 REG_FIELD(mmu, rw_mm_kbase_lo, base_1, 0x0) |
110 REG_FIELD(mmu, rw_mm_kbase_lo, base_0, 0x0));
111
112 mmu_page_id = REG_FIELD(mmu, rw_mm_tlb_hi, pid, 0);
113
114 /* Update the instruction MMU. */
115 SUPP_BANK_SEL(BANK_IM);
116 SUPP_REG_WR(RW_MM_CFG, mmu_config);
117 SUPP_REG_WR(RW_MM_KBASE_HI, mmu_kbase_hi);
118 SUPP_REG_WR(RW_MM_KBASE_LO, mmu_kbase_lo);
119 SUPP_REG_WR(RW_MM_TLB_HI, mmu_page_id);
120
121 /* Update the data MMU. */
122 SUPP_BANK_SEL(BANK_DM);
123 SUPP_REG_WR(RW_MM_CFG, mmu_config);
124 SUPP_REG_WR(RW_MM_KBASE_HI, mmu_kbase_hi);
125 SUPP_REG_WR(RW_MM_KBASE_LO, mmu_kbase_lo);
126 SUPP_REG_WR(RW_MM_TLB_HI, mmu_page_id);
127
128 SPEC_REG_WR(SPEC_REG_PID, 0);
129
130 /*
131 * The MMU has been enabled ever since head.S but just to make it
132 * totally obvious enable it here as well.
133 */
134 SUPP_BANK_SEL(BANK_GC);
135 SUPP_REG_WR(RW_GC_CFG, 0xf); /* IMMU, DMMU, ICache, DCache on */
136}
137
138void __init
139paging_init(void)
140{
141 int i;
142 unsigned long zones_size[MAX_NR_ZONES];
143
144 printk("Setting up paging and the MMU.\n");
145
146 /* Clear out the init_mm.pgd that will contain the kernel's mappings. */
147 for(i = 0; i < PTRS_PER_PGD; i++)
148 swapper_pg_dir[i] = __pgd(0);
149
150 cris_mmu_init();
151
152 /*
153 * Initialize the bad page table and bad page to point to a couple of
154 * allocated pages.
155 */
156 empty_zero_page = (unsigned long) alloc_bootmem_pages(PAGE_SIZE);
157 memset((void *) empty_zero_page, 0, PAGE_SIZE);
158
159 /* All pages are DMA'able in Etrax, so put all in the DMA'able zone. */
160 zones_size[0] = ((unsigned long) high_memory - PAGE_OFFSET) >> PAGE_SHIFT;
161
162 for (i = 1; i < MAX_NR_ZONES; i++)
163 zones_size[i] = 0;
164
165 /*
166 * Use free_area_init_node instead of free_area_init, because it is
167 * designed for systems where the DRAM starts at an address
168 * substantially higher than 0, like us (we start at PAGE_OFFSET). This
169 * saves space in the mem_map page array.
170 */
171 free_area_init_node(0, &contig_page_data, zones_size, PAGE_OFFSET >> PAGE_SHIFT, 0);
172
173 mem_map = contig_page_data.node_mem_map;
174}
diff --git a/arch/cris/arch-v32/mm/intmem.c b/arch/cris/arch-v32/mm/intmem.c
new file mode 100644
index 000000000000..41ee7f7997fd
--- /dev/null
+++ b/arch/cris/arch-v32/mm/intmem.c
@@ -0,0 +1,139 @@
1/*
2 * Simple allocator for internal RAM in ETRAX FS
3 *
4 * Copyright (c) 2004 Axis Communications AB.
5 */
6
7#include <linux/list.h>
8#include <linux/slab.h>
9#include <asm/io.h>
10#include <asm/arch/memmap.h>
11
12#define STATUS_FREE 0
13#define STATUS_ALLOCATED 1
14
15struct intmem_allocation {
16 struct list_head entry;
17 unsigned int size;
18 unsigned offset;
19 char status;
20};
21
22
23static struct list_head intmem_allocations;
24static void* intmem_virtual;
25
26static void crisv32_intmem_init(void)
27{
28 static int initiated = 0;
29 if (!initiated) {
30 struct intmem_allocation* alloc =
31 (struct intmem_allocation*)kmalloc(sizeof *alloc, GFP_KERNEL);
32 INIT_LIST_HEAD(&intmem_allocations);
33 intmem_virtual = ioremap(MEM_INTMEM_START, MEM_INTMEM_SIZE);
34 initiated = 1;
35 alloc->size = MEM_INTMEM_SIZE;
36 alloc->offset = 0;
37 alloc->status = STATUS_FREE;
38 list_add_tail(&alloc->entry, &intmem_allocations);
39 }
40}
41
42void* crisv32_intmem_alloc(unsigned size, unsigned align)
43{
44 struct intmem_allocation* allocation;
45 struct intmem_allocation* tmp;
46 void* ret = NULL;
47
48 preempt_disable();
49 crisv32_intmem_init();
50
51 list_for_each_entry_safe(allocation, tmp, &intmem_allocations, entry) {
52 int alignment = allocation->offset % align;
53 alignment = alignment ? align - alignment : alignment;
54
55 if (allocation->status == STATUS_FREE &&
56 allocation->size >= size + alignment) {
57 if (allocation->size > size + alignment) {
58 struct intmem_allocation* alloc =
59 (struct intmem_allocation*)
60 kmalloc(sizeof *alloc, GFP_ATOMIC);
61 alloc->status = STATUS_FREE;
62 alloc->size = allocation->size - size - alignment;
63 alloc->offset = allocation->offset + size;
64 list_add(&alloc->entry, &allocation->entry);
65
66 if (alignment) {
67 struct intmem_allocation* tmp;
68 tmp = (struct intmem_allocation*)
69 kmalloc(sizeof *tmp, GFP_ATOMIC);
70 tmp->offset = allocation->offset;
71 tmp->size = alignment;
72 tmp->status = STATUS_FREE;
73 allocation->offset += alignment;
74 list_add_tail(&tmp->entry, &allocation->entry);
75 }
76 }
77 allocation->status = STATUS_ALLOCATED;
78 allocation->size = size;
79 ret = (void*)((int)intmem_virtual + allocation->offset);
80 }
81 }
82 preempt_enable();
83 return ret;
84}
85
86void crisv32_intmem_free(void* addr)
87{
88 struct intmem_allocation* allocation;
89 struct intmem_allocation* tmp;
90
91 if (addr == NULL)
92 return;
93
94 preempt_disable();
95 crisv32_intmem_init();
96
97 list_for_each_entry_safe(allocation, tmp, &intmem_allocations, entry) {
98 if (allocation->offset == (int)(addr - intmem_virtual)) {
99 struct intmem_allocation* prev =
100 list_entry(allocation->entry.prev,
101 struct intmem_allocation, entry);
102 struct intmem_allocation* next =
103 list_entry(allocation->entry.next,
104 struct intmem_allocation, entry);
105
106 allocation->status = STATUS_FREE;
107 /* Join with prev and/or next if also free */
108 if (prev->status == STATUS_FREE) {
109 prev->size += allocation->size;
110 list_del(&allocation->entry);
111 kfree(allocation);
112 allocation = prev;
113 }
114 if (next->status == STATUS_FREE) {
115 allocation->size += next->size;
116 list_del(&next->entry);
117 kfree(next);
118 }
119 preempt_enable();
120 return;
121 }
122 }
123 preempt_enable();
124}
125
126void* crisv32_intmem_phys_to_virt(unsigned long addr)
127{
128 return (void*)(addr - MEM_INTMEM_START+
129 (unsigned long)intmem_virtual);
130}
131
132unsigned long crisv32_intmem_virt_to_phys(void* addr)
133{
134 return (unsigned long)((unsigned long )addr -
135 (unsigned long)intmem_virtual + MEM_INTMEM_START);
136}
137
138
139
diff --git a/arch/cris/arch-v32/mm/mmu.S b/arch/cris/arch-v32/mm/mmu.S
new file mode 100644
index 000000000000..27b70e5006af
--- /dev/null
+++ b/arch/cris/arch-v32/mm/mmu.S
@@ -0,0 +1,141 @@
1/*
2 * Copyright (C) 2003 Axis Communications AB
3 *
4 * Authors: Mikael Starvik (starvik@axis.com)
5 *
6 * Code for the fault low-level handling routines.
7 *
8 */
9
10#include <asm/page.h>
11#include <asm/pgtable.h>
12
13; Save all register. Must save in same order as struct pt_regs.
14.macro SAVE_ALL
15 subq 12, $sp
16 move $erp, [$sp]
17 subq 4, $sp
18 move $srp, [$sp]
19 subq 4, $sp
20 move $ccs, [$sp]
21 subq 4, $sp
22 move $spc, [$sp]
23 subq 4, $sp
24 move $mof, [$sp]
25 subq 4, $sp
26 move $srs, [$sp]
27 subq 4, $sp
28 move.d $acr, [$sp]
29 subq 14*4, $sp
30 movem $r13, [$sp]
31 subq 4, $sp
32 move.d $r10, [$sp]
33.endm
34
35; Bus fault handler. Extracts relevant information and calls mm subsystem
36; to handle the fault.
37.macro MMU_BUS_FAULT_HANDLER handler, mmu, we, ex
38 .globl \handler
39\handler:
40 SAVE_ALL
41 move \mmu, $srs ; Select MMU support register bank
42 move.d $sp, $r11 ; regs
43 moveq 1, $r12 ; protection fault
44 moveq \we, $r13 ; write exception?
45 orq \ex << 1, $r13 ; execute?
46 move $s3, $r10 ; rw_mm_cause
47 and.d ~8191, $r10 ; Get faulting page start address
48
49 jsr do_page_fault
50 nop
51 ba ret_from_intr
52 nop
53.endm
54
55; Refill handler. Three cases may occur:
56; 1. PMD and PTE exists in mm subsystem but not in TLB
57; 2. PMD exists but not PTE
58; 3. PMD doesn't exist
59; The code below handles case 1 and calls the mm subsystem for case 2 and 3.
60; Do not touch this code without very good reasons and extensive testing.
61; Note that the code is optimized to minimize stalls (makes the code harder
62; to read).
63;
64; Each page is 8 KB. Each PMD holds 8192/4 PTEs (each PTE is 4 bytes) so each
65; PMD holds 16 MB of virtual memory.
66; Bits 0-12 : Offset within a page
67; Bits 13-23 : PTE offset within a PMD
68; Bits 24-31 : PMD offset within the PGD
69
70.macro MMU_REFILL_HANDLER handler, mmu
71 .globl \handler
72\handler:
73 subq 4, $sp
74; (The pipeline stalls for one cycle; $sp used as address in the next cycle.)
75 move $srs, [$sp]
76 subq 4, $sp
77 move \mmu, $srs ; Select MMU support register bank
78 move.d $acr, [$sp]
79 subq 4, $sp
80 move.d $r0, [$sp]
81#ifdef CONFIG_SMP
82 move $s7, $acr ; PGD
83#else
84 move.d per_cpu__current_pgd, $acr ; PGD
85#endif
86 ; Look up PMD in PGD
87 move $s3, $r0 ; rw_mm_cause
88 lsrq 24, $r0 ; Get PMD index into PGD (bit 24-31)
89 move.d [$acr], $acr ; PGD for the current process
90 addi $r0.d, $acr, $acr
91 move $s3, $r0 ; rw_mm_cause
92 move.d [$acr], $acr ; Get PMD
93 beq 1f
94 ; Look up PTE in PMD
95 lsrq PAGE_SHIFT, $r0
96 and.w PAGE_MASK, $acr ; Remove PMD flags
97 and.d 0x7ff, $r0 ; Get PTE index into PMD (bit 13-23)
98 addi $r0.d, $acr, $acr
99 move.d [$acr], $acr ; Get PTE
100 beq 2f
101 move.d [$sp+], $r0 ; Pop r0 in delayslot
102 ; Store in TLB
103 move $acr, $s5
104 ; Return
105 move.d [$sp+], $acr
106 move [$sp], $srs
107 addq 4, $sp
108 rete
109 rfe
1101: ; PMD missing, let the mm subsystem fix it up.
111 move.d [$sp+], $r0 ; Pop r0
1122: ; PTE missing, let the mm subsystem fix it up.
113 move.d [$sp+], $acr
114 move [$sp], $srs
115 addq 4, $sp
116 SAVE_ALL
117 move \mmu, $srs
118 move.d $sp, $r11 ; regs
119 clear.d $r12 ; Not a protection fault
120 move.w PAGE_MASK, $acr
121 move $s3, $r10 ; rw_mm_cause
122 btstq 9, $r10 ; Check if write access
123 smi $r13
124 and.w PAGE_MASK, $r10 ; Get VPN (virtual address)
125 jsr do_page_fault
126 and.w $acr, $r10
127 ; Return
128 ba ret_from_intr
129 nop
130.endm
131
132 ; This is the MMU bus fault handlers.
133
134MMU_REFILL_HANDLER i_mmu_refill, 1
135MMU_BUS_FAULT_HANDLER i_mmu_invalid, 1, 0, 0
136MMU_BUS_FAULT_HANDLER i_mmu_access, 1, 0, 0
137MMU_BUS_FAULT_HANDLER i_mmu_execute, 1, 0, 1
138MMU_REFILL_HANDLER d_mmu_refill, 2
139MMU_BUS_FAULT_HANDLER d_mmu_invalid, 2, 0, 0
140MMU_BUS_FAULT_HANDLER d_mmu_access, 2, 0, 0
141MMU_BUS_FAULT_HANDLER d_mmu_write, 2, 1, 0
diff --git a/arch/cris/arch-v32/mm/tlb.c b/arch/cris/arch-v32/mm/tlb.c
new file mode 100644
index 000000000000..8233406798d3
--- /dev/null
+++ b/arch/cris/arch-v32/mm/tlb.c
@@ -0,0 +1,208 @@
1/*
2 * Low level TLB handling.
3 *
4 * Copyright (C) 2000-2003, Axis Communications AB.
5 *
6 * Authors: Bjorn Wesen <bjornw@axis.com>
7 * Tobias Anderberg <tobiasa@axis.com>, CRISv32 port.
8 */
9
10#include <asm/tlb.h>
11#include <asm/mmu_context.h>
12#include <asm/arch/hwregs/asm/mmu_defs_asm.h>
13#include <asm/arch/hwregs/supp_reg.h>
14
15#define UPDATE_TLB_SEL_IDX(val) \
16do { \
17 unsigned long tlb_sel; \
18 \
19 tlb_sel = REG_FIELD(mmu, rw_mm_tlb_sel, idx, val); \
20 SUPP_REG_WR(RW_MM_TLB_SEL, tlb_sel); \
21} while(0)
22
23#define UPDATE_TLB_HILO(tlb_hi, tlb_lo) \
24do { \
25 SUPP_REG_WR(RW_MM_TLB_HI, tlb_hi); \
26 SUPP_REG_WR(RW_MM_TLB_LO, tlb_lo); \
27} while(0)
28
29/*
30 * The TLB can host up to 256 different mm contexts at the same time. The running
31 * context is found in the PID register. Each TLB entry contains a page_id that
32 * has to match the PID register to give a hit. page_id_map keeps track of which
33 * mm's is assigned to which page_id's, making sure it's known when to
34 * invalidate TLB entries.
35 *
36 * The last page_id is never running, it is used as an invalid page_id so that
37 * it's possible to make TLB entries that will nerver match.
38 *
39 * Note; the flushes needs to be atomic otherwise an interrupt hander that uses
40 * vmalloc'ed memory might cause a TLB load in the middle of a flush.
41 */
42
43/* Flush all TLB entries. */
44void
45__flush_tlb_all(void)
46{
47 int i;
48 int mmu;
49 unsigned long flags;
50 unsigned long mmu_tlb_hi;
51 unsigned long mmu_tlb_sel;
52
53 /*
54 * Mask with 0xf so similar TLB entries aren't written in the same 4-way
55 * entry group.
56 */
57 local_save_flags(flags);
58 local_irq_disable();
59
60 for (mmu = 1; mmu <= 2; mmu++) {
61 SUPP_BANK_SEL(mmu); /* Select the MMU */
62 for (i = 0; i < NUM_TLB_ENTRIES; i++) {
63 /* Store invalid entry */
64 mmu_tlb_sel = REG_FIELD(mmu, rw_mm_tlb_sel, idx, i);
65
66 mmu_tlb_hi = (REG_FIELD(mmu, rw_mm_tlb_hi, pid, INVALID_PAGEID)
67 | REG_FIELD(mmu, rw_mm_tlb_hi, vpn, i & 0xf));
68
69 SUPP_REG_WR(RW_MM_TLB_SEL, mmu_tlb_sel);
70 SUPP_REG_WR(RW_MM_TLB_HI, mmu_tlb_hi);
71 SUPP_REG_WR(RW_MM_TLB_LO, 0);
72 }
73 }
74
75 local_irq_restore(flags);
76}
77
78/* Flush an entire user address space. */
79void
80__flush_tlb_mm(struct mm_struct *mm)
81{
82 int i;
83 int mmu;
84 unsigned long flags;
85 unsigned long page_id;
86 unsigned long tlb_hi;
87 unsigned long mmu_tlb_hi;
88
89 page_id = mm->context.page_id;
90
91 if (page_id == NO_CONTEXT)
92 return;
93
94 /* Mark the TLB entries that match the page_id as invalid. */
95 local_save_flags(flags);
96 local_irq_disable();
97
98 for (mmu = 1; mmu <= 2; mmu++) {
99 SUPP_BANK_SEL(mmu);
100 for (i = 0; i < NUM_TLB_ENTRIES; i++) {
101 UPDATE_TLB_SEL_IDX(i);
102
103 /* Get the page_id */
104 SUPP_REG_RD(RW_MM_TLB_HI, tlb_hi);
105
106 /* Check if the page_id match. */
107 if ((tlb_hi & 0xff) == page_id) {
108 mmu_tlb_hi = (REG_FIELD(mmu, rw_mm_tlb_hi, pid,
109 INVALID_PAGEID)
110 | REG_FIELD(mmu, rw_mm_tlb_hi, vpn,
111 i & 0xf));
112
113 UPDATE_TLB_HILO(mmu_tlb_hi, 0);
114 }
115 }
116 }
117
118 local_irq_restore(flags);
119}
120
121/* Invalidate a single page. */
122void
123__flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
124{
125 int i;
126 int mmu;
127 unsigned long page_id;
128 unsigned long flags;
129 unsigned long tlb_hi;
130 unsigned long mmu_tlb_hi;
131
132 page_id = vma->vm_mm->context.page_id;
133
134 if (page_id == NO_CONTEXT)
135 return;
136
137 addr &= PAGE_MASK;
138
139 /*
140 * Invalidate those TLB entries that match both the mm context and the
141 * requested virtual address.
142 */
143 local_save_flags(flags);
144 local_irq_disable();
145
146 for (mmu = 1; mmu <= 2; mmu++) {
147 SUPP_BANK_SEL(mmu);
148 for (i = 0; i < NUM_TLB_ENTRIES; i++) {
149 UPDATE_TLB_SEL_IDX(i);
150 SUPP_REG_RD(RW_MM_TLB_HI, tlb_hi);
151
152 /* Check if page_id and address matches */
153 if (((tlb_hi & 0xff) == page_id) &&
154 ((tlb_hi & PAGE_MASK) == addr)) {
155 mmu_tlb_hi = REG_FIELD(mmu, rw_mm_tlb_hi, pid,
156 INVALID_PAGEID) | addr;
157
158 UPDATE_TLB_HILO(mmu_tlb_hi, 0);
159 }
160 }
161 }
162
163 local_irq_restore(flags);
164}
165
166/*
167 * Initialize the context related info for a new mm_struct
168 * instance.
169 */
170
171int
172init_new_context(struct task_struct *tsk, struct mm_struct *mm)
173{
174 mm->context.page_id = NO_CONTEXT;
175 return 0;
176}
177
178/* Called in schedule() just before actually doing the switch_to. */
179void
180switch_mm(struct mm_struct *prev, struct mm_struct *next,
181 struct task_struct *tsk)
182{
183 int cpu = smp_processor_id();
184
185 /* Make sure there is a MMU context. */
186 spin_lock(&next->page_table_lock);
187 get_mmu_context(next);
188 cpu_set(cpu, next->cpu_vm_mask);
189 spin_unlock(&next->page_table_lock);
190
191 /*
192 * Remember the pgd for the fault handlers. Keep a seperate copy of it
193 * because current and active_mm might be invalid at points where
194 * there's still a need to derefer the pgd.
195 */
196 per_cpu(current_pgd, cpu) = next->pgd;
197
198 /* Switch context in the MMU. */
199 if (tsk && tsk->thread_info)
200 {
201 SPEC_REG_WR(SPEC_REG_PID, next->context.page_id | tsk->thread_info->tls);
202 }
203 else
204 {
205 SPEC_REG_WR(SPEC_REG_PID, next->context.page_id);
206 }
207}
208
diff --git a/arch/cris/arch-v32/output_arch.ld b/arch/cris/arch-v32/output_arch.ld
new file mode 100644
index 000000000000..d60a57db0ec2
--- /dev/null
+++ b/arch/cris/arch-v32/output_arch.ld
@@ -0,0 +1,2 @@
1/* At the time of this writing, there's no equivalent ld option. */
2OUTPUT_ARCH (crisv32)
diff --git a/arch/cris/arch-v32/vmlinux.lds.S b/arch/cris/arch-v32/vmlinux.lds.S
new file mode 100644
index 000000000000..adb94605d92a
--- /dev/null
+++ b/arch/cris/arch-v32/vmlinux.lds.S
@@ -0,0 +1,134 @@
1/* ld script to make the Linux/CRIS kernel
2 * Authors: Bjorn Wesen (bjornw@axis.com)
3 *
4 * It is VERY DANGEROUS to fiddle around with the symbols in this
5 * script. It is for example quite vital that all generated sections
6 * that are used are actually named here, otherwise the linker will
7 * put them at the end, where the init stuff is which is FREED after
8 * the kernel has booted.
9 */
10
11#include <linux/config.h>
12#include <asm-generic/vmlinux.lds.h>
13
14jiffies = jiffies_64;
15SECTIONS
16{
17 . = DRAM_VIRTUAL_BASE;
18 dram_start = .;
19 ebp_start = .;
20
21 /* The boot section is only necessary until the VCS top level testbench */
22 /* includes both flash and DRAM. */
23 .boot : { *(.boot) }
24
25 . = DRAM_VIRTUAL_BASE + 0x4000; /* See head.S and pages reserved at the start. */
26
27 _text = .; /* Text and read-only data. */
28 text_start = .; /* Lots of aliases. */
29 _stext = .;
30 __stext = .;
31 .text : {
32 *(.text)
33 SCHED_TEXT
34 LOCK_TEXT
35 *(.fixup)
36 *(.text.__*)
37 }
38
39 _etext = . ; /* End of text section. */
40 __etext = .;
41
42 . = ALIGN(4); /* Exception table. */
43 __start___ex_table = .;
44 __ex_table : { *(__ex_table) }
45 __stop___ex_table = .;
46
47 RODATA
48
49 . = ALIGN (4);
50 ___data_start = . ;
51 __Sdata = . ;
52 .data : { /* Data */
53 *(.data)
54 }
55 __edata = . ; /* End of data section. */
56 _edata = . ;
57
58 . = ALIGN(8192); /* init_task and stack, must be aligned. */
59 .data.init_task : { *(.data.init_task) }
60
61 . = ALIGN(8192); /* Init code and data. */
62 __init_begin = .;
63 .init.text : {
64 _sinittext = .;
65 *(.init.text)
66 _einittext = .;
67 }
68 .init.data : { *(.init.data) }
69 . = ALIGN(16);
70 __setup_start = .;
71 .init.setup : { *(.init.setup) }
72 __setup_end = .;
73 __start___param = .;
74 __param : { *(__param) }
75 __stop___param = .;
76 .initcall.init : {
77 __initcall_start = .;
78 *(.initcall1.init);
79 *(.initcall2.init);
80 *(.initcall3.init);
81 *(.initcall4.init);
82 *(.initcall5.init);
83 *(.initcall6.init);
84 *(.initcall7.init);
85 __initcall_end = .;
86 }
87
88 .con_initcall.init : {
89 __con_initcall_start = .;
90 *(.con_initcall.init)
91 __con_initcall_end = .;
92 }
93 SECURITY_INIT
94
95 __per_cpu_start = .;
96 .data.percpu : { *(.data.percpu) }
97 __per_cpu_end = .;
98
99 .init.ramfs : {
100 __initramfs_start = .;
101 *(.init.ramfs)
102 __initramfs_end = .;
103 /*
104 * We fill to the next page, so we can discard all init
105 * pages without needing to consider what payload might be
106 * appended to the kernel image.
107 */
108 FILL (0);
109 . = ALIGN (8192);
110 }
111
112 __vmlinux_end = .; /* Last address of the physical file. */
113 __init_end = .;
114
115 __data_end = . ; /* Move to _edata? */
116 __bss_start = .; /* BSS. */
117 .bss : {
118 *(COMMON)
119 *(.bss)
120 }
121
122 . = ALIGN (0x20);
123 _end = .;
124 __end = .;
125
126 /* Sections to be discarded */
127 /DISCARD/ : {
128 *(.text.exit)
129 *(.data.exit)
130 *(.exitcall.exit)
131 }
132
133 dram_end = dram_start + CONFIG_ETRAX_DRAM_SIZE*1024*1024;
134}
diff --git a/arch/cris/defconfig b/arch/cris/defconfig
index 32c9c987dbaa..142a10818af3 100644
--- a/arch/cris/defconfig
+++ b/arch/cris/defconfig
@@ -1,22 +1,27 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11
4# Mon Jun 20 13:42:02 2005
3# 5#
4CONFIG_MMU=y 6CONFIG_MMU=y
5CONFIG_UID16=y 7CONFIG_UID16=y
6CONFIG_RWSEM_GENERIC_SPINLOCK=y 8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9CONFIG_GENERIC_IOMAP=y
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11CONFIG_CRIS=y
7 12
8# 13#
9# Code maturity level options 14# Code maturity level options
10# 15#
11CONFIG_EXPERIMENTAL=y 16CONFIG_EXPERIMENTAL=y
12CONFIG_CLEAN_COMPILE=y 17CONFIG_CLEAN_COMPILE=y
13CONFIG_STANDALONE=y
14CONFIG_BROKEN_ON_SMP=y 18CONFIG_BROKEN_ON_SMP=y
15 19
16# 20#
17# General setup 21# General setup
18# 22#
19CONFIG_SWAP=y 23CONFIG_LOCALVERSION=""
24# CONFIG_SWAP is not set
20# CONFIG_SYSVIPC is not set 25# CONFIG_SYSVIPC is not set
21# CONFIG_POSIX_MQUEUE is not set 26# CONFIG_POSIX_MQUEUE is not set
22# CONFIG_BSD_PROCESS_ACCT is not set 27# CONFIG_BSD_PROCESS_ACCT is not set
@@ -24,16 +29,19 @@ CONFIG_SYSCTL=y
24# CONFIG_AUDIT is not set 29# CONFIG_AUDIT is not set
25CONFIG_LOG_BUF_SHIFT=14 30CONFIG_LOG_BUF_SHIFT=14
26# CONFIG_HOTPLUG is not set 31# CONFIG_HOTPLUG is not set
32CONFIG_KOBJECT_UEVENT=y
27# CONFIG_IKCONFIG is not set 33# CONFIG_IKCONFIG is not set
28CONFIG_EMBEDDED=y 34CONFIG_EMBEDDED=y
29# CONFIG_KALLSYMS is not set 35# CONFIG_KALLSYMS is not set
30CONFIG_FUTEX=y 36CONFIG_FUTEX=y
31CONFIG_EPOLL=y 37CONFIG_EPOLL=y
32CONFIG_IOSCHED_NOOP=y
33CONFIG_IOSCHED_AS=y
34CONFIG_IOSCHED_DEADLINE=y
35CONFIG_IOSCHED_CFQ=y
36# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 38# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
39CONFIG_SHMEM=y
40CONFIG_CC_ALIGN_FUNCTIONS=0
41CONFIG_CC_ALIGN_LABELS=0
42CONFIG_CC_ALIGN_LOOPS=0
43CONFIG_CC_ALIGN_JUMPS=0
44# CONFIG_TINY_SHMEM is not set
37 45
38# 46#
39# Loadable module support 47# Loadable module support
@@ -45,23 +53,28 @@ CONFIG_IOSCHED_CFQ=y
45# 53#
46CONFIG_BINFMT_ELF=y 54CONFIG_BINFMT_ELF=y
47# CONFIG_BINFMT_MISC is not set 55# CONFIG_BINFMT_MISC is not set
56CONFIG_GENERIC_HARDIRQS=y
57# CONFIG_SMP is not set
48CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc" 58CONFIG_ETRAX_CMDLINE="root=/dev/mtdblock3 init=/linuxrc"
49CONFIG_ETRAX_WATCHDOG=y 59# CONFIG_ETRAX_WATCHDOG is not set
50CONFIG_ETRAX_WATCHDOG_NICE_DOGGY=y
51CONFIG_ETRAX_FAST_TIMER=y 60CONFIG_ETRAX_FAST_TIMER=y
52# CONFIG_PREEMPT is not set 61# CONFIG_PREEMPT is not set
62# CONFIG_OOM_REBOOT is not set
53 63
54# 64#
55# Hardware setup 65# Hardware setup
56# 66#
57CONFIG_ETRAX100LX=y 67# CONFIG_ETRAX100LX is not set
58# CONFIG_ETRAX100LX_V2 is not set 68CONFIG_ETRAX100LX_V2=y
59# CONFIG_SVINTO_SIM is not set 69# CONFIG_SVINTO_SIM is not set
70# CONFIG_ETRAXFS is not set
71# CONFIG_ETRAXFS_SIM is not set
60CONFIG_ETRAX_ARCH_V10=y 72CONFIG_ETRAX_ARCH_V10=y
61CONFIG_ETRAX_DRAM_SIZE=16 73# CONFIG_ETRAX_ARCH_V32 is not set
74CONFIG_ETRAX_DRAM_SIZE=32
62CONFIG_ETRAX_FLASH_BUSWIDTH=2 75CONFIG_ETRAX_FLASH_BUSWIDTH=2
63CONFIG_CRIS_LOW_MAP=y 76CONFIG_ETRAX_FLASH1_SIZE=4
64CONFIG_ETRAX_DRAM_VIRTUAL_BASE=60000000 77CONFIG_ETRAX_DRAM_VIRTUAL_BASE=c0000000
65CONFIG_ETRAX_PA_LEDS=y 78CONFIG_ETRAX_PA_LEDS=y
66# CONFIG_ETRAX_PB_LEDS is not set 79# CONFIG_ETRAX_PB_LEDS is not set
67# CONFIG_ETRAX_CSP0_LEDS is not set 80# CONFIG_ETRAX_CSP0_LEDS is not set
@@ -81,13 +94,13 @@ CONFIG_ETRAX_RESCUE_SER0=y
81# CONFIG_ETRAX_RESCUE_SER1 is not set 94# CONFIG_ETRAX_RESCUE_SER1 is not set
82# CONFIG_ETRAX_RESCUE_SER2 is not set 95# CONFIG_ETRAX_RESCUE_SER2 is not set
83# CONFIG_ETRAX_RESCUE_SER3 is not set 96# CONFIG_ETRAX_RESCUE_SER3 is not set
84CONFIG_ETRAX_DEF_R_WAITSTATES=0x95f8 97CONFIG_ETRAX_DEF_R_WAITSTATES=0x95a6
85CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x104 98CONFIG_ETRAX_DEF_R_BUS_CONFIG=0x4
86CONFIG_ETRAX_SDRAM=y 99CONFIG_ETRAX_SDRAM=y
87CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x00e03636 100CONFIG_ETRAX_DEF_R_SDRAM_CONFIG=0x09e05757
88CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002 101CONFIG_ETRAX_DEF_R_SDRAM_TIMING=0x80008002
89CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d 102CONFIG_ETRAX_DEF_R_PORT_PA_DIR=0x1d
90CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0xf0 103CONFIG_ETRAX_DEF_R_PORT_PA_DATA=0x00
91CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00 104CONFIG_ETRAX_DEF_R_PORT_PB_CONFIG=0x00
92CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e 105CONFIG_ETRAX_DEF_R_PORT_PB_DIR=0x1e
93CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3 106CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3
@@ -97,16 +110,17 @@ CONFIG_ETRAX_DEF_R_PORT_PB_DATA=0xf3
97# Drivers for built-in interfaces 110# Drivers for built-in interfaces
98# 111#
99CONFIG_ETRAX_ETHERNET=y 112CONFIG_ETRAX_ETHERNET=y
100CONFIG_NET_ETHERNET=y
101# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set 113# CONFIG_ETRAX_NETWORK_LED_ON_WHEN_LINK is not set
102CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y 114CONFIG_ETRAX_NETWORK_LED_ON_WHEN_ACTIVITY=y
103CONFIG_ETRAX_SERIAL=y 115CONFIG_ETRAX_SERIAL=y
104CONFIG_ETRAX_SERIAL_FAST_TIMER=y 116# CONFIG_ETRAX_SERIAL_FAST_TIMER is not set
117# CONFIG_ETRAX_SERIAL_FLUSH_DMA_FAST is not set
118CONFIG_ETRAX_SERIAL_RX_TIMEOUT_TICKS=5
105CONFIG_ETRAX_SERIAL_PORT0=y 119CONFIG_ETRAX_SERIAL_PORT0=y
106# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set 120# CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_OUT is not set
107CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y 121CONFIG_ETRAX_SERIAL_PORT0_DMA6_OUT=y
108# CONFIG_CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set 122# CONFIG_ETRAX_SERIAL_PORT0_NO_DMA_IN is not set
109CONFIG_CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y 123CONFIG_ETRAX_SERIAL_PORT0_DMA7_IN=y
110CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y 124CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_NONE=y
111# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set 125# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PA is not set
112# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set 126# CONFIG_ETRAX_SER0_DTR_RI_DSR_CD_ON_PB is not set
@@ -121,10 +135,10 @@ CONFIG_ETRAX_SER0_DSR_ON_PB_BIT=-1
121CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1 135CONFIG_ETRAX_SER0_CD_ON_PB_BIT=-1
122# CONFIG_ETRAX_SERIAL_PORT1 is not set 136# CONFIG_ETRAX_SERIAL_PORT1 is not set
123CONFIG_ETRAX_SERIAL_PORT2=y 137CONFIG_ETRAX_SERIAL_PORT2=y
124# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set 138# CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_OUT is not set
125CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y 139CONFIG_ETRAX_SERIAL_PORT2_DMA2_OUT=y
126# CONFIG_CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set 140# CONFIG_ETRAX_SERIAL_PORT2_NO_DMA_IN is not set
127CONFIG_CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y 141CONFIG_ETRAX_SERIAL_PORT2_DMA3_IN=y
128CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y 142CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_NONE=y
129# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set 143# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PA is not set
130# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set 144# CONFIG_ETRAX_SER2_DTR_RI_DSR_CD_ON_PB is not set
@@ -138,44 +152,51 @@ CONFIG_ETRAX_SER2_RI_ON_PB_BIT=-1
138CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1 152CONFIG_ETRAX_SER2_DSR_ON_PB_BIT=-1
139CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1 153CONFIG_ETRAX_SER2_CD_ON_PB_BIT=-1
140# CONFIG_ETRAX_SERIAL_PORT3 is not set 154# CONFIG_ETRAX_SERIAL_PORT3 is not set
141# CONFIG_ETRAX_RS485 is not set 155CONFIG_ETRAX_RS485=y
142# CONFIG_ETRAX_IDE is not set 156# CONFIG_ETRAX_RS485_ON_PA is not set
143# CONFIG_IDE is not set 157# CONFIG_ETRAX_RS485_DISABLE_RECEIVER is not set
144# CONFIG_ETRAX_USB_HOST is not set 158CONFIG_ETRAX_IDE=y
159CONFIG_ETRAX_IDE_DELAY=15
160CONFIG_ETRAX_IDE_PB7_RESET=y
161# CONFIG_ETRAX_IDE_G27_RESET is not set
162CONFIG_ETRAX_USB_HOST=y
163CONFIG_ETRAX_USB_HOST_PORT1=y
164CONFIG_ETRAX_USB_HOST_PORT2=y
145CONFIG_ETRAX_AXISFLASHMAP=y 165CONFIG_ETRAX_AXISFLASHMAP=y
146CONFIG_ETRAX_PTABLE_SECTOR=65536 166CONFIG_ETRAX_PTABLE_SECTOR=65536
147CONFIG_MTD=y
148CONFIG_MTD_CFI=y
149CONFIG_MTD_CFI_AMDSTD=y
150CONFIG_MTD_OBSOLETE_CHIPS=y
151CONFIG_MTD_AMDSTD=y
152CONFIG_MTD_CHAR=y
153CONFIG_MTD_BLOCK=y
154CONFIG_MTD_PARTITIONS=y
155CONFIG_MTD_CONCAT=y
156# CONFIG_ETRAX_I2C is not set 167# CONFIG_ETRAX_I2C is not set
157CONFIG_ETRAX_GPIO=y 168# CONFIG_ETRAX_GPIO is not set
158CONFIG_ETRAX_PA_BUTTON_BITMASK=0x02 169CONFIG_ETRAX_RTC=y
159CONFIG_ETRAX_PA_CHANGEABLE_DIR=0x00 170CONFIG_ETRAX_DS1302=y
160CONFIG_ETRAX_PA_CHANGEABLE_BITS=0xFF 171# CONFIG_ETRAX_PCF8563 is not set
161CONFIG_ETRAX_PB_CHANGEABLE_DIR=0x00 172CONFIG_ETRAX_DS1302_RST_ON_GENERIC_PORT=y
162CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF 173CONFIG_ETRAX_DS1302_RSTBIT=0
163# CONFIG_ETRAX_RTC is not set 174CONFIG_ETRAX_DS1302_SCLBIT=1
175CONFIG_ETRAX_DS1302_SDABIT=0
176CONFIG_ETRAX_DS1302_TRICKLE_CHARGE=0
164 177
165# 178#
166# Generic Driver Options 179# Generic Driver Options
167# 180#
181CONFIG_STANDALONE=y
182CONFIG_PREVENT_FIRMWARE_BUILD=y
183# CONFIG_FW_LOADER is not set
168 184
169# 185#
170# Memory Technology Devices (MTD) 186# Memory Technology Devices (MTD)
171# 187#
188CONFIG_MTD=y
172# CONFIG_MTD_DEBUG is not set 189# CONFIG_MTD_DEBUG is not set
190CONFIG_MTD_PARTITIONS=y
191CONFIG_MTD_CONCAT=y
173# CONFIG_MTD_REDBOOT_PARTS is not set 192# CONFIG_MTD_REDBOOT_PARTS is not set
174# CONFIG_MTD_CMDLINE_PARTS is not set 193# CONFIG_MTD_CMDLINE_PARTS is not set
175 194
176# 195#
177# User Modules And Translation Layers 196# User Modules And Translation Layers
178# 197#
198CONFIG_MTD_CHAR=y
199CONFIG_MTD_BLOCK=y
179# CONFIG_FTL is not set 200# CONFIG_FTL is not set
180# CONFIG_NFTL is not set 201# CONFIG_NFTL is not set
181# CONFIG_INFTL is not set 202# CONFIG_INFTL is not set
@@ -183,14 +204,30 @@ CONFIG_ETRAX_PB_CHANGEABLE_BITS=0xFF
183# 204#
184# RAM/ROM/Flash chip drivers 205# RAM/ROM/Flash chip drivers
185# 206#
207CONFIG_MTD_CFI=y
186# CONFIG_MTD_JEDECPROBE is not set 208# CONFIG_MTD_JEDECPROBE is not set
187CONFIG_MTD_GEN_PROBE=y 209CONFIG_MTD_GEN_PROBE=y
188# CONFIG_MTD_CFI_ADV_OPTIONS is not set 210# CONFIG_MTD_CFI_ADV_OPTIONS is not set
211CONFIG_MTD_MAP_BANK_WIDTH_1=y
212CONFIG_MTD_MAP_BANK_WIDTH_2=y
213CONFIG_MTD_MAP_BANK_WIDTH_4=y
214# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
215# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
216# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
217CONFIG_MTD_CFI_I1=y
218CONFIG_MTD_CFI_I2=y
219# CONFIG_MTD_CFI_I4 is not set
220# CONFIG_MTD_CFI_I8 is not set
189# CONFIG_MTD_CFI_INTELEXT is not set 221# CONFIG_MTD_CFI_INTELEXT is not set
222CONFIG_MTD_CFI_AMDSTD=y
223CONFIG_MTD_CFI_AMDSTD_RETRY=0
190# CONFIG_MTD_CFI_STAA is not set 224# CONFIG_MTD_CFI_STAA is not set
225CONFIG_MTD_CFI_UTIL=y
191CONFIG_MTD_RAM=y 226CONFIG_MTD_RAM=y
192# CONFIG_MTD_ROM is not set 227# CONFIG_MTD_ROM is not set
193# CONFIG_MTD_ABSENT is not set 228# CONFIG_MTD_ABSENT is not set
229CONFIG_MTD_OBSOLETE_CHIPS=y
230CONFIG_MTD_AMDSTD=y
194# CONFIG_MTD_SHARP is not set 231# CONFIG_MTD_SHARP is not set
195# CONFIG_MTD_JEDEC is not set 232# CONFIG_MTD_JEDEC is not set
196 233
@@ -204,11 +241,13 @@ CONFIG_MTD_COMPLEX_MAPPINGS=y
204# Self-contained MTD device drivers 241# Self-contained MTD device drivers
205# 242#
206# CONFIG_MTD_SLRAM is not set 243# CONFIG_MTD_SLRAM is not set
244# CONFIG_MTD_PHRAM is not set
207CONFIG_MTD_MTDRAM=y 245CONFIG_MTD_MTDRAM=y
208CONFIG_MTDRAM_TOTAL_SIZE=0 246CONFIG_MTDRAM_TOTAL_SIZE=0
209CONFIG_MTDRAM_ERASE_SIZE=64 247CONFIG_MTDRAM_ERASE_SIZE=64
210CONFIG_MTDRAM_ABS_POS=0x0 248CONFIG_MTDRAM_ABS_POS=0x0
211# CONFIG_MTD_BLKMTD is not set 249# CONFIG_MTD_BLKMTD is not set
250# CONFIG_MTD_BLOCK2MTD is not set
212 251
213# 252#
214# Disk-On-Chip Device Drivers 253# Disk-On-Chip Device Drivers
@@ -235,11 +274,25 @@ CONFIG_MTDRAM_ABS_POS=0x0
235# Block devices 274# Block devices
236# 275#
237# CONFIG_BLK_DEV_FD is not set 276# CONFIG_BLK_DEV_FD is not set
277# CONFIG_BLK_DEV_COW_COMMON is not set
238# CONFIG_BLK_DEV_LOOP is not set 278# CONFIG_BLK_DEV_LOOP is not set
239# CONFIG_BLK_DEV_NBD is not set 279# CONFIG_BLK_DEV_NBD is not set
280# CONFIG_BLK_DEV_UB is not set
240CONFIG_BLK_DEV_RAM=y 281CONFIG_BLK_DEV_RAM=y
282CONFIG_BLK_DEV_RAM_COUNT=16
241CONFIG_BLK_DEV_RAM_SIZE=4096 283CONFIG_BLK_DEV_RAM_SIZE=4096
242# CONFIG_BLK_DEV_INITRD is not set 284# CONFIG_BLK_DEV_INITRD is not set
285CONFIG_INITRAMFS_SOURCE=""
286# CONFIG_CDROM_PKTCDVD is not set
287
288#
289# IO Schedulers
290#
291CONFIG_IOSCHED_NOOP=y
292# CONFIG_IOSCHED_AS is not set
293# CONFIG_IOSCHED_DEADLINE is not set
294CONFIG_IOSCHED_CFQ=y
295# CONFIG_ATA_OVER_ETH is not set
243 296
244# 297#
245# Multi-device support (RAID and LVM) 298# Multi-device support (RAID and LVM)
@@ -249,6 +302,28 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
249# 302#
250# ATA/ATAPI/MFM/RLL support 303# ATA/ATAPI/MFM/RLL support
251# 304#
305CONFIG_IDE=y
306CONFIG_BLK_DEV_IDE=y
307
308#
309# Please see Documentation/ide.txt for help/info on IDE drives
310#
311# CONFIG_BLK_DEV_IDE_SATA is not set
312CONFIG_BLK_DEV_IDEDISK=y
313# CONFIG_IDEDISK_MULTI_MODE is not set
314CONFIG_BLK_DEV_IDECD=y
315# CONFIG_BLK_DEV_IDETAPE is not set
316# CONFIG_BLK_DEV_IDEFLOPPY is not set
317# CONFIG_IDE_TASK_IOCTL is not set
318
319#
320# IDE chipset support/bugfixes
321#
322# CONFIG_IDE_GENERIC is not set
323# CONFIG_IDE_ARM is not set
324CONFIG_BLK_DEV_IDEDMA=y
325# CONFIG_IDEDMA_AUTO is not set
326# CONFIG_BLK_DEV_HD is not set
252 327
253# 328#
254# SCSI device support 329# SCSI device support
@@ -258,7 +333,6 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
258# 333#
259# IEEE 1394 (FireWire) support 334# IEEE 1394 (FireWire) support
260# 335#
261# CONFIG_IEEE1394 is not set
262 336
263# 337#
264# I2O device support 338# I2O device support
@@ -288,6 +362,9 @@ CONFIG_INET=y
288# CONFIG_INET_AH is not set 362# CONFIG_INET_AH is not set
289# CONFIG_INET_ESP is not set 363# CONFIG_INET_ESP is not set
290# CONFIG_INET_IPCOMP is not set 364# CONFIG_INET_IPCOMP is not set
365# CONFIG_INET_TUNNEL is not set
366CONFIG_IP_TCPDIAG=y
367# CONFIG_IP_TCPDIAG_IPV6 is not set
291 368
292# 369#
293# IP: Virtual Server Configuration 370# IP: Virtual Server Configuration
@@ -301,11 +378,10 @@ CONFIG_NETFILTER=y
301# IP: Netfilter Configuration 378# IP: Netfilter Configuration
302# 379#
303# CONFIG_IP_NF_CONNTRACK is not set 380# CONFIG_IP_NF_CONNTRACK is not set
381# CONFIG_IP_NF_CONNTRACK_MARK is not set
304# CONFIG_IP_NF_QUEUE is not set 382# CONFIG_IP_NF_QUEUE is not set
305# CONFIG_IP_NF_IPTABLES is not set 383# CONFIG_IP_NF_IPTABLES is not set
306# CONFIG_IP_NF_ARPTABLES is not set 384# CONFIG_IP_NF_ARPTABLES is not set
307# CONFIG_IP_NF_COMPAT_IPCHAINS is not set
308# CONFIG_IP_NF_COMPAT_IPFWADM is not set
309 385
310# 386#
311# SCTP Configuration (EXPERIMENTAL) 387# SCTP Configuration (EXPERIMENTAL)
@@ -323,12 +399,12 @@ CONFIG_NETFILTER=y
323# CONFIG_NET_DIVERT is not set 399# CONFIG_NET_DIVERT is not set
324# CONFIG_ECONET is not set 400# CONFIG_ECONET is not set
325# CONFIG_WAN_ROUTER is not set 401# CONFIG_WAN_ROUTER is not set
326# CONFIG_NET_HW_FLOWCONTROL is not set
327 402
328# 403#
329# QoS and/or fair queueing 404# QoS and/or fair queueing
330# 405#
331# CONFIG_NET_SCHED is not set 406# CONFIG_NET_SCHED is not set
407# CONFIG_NET_CLS_ROUTE is not set
332 408
333# 409#
334# Network testing 410# Network testing
@@ -338,7 +414,26 @@ CONFIG_NETFILTER=y
338# CONFIG_NET_POLL_CONTROLLER is not set 414# CONFIG_NET_POLL_CONTROLLER is not set
339# CONFIG_HAMRADIO is not set 415# CONFIG_HAMRADIO is not set
340# CONFIG_IRDA is not set 416# CONFIG_IRDA is not set
341# CONFIG_BT is not set 417CONFIG_BT=y
418CONFIG_BT_L2CAP=y
419# CONFIG_BT_SCO is not set
420CONFIG_BT_RFCOMM=y
421# CONFIG_BT_RFCOMM_TTY is not set
422CONFIG_BT_BNEP=y
423# CONFIG_BT_BNEP_MC_FILTER is not set
424# CONFIG_BT_BNEP_PROTO_FILTER is not set
425# CONFIG_BT_HIDP is not set
426
427#
428# Bluetooth device drivers
429#
430CONFIG_BT_HCIUSB=y
431# CONFIG_BT_HCIUSB_SCO is not set
432# CONFIG_BT_HCIUART is not set
433# CONFIG_BT_HCIBCM203X is not set
434# CONFIG_BT_HCIBPA10X is not set
435# CONFIG_BT_HCIBFUSB is not set
436# CONFIG_BT_HCIVHCI is not set
342CONFIG_NETDEVICES=y 437CONFIG_NETDEVICES=y
343# CONFIG_DUMMY is not set 438# CONFIG_DUMMY is not set
344# CONFIG_BONDING is not set 439# CONFIG_BONDING is not set
@@ -348,6 +443,7 @@ CONFIG_NETDEVICES=y
348# 443#
349# Ethernet (10 or 100Mbit) 444# Ethernet (10 or 100Mbit)
350# 445#
446CONFIG_NET_ETHERNET=y
351# CONFIG_MII is not set 447# CONFIG_MII is not set
352 448
353# 449#
@@ -389,11 +485,19 @@ CONFIG_NETDEVICES=y
389# 485#
390# Input device support 486# Input device support
391# 487#
392# CONFIG_INPUT is not set 488CONFIG_INPUT=y
393 489
394# 490#
395# Userland interfaces 491# Userland interfaces
396# 492#
493CONFIG_INPUT_MOUSEDEV=y
494CONFIG_INPUT_MOUSEDEV_PSAUX=y
495CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
496CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
497# CONFIG_INPUT_JOYDEV is not set
498# CONFIG_INPUT_TSDEV is not set
499# CONFIG_INPUT_EVDEV is not set
500# CONFIG_INPUT_EVBUG is not set
397 501
398# 502#
399# Input I/O drivers 503# Input I/O drivers
@@ -404,10 +508,25 @@ CONFIG_SERIO=y
404# CONFIG_SERIO_I8042 is not set 508# CONFIG_SERIO_I8042 is not set
405# CONFIG_SERIO_SERPORT is not set 509# CONFIG_SERIO_SERPORT is not set
406# CONFIG_SERIO_CT82C710 is not set 510# CONFIG_SERIO_CT82C710 is not set
511CONFIG_SERIO_LIBPS2=y
512# CONFIG_SERIO_RAW is not set
407 513
408# 514#
409# Input Device Drivers 515# Input Device Drivers
410# 516#
517CONFIG_INPUT_KEYBOARD=y
518CONFIG_KEYBOARD_ATKBD=y
519# CONFIG_KEYBOARD_SUNKBD is not set
520# CONFIG_KEYBOARD_LKKBD is not set
521# CONFIG_KEYBOARD_XTKBD is not set
522# CONFIG_KEYBOARD_NEWTON is not set
523CONFIG_INPUT_MOUSE=y
524CONFIG_MOUSE_PS2=y
525# CONFIG_MOUSE_SERIAL is not set
526# CONFIG_MOUSE_VSXXXAA is not set
527# CONFIG_INPUT_JOYSTICK is not set
528# CONFIG_INPUT_TOUCHSCREEN is not set
529# CONFIG_INPUT_MISC is not set
411 530
412# 531#
413# Character devices 532# Character devices
@@ -426,7 +545,6 @@ CONFIG_SERIO=y
426CONFIG_UNIX98_PTYS=y 545CONFIG_UNIX98_PTYS=y
427CONFIG_LEGACY_PTYS=y 546CONFIG_LEGACY_PTYS=y
428CONFIG_LEGACY_PTY_COUNT=256 547CONFIG_LEGACY_PTY_COUNT=256
429# CONFIG_QIC02_TAPE is not set
430 548
431# 549#
432# IPMI 550# IPMI
@@ -441,13 +559,10 @@ CONFIG_LEGACY_PTY_COUNT=256
441# CONFIG_GEN_RTC is not set 559# CONFIG_GEN_RTC is not set
442# CONFIG_DTLK is not set 560# CONFIG_DTLK is not set
443# CONFIG_R3964 is not set 561# CONFIG_R3964 is not set
444# CONFIG_APPLICOM is not set
445 562
446# 563#
447# Ftape, the floppy tape device driver 564# Ftape, the floppy tape device driver
448# 565#
449# CONFIG_FTAPE is not set
450# CONFIG_AGP is not set
451# CONFIG_DRM is not set 566# CONFIG_DRM is not set
452# CONFIG_RAW_DRIVER is not set 567# CONFIG_RAW_DRIVER is not set
453 568
@@ -469,10 +584,15 @@ CONFIG_LEGACY_PTY_COUNT=256
469# CONFIG_JBD is not set 584# CONFIG_JBD is not set
470# CONFIG_REISERFS_FS is not set 585# CONFIG_REISERFS_FS is not set
471# CONFIG_JFS_FS is not set 586# CONFIG_JFS_FS is not set
587
588#
589# XFS support
590#
472# CONFIG_XFS_FS is not set 591# CONFIG_XFS_FS is not set
473# CONFIG_MINIX_FS is not set 592# CONFIG_MINIX_FS is not set
474# CONFIG_ROMFS_FS is not set 593# CONFIG_ROMFS_FS is not set
475# CONFIG_QUOTA is not set 594# CONFIG_QUOTA is not set
595CONFIG_DNOTIFY=y
476# CONFIG_AUTOFS_FS is not set 596# CONFIG_AUTOFS_FS is not set
477# CONFIG_AUTOFS4_FS is not set 597# CONFIG_AUTOFS4_FS is not set
478 598
@@ -485,7 +605,8 @@ CONFIG_LEGACY_PTY_COUNT=256
485# 605#
486# DOS/FAT/NT Filesystems 606# DOS/FAT/NT Filesystems
487# 607#
488# CONFIG_FAT_FS is not set 608# CONFIG_MSDOS_FS is not set
609# CONFIG_VFAT_FS is not set
489# CONFIG_NTFS_FS is not set 610# CONFIG_NTFS_FS is not set
490 611
491# 612#
@@ -497,6 +618,7 @@ CONFIG_SYSFS=y
497# CONFIG_DEVFS_FS is not set 618# CONFIG_DEVFS_FS is not set
498# CONFIG_DEVPTS_FS_XATTR is not set 619# CONFIG_DEVPTS_FS_XATTR is not set
499CONFIG_TMPFS=y 620CONFIG_TMPFS=y
621# CONFIG_TMPFS_XATTR is not set
500# CONFIG_HUGETLB_PAGE is not set 622# CONFIG_HUGETLB_PAGE is not set
501CONFIG_RAMFS=y 623CONFIG_RAMFS=y
502 624
@@ -512,7 +634,15 @@ CONFIG_RAMFS=y
512# CONFIG_EFS_FS is not set 634# CONFIG_EFS_FS is not set
513CONFIG_JFFS_FS=y 635CONFIG_JFFS_FS=y
514CONFIG_JFFS_FS_VERBOSE=0 636CONFIG_JFFS_FS_VERBOSE=0
515# CONFIG_JFFS2_FS is not set 637# CONFIG_JFFS_PROC_FS is not set
638CONFIG_JFFS2_FS=y
639CONFIG_JFFS2_FS_DEBUG=0
640# CONFIG_JFFS2_FS_NAND is not set
641# CONFIG_JFFS2_FS_NOR_ECC is not set
642# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
643CONFIG_JFFS2_ZLIB=y
644CONFIG_JFFS2_RTIME=y
645# CONFIG_JFFS2_RUBIN is not set
516CONFIG_CRAMFS=y 646CONFIG_CRAMFS=y
517# CONFIG_VXFS_FS is not set 647# CONFIG_VXFS_FS is not set
518# CONFIG_HPFS_FS is not set 648# CONFIG_HPFS_FS is not set
@@ -530,14 +660,13 @@ CONFIG_NFS_V3=y
530# CONFIG_NFSD is not set 660# CONFIG_NFSD is not set
531CONFIG_LOCKD=y 661CONFIG_LOCKD=y
532CONFIG_LOCKD_V4=y 662CONFIG_LOCKD_V4=y
533# CONFIG_EXPORTFS is not set
534CONFIG_SUNRPC=y 663CONFIG_SUNRPC=y
535# CONFIG_RPCSEC_GSS_KRB5 is not set 664# CONFIG_RPCSEC_GSS_KRB5 is not set
665# CONFIG_RPCSEC_GSS_SPKM3 is not set
536# CONFIG_SMB_FS is not set 666# CONFIG_SMB_FS is not set
537# CONFIG_CIFS is not set 667# CONFIG_CIFS is not set
538# CONFIG_NCP_FS is not set 668# CONFIG_NCP_FS is not set
539# CONFIG_CODA_FS is not set 669# CONFIG_CODA_FS is not set
540# CONFIG_INTERMEZZO_FS is not set
541# CONFIG_AFS_FS is not set 670# CONFIG_AFS_FS is not set
542 671
543# 672#
@@ -557,8 +686,120 @@ CONFIG_MSDOS_PARTITION=y
557# CONFIG_SOUND is not set 686# CONFIG_SOUND is not set
558 687
559# 688#
689# PCCARD (PCMCIA/CardBus) support
690#
691# CONFIG_PCCARD is not set
692
693#
694# PC-card bridges
695#
696
697#
560# USB support 698# USB support
561# 699#
700CONFIG_USB=y
701# CONFIG_USB_DEBUG is not set
702
703#
704# Miscellaneous USB options
705#
706CONFIG_USB_DEVICEFS=y
707# CONFIG_USB_BANDWIDTH is not set
708# CONFIG_USB_DYNAMIC_MINORS is not set
709# CONFIG_USB_OTG is not set
710# CONFIG_USB_ARCH_HAS_HCD is not set
711# CONFIG_USB_ARCH_HAS_OHCI is not set
712
713#
714# USB Host Controller Drivers
715#
716# CONFIG_USB_SL811_HCD is not set
717
718#
719# USB Device Class drivers
720#
721
722#
723# USB Bluetooth TTY can only be used with disabled Bluetooth subsystem
724#
725# CONFIG_USB_ACM is not set
726# CONFIG_USB_PRINTER is not set
727
728#
729# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
730#
731# CONFIG_USB_STORAGE is not set
732
733#
734# USB Input Devices
735#
736# CONFIG_USB_HID is not set
737
738#
739# USB HID Boot Protocol drivers
740#
741# CONFIG_USB_KBD is not set
742# CONFIG_USB_MOUSE is not set
743# CONFIG_USB_AIPTEK is not set
744# CONFIG_USB_WACOM is not set
745# CONFIG_USB_KBTAB is not set
746# CONFIG_USB_POWERMATE is not set
747# CONFIG_USB_MTOUCH is not set
748# CONFIG_USB_EGALAX is not set
749# CONFIG_USB_XPAD is not set
750# CONFIG_USB_ATI_REMOTE is not set
751
752#
753# USB Imaging devices
754#
755# CONFIG_USB_MDC800 is not set
756
757#
758# USB Multimedia devices
759#
760# CONFIG_USB_DABUSB is not set
761
762#
763# Video4Linux support is needed for USB Multimedia device support
764#
765
766#
767# USB Network Adapters
768#
769# CONFIG_USB_CATC is not set
770# CONFIG_USB_KAWETH is not set
771# CONFIG_USB_PEGASUS is not set
772CONFIG_USB_RTL8150=y
773# CONFIG_USB_USBNET is not set
774
775#
776# USB port drivers
777#
778
779#
780# USB Serial Converter support
781#
782# CONFIG_USB_SERIAL is not set
783
784#
785# USB Miscellaneous drivers
786#
787# CONFIG_USB_EMI62 is not set
788# CONFIG_USB_EMI26 is not set
789# CONFIG_USB_AUERSWALD is not set
790# CONFIG_USB_RIO500 is not set
791# CONFIG_USB_LEGOTOWER is not set
792# CONFIG_USB_LCD is not set
793# CONFIG_USB_LED is not set
794# CONFIG_USB_CYTHERM is not set
795# CONFIG_USB_PHIDGETKIT is not set
796# CONFIG_USB_PHIDGETSERVO is not set
797# CONFIG_USB_IDMOUSE is not set
798# CONFIG_USB_TEST is not set
799
800#
801# USB ATM/DSL drivers
802#
562 803
563# 804#
564# USB Gadget Support 805# USB Gadget Support
@@ -568,14 +809,17 @@ CONFIG_MSDOS_PARTITION=y
568# 809#
569# Kernel hacking 810# Kernel hacking
570# 811#
571# CONFIG_PROFILE is not set 812# CONFIG_PROFILING is not set
813# CONFIG_SYSTEM_PROFILER is not set
572# CONFIG_ETRAX_KGDB is not set 814# CONFIG_ETRAX_KGDB is not set
573# CONFIG_DEBUG_INFO is not set 815# CONFIG_DEBUG_INFO is not set
574# CONFIG_FRAME_POINTER is not set 816# CONFIG_FRAME_POINTER is not set
817# CONFIG_DEBUG_NMI_OOPS is not set
575 818
576# 819#
577# Security options 820# Security options
578# 821#
822# CONFIG_KEYS is not set
579# CONFIG_SECURITY is not set 823# CONFIG_SECURITY is not set
580 824
581# 825#
@@ -584,8 +828,14 @@ CONFIG_MSDOS_PARTITION=y
584# CONFIG_CRYPTO is not set 828# CONFIG_CRYPTO is not set
585 829
586# 830#
831# Hardware crypto devices
832#
833
834#
587# Library routines 835# Library routines
588# 836#
589# CONFIG_CRC32 is not set 837# CONFIG_CRC_CCITT is not set
838CONFIG_CRC32=y
590# CONFIG_LIBCRC32C is not set 839# CONFIG_LIBCRC32C is not set
591CONFIG_ZLIB_INFLATE=y 840CONFIG_ZLIB_INFLATE=y
841CONFIG_ZLIB_DEFLATE=y
diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile
index 1546a0e74047..c8e8ea570989 100644
--- a/arch/cris/kernel/Makefile
+++ b/arch/cris/kernel/Makefile
@@ -1,4 +1,4 @@
1# $Id: Makefile,v 1.10 2004/05/14 10:18:12 starvik Exp $ 1# $Id: Makefile,v 1.12 2004/10/19 13:07:43 starvik Exp $
2# 2#
3# Makefile for the linux kernel. 3# Makefile for the linux kernel.
4# 4#
@@ -10,6 +10,7 @@ obj-y := process.o traps.o irq.o ptrace.o setup.o \
10 10
11obj-$(CONFIG_MODULES) += crisksyms.o 11obj-$(CONFIG_MODULES) += crisksyms.o
12obj-$(CONFIG_MODULES) += module.o 12obj-$(CONFIG_MODULES) += module.o
13obj-$(CONFIG_SYSTEM_PROFILER) += profile.o
13 14
14clean: 15clean:
15 16
diff --git a/arch/cris/kernel/crisksyms.c b/arch/cris/kernel/crisksyms.c
index 7141bbecd7e4..85833d704ebb 100644
--- a/arch/cris/kernel/crisksyms.c
+++ b/arch/cris/kernel/crisksyms.c
@@ -27,13 +27,13 @@ extern void __Udiv(void);
27extern void __Umod(void); 27extern void __Umod(void);
28extern void __Div(void); 28extern void __Div(void);
29extern void __Mod(void); 29extern void __Mod(void);
30extern void __ashldi3(void);
30extern void __ashrdi3(void); 31extern void __ashrdi3(void);
31extern void iounmap(void *addr); 32extern void __lshrdi3(void);
33extern void iounmap(volatile void * __iomem);
32 34
33/* Platform dependent support */ 35/* Platform dependent support */
34EXPORT_SYMBOL(dump_thread); 36EXPORT_SYMBOL(dump_thread);
35EXPORT_SYMBOL(enable_irq);
36EXPORT_SYMBOL(disable_irq);
37EXPORT_SYMBOL(kernel_thread); 37EXPORT_SYMBOL(kernel_thread);
38EXPORT_SYMBOL(get_cmos_time); 38EXPORT_SYMBOL(get_cmos_time);
39EXPORT_SYMBOL(loops_per_usec); 39EXPORT_SYMBOL(loops_per_usec);
@@ -57,7 +57,9 @@ EXPORT_SYMBOL(__Udiv);
57EXPORT_SYMBOL(__Umod); 57EXPORT_SYMBOL(__Umod);
58EXPORT_SYMBOL(__Div); 58EXPORT_SYMBOL(__Div);
59EXPORT_SYMBOL(__Mod); 59EXPORT_SYMBOL(__Mod);
60EXPORT_SYMBOL(__ashldi3);
60EXPORT_SYMBOL(__ashrdi3); 61EXPORT_SYMBOL(__ashrdi3);
62EXPORT_SYMBOL(__lshrdi3);
61 63
62/* Memory functions */ 64/* Memory functions */
63EXPORT_SYMBOL(__ioremap); 65EXPORT_SYMBOL(__ioremap);
@@ -69,23 +71,10 @@ EXPORT_SYMBOL(__down);
69EXPORT_SYMBOL(__down_interruptible); 71EXPORT_SYMBOL(__down_interruptible);
70EXPORT_SYMBOL(__down_trylock); 72EXPORT_SYMBOL(__down_trylock);
71 73
72/* Export shadow registers for the CPU I/O pins */
73EXPORT_SYMBOL(genconfig_shadow);
74EXPORT_SYMBOL(port_pa_data_shadow);
75EXPORT_SYMBOL(port_pa_dir_shadow);
76EXPORT_SYMBOL(port_pb_data_shadow);
77EXPORT_SYMBOL(port_pb_dir_shadow);
78EXPORT_SYMBOL(port_pb_config_shadow);
79EXPORT_SYMBOL(port_g_data_shadow);
80
81/* Userspace access functions */ 74/* Userspace access functions */
82EXPORT_SYMBOL(__copy_user_zeroing); 75EXPORT_SYMBOL(__copy_user_zeroing);
83EXPORT_SYMBOL(__copy_user); 76EXPORT_SYMBOL(__copy_user);
84 77
85/* Cache flush functions */
86EXPORT_SYMBOL(flush_etrax_cache);
87EXPORT_SYMBOL(prepare_rx_descriptor);
88
89#undef memcpy 78#undef memcpy
90#undef memset 79#undef memset
91extern void * memset(void *, int, __kernel_size_t); 80extern void * memset(void *, int, __kernel_size_t);
diff --git a/arch/cris/kernel/irq.c b/arch/cris/kernel/irq.c
index d848b9407457..30deaf1b728a 100644
--- a/arch/cris/kernel/irq.c
+++ b/arch/cris/kernel/irq.c
@@ -12,8 +12,6 @@
12 * shouldn't result in any weird surprises, and installing new handlers 12 * shouldn't result in any weird surprises, and installing new handlers
13 * should be easier. 13 * should be easier.
14 * 14 *
15 * Notice Linux/CRIS: these routines do not care about SMP
16 *
17 */ 15 */
18 16
19/* 17/*
@@ -24,6 +22,7 @@
24#include <linux/config.h> 22#include <linux/config.h>
25#include <linux/module.h> 23#include <linux/module.h>
26#include <linux/ptrace.h> 24#include <linux/ptrace.h>
25#include <linux/irq.h>
27 26
28#include <linux/kernel_stat.h> 27#include <linux/kernel_stat.h>
29#include <linux/signal.h> 28#include <linux/signal.h>
@@ -36,84 +35,56 @@
36#include <linux/init.h> 35#include <linux/init.h>
37#include <linux/seq_file.h> 36#include <linux/seq_file.h>
38#include <linux/errno.h> 37#include <linux/errno.h>
39#include <linux/bitops.h> 38#include <linux/spinlock.h>
40 39
41#include <asm/io.h> 40#include <asm/io.h>
42 41
43/* Defined in arch specific irq.c */ 42void ack_bad_irq(unsigned int irq)
44extern void arch_setup_irq(int irq);
45extern void arch_free_irq(int irq);
46
47void
48disable_irq(unsigned int irq_nr)
49{
50 unsigned long flags;
51
52 local_save_flags(flags);
53 local_irq_disable();
54 mask_irq(irq_nr);
55 local_irq_restore(flags);
56}
57
58void
59enable_irq(unsigned int irq_nr)
60{ 43{
61 unsigned long flags; 44 printk("unexpected IRQ trap at vector %02x\n", irq);
62 local_save_flags(flags);
63 local_irq_disable();
64 unmask_irq(irq_nr);
65 local_irq_restore(flags);
66} 45}
67 46
68unsigned long
69probe_irq_on()
70{
71 return 0;
72}
73
74EXPORT_SYMBOL(probe_irq_on);
75
76int
77probe_irq_off(unsigned long x)
78{
79 return 0;
80}
81
82EXPORT_SYMBOL(probe_irq_off);
83
84/*
85 * Initial irq handlers.
86 */
87
88static struct irqaction *irq_action[NR_IRQS];
89
90int show_interrupts(struct seq_file *p, void *v) 47int show_interrupts(struct seq_file *p, void *v)
91{ 48{
92 int i = *(loff_t *) v; 49 int i = *(loff_t *) v, j;
93 struct irqaction * action; 50 struct irqaction * action;
94 unsigned long flags; 51 unsigned long flags;
95 52
53 if (i == 0) {
54 seq_printf(p, " ");
55 for (j=0; j<NR_CPUS; j++)
56 if (cpu_online(j))
57 seq_printf(p, "CPU%d ",j);
58 seq_putc(p, '\n');
59 }
60
96 if (i < NR_IRQS) { 61 if (i < NR_IRQS) {
97 local_irq_save(flags); 62 spin_lock_irqsave(&irq_desc[i].lock, flags);
98 action = irq_action[i]; 63 action = irq_desc[i].action;
99 if (!action) 64 if (!action)
100 goto skip; 65 goto skip;
101 seq_printf(p, "%2d: %10u %c %s", 66 seq_printf(p, "%3d: ",i);
102 i, kstat_this_cpu.irqs[i], 67#ifndef CONFIG_SMP
103 (action->flags & SA_INTERRUPT) ? '+' : ' ', 68 seq_printf(p, "%10u ", kstat_irqs(i));
104 action->name); 69#else
105 for (action = action->next; action; action = action->next) { 70 for (j = 0; j < NR_CPUS; j++)
106 seq_printf(p, ",%s %s", 71 if (cpu_online(j))
107 (action->flags & SA_INTERRUPT) ? " +" : "", 72 seq_printf(p, "%10u ", kstat_cpu(j).irqs[i]);
108 action->name); 73#endif
109 } 74 seq_printf(p, " %14s", irq_desc[i].handler->typename);
75 seq_printf(p, " %s", action->name);
76
77 for (action=action->next; action; action = action->next)
78 seq_printf(p, ", %s", action->name);
79
110 seq_putc(p, '\n'); 80 seq_putc(p, '\n');
111skip: 81skip:
112 local_irq_restore(flags); 82 spin_unlock_irqrestore(&irq_desc[i].lock, flags);
113 } 83 }
114 return 0; 84 return 0;
115} 85}
116 86
87
117/* called by the assembler IRQ entry functions defined in irq.h 88/* called by the assembler IRQ entry functions defined in irq.h
118 * to dispatch the interrupts to registred handlers 89 * to dispatch the interrupts to registred handlers
119 * interrupts are disabled upon entry - depending on if the 90 * interrupts are disabled upon entry - depending on if the
@@ -123,164 +94,17 @@ skip:
123 94
124asmlinkage void do_IRQ(int irq, struct pt_regs * regs) 95asmlinkage void do_IRQ(int irq, struct pt_regs * regs)
125{ 96{
126 struct irqaction *action; 97 unsigned long sp;
127 int do_random, cpu; 98 irq_enter();
128 int ret, retval = 0; 99 sp = rdsp();
129 100 if (unlikely((sp & (PAGE_SIZE - 1)) < (PAGE_SIZE/8))) {
130 cpu = smp_processor_id(); 101 printk("do_IRQ: stack overflow: %lX\n", sp);
131 irq_enter(); 102 show_stack(NULL, (unsigned long *)sp);
132 kstat_cpu(cpu).irqs[irq - FIRST_IRQ]++;
133 action = irq_action[irq - FIRST_IRQ];
134
135 if (action) {
136 if (!(action->flags & SA_INTERRUPT))
137 local_irq_enable();
138 do_random = 0;
139 do {
140 ret = action->handler(irq, action->dev_id, regs);
141 if (ret == IRQ_HANDLED)
142 do_random |= action->flags;
143 retval |= ret;
144 action = action->next;
145 } while (action);
146
147 if (retval != 1) {
148 if (retval) {
149 printk("irq event %d: bogus retval mask %x\n",
150 irq, retval);
151 } else {
152 printk("irq %d: nobody cared\n", irq);
153 }
154 }
155
156 if (do_random & SA_SAMPLE_RANDOM)
157 add_interrupt_randomness(irq);
158 local_irq_disable();
159 }
160 irq_exit();
161}
162
163/* this function links in a handler into the chain of handlers for the
164 given irq, and if the irq has never been registred, the appropriate
165 handler is entered into the interrupt vector
166*/
167
168int setup_irq(int irq, struct irqaction * new)
169{
170 int shared = 0;
171 struct irqaction *old, **p;
172 unsigned long flags;
173
174 p = irq_action + irq - FIRST_IRQ;
175 if ((old = *p) != NULL) {
176 /* Can't share interrupts unless both agree to */
177 if (!(old->flags & new->flags & SA_SHIRQ))
178 return -EBUSY;
179
180 /* Can't share interrupts unless both are same type */
181 if ((old->flags ^ new->flags) & SA_INTERRUPT)
182 return -EBUSY;
183
184 /* add new interrupt at end of irq queue */
185 do {
186 p = &old->next;
187 old = *p;
188 } while (old);
189 shared = 1;
190 }
191
192 if (new->flags & SA_SAMPLE_RANDOM)
193 rand_initialize_irq(irq);
194
195 local_save_flags(flags);
196 local_irq_disable();
197 *p = new;
198
199 if (!shared) {
200 /* if the irq wasn't registred before, enter it into the vector table
201 and unmask it physically
202 */
203 arch_setup_irq(irq);
204 unmask_irq(irq);
205 }
206
207 local_irq_restore(flags);
208 return 0;
209}
210
211/* this function is called by a driver to register an irq handler
212 Valid flags:
213 SA_INTERRUPT -> it's a fast interrupt, handler called with irq disabled and
214 no signal checking etc is performed upon exit
215 SA_SHIRQ -> the interrupt can be shared between different handlers, the handler
216 is required to check if the irq was "aimed" at it explicitely
217 SA_RANDOM -> the interrupt will add to the random generators entropy
218*/
219
220int request_irq(unsigned int irq,
221 irqreturn_t (*handler)(int, void *, struct pt_regs *),
222 unsigned long irqflags,
223 const char * devname,
224 void *dev_id)
225{
226 int retval;
227 struct irqaction * action;
228
229 if(!handler)
230 return -EINVAL;
231
232 /* allocate and fill in a handler structure and setup the irq */
233
234 action = (struct irqaction *)kmalloc(sizeof(struct irqaction), GFP_KERNEL);
235 if (!action)
236 return -ENOMEM;
237
238 action->handler = handler;
239 action->flags = irqflags;
240 cpus_clear(action->mask);
241 action->name = devname;
242 action->next = NULL;
243 action->dev_id = dev_id;
244
245 retval = setup_irq(irq, action);
246
247 if (retval)
248 kfree(action);
249 return retval;
250}
251
252EXPORT_SYMBOL(request_irq);
253
254void free_irq(unsigned int irq, void *dev_id)
255{
256 struct irqaction * action, **p;
257 unsigned long flags;
258
259 if (irq >= NR_IRQS) {
260 printk("Trying to free IRQ%d\n",irq);
261 return;
262 } 103 }
263 for (p = irq - FIRST_IRQ + irq_action; (action = *p) != NULL; p = &action->next) { 104 __do_IRQ(irq, regs);
264 if (action->dev_id != dev_id) 105 irq_exit();
265 continue;
266
267 /* Found it - now free it */
268 local_save_flags(flags);
269 local_irq_disable();
270 *p = action->next;
271 if (!irq_action[irq - FIRST_IRQ]) {
272 mask_irq(irq);
273 arch_free_irq(irq);
274 }
275 local_irq_restore(flags);
276 kfree(action);
277 return;
278 }
279 printk("Trying to free free IRQ%d\n",irq);
280} 106}
281 107
282EXPORT_SYMBOL(free_irq);
283
284void weird_irq(void) 108void weird_irq(void)
285{ 109{
286 local_irq_disable(); 110 local_irq_disable();
@@ -288,10 +112,3 @@ void weird_irq(void)
288 while(1); 112 while(1);
289} 113}
290 114
291#if defined(CONFIG_PROC_FS) && defined(CONFIG_SYSCTL)
292/* Used by other archs to show/control IRQ steering during SMP */
293void __init
294init_irq_proc(void)
295{
296}
297#endif
diff --git a/arch/cris/kernel/module.c b/arch/cris/kernel/module.c
index f1d3e784f30c..11b867df8617 100644
--- a/arch/cris/kernel/module.c
+++ b/arch/cris/kernel/module.c
@@ -32,7 +32,7 @@ void *module_alloc(unsigned long size)
32{ 32{
33 if (size == 0) 33 if (size == 0)
34 return NULL; 34 return NULL;
35 return vmalloc(size); 35 return vmalloc_exec(size);
36} 36}
37 37
38 38
@@ -59,26 +59,8 @@ int apply_relocate(Elf32_Shdr *sechdrs,
59 unsigned int relsec, 59 unsigned int relsec,
60 struct module *me) 60 struct module *me)
61{ 61{
62 unsigned int i; 62 printk(KERN_ERR "module %s: REL relocation unsupported\n", me->name);
63 Elf32_Rel *rel = (void *)sechdrs[relsec].sh_addr; 63 return -ENOEXEC;
64 Elf32_Sym *sym;
65 uint32_t *location;
66
67 DEBUGP("Applying relocate section %u to %u\n", relsec,
68 sechdrs[relsec].sh_info);
69 for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
70 /* This is where to make the change */
71 location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_offset
72 + rel[i].r_offset;
73 /* This is the symbol it is referring to. Note that all
74 undefined symbols have been resolved. */
75 sym = (Elf32_Sym *)sechdrs[symindex].sh_addr
76 + ELF32_R_SYM(rel[i].r_info);
77
78 /* We add the value into the location given */
79 *location += sym->st_value;
80 }
81 return 0;
82} 64}
83 65
84int apply_relocate_add(Elf32_Shdr *sechdrs, 66int apply_relocate_add(Elf32_Shdr *sechdrs,
@@ -90,7 +72,7 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
90 unsigned int i; 72 unsigned int i;
91 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr; 73 Elf32_Rela *rela = (void *)sechdrs[relsec].sh_addr;
92 74
93 DEBUGP ("Applying relocate section %u to %u\n", relsec, 75 DEBUGP ("Applying add relocate section %u to %u\n", relsec,
94 sechdrs[relsec].sh_info); 76 sechdrs[relsec].sh_info);
95 77
96 for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) { 78 for (i = 0; i < sechdrs[relsec].sh_size / sizeof (*rela); i++) {
@@ -103,7 +85,18 @@ int apply_relocate_add(Elf32_Shdr *sechdrs,
103 Elf32_Sym *sym 85 Elf32_Sym *sym
104 = ((Elf32_Sym *)sechdrs[symindex].sh_addr 86 = ((Elf32_Sym *)sechdrs[symindex].sh_addr
105 + ELF32_R_SYM (rela[i].r_info)); 87 + ELF32_R_SYM (rela[i].r_info));
106 *loc = sym->st_value + rela[i].r_addend; 88 switch (ELF32_R_TYPE(rela[i].r_info)) {
89 case R_CRIS_32:
90 *loc = sym->st_value + rela[i].r_addend;
91 break;
92 case R_CRIS_32_PCREL:
93 *loc = sym->st_value - (unsigned)loc + rela[i].r_addend - 4;
94 break;
95 default:
96 printk(KERN_ERR "module %s: Unknown relocation: %u\n",
97 me->name, ELF32_R_TYPE(rela[i].r_info));
98 return -ENOEXEC;
99 }
107 } 100 }
108 101
109 return 0; 102 return 0;
diff --git a/arch/cris/kernel/process.c b/arch/cris/kernel/process.c
index 9f7cad7c7849..949a0e40e03c 100644
--- a/arch/cris/kernel/process.c
+++ b/arch/cris/kernel/process.c
@@ -1,4 +1,4 @@
1/* $Id: process.c,v 1.17 2004/04/05 13:53:48 starvik Exp $ 1/* $Id: process.c,v 1.21 2005/03/04 08:16:17 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/process.c 3 * linux/arch/cris/kernel/process.c
4 * 4 *
@@ -8,6 +8,18 @@
8 * Authors: Bjorn Wesen (bjornw@axis.com) 8 * Authors: Bjorn Wesen (bjornw@axis.com)
9 * 9 *
10 * $Log: process.c,v $ 10 * $Log: process.c,v $
11 * Revision 1.21 2005/03/04 08:16:17 starvik
12 * Merge of Linux 2.6.11.
13 *
14 * Revision 1.20 2005/01/18 05:57:22 starvik
15 * Renamed hlt_counter to cris_hlt_counter and made it global.
16 *
17 * Revision 1.19 2004/10/19 13:07:43 starvik
18 * Merge of Linux 2.6.9
19 *
20 * Revision 1.18 2004/08/16 12:37:23 starvik
21 * Merge of Linux 2.6.8
22 *
11 * Revision 1.17 2004/04/05 13:53:48 starvik 23 * Revision 1.17 2004/04/05 13:53:48 starvik
12 * Merge of Linux 2.6.5 24 * Merge of Linux 2.6.5
13 * 25 *
@@ -113,6 +125,7 @@
113#include <linux/user.h> 125#include <linux/user.h>
114#include <linux/elfcore.h> 126#include <linux/elfcore.h>
115#include <linux/mqueue.h> 127#include <linux/mqueue.h>
128#include <linux/reboot.h>
116 129
117//#define DEBUG 130//#define DEBUG
118 131
@@ -160,18 +173,18 @@ EXPORT_SYMBOL(init_task);
160 * region by enable_hlt/disable_hlt. 173 * region by enable_hlt/disable_hlt.
161 */ 174 */
162 175
163static int hlt_counter=0; 176int cris_hlt_counter=0;
164 177
165void disable_hlt(void) 178void disable_hlt(void)
166{ 179{
167 hlt_counter++; 180 cris_hlt_counter++;
168} 181}
169 182
170EXPORT_SYMBOL(disable_hlt); 183EXPORT_SYMBOL(disable_hlt);
171 184
172void enable_hlt(void) 185void enable_hlt(void)
173{ 186{
174 hlt_counter--; 187 cris_hlt_counter--;
175} 188}
176 189
177EXPORT_SYMBOL(enable_hlt); 190EXPORT_SYMBOL(enable_hlt);
@@ -194,27 +207,28 @@ void cpu_idle (void)
194 /* endless idle loop with no priority at all */ 207 /* endless idle loop with no priority at all */
195 while (1) { 208 while (1) {
196 while (!need_resched()) { 209 while (!need_resched()) {
197 void (*idle)(void) = pm_idle; 210 void (*idle)(void);
198 211 /*
212 * Mark this as an RCU critical section so that
213 * synchronize_kernel() in the unload path waits
214 * for our completion.
215 */
216 idle = pm_idle;
199 if (!idle) 217 if (!idle)
200 idle = default_idle; 218 idle = default_idle;
201
202 idle(); 219 idle();
203 } 220 }
204 schedule(); 221 schedule();
205 } 222 }
206
207} 223}
208 224
209void hard_reset_now (void); 225void hard_reset_now (void);
210 226
211void machine_restart(void) 227void machine_restart(char *cmd)
212{ 228{
213 hard_reset_now(); 229 hard_reset_now();
214} 230}
215 231
216EXPORT_SYMBOL(machine_restart);
217
218/* 232/*
219 * Similar to machine_power_off, but don't shut off power. Add code 233 * Similar to machine_power_off, but don't shut off power. Add code
220 * here to freeze the system for e.g. post-mortem debug purpose when 234 * here to freeze the system for e.g. post-mortem debug purpose when
@@ -225,16 +239,12 @@ void machine_halt(void)
225{ 239{
226} 240}
227 241
228EXPORT_SYMBOL(machine_halt);
229
230/* If or when software power-off is implemented, add code here. */ 242/* If or when software power-off is implemented, add code here. */
231 243
232void machine_power_off(void) 244void machine_power_off(void)
233{ 245{
234} 246}
235 247
236EXPORT_SYMBOL(machine_power_off);
237
238/* 248/*
239 * When a process does an "exec", machine state like FPU and debug 249 * When a process does an "exec", machine state like FPU and debug
240 * registers need to be reset. This is a hook function for that. 250 * registers need to be reset. This is a hook function for that.
diff --git a/arch/cris/kernel/profile.c b/arch/cris/kernel/profile.c
new file mode 100644
index 000000000000..69c52189f044
--- /dev/null
+++ b/arch/cris/kernel/profile.c
@@ -0,0 +1,73 @@
1#include <linux/init.h>
2#include <linux/errno.h>
3#include <linux/kernel.h>
4#include <linux/proc_fs.h>
5#include <linux/types.h>
6#include <asm/ptrace.h>
7#include <asm/uaccess.h>
8
9#define SAMPLE_BUFFER_SIZE 8192
10
11static char* sample_buffer;
12static char* sample_buffer_pos;
13static int prof_running = 0;
14
15void
16cris_profile_sample(struct pt_regs* regs)
17{
18 if (!prof_running)
19 return;
20 if (user_mode(regs))
21 *(unsigned int*)sample_buffer_pos = current->pid;
22 else
23 *(unsigned int*)sample_buffer_pos = 0;
24 *(unsigned int*)(sample_buffer_pos + 4) = instruction_pointer(regs);
25 sample_buffer_pos += 8;
26 if (sample_buffer_pos == sample_buffer + SAMPLE_BUFFER_SIZE)
27 sample_buffer_pos = sample_buffer;
28}
29
30static ssize_t
31read_cris_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
32{
33 unsigned long p = *ppos;
34 if (p > SAMPLE_BUFFER_SIZE)
35 return 0;
36 if (p + count > SAMPLE_BUFFER_SIZE)
37 count = SAMPLE_BUFFER_SIZE - p;
38 if (copy_to_user(buf, sample_buffer + p,count))
39 return -EFAULT;
40 memset(sample_buffer + p, 0, count);
41 *ppos += count;
42 return count;
43}
44
45static ssize_t
46write_cris_profile(struct file *file, const char __user *buf,
47 size_t count, loff_t *ppos)
48{
49 sample_buffer_pos = sample_buffer;
50 memset(sample_buffer, 0, SAMPLE_BUFFER_SIZE);
51}
52
53static struct file_operations cris_proc_profile_operations = {
54 .read = read_cris_profile,
55 .write = write_cris_profile,
56};
57
58static int
59__init init_cris_profile(void)
60{
61 struct proc_dir_entry *entry;
62 sample_buffer = (char*)kmalloc(SAMPLE_BUFFER_SIZE, GFP_KERNEL);
63 sample_buffer_pos = sample_buffer;
64 entry = create_proc_entry("system_profile", S_IWUSR | S_IRUGO, NULL);
65 if (entry) {
66 entry->proc_fops = &cris_proc_profile_operations;
67 entry->size = SAMPLE_BUFFER_SIZE;
68 }
69 prof_running = 1;
70 return 0;
71}
72
73__initcall(init_cris_profile);
diff --git a/arch/cris/kernel/ptrace.c b/arch/cris/kernel/ptrace.c
index e85a2fdd9acf..2b6363cbe985 100644
--- a/arch/cris/kernel/ptrace.c
+++ b/arch/cris/kernel/ptrace.c
@@ -8,6 +8,12 @@
8 * Authors: Bjorn Wesen 8 * Authors: Bjorn Wesen
9 * 9 *
10 * $Log: ptrace.c,v $ 10 * $Log: ptrace.c,v $
11 * Revision 1.10 2004/09/22 11:50:01 orjanf
12 * * Moved get_reg/put_reg to arch-specific files.
13 * * Added functions to access debug registers (CRISv32).
14 * * Added support for PTRACE_SINGLESTEP (CRISv32).
15 * * Added S flag to CCS_MASK (CRISv32).
16 *
11 * Revision 1.9 2003/07/04 12:56:11 tobiasa 17 * Revision 1.9 2003/07/04 12:56:11 tobiasa
12 * Moved arch-specific code to arch-specific files. 18 * Moved arch-specific code to arch-specific files.
13 * 19 *
@@ -72,37 +78,6 @@
72#include <asm/system.h> 78#include <asm/system.h>
73#include <asm/processor.h> 79#include <asm/processor.h>
74 80
75/*
76 * Get contents of register REGNO in task TASK.
77 */
78inline long get_reg(struct task_struct *task, unsigned int regno)
79{
80 /* USP is a special case, it's not in the pt_regs struct but
81 * in the tasks thread struct
82 */
83
84 if (regno == PT_USP)
85 return task->thread.usp;
86 else if (regno < PT_MAX)
87 return ((unsigned long *)user_regs(task->thread_info))[regno];
88 else
89 return 0;
90}
91
92/*
93 * Write contents of register REGNO in task TASK.
94 */
95inline int put_reg(struct task_struct *task, unsigned int regno,
96 unsigned long data)
97{
98 if (regno == PT_USP)
99 task->thread.usp = data;
100 else if (regno < PT_MAX)
101 ((unsigned long *)user_regs(task->thread_info))[regno] = data;
102 else
103 return -1;
104 return 0;
105}
106 81
107/* notification of userspace execution resumption 82/* notification of userspace execution resumption
108 * - triggered by current->work.notify_resume 83 * - triggered by current->work.notify_resume
diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c
index 6ec2671078bf..d11206e467ab 100644
--- a/arch/cris/kernel/setup.c
+++ b/arch/cris/kernel/setup.c
@@ -17,6 +17,7 @@
17#include <asm/pgtable.h> 17#include <asm/pgtable.h>
18#include <linux/seq_file.h> 18#include <linux/seq_file.h>
19#include <linux/tty.h> 19#include <linux/tty.h>
20#include <linux/utsname.h>
20 21
21#include <asm/setup.h> 22#include <asm/setup.h>
22 23
@@ -29,7 +30,7 @@ struct screen_info screen_info;
29extern int root_mountflags; 30extern int root_mountflags;
30extern char _etext, _edata, _end; 31extern char _etext, _edata, _end;
31 32
32static char command_line[COMMAND_LINE_SIZE] = { 0, }; 33char cris_command_line[COMMAND_LINE_SIZE] = { 0, };
33 34
34extern const unsigned long text_start, edata; /* set by the linker script */ 35extern const unsigned long text_start, edata; /* set by the linker script */
35extern unsigned long dram_start, dram_end; 36extern unsigned long dram_start, dram_end;
@@ -147,34 +148,35 @@ setup_arch(char **cmdline_p)
147 148
148 paging_init(); 149 paging_init();
149 150
150 /* We don't use a command line yet, so just re-initialize it without 151 *cmdline_p = cris_command_line;
151 saving anything that might be there. */
152
153 *cmdline_p = command_line;
154 152
155#ifdef CONFIG_ETRAX_CMDLINE 153#ifdef CONFIG_ETRAX_CMDLINE
156 strlcpy(command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE); 154 if (!strcmp(cris_command_line, "")) {
157 command_line[COMMAND_LINE_SIZE - 1] = '\0'; 155 strlcpy(cris_command_line, CONFIG_ETRAX_CMDLINE, COMMAND_LINE_SIZE);
156 cris_command_line[COMMAND_LINE_SIZE - 1] = '\0';
157 }
158#endif
158 159
159 /* Save command line for future references. */ 160 /* Save command line for future references. */
160 memcpy(saved_command_line, command_line, COMMAND_LINE_SIZE); 161 memcpy(saved_command_line, cris_command_line, COMMAND_LINE_SIZE);
161 saved_command_line[COMMAND_LINE_SIZE - 1] = '\0'; 162 saved_command_line[COMMAND_LINE_SIZE - 1] = '\0';
162#endif
163 163
164 /* give credit for the CRIS port */ 164 /* give credit for the CRIS port */
165 show_etrax_copyright(); 165 show_etrax_copyright();
166
167 /* Setup utsname */
168 strcpy(system_utsname.machine, cris_machine_name);
166} 169}
167 170
168static void *c_start(struct seq_file *m, loff_t *pos) 171static void *c_start(struct seq_file *m, loff_t *pos)
169{ 172{
170 /* We only got one CPU... */ 173 return *pos < NR_CPUS ? (void *)(int)(*pos + 1): NULL;
171 return *pos < 1 ? (void *)1 : NULL;
172} 174}
173 175
174static void *c_next(struct seq_file *m, void *v, loff_t *pos) 176static void *c_next(struct seq_file *m, void *v, loff_t *pos)
175{ 177{
176 ++*pos; 178 ++*pos;
177 return NULL; 179 return c_start(m, pos);
178} 180}
179 181
180static void c_stop(struct seq_file *m, void *v) 182static void c_stop(struct seq_file *m, void *v)
diff --git a/arch/cris/kernel/time.c b/arch/cris/kernel/time.c
index 6c28b0e7f7b4..fa2d4323da25 100644
--- a/arch/cris/kernel/time.c
+++ b/arch/cris/kernel/time.c
@@ -1,4 +1,4 @@
1/* $Id: time.c,v 1.14 2004/06/01 05:38:11 starvik Exp $ 1/* $Id: time.c,v 1.18 2005/03/04 08:16:17 starvik Exp $
2 * 2 *
3 * linux/arch/cris/kernel/time.c 3 * linux/arch/cris/kernel/time.c
4 * 4 *
@@ -30,6 +30,7 @@
30#include <linux/bcd.h> 30#include <linux/bcd.h>
31#include <linux/timex.h> 31#include <linux/timex.h>
32#include <linux/init.h> 32#include <linux/init.h>
33#include <linux/profile.h>
33 34
34u64 jiffies_64 = INITIAL_JIFFIES; 35u64 jiffies_64 = INITIAL_JIFFIES;
35 36
@@ -214,6 +215,21 @@ update_xtime_from_cmos(void)
214 } 215 }
215} 216}
216 217
218extern void cris_profile_sample(struct pt_regs* regs);
219
220void
221cris_do_profile(struct pt_regs* regs)
222{
223
224#if CONFIG_SYSTEM_PROFILER
225 cris_profile_sample(regs);
226#endif
227
228#if CONFIG_PROFILING
229 profile_tick(CPU_PROFILING, regs);
230#endif
231}
232
217/* 233/*
218 * Scheduler clock - returns current time in nanosec units. 234 * Scheduler clock - returns current time in nanosec units.
219 */ 235 */
diff --git a/arch/cris/kernel/traps.c b/arch/cris/kernel/traps.c
index d4dfa050e3a5..520d92205fed 100644
--- a/arch/cris/kernel/traps.c
+++ b/arch/cris/kernel/traps.c
@@ -1,4 +1,4 @@
1/* $Id: traps.c,v 1.9 2004/05/11 12:28:26 starvik Exp $ 1/* $Id: traps.c,v 1.11 2005/01/24 16:03:19 orjanf Exp $
2 * 2 *
3 * linux/arch/cris/traps.c 3 * linux/arch/cris/traps.c
4 * 4 *
@@ -20,13 +20,15 @@
20 20
21static int kstack_depth_to_print = 24; 21static int kstack_depth_to_print = 24;
22 22
23extern int raw_printk(const char *fmt, ...);
24
23void show_trace(unsigned long * stack) 25void show_trace(unsigned long * stack)
24{ 26{
25 unsigned long addr, module_start, module_end; 27 unsigned long addr, module_start, module_end;
26 extern char _stext, _etext; 28 extern char _stext, _etext;
27 int i; 29 int i;
28 30
29 printk("\nCall Trace: "); 31 raw_printk("\nCall Trace: ");
30 32
31 i = 1; 33 i = 1;
32 module_start = VMALLOC_START; 34 module_start = VMALLOC_START;
@@ -37,7 +39,7 @@ void show_trace(unsigned long * stack)
37 /* This message matches "failing address" marked 39 /* This message matches "failing address" marked
38 s390 in ksymoops, so lines containing it will 40 s390 in ksymoops, so lines containing it will
39 not be filtered out by ksymoops. */ 41 not be filtered out by ksymoops. */
40 printk ("Failing address 0x%lx\n", (unsigned long)stack); 42 raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
41 break; 43 break;
42 } 44 }
43 stack++; 45 stack++;
@@ -54,8 +56,8 @@ void show_trace(unsigned long * stack)
54 (addr <= (unsigned long) &_etext)) || 56 (addr <= (unsigned long) &_etext)) ||
55 ((addr >= module_start) && (addr <= module_end))) { 57 ((addr >= module_start) && (addr <= module_end))) {
56 if (i && ((i % 8) == 0)) 58 if (i && ((i % 8) == 0))
57 printk("\n "); 59 raw_printk("\n ");
58 printk("[<%08lx>] ", addr); 60 raw_printk("[<%08lx>] ", addr);
59 i++; 61 i++;
60 } 62 }
61 } 63 }
@@ -96,25 +98,59 @@ show_stack(struct task_struct *task, unsigned long *sp)
96 98
97 stack = sp; 99 stack = sp;
98 100
99 printk("\nStack from %08lx:\n ", (unsigned long)stack); 101 raw_printk("\nStack from %08lx:\n ", (unsigned long)stack);
100 for(i = 0; i < kstack_depth_to_print; i++) { 102 for(i = 0; i < kstack_depth_to_print; i++) {
101 if (((long) stack & (THREAD_SIZE-1)) == 0) 103 if (((long) stack & (THREAD_SIZE-1)) == 0)
102 break; 104 break;
103 if (i && ((i % 8) == 0)) 105 if (i && ((i % 8) == 0))
104 printk("\n "); 106 raw_printk("\n ");
105 if (__get_user (addr, stack)) { 107 if (__get_user (addr, stack)) {
106 /* This message matches "failing address" marked 108 /* This message matches "failing address" marked
107 s390 in ksymoops, so lines containing it will 109 s390 in ksymoops, so lines containing it will
108 not be filtered out by ksymoops. */ 110 not be filtered out by ksymoops. */
109 printk ("Failing address 0x%lx\n", (unsigned long)stack); 111 raw_printk ("Failing address 0x%lx\n", (unsigned long)stack);
110 break; 112 break;
111 } 113 }
112 stack++; 114 stack++;
113 printk("%08lx ", addr); 115 raw_printk("%08lx ", addr);
114 } 116 }
115 show_trace(sp); 117 show_trace(sp);
116} 118}
117 119
120static void (*nmi_handler)(struct pt_regs*);
121extern void arch_enable_nmi(void);
122
123void set_nmi_handler(void (*handler)(struct pt_regs*))
124{
125 nmi_handler = handler;
126 arch_enable_nmi();
127}
128
129void handle_nmi(struct pt_regs* regs)
130{
131 if (nmi_handler)
132 nmi_handler(regs);
133}
134
135#ifdef CONFIG_DEBUG_NMI_OOPS
136void oops_nmi_handler(struct pt_regs* regs)
137{
138 stop_watchdog();
139 raw_printk("NMI!\n");
140 show_registers(regs);
141}
142
143static int
144__init oops_nmi_register(void)
145{
146 set_nmi_handler(oops_nmi_handler);
147 return 0;
148}
149
150__initcall(oops_nmi_register);
151
152#endif
153
118#if 0 154#if 0
119/* displays a short stack trace */ 155/* displays a short stack trace */
120 156
@@ -123,9 +159,9 @@ show_stack()
123{ 159{
124 unsigned long *sp = (unsigned long *)rdusp(); 160 unsigned long *sp = (unsigned long *)rdusp();
125 int i; 161 int i;
126 printk("Stack dump [0x%08lx]:\n", (unsigned long)sp); 162 raw_printk("Stack dump [0x%08lx]:\n", (unsigned long)sp);
127 for(i = 0; i < 16; i++) 163 for(i = 0; i < 16; i++)
128 printk("sp + %d: 0x%08lx\n", i*4, sp[i]); 164 raw_printk("sp + %d: 0x%08lx\n", i*4, sp[i]);
129 return 0; 165 return 0;
130} 166}
131#endif 167#endif
@@ -142,3 +178,9 @@ trap_init(void)
142{ 178{
143 /* Nothing needs to be done */ 179 /* Nothing needs to be done */
144} 180}
181
182void spinning_cpu(void* addr)
183{
184 raw_printk("CPU %d spinning on %X\n", smp_processor_id(), addr);
185 dump_stack();
186}
diff --git a/arch/cris/mm/fault.c b/arch/cris/mm/fault.c
index 03254b9eded1..fe1cc36b5aca 100644
--- a/arch/cris/mm/fault.c
+++ b/arch/cris/mm/fault.c
@@ -6,6 +6,38 @@
6 * Authors: Bjorn Wesen 6 * Authors: Bjorn Wesen
7 * 7 *
8 * $Log: fault.c,v $ 8 * $Log: fault.c,v $
9 * Revision 1.20 2005/03/04 08:16:18 starvik
10 * Merge of Linux 2.6.11.
11 *
12 * Revision 1.19 2005/01/14 10:07:59 starvik
13 * Fixed warning.
14 *
15 * Revision 1.18 2005/01/12 08:10:14 starvik
16 * Readded the change of frametype when handling kernel page fault fixup
17 * for v10. This is necessary to avoid that the CPU remakes the faulting
18 * access.
19 *
20 * Revision 1.17 2005/01/11 13:53:05 starvik
21 * Use raw_printk.
22 *
23 * Revision 1.16 2004/12/17 11:39:41 starvik
24 * SMP support.
25 *
26 * Revision 1.15 2004/11/23 18:36:18 starvik
27 * Stack is now non-executable.
28 * Signal handler trampolines are placed in a reserved page mapped into all
29 * processes.
30 *
31 * Revision 1.14 2004/11/23 07:10:21 starvik
32 * Moved find_fixup_code to generic code.
33 *
34 * Revision 1.13 2004/11/23 07:00:54 starvik
35 * Actually use the execute permission bit in the MMU. This makes it possible
36 * to prevent e.g. attacks where executable code is put on the stack.
37 *
38 * Revision 1.12 2004/09/29 06:16:04 starvik
39 * Use instruction_pointer
40 *
9 * Revision 1.11 2004/05/14 07:58:05 starvik 41 * Revision 1.11 2004/05/14 07:58:05 starvik
10 * Merge of changes from 2.4 42 * Merge of changes from 2.4
11 * 43 *
@@ -103,6 +135,7 @@
103 135
104extern int find_fixup_code(struct pt_regs *); 136extern int find_fixup_code(struct pt_regs *);
105extern void die_if_kernel(const char *, struct pt_regs *, long); 137extern void die_if_kernel(const char *, struct pt_regs *, long);
138extern int raw_printk(const char *fmt, ...);
106 139
107/* debug of low-level TLB reload */ 140/* debug of low-level TLB reload */
108#undef DEBUG 141#undef DEBUG
@@ -118,7 +151,8 @@ extern void die_if_kernel(const char *, struct pt_regs *, long);
118 151
119/* current active page directory */ 152/* current active page directory */
120 153
121volatile pgd_t *current_pgd; 154volatile DEFINE_PER_CPU(pgd_t *,current_pgd);
155unsigned long cris_signal_return_page;
122 156
123/* 157/*
124 * This routine handles page faults. It determines the address, 158 * This routine handles page faults. It determines the address,
@@ -146,8 +180,9 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
146 struct vm_area_struct * vma; 180 struct vm_area_struct * vma;
147 siginfo_t info; 181 siginfo_t info;
148 182
149 D(printk("Page fault for %X at %X, prot %d write %d\n", 183 D(printk("Page fault for %lX on %X at %lX, prot %d write %d\n",
150 address, regs->erp, protection, writeaccess)); 184 address, smp_processor_id(), instruction_pointer(regs),
185 protection, writeaccess));
151 186
152 tsk = current; 187 tsk = current;
153 188
@@ -175,8 +210,19 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
175 !user_mode(regs)) 210 !user_mode(regs))
176 goto vmalloc_fault; 211 goto vmalloc_fault;
177 212
213 /* When stack execution is not allowed we store the signal
214 * trampolines in the reserved cris_signal_return_page.
215 * Handle this in the exact same way as vmalloc (we know
216 * that the mapping is there and is valid so no need to
217 * call handle_mm_fault).
218 */
219 if (cris_signal_return_page &&
220 address == cris_signal_return_page &&
221 !protection && user_mode(regs))
222 goto vmalloc_fault;
223
178 /* we can and should enable interrupts at this point */ 224 /* we can and should enable interrupts at this point */
179 sti(); 225 local_irq_enable();
180 226
181 mm = tsk->mm; 227 mm = tsk->mm;
182 info.si_code = SEGV_MAPERR; 228 info.si_code = SEGV_MAPERR;
@@ -220,7 +266,10 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
220 266
221 /* first do some preliminary protection checks */ 267 /* first do some preliminary protection checks */
222 268
223 if (writeaccess) { 269 if (writeaccess == 2){
270 if (!(vma->vm_flags & VM_EXEC))
271 goto bad_area;
272 } else if (writeaccess == 1) {
224 if (!(vma->vm_flags & VM_WRITE)) 273 if (!(vma->vm_flags & VM_WRITE))
225 goto bad_area; 274 goto bad_area;
226 } else { 275 } else {
@@ -234,7 +283,7 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
234 * the fault. 283 * the fault.
235 */ 284 */
236 285
237 switch (handle_mm_fault(mm, vma, address, writeaccess)) { 286 switch (handle_mm_fault(mm, vma, address, writeaccess & 1)) {
238 case 1: 287 case 1:
239 tsk->min_flt++; 288 tsk->min_flt++;
240 break; 289 break;
@@ -292,10 +341,10 @@ do_page_fault(unsigned long address, struct pt_regs *regs,
292 */ 341 */
293 342
294 if ((unsigned long) (address) < PAGE_SIZE) 343 if ((unsigned long) (address) < PAGE_SIZE)
295 printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference"); 344 raw_printk(KERN_ALERT "Unable to handle kernel NULL pointer dereference");
296 else 345 else
297 printk(KERN_ALERT "Unable to handle kernel access"); 346 raw_printk(KERN_ALERT "Unable to handle kernel access");
298 printk(" at virtual address %08lx\n",address); 347 raw_printk(" at virtual address %08lx\n",address);
299 348
300 die_if_kernel("Oops", regs, (writeaccess << 1) | protection); 349 die_if_kernel("Oops", regs, (writeaccess << 1) | protection);
301 350
@@ -346,10 +395,11 @@ vmalloc_fault:
346 395
347 int offset = pgd_index(address); 396 int offset = pgd_index(address);
348 pgd_t *pgd, *pgd_k; 397 pgd_t *pgd, *pgd_k;
398 pud_t *pud, *pud_k;
349 pmd_t *pmd, *pmd_k; 399 pmd_t *pmd, *pmd_k;
350 pte_t *pte_k; 400 pte_t *pte_k;
351 401
352 pgd = (pgd_t *)current_pgd + offset; 402 pgd = (pgd_t *)per_cpu(current_pgd, smp_processor_id()) + offset;
353 pgd_k = init_mm.pgd + offset; 403 pgd_k = init_mm.pgd + offset;
354 404
355 /* Since we're two-level, we don't need to do both 405 /* Since we're two-level, we don't need to do both
@@ -364,8 +414,13 @@ vmalloc_fault:
364 * it exists. 414 * it exists.
365 */ 415 */
366 416
367 pmd = pmd_offset(pgd, address); 417 pud = pud_offset(pgd, address);
368 pmd_k = pmd_offset(pgd_k, address); 418 pud_k = pud_offset(pgd_k, address);
419 if (!pud_present(*pud_k))
420 goto no_context;
421
422 pmd = pmd_offset(pud, address);
423 pmd_k = pmd_offset(pud_k, address);
369 424
370 if (!pmd_present(*pmd_k)) 425 if (!pmd_present(*pmd_k))
371 goto bad_area_nosemaphore; 426 goto bad_area_nosemaphore;
@@ -385,3 +440,19 @@ vmalloc_fault:
385 return; 440 return;
386 } 441 }
387} 442}
443
444/* Find fixup code. */
445int
446find_fixup_code(struct pt_regs *regs)
447{
448 const struct exception_table_entry *fixup;
449
450 if ((fixup = search_exception_tables(instruction_pointer(regs))) != 0) {
451 /* Adjust the instruction pointer in the stackframe. */
452 instruction_pointer(regs) = fixup->fixup;
453 arch_fixup(regs);
454 return 1;
455 }
456
457 return 0;
458}
diff --git a/arch/cris/mm/ioremap.c b/arch/cris/mm/ioremap.c
index 6b9130bfb6c1..ebba11e270fa 100644
--- a/arch/cris/mm/ioremap.c
+++ b/arch/cris/mm/ioremap.c
@@ -14,9 +14,10 @@
14#include <asm/pgalloc.h> 14#include <asm/pgalloc.h>
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/tlbflush.h> 16#include <asm/tlbflush.h>
17#include <asm/arch/memmap.h>
17 18
18extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size, 19extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned long size,
19 unsigned long phys_addr, unsigned long flags) 20 unsigned long phys_addr, pgprot_t prot)
20{ 21{
21 unsigned long end; 22 unsigned long end;
22 23
@@ -31,9 +32,7 @@ extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned l
31 printk("remap_area_pte: page already exists\n"); 32 printk("remap_area_pte: page already exists\n");
32 BUG(); 33 BUG();
33 } 34 }
34 set_pte(pte, mk_pte_phys(phys_addr, __pgprot(_PAGE_PRESENT | __READABLE | 35 set_pte(pte, mk_pte_phys(phys_addr, prot));
35 __WRITEABLE | _PAGE_GLOBAL |
36 _PAGE_KERNEL | flags)));
37 address += PAGE_SIZE; 36 address += PAGE_SIZE;
38 phys_addr += PAGE_SIZE; 37 phys_addr += PAGE_SIZE;
39 pte++; 38 pte++;
@@ -41,7 +40,7 @@ extern inline void remap_area_pte(pte_t * pte, unsigned long address, unsigned l
41} 40}
42 41
43static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size, 42static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned long size,
44 unsigned long phys_addr, unsigned long flags) 43 unsigned long phys_addr, pgprot_t prot)
45{ 44{
46 unsigned long end; 45 unsigned long end;
47 46
@@ -56,7 +55,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo
56 pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address); 55 pte_t * pte = pte_alloc_kernel(&init_mm, pmd, address);
57 if (!pte) 56 if (!pte)
58 return -ENOMEM; 57 return -ENOMEM;
59 remap_area_pte(pte, address, end - address, address + phys_addr, flags); 58 remap_area_pte(pte, address, end - address, address + phys_addr, prot);
60 address = (address + PMD_SIZE) & PMD_MASK; 59 address = (address + PMD_SIZE) & PMD_MASK;
61 pmd++; 60 pmd++;
62 } while (address && (address < end)); 61 } while (address && (address < end));
@@ -64,7 +63,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address, unsigned lo
64} 63}
65 64
66static int remap_area_pages(unsigned long address, unsigned long phys_addr, 65static int remap_area_pages(unsigned long address, unsigned long phys_addr,
67 unsigned long size, unsigned long flags) 66 unsigned long size, pgprot_t prot)
68{ 67{
69 int error; 68 int error;
70 pgd_t * dir; 69 pgd_t * dir;
@@ -77,13 +76,19 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
77 BUG(); 76 BUG();
78 spin_lock(&init_mm.page_table_lock); 77 spin_lock(&init_mm.page_table_lock);
79 do { 78 do {
79 pud_t *pud;
80 pmd_t *pmd; 80 pmd_t *pmd;
81 pmd = pmd_alloc(&init_mm, dir, address); 81
82 error = -ENOMEM; 82 error = -ENOMEM;
83 pud = pud_alloc(&init_mm, dir, address);
84 if (!pud)
85 break;
86 pmd = pmd_alloc(&init_mm, pud, address);
87
83 if (!pmd) 88 if (!pmd)
84 break; 89 break;
85 if (remap_area_pmd(pmd, address, end - address, 90 if (remap_area_pmd(pmd, address, end - address,
86 phys_addr + address, flags)) 91 phys_addr + address, prot))
87 break; 92 break;
88 error = 0; 93 error = 0;
89 address = (address + PGDIR_SIZE) & PGDIR_MASK; 94 address = (address + PGDIR_SIZE) & PGDIR_MASK;
@@ -107,9 +112,9 @@ static int remap_area_pages(unsigned long address, unsigned long phys_addr,
107 * have to convert them into an offset in a page-aligned mapping, but the 112 * have to convert them into an offset in a page-aligned mapping, but the
108 * caller shouldn't need to know that small detail. 113 * caller shouldn't need to know that small detail.
109 */ 114 */
110void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags) 115void __iomem * __ioremap_prot(unsigned long phys_addr, unsigned long size, pgprot_t prot)
111{ 116{
112 void * addr; 117 void __iomem * addr;
113 struct vm_struct * area; 118 struct vm_struct * area;
114 unsigned long offset, last_addr; 119 unsigned long offset, last_addr;
115 120
@@ -131,15 +136,36 @@ void * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flag
131 area = get_vm_area(size, VM_IOREMAP); 136 area = get_vm_area(size, VM_IOREMAP);
132 if (!area) 137 if (!area)
133 return NULL; 138 return NULL;
134 addr = area->addr; 139 addr = (void __iomem *)area->addr;
135 if (remap_area_pages((unsigned long) addr, phys_addr, size, flags)) { 140 if (remap_area_pages((unsigned long) addr, phys_addr, size, prot)) {
136 vfree(addr); 141 vfree((void __force *)addr);
137 return NULL; 142 return NULL;
138 } 143 }
139 return (void *) (offset + (char *)addr); 144 return (void __iomem *) (offset + (char __iomem *)addr);
145}
146
147void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned long flags)
148{
149 return __ioremap_prot(phys_addr, size,
150 __pgprot(_PAGE_PRESENT | __READABLE |
151 __WRITEABLE | _PAGE_GLOBAL |
152 _PAGE_KERNEL | flags));
153}
154
155/**
156 * ioremap_nocache - map bus memory into CPU space
157 * @offset: bus address of the memory
158 * @size: size of the resource to map
159 *
160 * Must be freed with iounmap.
161 */
162
163void __iomem *ioremap_nocache (unsigned long phys_addr, unsigned long size)
164{
165 return __ioremap(phys_addr | MEM_NON_CACHEABLE, size, 0);
140} 166}
141 167
142void iounmap(void *addr) 168void iounmap(volatile void __iomem *addr)
143{ 169{
144 if (addr > high_memory) 170 if (addr > high_memory)
145 return vfree((void *) (PAGE_MASK & (unsigned long) addr)); 171 return vfree((void *) (PAGE_MASK & (unsigned long) addr));
diff --git a/arch/cris/mm/tlb.c b/arch/cris/mm/tlb.c
index 23eca5ad7389..0df390a656cd 100644
--- a/arch/cris/mm/tlb.c
+++ b/arch/cris/mm/tlb.c
@@ -29,18 +29,6 @@
29struct mm_struct *page_id_map[NUM_PAGEID]; 29struct mm_struct *page_id_map[NUM_PAGEID];
30static int map_replace_ptr = 1; /* which page_id_map entry to replace next */ 30static int map_replace_ptr = 1; /* which page_id_map entry to replace next */
31 31
32/*
33 * Initialize the context related info for a new mm_struct
34 * instance.
35 */
36
37int
38init_new_context(struct task_struct *tsk, struct mm_struct *mm)
39{
40 mm->context = NO_CONTEXT;
41 return 0;
42}
43
44/* the following functions are similar to those used in the PPC port */ 32/* the following functions are similar to those used in the PPC port */
45 33
46static inline void 34static inline void
@@ -60,12 +48,12 @@ alloc_context(struct mm_struct *mm)
60 */ 48 */
61 flush_tlb_mm(old_mm); 49 flush_tlb_mm(old_mm);
62 50
63 old_mm->context = NO_CONTEXT; 51 old_mm->context.page_id = NO_CONTEXT;
64 } 52 }
65 53
66 /* insert it into the page_id_map */ 54 /* insert it into the page_id_map */
67 55
68 mm->context = map_replace_ptr; 56 mm->context.page_id = map_replace_ptr;
69 page_id_map[map_replace_ptr] = mm; 57 page_id_map[map_replace_ptr] = mm;
70 58
71 map_replace_ptr++; 59 map_replace_ptr++;
@@ -81,7 +69,7 @@ alloc_context(struct mm_struct *mm)
81void 69void
82get_mmu_context(struct mm_struct *mm) 70get_mmu_context(struct mm_struct *mm)
83{ 71{
84 if(mm->context == NO_CONTEXT) 72 if(mm->context.page_id == NO_CONTEXT)
85 alloc_context(mm); 73 alloc_context(mm);
86} 74}
87 75
@@ -96,11 +84,10 @@ get_mmu_context(struct mm_struct *mm)
96void 84void
97destroy_context(struct mm_struct *mm) 85destroy_context(struct mm_struct *mm)
98{ 86{
99 if(mm->context != NO_CONTEXT) { 87 if(mm->context.page_id != NO_CONTEXT) {
100 D(printk("destroy_context %d (%p)\n", mm->context, mm)); 88 D(printk("destroy_context %d (%p)\n", mm->context.page_id, mm));
101 flush_tlb_mm(mm); /* TODO this might be redundant ? */ 89 flush_tlb_mm(mm); /* TODO this might be redundant ? */
102 page_id_map[mm->context] = NULL; 90 page_id_map[mm->context.page_id] = NULL;
103 /* mm->context = NO_CONTEXT; redundant.. mm will be freed */
104 } 91 }
105} 92}
106 93
diff --git a/arch/h8300/kernel/process.c b/arch/h8300/kernel/process.c
index b5f83e9f04db..27f1fce64ce4 100644
--- a/arch/h8300/kernel/process.c
+++ b/arch/h8300/kernel/process.c
@@ -90,8 +90,6 @@ void machine_restart(char * __unused)
90 __asm__("jmp @@0"); 90 __asm__("jmp @@0");
91} 91}
92 92
93EXPORT_SYMBOL(machine_restart);
94
95void machine_halt(void) 93void machine_halt(void)
96{ 94{
97 local_irq_disable(); 95 local_irq_disable();
@@ -99,8 +97,6 @@ void machine_halt(void)
99 for (;;); 97 for (;;);
100} 98}
101 99
102EXPORT_SYMBOL(machine_halt);
103
104void machine_power_off(void) 100void machine_power_off(void)
105{ 101{
106 local_irq_disable(); 102 local_irq_disable();
@@ -108,8 +104,6 @@ void machine_power_off(void)
108 for (;;); 104 for (;;);
109} 105}
110 106
111EXPORT_SYMBOL(machine_power_off);
112
113void show_regs(struct pt_regs * regs) 107void show_regs(struct pt_regs * regs)
114{ 108{
115 printk("\nPC: %08lx Status: %02x", 109 printk("\nPC: %08lx Status: %02x",
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug
index bfb2064f7104..5228c40a6fb2 100644
--- a/arch/i386/Kconfig.debug
+++ b/arch/i386/Kconfig.debug
@@ -18,6 +18,9 @@ config EARLY_PRINTK
18config DEBUG_STACKOVERFLOW 18config DEBUG_STACKOVERFLOW
19 bool "Check for stack overflows" 19 bool "Check for stack overflows"
20 depends on DEBUG_KERNEL 20 depends on DEBUG_KERNEL
21 help
22 This option will cause messages to be printed if free stack space
23 drops below a certain limit.
21 24
22config KPROBES 25config KPROBES
23 bool "Kprobes" 26 bool "Kprobes"
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 064211d5f41b..d7811c4e8b50 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -911,14 +911,7 @@ static void apm_power_off(void)
911 0xcd, 0x15 /* int $0x15 */ 911 0xcd, 0x15 /* int $0x15 */
912 }; 912 };
913 913
914 /*
915 * This may be called on an SMP machine.
916 */
917#ifdef CONFIG_SMP
918 /* Some bioses don't like being called from CPU != 0 */ 914 /* Some bioses don't like being called from CPU != 0 */
919 set_cpus_allowed(current, cpumask_of_cpu(0));
920 BUG_ON(smp_processor_id() != 0);
921#endif
922 if (apm_info.realmode_power_off) 915 if (apm_info.realmode_power_off)
923 { 916 {
924 (void)apm_save_cpus(); 917 (void)apm_save_cpus();
diff --git a/arch/i386/kernel/cpu/intel_cacheinfo.c b/arch/i386/kernel/cpu/intel_cacheinfo.c
index 1d768b263269..6c55b50cf048 100644
--- a/arch/i386/kernel/cpu/intel_cacheinfo.c
+++ b/arch/i386/kernel/cpu/intel_cacheinfo.c
@@ -128,7 +128,7 @@ static int __devinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_le
128 cpuid_count(4, index, &eax, &ebx, &ecx, &edx); 128 cpuid_count(4, index, &eax, &ebx, &ecx, &edx);
129 cache_eax.full = eax; 129 cache_eax.full = eax;
130 if (cache_eax.split.type == CACHE_TYPE_NULL) 130 if (cache_eax.split.type == CACHE_TYPE_NULL)
131 return -1; 131 return -EIO; /* better error ? */
132 132
133 this_leaf->eax.full = eax; 133 this_leaf->eax.full = eax;
134 this_leaf->ebx.full = ebx; 134 this_leaf->ebx.full = ebx;
@@ -334,6 +334,7 @@ static int __devinit detect_cache_attributes(unsigned int cpu)
334 struct _cpuid4_info *this_leaf; 334 struct _cpuid4_info *this_leaf;
335 unsigned long j; 335 unsigned long j;
336 int retval; 336 int retval;
337 cpumask_t oldmask;
337 338
338 if (num_cache_leaves == 0) 339 if (num_cache_leaves == 0)
339 return -ENOENT; 340 return -ENOENT;
@@ -345,19 +346,26 @@ static int __devinit detect_cache_attributes(unsigned int cpu)
345 memset(cpuid4_info[cpu], 0, 346 memset(cpuid4_info[cpu], 0,
346 sizeof(struct _cpuid4_info) * num_cache_leaves); 347 sizeof(struct _cpuid4_info) * num_cache_leaves);
347 348
349 oldmask = current->cpus_allowed;
350 retval = set_cpus_allowed(current, cpumask_of_cpu(cpu));
351 if (retval)
352 goto out;
353
348 /* Do cpuid and store the results */ 354 /* Do cpuid and store the results */
355 retval = 0;
349 for (j = 0; j < num_cache_leaves; j++) { 356 for (j = 0; j < num_cache_leaves; j++) {
350 this_leaf = CPUID4_INFO_IDX(cpu, j); 357 this_leaf = CPUID4_INFO_IDX(cpu, j);
351 retval = cpuid4_cache_lookup(j, this_leaf); 358 retval = cpuid4_cache_lookup(j, this_leaf);
352 if (unlikely(retval < 0)) 359 if (unlikely(retval < 0))
353 goto err_out; 360 break;
354 cache_shared_cpu_map_setup(cpu, j); 361 cache_shared_cpu_map_setup(cpu, j);
355 } 362 }
356 return 0; 363 set_cpus_allowed(current, oldmask);
357 364
358err_out: 365out:
359 free_cache_attributes(cpu); 366 if (retval)
360 return -ENOMEM; 367 free_cache_attributes(cpu);
368 return retval;
361} 369}
362 370
363#ifdef CONFIG_SYSFS 371#ifdef CONFIG_SYSFS
diff --git a/arch/i386/kernel/numaq.c b/arch/i386/kernel/numaq.c
index e51edf0a6564..5f5b075f860a 100644
--- a/arch/i386/kernel/numaq.c
+++ b/arch/i386/kernel/numaq.c
@@ -31,6 +31,7 @@
31#include <linux/nodemask.h> 31#include <linux/nodemask.h>
32#include <asm/numaq.h> 32#include <asm/numaq.h>
33#include <asm/topology.h> 33#include <asm/topology.h>
34#include <asm/processor.h>
34 35
35#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) 36#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
36 37
@@ -77,3 +78,11 @@ int __init get_memcfg_numaq(void)
77 smp_dump_qct(); 78 smp_dump_qct();
78 return 1; 79 return 1;
79} 80}
81
82static int __init numaq_dsc_disable(void)
83{
84 printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
85 tsc_disable = 1;
86 return 0;
87}
88core_initcall(numaq_dsc_disable);
diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c
index d9492058aaf3..e3f362e8af5b 100644
--- a/arch/i386/kernel/process.c
+++ b/arch/i386/kernel/process.c
@@ -917,6 +917,8 @@ asmlinkage int sys_get_thread_area(struct user_desc __user *u_info)
917 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) 917 if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX)
918 return -EINVAL; 918 return -EINVAL;
919 919
920 memset(&info, 0, sizeof(info));
921
920 desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN; 922 desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN;
921 923
922 info.entry_number = idx; 924 info.entry_number = idx;
diff --git a/arch/i386/kernel/reboot.c b/arch/i386/kernel/reboot.c
index b3e584849961..c71fef31dc47 100644
--- a/arch/i386/kernel/reboot.c
+++ b/arch/i386/kernel/reboot.c
@@ -284,7 +284,7 @@ void machine_shutdown(void)
284 reboot_cpu_id = 0; 284 reboot_cpu_id = 0;
285 285
286 /* See if there has been given a command line override */ 286 /* See if there has been given a command line override */
287 if ((reboot_cpu_id != -1) && (reboot_cpu < NR_CPUS) && 287 if ((reboot_cpu != -1) && (reboot_cpu < NR_CPUS) &&
288 cpu_isset(reboot_cpu, cpu_online_map)) { 288 cpu_isset(reboot_cpu, cpu_online_map)) {
289 reboot_cpu_id = reboot_cpu; 289 reboot_cpu_id = reboot_cpu;
290 } 290 }
@@ -311,10 +311,8 @@ void machine_shutdown(void)
311#endif 311#endif
312} 312}
313 313
314void machine_restart(char * __unused) 314void machine_emergency_restart(void)
315{ 315{
316 machine_shutdown();
317
318 if (!reboot_thru_bios) { 316 if (!reboot_thru_bios) {
319 if (efi_enabled) { 317 if (efi_enabled) {
320 efi.reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL); 318 efi.reset_system(EFI_RESET_COLD, EFI_SUCCESS, 0, NULL);
@@ -337,23 +335,22 @@ void machine_restart(char * __unused)
337 machine_real_restart(jump_to_bios, sizeof(jump_to_bios)); 335 machine_real_restart(jump_to_bios, sizeof(jump_to_bios));
338} 336}
339 337
340EXPORT_SYMBOL(machine_restart); 338void machine_restart(char * __unused)
339{
340 machine_shutdown();
341 machine_emergency_restart();
342}
341 343
342void machine_halt(void) 344void machine_halt(void)
343{ 345{
344} 346}
345 347
346EXPORT_SYMBOL(machine_halt);
347
348void machine_power_off(void) 348void machine_power_off(void)
349{ 349{
350 lapic_shutdown(); 350 machine_shutdown();
351 351
352 if (efi_enabled)
353 efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
354 if (pm_power_off) 352 if (pm_power_off)
355 pm_power_off(); 353 pm_power_off();
356} 354}
357 355
358EXPORT_SYMBOL(machine_power_off);
359 356
diff --git a/arch/i386/mach-visws/reboot.c b/arch/i386/mach-visws/reboot.c
index 95e4676594e1..9e9296676f93 100644
--- a/arch/i386/mach-visws/reboot.c
+++ b/arch/i386/mach-visws/reboot.c
@@ -22,8 +22,6 @@ void machine_restart(char * __unused)
22 outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT); 22 outb(PIIX4_RESET_VAL, PIIX4_RESET_PORT);
23} 23}
24 24
25EXPORT_SYMBOL(machine_restart);
26
27void machine_power_off(void) 25void machine_power_off(void)
28{ 26{
29 unsigned short pm_status; 27 unsigned short pm_status;
@@ -43,10 +41,7 @@ void machine_power_off(void)
43 outl(PIIX_SPECIAL_STOP, 0xCFC); 41 outl(PIIX_SPECIAL_STOP, 0xCFC);
44} 42}
45 43
46EXPORT_SYMBOL(machine_power_off);
47
48void machine_halt(void) 44void machine_halt(void)
49{ 45{
50} 46}
51 47
52EXPORT_SYMBOL(machine_halt);
diff --git a/arch/i386/mach-voyager/voyager_basic.c b/arch/i386/mach-voyager/voyager_basic.c
index 8680080a6a89..b3eda46e0fe9 100644
--- a/arch/i386/mach-voyager/voyager_basic.c
+++ b/arch/i386/mach-voyager/voyager_basic.c
@@ -278,8 +278,6 @@ machine_restart(char *cmd)
278 } 278 }
279} 279}
280 280
281EXPORT_SYMBOL(machine_restart);
282
283void 281void
284mca_nmi_hook(void) 282mca_nmi_hook(void)
285{ 283{
@@ -315,12 +313,9 @@ machine_halt(void)
315 machine_power_off(); 313 machine_power_off();
316} 314}
317 315
318EXPORT_SYMBOL(machine_halt);
319
320void machine_power_off(void) 316void machine_power_off(void)
321{ 317{
322 if (pm_power_off) 318 if (pm_power_off)
323 pm_power_off(); 319 pm_power_off();
324} 320}
325 321
326EXPORT_SYMBOL(machine_power_off);
diff --git a/arch/i386/pci/irq.c b/arch/i386/pci/irq.c
index 766b104ac1a1..d291fb7f1357 100644
--- a/arch/i386/pci/irq.c
+++ b/arch/i386/pci/irq.c
@@ -550,6 +550,13 @@ static __init int intel_router_probe(struct irq_router *r, struct pci_dev *route
550static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device) 550static __init int via_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
551{ 551{
552 /* FIXME: We should move some of the quirk fixup stuff here */ 552 /* FIXME: We should move some of the quirk fixup stuff here */
553
554 if (router->device == PCI_DEVICE_ID_VIA_82C686 &&
555 device == PCI_DEVICE_ID_VIA_82C586_0) {
556 /* Asus k7m bios wrongly reports 82C686A as 586-compatible */
557 device = PCI_DEVICE_ID_VIA_82C686;
558 }
559
553 switch(device) 560 switch(device)
554 { 561 {
555 case PCI_DEVICE_ID_VIA_82C586_0: 562 case PCI_DEVICE_ID_VIA_82C586_0:
diff --git a/arch/ia64/kernel/entry.S b/arch/ia64/kernel/entry.S
index bb9a506deb78..66946f3fdac7 100644
--- a/arch/ia64/kernel/entry.S
+++ b/arch/ia64/kernel/entry.S
@@ -1574,8 +1574,8 @@ sys_call_table:
1574 data8 sys_ioprio_set 1574 data8 sys_ioprio_set
1575 data8 sys_ioprio_get // 1275 1575 data8 sys_ioprio_get // 1275
1576 data8 sys_set_zone_reclaim 1576 data8 sys_set_zone_reclaim
1577 data8 sys_ni_syscall 1577 data8 sys_inotify_init
1578 data8 sys_ni_syscall 1578 data8 sys_inotify_add_watch
1579 data8 sys_ni_syscall 1579 data8 sys_inotify_rm_watch
1580 1580
1581 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls 1581 .org sys_call_table + 8*NR_syscalls // guard against failures to increase NR_syscalls
diff --git a/arch/ia64/kernel/process.c b/arch/ia64/kernel/process.c
index e484910246ad..66e840609808 100644
--- a/arch/ia64/kernel/process.c
+++ b/arch/ia64/kernel/process.c
@@ -807,16 +807,12 @@ machine_restart (char *restart_cmd)
807 (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL); 807 (*efi.reset_system)(EFI_RESET_WARM, 0, 0, NULL);
808} 808}
809 809
810EXPORT_SYMBOL(machine_restart);
811
812void 810void
813machine_halt (void) 811machine_halt (void)
814{ 812{
815 cpu_halt(); 813 cpu_halt();
816} 814}
817 815
818EXPORT_SYMBOL(machine_halt);
819
820void 816void
821machine_power_off (void) 817machine_power_off (void)
822{ 818{
@@ -825,4 +821,3 @@ machine_power_off (void)
825 machine_halt(); 821 machine_halt();
826} 822}
827 823
828EXPORT_SYMBOL(machine_power_off);
diff --git a/arch/ia64/kernel/unwind.c b/arch/ia64/kernel/unwind.c
index 2776a074c6f1..3288be47bc75 100644
--- a/arch/ia64/kernel/unwind.c
+++ b/arch/ia64/kernel/unwind.c
@@ -362,7 +362,7 @@ unw_access_gr (struct unw_frame_info *info, int regnum, unsigned long *val, char
362 if (info->pri_unat_loc) 362 if (info->pri_unat_loc)
363 nat_addr = info->pri_unat_loc; 363 nat_addr = info->pri_unat_loc;
364 else 364 else
365 nat_addr = &info->sw->ar_unat; 365 nat_addr = &info->sw->caller_unat;
366 nat_mask = (1UL << ((long) addr & 0x1f8)/8); 366 nat_mask = (1UL << ((long) addr & 0x1f8)/8);
367 } 367 }
368 } else { 368 } else {
@@ -524,7 +524,7 @@ unw_access_ar (struct unw_frame_info *info, int regnum, unsigned long *val, int
524 case UNW_AR_UNAT: 524 case UNW_AR_UNAT:
525 addr = info->unat_loc; 525 addr = info->unat_loc;
526 if (!addr) 526 if (!addr)
527 addr = &info->sw->ar_unat; 527 addr = &info->sw->caller_unat;
528 break; 528 break;
529 529
530 case UNW_AR_LC: 530 case UNW_AR_LC:
@@ -1775,7 +1775,7 @@ run_script (struct unw_script *script, struct unw_frame_info *state)
1775 1775
1776 case UNW_INSN_SETNAT_MEMSTK: 1776 case UNW_INSN_SETNAT_MEMSTK:
1777 if (!state->pri_unat_loc) 1777 if (!state->pri_unat_loc)
1778 state->pri_unat_loc = &state->sw->ar_unat; 1778 state->pri_unat_loc = &state->sw->caller_unat;
1779 /* register off. is a multiple of 8, so the least 3 bits (type) are 0 */ 1779 /* register off. is a multiple of 8, so the least 3 bits (type) are 0 */
1780 s[dst+1] = ((unsigned long) state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK; 1780 s[dst+1] = ((unsigned long) state->pri_unat_loc - s[dst]) | UNW_NAT_MEMSTK;
1781 break; 1781 break;
@@ -2243,11 +2243,11 @@ unw_init (void)
2243 if (8*sizeof(unw_hash_index_t) < UNW_LOG_HASH_SIZE) 2243 if (8*sizeof(unw_hash_index_t) < UNW_LOG_HASH_SIZE)
2244 unw_hash_index_t_is_too_narrow(); 2244 unw_hash_index_t_is_too_narrow();
2245 2245
2246 unw.sw_off[unw.preg_index[UNW_REG_PRI_UNAT_GR]] = SW(AR_UNAT); 2246 unw.sw_off[unw.preg_index[UNW_REG_PRI_UNAT_GR]] = SW(CALLER_UNAT);
2247 unw.sw_off[unw.preg_index[UNW_REG_BSPSTORE]] = SW(AR_BSPSTORE); 2247 unw.sw_off[unw.preg_index[UNW_REG_BSPSTORE]] = SW(AR_BSPSTORE);
2248 unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_UNAT); 2248 unw.sw_off[unw.preg_index[UNW_REG_PFS]] = SW(AR_PFS);
2249 unw.sw_off[unw.preg_index[UNW_REG_RP]] = SW(B0); 2249 unw.sw_off[unw.preg_index[UNW_REG_RP]] = SW(B0);
2250 unw.sw_off[unw.preg_index[UNW_REG_UNAT]] = SW(AR_UNAT); 2250 unw.sw_off[unw.preg_index[UNW_REG_UNAT]] = SW(CALLER_UNAT);
2251 unw.sw_off[unw.preg_index[UNW_REG_PR]] = SW(PR); 2251 unw.sw_off[unw.preg_index[UNW_REG_PR]] = SW(PR);
2252 unw.sw_off[unw.preg_index[UNW_REG_LC]] = SW(AR_LC); 2252 unw.sw_off[unw.preg_index[UNW_REG_LC]] = SW(AR_LC);
2253 unw.sw_off[unw.preg_index[UNW_REG_FPSR]] = SW(AR_FPSR); 2253 unw.sw_off[unw.preg_index[UNW_REG_FPSR]] = SW(AR_FPSR);
diff --git a/arch/ia64/sn/kernel/xpc_main.c b/arch/ia64/sn/kernel/xpc_main.c
index d580adcad927..bb1d5cf30440 100644
--- a/arch/ia64/sn/kernel/xpc_main.c
+++ b/arch/ia64/sn/kernel/xpc_main.c
@@ -420,7 +420,7 @@ xpc_activating(void *__partid)
420 partid_t partid = (u64) __partid; 420 partid_t partid = (u64) __partid;
421 struct xpc_partition *part = &xpc_partitions[partid]; 421 struct xpc_partition *part = &xpc_partitions[partid];
422 unsigned long irq_flags; 422 unsigned long irq_flags;
423 struct sched_param param = { sched_priority: MAX_USER_RT_PRIO - 1 }; 423 struct sched_param param = { sched_priority: MAX_RT_PRIO - 1 };
424 int ret; 424 int ret;
425 425
426 426
diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug
index 36788c2c310d..31039723804f 100644
--- a/arch/m32r/Kconfig.debug
+++ b/arch/m32r/Kconfig.debug
@@ -5,6 +5,9 @@ source "lib/Kconfig.debug"
5config DEBUG_STACKOVERFLOW 5config DEBUG_STACKOVERFLOW
6 bool "Check for stack overflows" 6 bool "Check for stack overflows"
7 depends on DEBUG_KERNEL 7 depends on DEBUG_KERNEL
8 help
9 This option will cause messages to be printed if free stack space
10 drops below a certain limit.
8 11
9config DEBUG_STACK_USAGE 12config DEBUG_STACK_USAGE
10 bool "Stack utilization instrumentation" 13 bool "Stack utilization instrumentation"
diff --git a/arch/m32r/kernel/process.c b/arch/m32r/kernel/process.c
index b556c3cf6495..ea13a8f4d8b0 100644
--- a/arch/m32r/kernel/process.c
+++ b/arch/m32r/kernel/process.c
@@ -115,8 +115,6 @@ void machine_restart(char *__unused)
115 cpu_relax(); 115 cpu_relax();
116} 116}
117 117
118EXPORT_SYMBOL(machine_restart);
119
120void machine_halt(void) 118void machine_halt(void)
121{ 119{
122 printk("Please push reset button!\n"); 120 printk("Please push reset button!\n");
@@ -124,15 +122,11 @@ void machine_halt(void)
124 cpu_relax(); 122 cpu_relax();
125} 123}
126 124
127EXPORT_SYMBOL(machine_halt);
128
129void machine_power_off(void) 125void machine_power_off(void)
130{ 126{
131 /* M32R_FIXME */ 127 /* M32R_FIXME */
132} 128}
133 129
134EXPORT_SYMBOL(machine_power_off);
135
136static int __init idle_setup (char *str) 130static int __init idle_setup (char *str)
137{ 131{
138 if (!strncmp(str, "poll", 4)) { 132 if (!strncmp(str, "poll", 4)) {
diff --git a/arch/m68k/kernel/process.c b/arch/m68k/kernel/process.c
index 93b043e2a435..11b1b90ba6ba 100644
--- a/arch/m68k/kernel/process.c
+++ b/arch/m68k/kernel/process.c
@@ -113,8 +113,6 @@ void machine_restart(char * __unused)
113 for (;;); 113 for (;;);
114} 114}
115 115
116EXPORT_SYMBOL(machine_restart);
117
118void machine_halt(void) 116void machine_halt(void)
119{ 117{
120 if (mach_halt) 118 if (mach_halt)
@@ -122,8 +120,6 @@ void machine_halt(void)
122 for (;;); 120 for (;;);
123} 121}
124 122
125EXPORT_SYMBOL(machine_halt);
126
127void machine_power_off(void) 123void machine_power_off(void)
128{ 124{
129 if (mach_power_off) 125 if (mach_power_off)
@@ -131,8 +127,6 @@ void machine_power_off(void)
131 for (;;); 127 for (;;);
132} 128}
133 129
134EXPORT_SYMBOL(machine_power_off);
135
136void show_regs(struct pt_regs * regs) 130void show_regs(struct pt_regs * regs)
137{ 131{
138 printk("\n"); 132 printk("\n");
diff --git a/arch/m68knommu/kernel/process.c b/arch/m68knommu/kernel/process.c
index c4a33f265dc0..82e7ec888806 100644
--- a/arch/m68knommu/kernel/process.c
+++ b/arch/m68knommu/kernel/process.c
@@ -80,8 +80,6 @@ void machine_restart(char * __unused)
80 for (;;); 80 for (;;);
81} 81}
82 82
83EXPORT_SYMBOL(machine_restart);
84
85void machine_halt(void) 83void machine_halt(void)
86{ 84{
87 if (mach_halt) 85 if (mach_halt)
@@ -89,8 +87,6 @@ void machine_halt(void)
89 for (;;); 87 for (;;);
90} 88}
91 89
92EXPORT_SYMBOL(machine_halt);
93
94void machine_power_off(void) 90void machine_power_off(void)
95{ 91{
96 if (mach_power_off) 92 if (mach_power_off)
@@ -98,8 +94,6 @@ void machine_power_off(void)
98 for (;;); 94 for (;;);
99} 95}
100 96
101EXPORT_SYMBOL(machine_power_off);
102
103void show_regs(struct pt_regs * regs) 97void show_regs(struct pt_regs * regs)
104{ 98{
105 printk(KERN_NOTICE "\n"); 99 printk(KERN_NOTICE "\n");
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index b578239146b5..898de2df1fc7 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -1088,41 +1088,6 @@ config ARC32
1088 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32 1088 depends on MACH_JAZZ || SNI_RM200_PCI || SGI_IP22 || SGI_IP32
1089 default y 1089 default y
1090 1090
1091config FB
1092 bool
1093 depends on MIPS_MAGNUM_4000 || OLIVETTI_M700
1094 default y
1095 ---help---
1096 The frame buffer device provides an abstraction for the graphics
1097 hardware. It represents the frame buffer of some video hardware and
1098 allows application software to access the graphics hardware through
1099 a well-defined interface, so the software doesn't need to know
1100 anything about the low-level (hardware register) stuff.
1101
1102 Frame buffer devices work identically across the different
1103 architectures supported by Linux and make the implementation of
1104 application programs easier and more portable; at this point, an X
1105 server exists which uses the frame buffer device exclusively.
1106 On several non-X86 architectures, the frame buffer device is the
1107 only way to use the graphics hardware.
1108
1109 The device is accessed through special device nodes, usually located
1110 in the /dev directory, i.e. /dev/fb*.
1111
1112 You need an utility program called fbset to make full use of frame
1113 buffer devices. Please read <file:Documentation/fb/framebuffer.txt>
1114 and the Framebuffer-HOWTO at <http://www.tldp.org/docs.html#howto>
1115 for more information.
1116
1117 Say Y here and to the driver for your graphics board below if you
1118 are compiling a kernel for a non-x86 architecture.
1119
1120 If you are compiling for the x86 architecture, you can say Y if you
1121 want to play with it, but it is not essential. Please note that
1122 running graphical applications that directly touch the hardware
1123 (e.g. an accelerated X server) and that are not frame buffer
1124 device-aware may cause unexpected results. If unsure, say N.
1125
1126config HAVE_STD_PC_SERIAL_PORT 1091config HAVE_STD_PC_SERIAL_PORT
1127 bool 1092 bool
1128 1093
diff --git a/arch/mips/kernel/irixsig.c b/arch/mips/kernel/irixsig.c
index 3f956f809fa4..40244782a8e5 100644
--- a/arch/mips/kernel/irixsig.c
+++ b/arch/mips/kernel/irixsig.c
@@ -178,7 +178,7 @@ asmlinkage int do_irix_signal(sigset_t *oldset, struct pt_regs *regs)
178 if (!user_mode(regs)) 178 if (!user_mode(regs))
179 return 1; 179 return 1;
180 180
181 if (try_to_freeze(0)) 181 if (try_to_freeze())
182 goto no_signal; 182 goto no_signal;
183 183
184 if (!oldset) 184 if (!oldset)
diff --git a/arch/mips/kernel/reset.c b/arch/mips/kernel/reset.c
index 7e0a9821931a..ae2ba67b7ef6 100644
--- a/arch/mips/kernel/reset.c
+++ b/arch/mips/kernel/reset.c
@@ -26,18 +26,13 @@ void machine_restart(char *command)
26 _machine_restart(command); 26 _machine_restart(command);
27} 27}
28 28
29EXPORT_SYMBOL(machine_restart);
30
31void machine_halt(void) 29void machine_halt(void)
32{ 30{
33 _machine_halt(); 31 _machine_halt();
34} 32}
35 33
36EXPORT_SYMBOL(machine_halt);
37
38void machine_power_off(void) 34void machine_power_off(void)
39{ 35{
40 _machine_power_off(); 36 _machine_power_off();
41} 37}
42 38
43EXPORT_SYMBOL(machine_power_off);
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 1f3b19124c01..c1a69cf232f9 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -774,7 +774,7 @@ int do_signal32(sigset_t *oldset, struct pt_regs *regs)
774 if (!user_mode(regs)) 774 if (!user_mode(regs))
775 return 1; 775 return 1;
776 776
777 if (try_to_freeze(0)) 777 if (try_to_freeze())
778 goto no_signal; 778 goto no_signal;
779 779
780 if (!oldset) 780 if (!oldset)
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
index 92c11e9bbb3f..fa98ef3855bc 100644
--- a/arch/mips/vr41xx/common/Makefile
+++ b/arch/mips/vr41xx/common/Makefile
@@ -2,7 +2,7 @@
2# Makefile for common code of the NEC VR4100 series. 2# Makefile for common code of the NEC VR4100 series.
3# 3#
4 4
5obj-y += bcu.o cmu.o giu.o icu.o init.o int-handler.o pmu.o 5obj-y += bcu.o cmu.o icu.o init.o int-handler.o pmu.o
6obj-$(CONFIG_VRC4173) += vrc4173.o 6obj-$(CONFIG_VRC4173) += vrc4173.o
7 7
8EXTRA_AFLAGS := $(CFLAGS) 8EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/vr41xx/common/giu.c b/arch/mips/vr41xx/common/giu.c
deleted file mode 100644
index 9c6b21a79e8f..000000000000
--- a/arch/mips/vr41xx/common/giu.c
+++ /dev/null
@@ -1,455 +0,0 @@
1/*
2 * giu.c, General-purpose I/O Unit Interrupt routines for NEC VR4100 series.
3 *
4 * Copyright (C) 2002 MontaVista Software Inc.
5 * Author: Yoichi Yuasa <yyuasa@mvista.com or source@mvista.com>
6 * Copyright (C) 2003-2004 Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
7 * Copyright (C) 2005 Ralf Baechle (ralf@linux-mips.org)
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
23/*
24 * Changes:
25 * MontaVista Software Inc. <yyuasa@mvista.com> or <source@mvista.com>
26 * - New creation, NEC VR4111, VR4121, VR4122 and VR4131 are supported.
27 *
28 * Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
29 * - Added support for NEC VR4133.
30 * - Removed board_irq_init.
31 */
32#include <linux/errno.h>
33#include <linux/init.h>
34#include <linux/irq.h>
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/smp.h>
38#include <linux/types.h>
39
40#include <asm/cpu.h>
41#include <asm/io.h>
42#include <asm/vr41xx/vr41xx.h>
43
44#define GIUIOSELL_TYPE1 KSEG1ADDR(0x0b000100)
45#define GIUIOSELL_TYPE2 KSEG1ADDR(0x0f000140)
46
47#define GIUIOSELL 0x00
48#define GIUIOSELH 0x02
49#define GIUINTSTATL 0x08
50#define GIUINTSTATH 0x0a
51#define GIUINTENL 0x0c
52#define GIUINTENH 0x0e
53#define GIUINTTYPL 0x10
54#define GIUINTTYPH 0x12
55#define GIUINTALSELL 0x14
56#define GIUINTALSELH 0x16
57#define GIUINTHTSELL 0x18
58#define GIUINTHTSELH 0x1a
59#define GIUFEDGEINHL 0x20
60#define GIUFEDGEINHH 0x22
61#define GIUREDGEINHL 0x24
62#define GIUREDGEINHH 0x26
63
64static uint32_t giu_base;
65
66static struct irqaction giu_cascade = {
67 .handler = no_action,
68 .mask = CPU_MASK_NONE,
69 .name = "cascade",
70};
71
72#define read_giuint(offset) readw(giu_base + (offset))
73#define write_giuint(val, offset) writew((val), giu_base + (offset))
74
75#define GIUINT_HIGH_OFFSET 16
76
77static inline uint16_t set_giuint(uint8_t offset, uint16_t set)
78{
79 uint16_t res;
80
81 res = read_giuint(offset);
82 res |= set;
83 write_giuint(res, offset);
84
85 return res;
86}
87
88static inline uint16_t clear_giuint(uint8_t offset, uint16_t clear)
89{
90 uint16_t res;
91
92 res = read_giuint(offset);
93 res &= ~clear;
94 write_giuint(res, offset);
95
96 return res;
97}
98
99static unsigned int startup_giuint_low_irq(unsigned int irq)
100{
101 unsigned int pin;
102
103 pin = GIU_IRQ_TO_PIN(irq);
104 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
105 set_giuint(GIUINTENL, (uint16_t)1 << pin);
106
107 return 0;
108}
109
110static void shutdown_giuint_low_irq(unsigned int irq)
111{
112 clear_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
113}
114
115static void enable_giuint_low_irq(unsigned int irq)
116{
117 set_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
118}
119
120#define disable_giuint_low_irq shutdown_giuint_low_irq
121
122static void ack_giuint_low_irq(unsigned int irq)
123{
124 unsigned int pin;
125
126 pin = GIU_IRQ_TO_PIN(irq);
127 clear_giuint(GIUINTENL, (uint16_t)1 << pin);
128 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
129}
130
131static void end_giuint_low_irq(unsigned int irq)
132{
133 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
134 set_giuint(GIUINTENL, (uint16_t)1 << GIU_IRQ_TO_PIN(irq));
135}
136
137static struct hw_interrupt_type giuint_low_irq_type = {
138 .typename = "GIUINTL",
139 .startup = startup_giuint_low_irq,
140 .shutdown = shutdown_giuint_low_irq,
141 .enable = enable_giuint_low_irq,
142 .disable = disable_giuint_low_irq,
143 .ack = ack_giuint_low_irq,
144 .end = end_giuint_low_irq,
145};
146
147static unsigned int startup_giuint_high_irq(unsigned int irq)
148{
149 unsigned int pin;
150
151 pin = GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET);
152 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
153 set_giuint(GIUINTENH, (uint16_t)1 << pin);
154
155 return 0;
156}
157
158static void shutdown_giuint_high_irq(unsigned int irq)
159{
160 clear_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
161}
162
163static void enable_giuint_high_irq(unsigned int irq)
164{
165 set_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
166}
167
168#define disable_giuint_high_irq shutdown_giuint_high_irq
169
170static void ack_giuint_high_irq(unsigned int irq)
171{
172 unsigned int pin;
173
174 pin = GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET);
175 clear_giuint(GIUINTENH, (uint16_t)1 << pin);
176 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
177}
178
179static void end_giuint_high_irq(unsigned int irq)
180{
181 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
182 set_giuint(GIUINTENH, (uint16_t)1 << GIU_IRQ_TO_PIN(irq - GIUINT_HIGH_OFFSET));
183}
184
185static struct hw_interrupt_type giuint_high_irq_type = {
186 .typename = "GIUINTH",
187 .startup = startup_giuint_high_irq,
188 .shutdown = shutdown_giuint_high_irq,
189 .enable = enable_giuint_high_irq,
190 .disable = disable_giuint_high_irq,
191 .ack = ack_giuint_high_irq,
192 .end = end_giuint_high_irq,
193};
194
195void __init init_vr41xx_giuint_irq(void)
196{
197 int i;
198
199 for (i = GIU_IRQ_BASE; i <= GIU_IRQ_LAST; i++) {
200 if (i < (GIU_IRQ_BASE + GIUINT_HIGH_OFFSET))
201 irq_desc[i].handler = &giuint_low_irq_type;
202 else
203 irq_desc[i].handler = &giuint_high_irq_type;
204 }
205
206 setup_irq(GIUINT_CASCADE_IRQ, &giu_cascade);
207}
208
209void vr41xx_set_irq_trigger(int pin, int trigger, int hold)
210{
211 uint16_t mask;
212
213 if (pin < GIUINT_HIGH_OFFSET) {
214 mask = (uint16_t)1 << pin;
215 if (trigger != TRIGGER_LEVEL) {
216 set_giuint(GIUINTTYPL, mask);
217 if (hold == SIGNAL_HOLD)
218 set_giuint(GIUINTHTSELL, mask);
219 else
220 clear_giuint(GIUINTHTSELL, mask);
221 if (current_cpu_data.cputype == CPU_VR4133) {
222 switch (trigger) {
223 case TRIGGER_EDGE_FALLING:
224 set_giuint(GIUFEDGEINHL, mask);
225 clear_giuint(GIUREDGEINHL, mask);
226 break;
227 case TRIGGER_EDGE_RISING:
228 clear_giuint(GIUFEDGEINHL, mask);
229 set_giuint(GIUREDGEINHL, mask);
230 break;
231 default:
232 set_giuint(GIUFEDGEINHL, mask);
233 set_giuint(GIUREDGEINHL, mask);
234 break;
235 }
236 }
237 } else {
238 clear_giuint(GIUINTTYPL, mask);
239 clear_giuint(GIUINTHTSELL, mask);
240 }
241 write_giuint(mask, GIUINTSTATL);
242 } else {
243 mask = (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET);
244 if (trigger != TRIGGER_LEVEL) {
245 set_giuint(GIUINTTYPH, mask);
246 if (hold == SIGNAL_HOLD)
247 set_giuint(GIUINTHTSELH, mask);
248 else
249 clear_giuint(GIUINTHTSELH, mask);
250 if (current_cpu_data.cputype == CPU_VR4133) {
251 switch (trigger) {
252 case TRIGGER_EDGE_FALLING:
253 set_giuint(GIUFEDGEINHH, mask);
254 clear_giuint(GIUREDGEINHH, mask);
255 break;
256 case TRIGGER_EDGE_RISING:
257 clear_giuint(GIUFEDGEINHH, mask);
258 set_giuint(GIUREDGEINHH, mask);
259 break;
260 default:
261 set_giuint(GIUFEDGEINHH, mask);
262 set_giuint(GIUREDGEINHH, mask);
263 break;
264 }
265 }
266 } else {
267 clear_giuint(GIUINTTYPH, mask);
268 clear_giuint(GIUINTHTSELH, mask);
269 }
270 write_giuint(mask, GIUINTSTATH);
271 }
272}
273
274EXPORT_SYMBOL(vr41xx_set_irq_trigger);
275
276void vr41xx_set_irq_level(int pin, int level)
277{
278 uint16_t mask;
279
280 if (pin < GIUINT_HIGH_OFFSET) {
281 mask = (uint16_t)1 << pin;
282 if (level == LEVEL_HIGH)
283 set_giuint(GIUINTALSELL, mask);
284 else
285 clear_giuint(GIUINTALSELL, mask);
286 write_giuint(mask, GIUINTSTATL);
287 } else {
288 mask = (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET);
289 if (level == LEVEL_HIGH)
290 set_giuint(GIUINTALSELH, mask);
291 else
292 clear_giuint(GIUINTALSELH, mask);
293 write_giuint(mask, GIUINTSTATH);
294 }
295}
296
297EXPORT_SYMBOL(vr41xx_set_irq_level);
298
299#define GIUINT_NR_IRQS 32
300
301enum {
302 GIUINT_NO_CASCADE,
303 GIUINT_CASCADE
304};
305
306struct vr41xx_giuint_cascade {
307 unsigned int flag;
308 int (*get_irq_number)(int irq);
309};
310
311static struct vr41xx_giuint_cascade giuint_cascade[GIUINT_NR_IRQS];
312
313static int no_irq_number(int irq)
314{
315 return -EINVAL;
316}
317
318int vr41xx_cascade_irq(unsigned int irq, int (*get_irq_number)(int irq))
319{
320 unsigned int pin;
321 int retval;
322
323 if (irq < GIU_IRQ(0) || irq > GIU_IRQ(31))
324 return -EINVAL;
325
326 if(!get_irq_number)
327 return -EINVAL;
328
329 pin = GIU_IRQ_TO_PIN(irq);
330 giuint_cascade[pin].flag = GIUINT_CASCADE;
331 giuint_cascade[pin].get_irq_number = get_irq_number;
332
333 retval = setup_irq(irq, &giu_cascade);
334 if (retval != 0) {
335 giuint_cascade[pin].flag = GIUINT_NO_CASCADE;
336 giuint_cascade[pin].get_irq_number = no_irq_number;
337 }
338
339 return retval;
340}
341
342EXPORT_SYMBOL(vr41xx_cascade_irq);
343
344static inline int get_irq_pin_number(void)
345{
346 uint16_t pendl, pendh, maskl, maskh;
347 int i;
348
349 pendl = read_giuint(GIUINTSTATL);
350 pendh = read_giuint(GIUINTSTATH);
351 maskl = read_giuint(GIUINTENL);
352 maskh = read_giuint(GIUINTENH);
353
354 maskl &= pendl;
355 maskh &= pendh;
356
357 if (maskl) {
358 for (i = 0; i < 16; i++) {
359 if (maskl & ((uint16_t)1 << i))
360 return i;
361 }
362 } else if (maskh) {
363 for (i = 0; i < 16; i++) {
364 if (maskh & ((uint16_t)1 << i))
365 return i + GIUINT_HIGH_OFFSET;
366 }
367 }
368
369 printk(KERN_ERR "spurious GIU interrupt: %04x(%04x),%04x(%04x)\n",
370 maskl, pendl, maskh, pendh);
371
372 atomic_inc(&irq_err_count);
373
374 return -1;
375}
376
377static inline void ack_giuint_irq(int pin)
378{
379 if (pin < GIUINT_HIGH_OFFSET) {
380 clear_giuint(GIUINTENL, (uint16_t)1 << pin);
381 write_giuint((uint16_t)1 << pin, GIUINTSTATL);
382 } else {
383 pin -= GIUINT_HIGH_OFFSET;
384 clear_giuint(GIUINTENH, (uint16_t)1 << pin);
385 write_giuint((uint16_t)1 << pin, GIUINTSTATH);
386 }
387}
388
389static inline void end_giuint_irq(int pin)
390{
391 if (pin < GIUINT_HIGH_OFFSET)
392 set_giuint(GIUINTENL, (uint16_t)1 << pin);
393 else
394 set_giuint(GIUINTENH, (uint16_t)1 << (pin - GIUINT_HIGH_OFFSET));
395}
396
397void giuint_irq_dispatch(struct pt_regs *regs)
398{
399 struct vr41xx_giuint_cascade *cascade;
400 unsigned int giuint_irq;
401 int pin;
402
403 pin = get_irq_pin_number();
404 if (pin < 0)
405 return;
406
407 disable_irq(GIUINT_CASCADE_IRQ);
408
409 cascade = &giuint_cascade[pin];
410 giuint_irq = GIU_IRQ(pin);
411 if (cascade->flag == GIUINT_CASCADE) {
412 int irq = cascade->get_irq_number(giuint_irq);
413 ack_giuint_irq(pin);
414 if (irq >= 0)
415 do_IRQ(irq, regs);
416 end_giuint_irq(pin);
417 } else {
418 do_IRQ(giuint_irq, regs);
419 }
420
421 enable_irq(GIUINT_CASCADE_IRQ);
422}
423
424static int __init vr41xx_giu_init(void)
425{
426 int i;
427
428 switch (current_cpu_data.cputype) {
429 case CPU_VR4111:
430 case CPU_VR4121:
431 giu_base = GIUIOSELL_TYPE1;
432 break;
433 case CPU_VR4122:
434 case CPU_VR4131:
435 case CPU_VR4133:
436 giu_base = GIUIOSELL_TYPE2;
437 break;
438 default:
439 printk(KERN_ERR "GIU: Unexpected CPU of NEC VR4100 series\n");
440 return -EINVAL;
441 }
442
443 for (i = 0; i < GIUINT_NR_IRQS; i++) {
444 if (i < GIUINT_HIGH_OFFSET)
445 clear_giuint(GIUINTENL, (uint16_t)1 << i);
446 else
447 clear_giuint(GIUINTENH, (uint16_t)1 << (i - GIUINT_HIGH_OFFSET));
448 giuint_cascade[i].flag = GIUINT_NO_CASCADE;
449 giuint_cascade[i].get_irq_number = no_irq_number;
450 }
451
452 return 0;
453}
454
455early_initcall(vr41xx_giu_init);
diff --git a/arch/parisc/kernel/pci.c b/arch/parisc/kernel/pci.c
index 3cb08a4a513a..e6a891a0cad0 100644
--- a/arch/parisc/kernel/pci.c
+++ b/arch/parisc/kernel/pci.c
@@ -255,8 +255,26 @@ void __devinit pcibios_resource_to_bus(struct pci_dev *dev,
255 pcibios_link_hba_resources(&hba->lmmio_space, bus->resource[1]); 255 pcibios_link_hba_resources(&hba->lmmio_space, bus->resource[1]);
256} 256}
257 257
258void pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
259 struct pci_bus_region *region)
260{
261 struct pci_bus *bus = dev->bus;
262 struct pci_hba_data *hba = HBA_DATA(bus->bridge->platform_data);
263
264 if (res->flags & IORESOURCE_MEM) {
265 res->start = PCI_HOST_ADDR(hba, region->start);
266 res->end = PCI_HOST_ADDR(hba, region->end);
267 }
268
269 if (res->flags & IORESOURCE_IO) {
270 res->start = region->start;
271 res->end = region->end;
272 }
273}
274
258#ifdef CONFIG_HOTPLUG 275#ifdef CONFIG_HOTPLUG
259EXPORT_SYMBOL(pcibios_resource_to_bus); 276EXPORT_SYMBOL(pcibios_resource_to_bus);
277EXPORT_SYMBOL(pcibios_bus_to_resource);
260#endif 278#endif
261 279
262/* 280/*
diff --git a/arch/parisc/kernel/process.c b/arch/parisc/kernel/process.c
index 46e4a6881f11..4fc04501d5e5 100644
--- a/arch/parisc/kernel/process.c
+++ b/arch/parisc/kernel/process.c
@@ -150,8 +150,6 @@ void machine_restart(char *cmd)
150 150
151} 151}
152 152
153EXPORT_SYMBOL(machine_restart);
154
155void machine_halt(void) 153void machine_halt(void)
156{ 154{
157 /* 155 /*
@@ -160,8 +158,6 @@ void machine_halt(void)
160 */ 158 */
161} 159}
162 160
163EXPORT_SYMBOL(machine_halt);
164
165 161
166/* 162/*
167 * This routine is called from sys_reboot to actually turn off the 163 * This routine is called from sys_reboot to actually turn off the
@@ -187,8 +183,6 @@ void machine_power_off(void)
187 KERN_EMERG "Please power this system off now."); 183 KERN_EMERG "Please power this system off now.");
188} 184}
189 185
190EXPORT_SYMBOL(machine_power_off);
191
192 186
193/* 187/*
194 * Create a kernel thread 188 * Create a kernel thread
diff --git a/arch/ppc/Kconfig b/arch/ppc/Kconfig
index b833cbcd77f0..2c2da9b43b7a 100644
--- a/arch/ppc/Kconfig
+++ b/arch/ppc/Kconfig
@@ -85,7 +85,6 @@ config POWER4
85 bool "POWER4 and 970 (G5)" 85 bool "POWER4 and 970 (G5)"
86 86
87config 8xx 87config 8xx
88 depends on BROKEN
89 bool "8xx" 88 bool "8xx"
90 89
91config E200 90config E200
@@ -878,6 +877,13 @@ config MPC10X_STORE_GATHERING
878 bool "Enable MPC10x store gathering" 877 bool "Enable MPC10x store gathering"
879 depends on MPC10X_BRIDGE 878 depends on MPC10X_BRIDGE
880 879
880config SANDPOINT_ENABLE_UART1
881 bool "Enable DUART mode on Sandpoint"
882 depends on SANDPOINT
883 help
884 If this option is enabled then the MPC824x processor will run
885 in DUART mode instead of UART mode.
886
881config CPC710_DATA_GATHERING 887config CPC710_DATA_GATHERING
882 bool "Enable CPC710 data gathering" 888 bool "Enable CPC710 data gathering"
883 depends on K2 889 depends on K2
@@ -935,19 +941,11 @@ config NR_CPUS
935 depends on SMP 941 depends on SMP
936 default "4" 942 default "4"
937 943
938config PREEMPT
939 bool "Preemptible Kernel"
940 help
941 This option reduces the latency of the kernel when reacting to
942 real-time or interactive events by allowing a low priority process to
943 be preempted even if it is in kernel mode executing a system call.
944
945 Say Y here if you are building a kernel for a desktop, embedded
946 or real-time system. Say N if you are unsure.
947
948config HIGHMEM 944config HIGHMEM
949 bool "High memory support" 945 bool "High memory support"
950 946
947source kernel/Kconfig.hz
948source kernel/Kconfig.preempt
951source "mm/Kconfig" 949source "mm/Kconfig"
952 950
953source "fs/Kconfig.binfmt" 951source "fs/Kconfig.binfmt"
diff --git a/arch/ppc/configs/common_defconfig b/arch/ppc/configs/common_defconfig
index 95ead3f1b1cf..4d33bee23a89 100644
--- a/arch/ppc/configs/common_defconfig
+++ b/arch/ppc/configs/common_defconfig
@@ -1,15 +1,17 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.10-rc2 3# Linux kernel version: 2.6.13-rc3
4# Thu Nov 18 08:22:35 2004 4# Wed Jul 13 13:34:24 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
8CONFIG_RWSEM_XCHGADD_ALGORITHM=y 8CONFIG_RWSEM_XCHGADD_ALGORITHM=y
9CONFIG_GENERIC_CALIBRATE_DELAY=y
9CONFIG_HAVE_DEC_LOCK=y 10CONFIG_HAVE_DEC_LOCK=y
10CONFIG_PPC=y 11CONFIG_PPC=y
11CONFIG_PPC32=y 12CONFIG_PPC32=y
12CONFIG_GENERIC_NVRAM=y 13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
13 15
14# 16#
15# Code maturity level options 17# Code maturity level options
@@ -17,6 +19,7 @@ CONFIG_GENERIC_NVRAM=y
17CONFIG_EXPERIMENTAL=y 19CONFIG_EXPERIMENTAL=y
18CONFIG_CLEAN_COMPILE=y 20CONFIG_CLEAN_COMPILE=y
19CONFIG_BROKEN_ON_SMP=y 21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
20 23
21# 24#
22# General setup 25# General setup
@@ -28,30 +31,33 @@ CONFIG_POSIX_MQUEUE=y
28# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
29CONFIG_SYSCTL=y 32CONFIG_SYSCTL=y
30# CONFIG_AUDIT is not set 33# CONFIG_AUDIT is not set
31CONFIG_LOG_BUF_SHIFT=14
32CONFIG_HOTPLUG=y 34CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 35CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 36CONFIG_IKCONFIG=y
35CONFIG_IKCONFIG_PROC=y 37CONFIG_IKCONFIG_PROC=y
36# CONFIG_EMBEDDED is not set 38# CONFIG_EMBEDDED is not set
37CONFIG_KALLSYMS=y 39CONFIG_KALLSYMS=y
40# CONFIG_KALLSYMS_ALL is not set
38# CONFIG_KALLSYMS_EXTRA_PASS is not set 41# CONFIG_KALLSYMS_EXTRA_PASS is not set
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 45CONFIG_FUTEX=y
40CONFIG_EPOLL=y 46CONFIG_EPOLL=y
41# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
42CONFIG_SHMEM=y 47CONFIG_SHMEM=y
43CONFIG_CC_ALIGN_FUNCTIONS=0 48CONFIG_CC_ALIGN_FUNCTIONS=0
44CONFIG_CC_ALIGN_LABELS=0 49CONFIG_CC_ALIGN_LABELS=0
45CONFIG_CC_ALIGN_LOOPS=0 50CONFIG_CC_ALIGN_LOOPS=0
46CONFIG_CC_ALIGN_JUMPS=0 51CONFIG_CC_ALIGN_JUMPS=0
47# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
48 54
49# 55#
50# Loadable module support 56# Loadable module support
51# 57#
52CONFIG_MODULES=y 58CONFIG_MODULES=y
53CONFIG_MODULE_UNLOAD=y 59CONFIG_MODULE_UNLOAD=y
54CONFIG_MODULE_FORCE_UNLOAD=y 60# CONFIG_MODULE_FORCE_UNLOAD is not set
55CONFIG_OBSOLETE_MODPARM=y 61CONFIG_OBSOLETE_MODPARM=y
56CONFIG_MODVERSIONS=y 62CONFIG_MODVERSIONS=y
57# CONFIG_MODULE_SRCVERSION_ALL is not set 63# CONFIG_MODULE_SRCVERSION_ALL is not set
@@ -66,22 +72,27 @@ CONFIG_6xx=y
66# CONFIG_POWER3 is not set 72# CONFIG_POWER3 is not set
67# CONFIG_POWER4 is not set 73# CONFIG_POWER4 is not set
68# CONFIG_8xx is not set 74# CONFIG_8xx is not set
75# CONFIG_E200 is not set
69# CONFIG_E500 is not set 76# CONFIG_E500 is not set
77CONFIG_PPC_FPU=y
70CONFIG_ALTIVEC=y 78CONFIG_ALTIVEC=y
71CONFIG_TAU=y 79CONFIG_TAU=y
72# CONFIG_TAU_INT is not set 80# CONFIG_TAU_INT is not set
73# CONFIG_TAU_AVERAGE is not set 81# CONFIG_TAU_AVERAGE is not set
82# CONFIG_KEXEC is not set
74CONFIG_CPU_FREQ=y 83CONFIG_CPU_FREQ=y
84CONFIG_CPU_FREQ_TABLE=y
75# CONFIG_CPU_FREQ_DEBUG is not set 85# CONFIG_CPU_FREQ_DEBUG is not set
76CONFIG_CPU_FREQ_PROC_INTF=y 86CONFIG_CPU_FREQ_STAT=m
87CONFIG_CPU_FREQ_STAT_DETAILS=y
77CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y 88CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
78# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set 89# CONFIG_CPU_FREQ_DEFAULT_GOV_USERSPACE is not set
79CONFIG_CPU_FREQ_GOV_PERFORMANCE=y 90CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
80# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 91CONFIG_CPU_FREQ_GOV_POWERSAVE=m
81# CONFIG_CPU_FREQ_GOV_USERSPACE is not set 92CONFIG_CPU_FREQ_GOV_USERSPACE=m
82# CONFIG_CPU_FREQ_GOV_ONDEMAND is not set 93CONFIG_CPU_FREQ_GOV_ONDEMAND=m
94CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
83CONFIG_CPU_FREQ_PMAC=y 95CONFIG_CPU_FREQ_PMAC=y
84CONFIG_CPU_FREQ_TABLE=y
85CONFIG_PPC601_SYNC_FIX=y 96CONFIG_PPC601_SYNC_FIX=y
86CONFIG_PM=y 97CONFIG_PM=y
87CONFIG_PPC_STD_MMU=y 98CONFIG_PPC_STD_MMU=y
@@ -91,11 +102,15 @@ CONFIG_PPC_STD_MMU=y
91# 102#
92CONFIG_PPC_MULTIPLATFORM=y 103CONFIG_PPC_MULTIPLATFORM=y
93# CONFIG_APUS is not set 104# CONFIG_APUS is not set
105# CONFIG_KATANA is not set
94# CONFIG_WILLOW is not set 106# CONFIG_WILLOW is not set
107# CONFIG_CPCI690 is not set
95# CONFIG_PCORE is not set 108# CONFIG_PCORE is not set
96# CONFIG_POWERPMC250 is not set 109# CONFIG_POWERPMC250 is not set
97# CONFIG_EV64260 is not set 110# CONFIG_CHESTNUT is not set
98# CONFIG_SPRUCE is not set 111# CONFIG_SPRUCE is not set
112# CONFIG_HDPU is not set
113# CONFIG_EV64260 is not set
99# CONFIG_LOPEC is not set 114# CONFIG_LOPEC is not set
100# CONFIG_MCPN765 is not set 115# CONFIG_MCPN765 is not set
101# CONFIG_MVME5100 is not set 116# CONFIG_MVME5100 is not set
@@ -103,6 +118,7 @@ CONFIG_PPC_MULTIPLATFORM=y
103# CONFIG_PRPMC750 is not set 118# CONFIG_PRPMC750 is not set
104# CONFIG_PRPMC800 is not set 119# CONFIG_PRPMC800 is not set
105# CONFIG_SANDPOINT is not set 120# CONFIG_SANDPOINT is not set
121# CONFIG_RADSTONE_PPC7D is not set
106# CONFIG_ADIR is not set 122# CONFIG_ADIR is not set
107# CONFIG_K2 is not set 123# CONFIG_K2 is not set
108# CONFIG_PAL4 is not set 124# CONFIG_PAL4 is not set
@@ -113,22 +129,40 @@ CONFIG_PPC_MULTIPLATFORM=y
113# CONFIG_RPX8260 is not set 129# CONFIG_RPX8260 is not set
114# CONFIG_TQM8260 is not set 130# CONFIG_TQM8260 is not set
115# CONFIG_ADS8272 is not set 131# CONFIG_ADS8272 is not set
132# CONFIG_PQ2FADS is not set
116# CONFIG_LITE5200 is not set 133# CONFIG_LITE5200 is not set
134# CONFIG_MPC834x_SYS is not set
117CONFIG_PPC_CHRP=y 135CONFIG_PPC_CHRP=y
118CONFIG_PPC_PMAC=y 136CONFIG_PPC_PMAC=y
119CONFIG_PPC_PREP=y 137CONFIG_PPC_PREP=y
120CONFIG_PPC_OF=y 138CONFIG_PPC_OF=y
121CONFIG_PPCBUG_NVRAM=y 139CONFIG_PPCBUG_NVRAM=y
122# CONFIG_SMP is not set 140# CONFIG_SMP is not set
123# CONFIG_PREEMPT is not set
124# CONFIG_HIGHMEM is not set 141# CONFIG_HIGHMEM is not set
142# CONFIG_HZ_100 is not set
143CONFIG_HZ_250=y
144# CONFIG_HZ_1000 is not set
145CONFIG_HZ=250
146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set
149CONFIG_SELECT_MEMORY_MODEL=y
150CONFIG_FLATMEM_MANUAL=y
151# CONFIG_DISCONTIGMEM_MANUAL is not set
152# CONFIG_SPARSEMEM_MANUAL is not set
153CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y
125CONFIG_BINFMT_ELF=y 155CONFIG_BINFMT_ELF=y
126CONFIG_BINFMT_MISC=m 156CONFIG_BINFMT_MISC=m
127CONFIG_PROC_DEVICETREE=y 157CONFIG_PROC_DEVICETREE=y
128CONFIG_PREP_RESIDUAL=y 158CONFIG_PREP_RESIDUAL=y
129CONFIG_PROC_PREPRESIDUAL=y 159CONFIG_PROC_PREPRESIDUAL=y
130CONFIG_CMDLINE_BOOL=y 160# CONFIG_CMDLINE_BOOL is not set
131CONFIG_CMDLINE="console=ttyS0,9600 console=tty0 root=/dev/sda2" 161# CONFIG_PM_DEBUG is not set
162CONFIG_SOFTWARE_SUSPEND=y
163CONFIG_PM_STD_PARTITION=""
164# CONFIG_SECCOMP is not set
165CONFIG_ISA_DMA_API=y
132 166
133# 167#
134# Bus options 168# Bus options
@@ -137,18 +171,24 @@ CONFIG_ISA=y
137CONFIG_GENERIC_ISA_DMA=y 171CONFIG_GENERIC_ISA_DMA=y
138CONFIG_PCI=y 172CONFIG_PCI=y
139CONFIG_PCI_DOMAINS=y 173CONFIG_PCI_DOMAINS=y
140CONFIG_PCI_LEGACY_PROC=y 174# CONFIG_PCI_LEGACY_PROC is not set
141CONFIG_PCI_NAMES=y 175# CONFIG_PCI_NAMES is not set
176# CONFIG_PCI_DEBUG is not set
142 177
143# 178#
144# PCCARD (PCMCIA/CardBus) support 179# PCCARD (PCMCIA/CardBus) support
145# 180#
146# CONFIG_PCCARD is not set 181CONFIG_PCCARD=m
182# CONFIG_PCMCIA_DEBUG is not set
183# CONFIG_PCMCIA is not set
184CONFIG_CARDBUS=y
147 185
148# 186#
149# PC-card bridges 187# PC-card bridges
150# 188#
189CONFIG_YENTA=m
151CONFIG_PCMCIA_PROBE=y 190CONFIG_PCMCIA_PROBE=y
191CONFIG_PCCARD_NONSTATIC=m
152 192
153# 193#
154# Advanced setup 194# Advanced setup
@@ -165,6 +205,143 @@ CONFIG_TASK_SIZE=0x80000000
165CONFIG_BOOT_LOAD=0x00800000 205CONFIG_BOOT_LOAD=0x00800000
166 206
167# 207#
208# Networking
209#
210CONFIG_NET=y
211
212#
213# Networking options
214#
215CONFIG_PACKET=y
216# CONFIG_PACKET_MMAP is not set
217CONFIG_UNIX=y
218# CONFIG_NET_KEY is not set
219CONFIG_INET=y
220CONFIG_IP_MULTICAST=y
221# CONFIG_IP_ADVANCED_ROUTER is not set
222CONFIG_IP_FIB_HASH=y
223# CONFIG_IP_PNP is not set
224# CONFIG_NET_IPIP is not set
225# CONFIG_NET_IPGRE is not set
226# CONFIG_IP_MROUTE is not set
227# CONFIG_ARPD is not set
228CONFIG_SYN_COOKIES=y
229# CONFIG_INET_AH is not set
230# CONFIG_INET_ESP is not set
231# CONFIG_INET_IPCOMP is not set
232# CONFIG_INET_TUNNEL is not set
233CONFIG_IP_TCPDIAG=y
234# CONFIG_IP_TCPDIAG_IPV6 is not set
235# CONFIG_TCP_CONG_ADVANCED is not set
236CONFIG_TCP_CONG_BIC=y
237
238#
239# IP: Virtual Server Configuration
240#
241# CONFIG_IP_VS is not set
242# CONFIG_IPV6 is not set
243CONFIG_NETFILTER=y
244# CONFIG_NETFILTER_DEBUG is not set
245
246#
247# IP: Netfilter Configuration
248#
249CONFIG_IP_NF_CONNTRACK=m
250# CONFIG_IP_NF_CT_ACCT is not set
251CONFIG_IP_NF_CONNTRACK_MARK=y
252# CONFIG_IP_NF_CT_PROTO_SCTP is not set
253CONFIG_IP_NF_FTP=m
254CONFIG_IP_NF_IRC=m
255CONFIG_IP_NF_TFTP=m
256CONFIG_IP_NF_AMANDA=m
257CONFIG_IP_NF_QUEUE=m
258CONFIG_IP_NF_IPTABLES=m
259CONFIG_IP_NF_MATCH_LIMIT=m
260CONFIG_IP_NF_MATCH_IPRANGE=m
261CONFIG_IP_NF_MATCH_MAC=m
262CONFIG_IP_NF_MATCH_PKTTYPE=m
263CONFIG_IP_NF_MATCH_MARK=m
264CONFIG_IP_NF_MATCH_MULTIPORT=m
265CONFIG_IP_NF_MATCH_TOS=m
266CONFIG_IP_NF_MATCH_RECENT=m
267CONFIG_IP_NF_MATCH_ECN=m
268CONFIG_IP_NF_MATCH_DSCP=m
269CONFIG_IP_NF_MATCH_AH_ESP=m
270CONFIG_IP_NF_MATCH_LENGTH=m
271CONFIG_IP_NF_MATCH_TTL=m
272CONFIG_IP_NF_MATCH_TCPMSS=m
273CONFIG_IP_NF_MATCH_HELPER=m
274CONFIG_IP_NF_MATCH_STATE=m
275CONFIG_IP_NF_MATCH_CONNTRACK=m
276CONFIG_IP_NF_MATCH_OWNER=m
277CONFIG_IP_NF_MATCH_ADDRTYPE=m
278CONFIG_IP_NF_MATCH_REALM=m
279CONFIG_IP_NF_MATCH_SCTP=m
280CONFIG_IP_NF_MATCH_COMMENT=m
281CONFIG_IP_NF_MATCH_CONNMARK=m
282CONFIG_IP_NF_MATCH_HASHLIMIT=m
283CONFIG_IP_NF_FILTER=m
284CONFIG_IP_NF_TARGET_REJECT=m
285CONFIG_IP_NF_TARGET_LOG=m
286CONFIG_IP_NF_TARGET_ULOG=m
287CONFIG_IP_NF_TARGET_TCPMSS=m
288CONFIG_IP_NF_NAT=m
289CONFIG_IP_NF_NAT_NEEDED=y
290CONFIG_IP_NF_TARGET_MASQUERADE=m
291CONFIG_IP_NF_TARGET_REDIRECT=m
292CONFIG_IP_NF_TARGET_NETMAP=m
293CONFIG_IP_NF_TARGET_SAME=m
294CONFIG_IP_NF_NAT_SNMP_BASIC=m
295CONFIG_IP_NF_NAT_IRC=m
296CONFIG_IP_NF_NAT_FTP=m
297CONFIG_IP_NF_NAT_TFTP=m
298CONFIG_IP_NF_NAT_AMANDA=m
299CONFIG_IP_NF_MANGLE=m
300CONFIG_IP_NF_TARGET_TOS=m
301CONFIG_IP_NF_TARGET_ECN=m
302CONFIG_IP_NF_TARGET_DSCP=m
303CONFIG_IP_NF_TARGET_MARK=m
304CONFIG_IP_NF_TARGET_CLASSIFY=m
305CONFIG_IP_NF_TARGET_CONNMARK=m
306CONFIG_IP_NF_TARGET_CLUSTERIP=m
307CONFIG_IP_NF_RAW=m
308CONFIG_IP_NF_TARGET_NOTRACK=m
309CONFIG_IP_NF_ARPTABLES=m
310# CONFIG_IP_NF_ARPFILTER is not set
311# CONFIG_IP_NF_ARP_MANGLE is not set
312
313#
314# SCTP Configuration (EXPERIMENTAL)
315#
316# CONFIG_IP_SCTP is not set
317# CONFIG_ATM is not set
318# CONFIG_BRIDGE is not set
319# CONFIG_VLAN_8021Q is not set
320# CONFIG_DECNET is not set
321# CONFIG_LLC2 is not set
322# CONFIG_IPX is not set
323# CONFIG_ATALK is not set
324# CONFIG_X25 is not set
325# CONFIG_LAPB is not set
326# CONFIG_NET_DIVERT is not set
327# CONFIG_ECONET is not set
328# CONFIG_WAN_ROUTER is not set
329# CONFIG_NET_SCHED is not set
330CONFIG_NET_CLS_ROUTE=y
331
332#
333# Network testing
334#
335# CONFIG_NET_PKTGEN is not set
336CONFIG_NETPOLL=y
337# CONFIG_NETPOLL_RX is not set
338# CONFIG_NETPOLL_TRAP is not set
339CONFIG_NET_POLL_CONTROLLER=y
340# CONFIG_HAMRADIO is not set
341# CONFIG_IRDA is not set
342# CONFIG_BT is not set
343
344#
168# Device Drivers 345# Device Drivers
169# 346#
170 347
@@ -173,7 +350,8 @@ CONFIG_BOOT_LOAD=0x00800000
173# 350#
174# CONFIG_STANDALONE is not set 351# CONFIG_STANDALONE is not set
175CONFIG_PREVENT_FIRMWARE_BUILD=y 352CONFIG_PREVENT_FIRMWARE_BUILD=y
176# CONFIG_FW_LOADER is not set 353CONFIG_FW_LOADER=m
354# CONFIG_DEBUG_DRIVER is not set
177 355
178# 356#
179# Memory Technology Devices (MTD) 357# Memory Technology Devices (MTD)
@@ -183,7 +361,13 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
183# 361#
184# Parallel port support 362# Parallel port support
185# 363#
186# CONFIG_PARPORT is not set 364CONFIG_PARPORT=m
365CONFIG_PARPORT_PC=m
366CONFIG_PARPORT_SERIAL=m
367CONFIG_PARPORT_PC_FIFO=y
368CONFIG_PARPORT_PC_SUPERIO=y
369# CONFIG_PARPORT_GSC is not set
370CONFIG_PARPORT_1284=y
187 371
188# 372#
189# Plug and Play support 373# Plug and Play support
@@ -194,18 +378,21 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
194# Block devices 378# Block devices
195# 379#
196CONFIG_BLK_DEV_FD=m 380CONFIG_BLK_DEV_FD=m
197# CONFIG_MAC_FLOPPY is not set 381CONFIG_MAC_FLOPPY=m
198# CONFIG_BLK_DEV_XD is not set 382# CONFIG_BLK_DEV_XD is not set
383# CONFIG_PARIDE is not set
199# CONFIG_BLK_CPQ_DA is not set 384# CONFIG_BLK_CPQ_DA is not set
200# CONFIG_BLK_CPQ_CISS_DA is not set 385# CONFIG_BLK_CPQ_CISS_DA is not set
201# CONFIG_BLK_DEV_DAC960 is not set 386# CONFIG_BLK_DEV_DAC960 is not set
202# CONFIG_BLK_DEV_UMEM is not set 387# CONFIG_BLK_DEV_UMEM is not set
388# CONFIG_BLK_DEV_COW_COMMON is not set
203CONFIG_BLK_DEV_LOOP=y 389CONFIG_BLK_DEV_LOOP=y
204# CONFIG_BLK_DEV_CRYPTOLOOP is not set 390# CONFIG_BLK_DEV_CRYPTOLOOP is not set
205# CONFIG_BLK_DEV_NBD is not set 391# CONFIG_BLK_DEV_NBD is not set
206# CONFIG_BLK_DEV_SX8 is not set 392# CONFIG_BLK_DEV_SX8 is not set
207# CONFIG_BLK_DEV_UB is not set 393# CONFIG_BLK_DEV_UB is not set
208CONFIG_BLK_DEV_RAM=y 394CONFIG_BLK_DEV_RAM=y
395CONFIG_BLK_DEV_RAM_COUNT=16
209CONFIG_BLK_DEV_RAM_SIZE=4096 396CONFIG_BLK_DEV_RAM_SIZE=4096
210CONFIG_BLK_DEV_INITRD=y 397CONFIG_BLK_DEV_INITRD=y
211CONFIG_INITRAMFS_SOURCE="" 398CONFIG_INITRAMFS_SOURCE=""
@@ -219,6 +406,7 @@ CONFIG_IOSCHED_NOOP=y
219CONFIG_IOSCHED_AS=y 406CONFIG_IOSCHED_AS=y
220CONFIG_IOSCHED_DEADLINE=y 407CONFIG_IOSCHED_DEADLINE=y
221CONFIG_IOSCHED_CFQ=y 408CONFIG_IOSCHED_CFQ=y
409# CONFIG_ATA_OVER_ETH is not set
222 410
223# 411#
224# ATA/ATAPI/MFM/RLL support 412# ATA/ATAPI/MFM/RLL support
@@ -247,7 +435,7 @@ CONFIG_IDEPCI_SHARE_IRQ=y
247# CONFIG_BLK_DEV_OFFBOARD is not set 435# CONFIG_BLK_DEV_OFFBOARD is not set
248CONFIG_BLK_DEV_GENERIC=y 436CONFIG_BLK_DEV_GENERIC=y
249# CONFIG_BLK_DEV_OPTI621 is not set 437# CONFIG_BLK_DEV_OPTI621 is not set
250CONFIG_BLK_DEV_SL82C105=y 438# CONFIG_BLK_DEV_SL82C105 is not set
251CONFIG_BLK_DEV_IDEDMA_PCI=y 439CONFIG_BLK_DEV_IDEDMA_PCI=y
252# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 440# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
253CONFIG_IDEDMA_PCI_AUTO=y 441CONFIG_IDEDMA_PCI_AUTO=y
@@ -264,6 +452,7 @@ CONFIG_BLK_DEV_CMD64X=y
264# CONFIG_BLK_DEV_HPT366 is not set 452# CONFIG_BLK_DEV_HPT366 is not set
265# CONFIG_BLK_DEV_SC1200 is not set 453# CONFIG_BLK_DEV_SC1200 is not set
266# CONFIG_BLK_DEV_PIIX is not set 454# CONFIG_BLK_DEV_PIIX is not set
455# CONFIG_BLK_DEV_IT821X is not set
267# CONFIG_BLK_DEV_NS87415 is not set 456# CONFIG_BLK_DEV_NS87415 is not set
268# CONFIG_BLK_DEV_PDC202XX_OLD is not set 457# CONFIG_BLK_DEV_PDC202XX_OLD is not set
269CONFIG_BLK_DEV_PDC202XX_NEW=y 458CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -299,19 +488,21 @@ CONFIG_CHR_DEV_ST=y
299CONFIG_BLK_DEV_SR=y 488CONFIG_BLK_DEV_SR=y
300CONFIG_BLK_DEV_SR_VENDOR=y 489CONFIG_BLK_DEV_SR_VENDOR=y
301CONFIG_CHR_DEV_SG=y 490CONFIG_CHR_DEV_SG=y
491# CONFIG_CHR_DEV_SCH is not set
302 492
303# 493#
304# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 494# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
305# 495#
306# CONFIG_SCSI_MULTI_LUN is not set 496# CONFIG_SCSI_MULTI_LUN is not set
307CONFIG_SCSI_CONSTANTS=y 497CONFIG_SCSI_CONSTANTS=y
308# CONFIG_SCSI_LOGGING is not set 498CONFIG_SCSI_LOGGING=y
309 499
310# 500#
311# SCSI Transport Attributes 501# SCSI Transport Attributes
312# 502#
313CONFIG_SCSI_SPI_ATTRS=y 503CONFIG_SCSI_SPI_ATTRS=y
314# CONFIG_SCSI_FC_ATTRS is not set 504# CONFIG_SCSI_FC_ATTRS is not set
505# CONFIG_SCSI_ISCSI_ATTRS is not set
315 506
316# 507#
317# SCSI low-level drivers 508# SCSI low-level drivers
@@ -340,7 +531,6 @@ CONFIG_SCSI_AIC7XXX_OLD=m
340# CONFIG_SCSI_DMX3191D is not set 531# CONFIG_SCSI_DMX3191D is not set
341# CONFIG_SCSI_DTC3280 is not set 532# CONFIG_SCSI_DTC3280 is not set
342# CONFIG_SCSI_EATA is not set 533# CONFIG_SCSI_EATA is not set
343# CONFIG_SCSI_EATA_PIO is not set
344# CONFIG_SCSI_FUTURE_DOMAIN is not set 534# CONFIG_SCSI_FUTURE_DOMAIN is not set
345# CONFIG_SCSI_GDTH is not set 535# CONFIG_SCSI_GDTH is not set
346# CONFIG_SCSI_GENERIC_NCR5380 is not set 536# CONFIG_SCSI_GENERIC_NCR5380 is not set
@@ -348,6 +538,8 @@ CONFIG_SCSI_AIC7XXX_OLD=m
348# CONFIG_SCSI_IPS is not set 538# CONFIG_SCSI_IPS is not set
349# CONFIG_SCSI_INITIO is not set 539# CONFIG_SCSI_INITIO is not set
350# CONFIG_SCSI_INIA100 is not set 540# CONFIG_SCSI_INIA100 is not set
541# CONFIG_SCSI_PPA is not set
542# CONFIG_SCSI_IMM is not set
351# CONFIG_SCSI_NCR53C406A is not set 543# CONFIG_SCSI_NCR53C406A is not set
352CONFIG_SCSI_SYM53C8XX_2=y 544CONFIG_SCSI_SYM53C8XX_2=y
353CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0 545CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=0
@@ -358,17 +550,15 @@ CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
358# CONFIG_SCSI_PAS16 is not set 550# CONFIG_SCSI_PAS16 is not set
359# CONFIG_SCSI_PSI240I is not set 551# CONFIG_SCSI_PSI240I is not set
360# CONFIG_SCSI_QLOGIC_FAS is not set 552# CONFIG_SCSI_QLOGIC_FAS is not set
361# CONFIG_SCSI_QLOGIC_ISP is not set
362# CONFIG_SCSI_QLOGIC_FC is not set 553# CONFIG_SCSI_QLOGIC_FC is not set
363# CONFIG_SCSI_QLOGIC_1280 is not set 554# CONFIG_SCSI_QLOGIC_1280 is not set
364# CONFIG_SCSI_QLOGIC_1280_1040 is not set
365CONFIG_SCSI_QLA2XXX=y 555CONFIG_SCSI_QLA2XXX=y
366# CONFIG_SCSI_QLA21XX is not set 556# CONFIG_SCSI_QLA21XX is not set
367# CONFIG_SCSI_QLA22XX is not set 557# CONFIG_SCSI_QLA22XX is not set
368# CONFIG_SCSI_QLA2300 is not set 558# CONFIG_SCSI_QLA2300 is not set
369# CONFIG_SCSI_QLA2322 is not set 559# CONFIG_SCSI_QLA2322 is not set
370# CONFIG_SCSI_QLA6312 is not set 560# CONFIG_SCSI_QLA6312 is not set
371# CONFIG_SCSI_QLA6322 is not set 561# CONFIG_SCSI_LPFC is not set
372# CONFIG_SCSI_SYM53C416 is not set 562# CONFIG_SCSI_SYM53C416 is not set
373# CONFIG_SCSI_DC395x is not set 563# CONFIG_SCSI_DC395x is not set
374# CONFIG_SCSI_DC390T is not set 564# CONFIG_SCSI_DC390T is not set
@@ -395,11 +585,40 @@ CONFIG_SCSI_MAC53C94=y
395# Fusion MPT device support 585# Fusion MPT device support
396# 586#
397# CONFIG_FUSION is not set 587# CONFIG_FUSION is not set
588# CONFIG_FUSION_SPI is not set
589# CONFIG_FUSION_FC is not set
398 590
399# 591#
400# IEEE 1394 (FireWire) support 592# IEEE 1394 (FireWire) support
401# 593#
402# CONFIG_IEEE1394 is not set 594CONFIG_IEEE1394=m
595
596#
597# Subsystem Options
598#
599# CONFIG_IEEE1394_VERBOSEDEBUG is not set
600CONFIG_IEEE1394_OUI_DB=y
601CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
602CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
603# CONFIG_IEEE1394_EXPORT_FULL_API is not set
604
605#
606# Device Drivers
607#
608# CONFIG_IEEE1394_PCILYNX is not set
609CONFIG_IEEE1394_OHCI1394=m
610
611#
612# Protocol Drivers
613#
614CONFIG_IEEE1394_VIDEO1394=m
615CONFIG_IEEE1394_SBP2=m
616# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set
617CONFIG_IEEE1394_ETH1394=m
618CONFIG_IEEE1394_DV1394=m
619CONFIG_IEEE1394_RAWIO=m
620CONFIG_IEEE1394_CMP=m
621CONFIG_IEEE1394_AMDTP=m
403 622
404# 623#
405# I2O device support 624# I2O device support
@@ -412,8 +631,8 @@ CONFIG_SCSI_MAC53C94=y
412CONFIG_ADB=y 631CONFIG_ADB=y
413CONFIG_ADB_CUDA=y 632CONFIG_ADB_CUDA=y
414CONFIG_ADB_PMU=y 633CONFIG_ADB_PMU=y
415CONFIG_PMAC_PBOOK=y
416CONFIG_PMAC_APM_EMU=y 634CONFIG_PMAC_APM_EMU=y
635CONFIG_PMAC_MEDIABAY=y
417CONFIG_PMAC_BACKLIGHT=y 636CONFIG_PMAC_BACKLIGHT=y
418CONFIG_ADB_MACIO=y 637CONFIG_ADB_MACIO=y
419CONFIG_INPUT_ADBHID=y 638CONFIG_INPUT_ADBHID=y
@@ -423,138 +642,13 @@ CONFIG_THERM_ADT746X=m
423# CONFIG_ANSLCD is not set 642# CONFIG_ANSLCD is not set
424 643
425# 644#
426# Networking support 645# Network device support
427#
428CONFIG_NET=y
429
430#
431# Networking options
432#
433CONFIG_PACKET=y
434# CONFIG_PACKET_MMAP is not set
435# CONFIG_NETLINK_DEV is not set
436CONFIG_UNIX=y
437# CONFIG_NET_KEY is not set
438CONFIG_INET=y
439CONFIG_IP_MULTICAST=y
440# CONFIG_IP_ADVANCED_ROUTER is not set
441# CONFIG_IP_PNP is not set
442# CONFIG_NET_IPIP is not set
443# CONFIG_NET_IPGRE is not set
444# CONFIG_IP_MROUTE is not set
445# CONFIG_ARPD is not set
446CONFIG_SYN_COOKIES=y
447# CONFIG_INET_AH is not set
448# CONFIG_INET_ESP is not set
449# CONFIG_INET_IPCOMP is not set
450# CONFIG_INET_TUNNEL is not set
451CONFIG_IP_TCPDIAG=y
452# CONFIG_IP_TCPDIAG_IPV6 is not set
453
454#
455# IP: Virtual Server Configuration
456#
457# CONFIG_IP_VS is not set
458# CONFIG_IPV6 is not set
459CONFIG_NETFILTER=y
460# CONFIG_NETFILTER_DEBUG is not set
461
462#
463# IP: Netfilter Configuration
464# 646#
465CONFIG_IP_NF_CONNTRACK=m
466# CONFIG_IP_NF_CT_ACCT is not set
467# CONFIG_IP_NF_CONNTRACK_MARK is not set
468# CONFIG_IP_NF_CT_PROTO_SCTP is not set
469CONFIG_IP_NF_FTP=m
470CONFIG_IP_NF_IRC=m
471CONFIG_IP_NF_TFTP=m
472CONFIG_IP_NF_AMANDA=m
473# CONFIG_IP_NF_QUEUE is not set
474CONFIG_IP_NF_IPTABLES=m
475CONFIG_IP_NF_MATCH_LIMIT=m
476CONFIG_IP_NF_MATCH_IPRANGE=m
477CONFIG_IP_NF_MATCH_MAC=m
478CONFIG_IP_NF_MATCH_PKTTYPE=m
479CONFIG_IP_NF_MATCH_MARK=m
480CONFIG_IP_NF_MATCH_MULTIPORT=m
481CONFIG_IP_NF_MATCH_TOS=m
482CONFIG_IP_NF_MATCH_RECENT=m
483CONFIG_IP_NF_MATCH_ECN=m
484CONFIG_IP_NF_MATCH_DSCP=m
485CONFIG_IP_NF_MATCH_AH_ESP=m
486CONFIG_IP_NF_MATCH_LENGTH=m
487CONFIG_IP_NF_MATCH_TTL=m
488CONFIG_IP_NF_MATCH_TCPMSS=m
489CONFIG_IP_NF_MATCH_HELPER=m
490CONFIG_IP_NF_MATCH_STATE=m
491CONFIG_IP_NF_MATCH_CONNTRACK=m
492CONFIG_IP_NF_MATCH_OWNER=m
493# CONFIG_IP_NF_MATCH_ADDRTYPE is not set
494# CONFIG_IP_NF_MATCH_REALM is not set
495# CONFIG_IP_NF_MATCH_SCTP is not set
496# CONFIG_IP_NF_MATCH_COMMENT is not set
497# CONFIG_IP_NF_MATCH_HASHLIMIT is not set
498CONFIG_IP_NF_FILTER=m
499CONFIG_IP_NF_TARGET_REJECT=m
500# CONFIG_IP_NF_TARGET_LOG is not set
501CONFIG_IP_NF_TARGET_ULOG=m
502CONFIG_IP_NF_TARGET_TCPMSS=m
503CONFIG_IP_NF_NAT=m
504CONFIG_IP_NF_NAT_NEEDED=y
505CONFIG_IP_NF_TARGET_MASQUERADE=m
506CONFIG_IP_NF_TARGET_REDIRECT=m
507CONFIG_IP_NF_TARGET_NETMAP=m
508CONFIG_IP_NF_TARGET_SAME=m
509CONFIG_IP_NF_NAT_SNMP_BASIC=m
510CONFIG_IP_NF_NAT_IRC=m
511CONFIG_IP_NF_NAT_FTP=m
512CONFIG_IP_NF_NAT_TFTP=m
513CONFIG_IP_NF_NAT_AMANDA=m
514# CONFIG_IP_NF_MANGLE is not set
515CONFIG_IP_NF_RAW=m
516CONFIG_IP_NF_TARGET_NOTRACK=m
517# CONFIG_IP_NF_ARPTABLES is not set
518CONFIG_IP_NF_COMPAT_IPCHAINS=m
519# CONFIG_IP_NF_COMPAT_IPFWADM is not set
520
521#
522# SCTP Configuration (EXPERIMENTAL)
523#
524# CONFIG_IP_SCTP is not set
525# CONFIG_ATM is not set
526# CONFIG_BRIDGE is not set
527# CONFIG_VLAN_8021Q is not set
528# CONFIG_DECNET is not set
529# CONFIG_LLC2 is not set
530# CONFIG_IPX is not set
531# CONFIG_ATALK is not set
532# CONFIG_X25 is not set
533# CONFIG_LAPB is not set
534# CONFIG_NET_DIVERT is not set
535# CONFIG_ECONET is not set
536# CONFIG_WAN_ROUTER is not set
537
538#
539# QoS and/or fair queueing
540#
541# CONFIG_NET_SCHED is not set
542# CONFIG_NET_CLS_ROUTE is not set
543
544#
545# Network testing
546#
547# CONFIG_NET_PKTGEN is not set
548# CONFIG_NETPOLL is not set
549# CONFIG_NET_POLL_CONTROLLER is not set
550# CONFIG_HAMRADIO is not set
551# CONFIG_IRDA is not set
552# CONFIG_BT is not set
553CONFIG_NETDEVICES=y 647CONFIG_NETDEVICES=y
554# CONFIG_DUMMY is not set 648# CONFIG_DUMMY is not set
555# CONFIG_BONDING is not set 649# CONFIG_BONDING is not set
556# CONFIG_EQUALIZER is not set 650# CONFIG_EQUALIZER is not set
557# CONFIG_TUN is not set 651CONFIG_TUN=m
558 652
559# 653#
560# ARCnet devices 654# ARCnet devices
@@ -588,6 +682,8 @@ CONFIG_TULIP_MMIO=y
588CONFIG_DE4X5=m 682CONFIG_DE4X5=m
589# CONFIG_WINBOND_840 is not set 683# CONFIG_WINBOND_840 is not set
590# CONFIG_DM9102 is not set 684# CONFIG_DM9102 is not set
685# CONFIG_PCMCIA_XIRCOM is not set
686# CONFIG_PCMCIA_XIRTULIP is not set
591# CONFIG_AT1700 is not set 687# CONFIG_AT1700 is not set
592# CONFIG_DEPCA is not set 688# CONFIG_DEPCA is not set
593# CONFIG_HP100 is not set 689# CONFIG_HP100 is not set
@@ -626,9 +722,12 @@ CONFIG_PCNET32=y
626# CONFIG_HAMACHI is not set 722# CONFIG_HAMACHI is not set
627# CONFIG_YELLOWFIN is not set 723# CONFIG_YELLOWFIN is not set
628# CONFIG_R8169 is not set 724# CONFIG_R8169 is not set
725# CONFIG_SKGE is not set
629# CONFIG_SK98LIN is not set 726# CONFIG_SK98LIN is not set
630# CONFIG_VIA_VELOCITY is not set 727# CONFIG_VIA_VELOCITY is not set
631# CONFIG_TIGON3 is not set 728# CONFIG_TIGON3 is not set
729# CONFIG_BNX2 is not set
730# CONFIG_MV643XX_ETH is not set
632 731
633# 732#
634# Ethernet (10000 Mbit) 733# Ethernet (10000 Mbit)
@@ -676,18 +775,19 @@ CONFIG_NET_WIRELESS=y
676# CONFIG_WAN is not set 775# CONFIG_WAN is not set
677# CONFIG_FDDI is not set 776# CONFIG_FDDI is not set
678# CONFIG_HIPPI is not set 777# CONFIG_HIPPI is not set
778# CONFIG_PLIP is not set
679CONFIG_PPP=y 779CONFIG_PPP=y
680CONFIG_PPP_MULTILINK=y 780CONFIG_PPP_MULTILINK=y
681CONFIG_PPP_FILTER=y 781CONFIG_PPP_FILTER=y
682CONFIG_PPP_ASYNC=y 782CONFIG_PPP_ASYNC=y
683# CONFIG_PPP_SYNC_TTY is not set 783# CONFIG_PPP_SYNC_TTY is not set
684CONFIG_PPP_DEFLATE=y 784CONFIG_PPP_DEFLATE=y
685# CONFIG_PPP_BSDCOMP is not set 785CONFIG_PPP_BSDCOMP=m
686# CONFIG_PPPOE is not set 786CONFIG_PPPOE=m
687# CONFIG_SLIP is not set 787# CONFIG_SLIP is not set
688# CONFIG_NET_FC is not set 788# CONFIG_NET_FC is not set
689# CONFIG_SHAPER is not set 789# CONFIG_SHAPER is not set
690# CONFIG_NETCONSOLE is not set 790CONFIG_NETCONSOLE=m
691 791
692# 792#
693# ISDN subsystem 793# ISDN subsystem
@@ -708,7 +808,7 @@ CONFIG_INPUT=y
708# Userland interfaces 808# Userland interfaces
709# 809#
710CONFIG_INPUT_MOUSEDEV=y 810CONFIG_INPUT_MOUSEDEV=y
711CONFIG_INPUT_MOUSEDEV_PSAUX=y 811# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
712CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024 812CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
713CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768 813CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
714# CONFIG_INPUT_JOYDEV is not set 814# CONFIG_INPUT_JOYDEV is not set
@@ -717,18 +817,6 @@ CONFIG_INPUT_EVDEV=y
717CONFIG_INPUT_EVBUG=m 817CONFIG_INPUT_EVBUG=m
718 818
719# 819#
720# Input I/O drivers
721#
722# CONFIG_GAMEPORT is not set
723CONFIG_SOUND_GAMEPORT=y
724CONFIG_SERIO=y
725CONFIG_SERIO_I8042=y
726# CONFIG_SERIO_SERPORT is not set
727# CONFIG_SERIO_CT82C710 is not set
728# CONFIG_SERIO_PCIPS2 is not set
729# CONFIG_SERIO_RAW is not set
730
731#
732# Input Device Drivers 820# Input Device Drivers
733# 821#
734CONFIG_INPUT_KEYBOARD=y 822CONFIG_INPUT_KEYBOARD=y
@@ -751,6 +839,18 @@ CONFIG_INPUT_MISC=y
751CONFIG_INPUT_UINPUT=m 839CONFIG_INPUT_UINPUT=m
752 840
753# 841#
842# Hardware I/O ports
843#
844CONFIG_SERIO=y
845CONFIG_SERIO_I8042=y
846# CONFIG_SERIO_SERPORT is not set
847# CONFIG_SERIO_PARKBD is not set
848# CONFIG_SERIO_PCIPS2 is not set
849CONFIG_SERIO_LIBPS2=y
850# CONFIG_SERIO_RAW is not set
851# CONFIG_GAMEPORT is not set
852
853#
754# Character devices 854# Character devices
755# 855#
756CONFIG_VT=y 856CONFIG_VT=y
@@ -761,7 +861,8 @@ CONFIG_HW_CONSOLE=y
761# 861#
762# Serial drivers 862# Serial drivers
763# 863#
764CONFIG_SERIAL_8250=m 864CONFIG_SERIAL_8250=y
865CONFIG_SERIAL_8250_CONSOLE=y
765CONFIG_SERIAL_8250_NR_UARTS=4 866CONFIG_SERIAL_8250_NR_UARTS=4
766# CONFIG_SERIAL_8250_EXTENDED is not set 867# CONFIG_SERIAL_8250_EXTENDED is not set
767 868
@@ -769,11 +870,16 @@ CONFIG_SERIAL_8250_NR_UARTS=4
769# Non-8250 serial port support 870# Non-8250 serial port support
770# 871#
771CONFIG_SERIAL_CORE=y 872CONFIG_SERIAL_CORE=y
873CONFIG_SERIAL_CORE_CONSOLE=y
772CONFIG_SERIAL_PMACZILOG=y 874CONFIG_SERIAL_PMACZILOG=y
773# CONFIG_SERIAL_PMACZILOG_CONSOLE is not set 875CONFIG_SERIAL_PMACZILOG_CONSOLE=y
876# CONFIG_SERIAL_JSM is not set
774CONFIG_UNIX98_PTYS=y 877CONFIG_UNIX98_PTYS=y
775CONFIG_LEGACY_PTYS=y 878CONFIG_LEGACY_PTYS=y
776CONFIG_LEGACY_PTY_COUNT=256 879CONFIG_LEGACY_PTY_COUNT=256
880# CONFIG_PRINTER is not set
881# CONFIG_PPDEV is not set
882# CONFIG_TIPAR is not set
777 883
778# 884#
779# IPMI 885# IPMI
@@ -794,11 +900,23 @@ CONFIG_GEN_RTC=y
794# 900#
795# Ftape, the floppy tape device driver 901# Ftape, the floppy tape device driver
796# 902#
797# CONFIG_AGP is not set 903CONFIG_AGP=m
798# CONFIG_DRM is not set 904CONFIG_AGP_UNINORTH=m
905CONFIG_DRM=m
906# CONFIG_DRM_TDFX is not set
907CONFIG_DRM_R128=m
908CONFIG_DRM_RADEON=m
909# CONFIG_DRM_MGA is not set
910# CONFIG_DRM_SIS is not set
911# CONFIG_DRM_VIA is not set
799# CONFIG_RAW_DRIVER is not set 912# CONFIG_RAW_DRIVER is not set
800 913
801# 914#
915# TPM devices
916#
917# CONFIG_TCG_TPM is not set
918
919#
802# I2C support 920# I2C support
803# 921#
804CONFIG_I2C=y 922CONFIG_I2C=y
@@ -823,11 +941,13 @@ CONFIG_I2C_ALGOBIT=y
823CONFIG_I2C_HYDRA=y 941CONFIG_I2C_HYDRA=y
824# CONFIG_I2C_I801 is not set 942# CONFIG_I2C_I801 is not set
825# CONFIG_I2C_I810 is not set 943# CONFIG_I2C_I810 is not set
944# CONFIG_I2C_PIIX4 is not set
826# CONFIG_I2C_ISA is not set 945# CONFIG_I2C_ISA is not set
827CONFIG_I2C_KEYWEST=m 946CONFIG_I2C_KEYWEST=m
947# CONFIG_I2C_MPC is not set
828# CONFIG_I2C_NFORCE2 is not set 948# CONFIG_I2C_NFORCE2 is not set
949# CONFIG_I2C_PARPORT is not set
829# CONFIG_I2C_PARPORT_LIGHT is not set 950# CONFIG_I2C_PARPORT_LIGHT is not set
830# CONFIG_I2C_PIIX4 is not set
831# CONFIG_I2C_PROSAVAGE is not set 951# CONFIG_I2C_PROSAVAGE is not set
832# CONFIG_I2C_SAVAGE4 is not set 952# CONFIG_I2C_SAVAGE4 is not set
833# CONFIG_SCx200_ACB is not set 953# CONFIG_SCx200_ACB is not set
@@ -839,43 +959,20 @@ CONFIG_I2C_KEYWEST=m
839# CONFIG_I2C_VIAPRO is not set 959# CONFIG_I2C_VIAPRO is not set
840# CONFIG_I2C_VOODOO3 is not set 960# CONFIG_I2C_VOODOO3 is not set
841# CONFIG_I2C_PCA_ISA is not set 961# CONFIG_I2C_PCA_ISA is not set
962# CONFIG_I2C_SENSOR is not set
842 963
843# 964#
844# Hardware Sensors Chip support 965# Miscellaneous I2C Chip support
845#
846# CONFIG_I2C_SENSOR is not set
847# CONFIG_SENSORS_ADM1021 is not set
848# CONFIG_SENSORS_ADM1025 is not set
849# CONFIG_SENSORS_ADM1031 is not set
850# CONFIG_SENSORS_ASB100 is not set
851# CONFIG_SENSORS_DS1621 is not set
852# CONFIG_SENSORS_FSCHER is not set
853# CONFIG_SENSORS_GL518SM is not set
854# CONFIG_SENSORS_IT87 is not set
855# CONFIG_SENSORS_LM63 is not set
856# CONFIG_SENSORS_LM75 is not set
857# CONFIG_SENSORS_LM77 is not set
858# CONFIG_SENSORS_LM78 is not set
859# CONFIG_SENSORS_LM80 is not set
860# CONFIG_SENSORS_LM83 is not set
861# CONFIG_SENSORS_LM85 is not set
862# CONFIG_SENSORS_LM87 is not set
863# CONFIG_SENSORS_LM90 is not set
864# CONFIG_SENSORS_MAX1619 is not set
865# CONFIG_SENSORS_PC87360 is not set
866# CONFIG_SENSORS_SMSC47M1 is not set
867# CONFIG_SENSORS_VIA686A is not set
868# CONFIG_SENSORS_W83781D is not set
869# CONFIG_SENSORS_W83L785TS is not set
870# CONFIG_SENSORS_W83627HF is not set
871
872#
873# Other I2C Chip support
874# 966#
967# CONFIG_SENSORS_DS1337 is not set
968# CONFIG_SENSORS_DS1374 is not set
875# CONFIG_SENSORS_EEPROM is not set 969# CONFIG_SENSORS_EEPROM is not set
876# CONFIG_SENSORS_PCF8574 is not set 970# CONFIG_SENSORS_PCF8574 is not set
971# CONFIG_SENSORS_PCA9539 is not set
877# CONFIG_SENSORS_PCF8591 is not set 972# CONFIG_SENSORS_PCF8591 is not set
878# CONFIG_SENSORS_RTC8564 is not set 973# CONFIG_SENSORS_RTC8564 is not set
974# CONFIG_SENSORS_M41T00 is not set
975# CONFIG_SENSORS_MAX6875 is not set
879# CONFIG_I2C_DEBUG_CORE is not set 976# CONFIG_I2C_DEBUG_CORE is not set
880# CONFIG_I2C_DEBUG_ALGO is not set 977# CONFIG_I2C_DEBUG_ALGO is not set
881# CONFIG_I2C_DEBUG_BUS is not set 978# CONFIG_I2C_DEBUG_BUS is not set
@@ -887,6 +984,11 @@ CONFIG_I2C_KEYWEST=m
887# CONFIG_W1 is not set 984# CONFIG_W1 is not set
888 985
889# 986#
987# Hardware Monitoring support
988#
989# CONFIG_HWMON is not set
990
991#
890# Misc devices 992# Misc devices
891# 993#
892 994
@@ -904,8 +1006,13 @@ CONFIG_I2C_KEYWEST=m
904# Graphics support 1006# Graphics support
905# 1007#
906CONFIG_FB=y 1008CONFIG_FB=y
1009CONFIG_FB_CFB_FILLRECT=y
1010CONFIG_FB_CFB_COPYAREA=y
1011CONFIG_FB_CFB_IMAGEBLIT=y
1012CONFIG_FB_SOFT_CURSOR=y
1013CONFIG_FB_MACMODES=y
907CONFIG_FB_MODE_HELPERS=y 1014CONFIG_FB_MODE_HELPERS=y
908# CONFIG_FB_TILEBLITTING is not set 1015CONFIG_FB_TILEBLITTING=y
909# CONFIG_FB_CIRRUS is not set 1016# CONFIG_FB_CIRRUS is not set
910# CONFIG_FB_PM2 is not set 1017# CONFIG_FB_PM2 is not set
911# CONFIG_FB_CYBER2000 is not set 1018# CONFIG_FB_CYBER2000 is not set
@@ -917,13 +1024,16 @@ CONFIG_FB_CT65550=y
917# CONFIG_FB_ASILIANT is not set 1024# CONFIG_FB_ASILIANT is not set
918CONFIG_FB_IMSTT=y 1025CONFIG_FB_IMSTT=y
919# CONFIG_FB_VGA16 is not set 1026# CONFIG_FB_VGA16 is not set
920# CONFIG_FB_RIVA is not set 1027# CONFIG_FB_NVIDIA is not set
1028CONFIG_FB_RIVA=y
1029CONFIG_FB_RIVA_I2C=y
1030# CONFIG_FB_RIVA_DEBUG is not set
921CONFIG_FB_MATROX=y 1031CONFIG_FB_MATROX=y
922CONFIG_FB_MATROX_MILLENIUM=y 1032CONFIG_FB_MATROX_MILLENIUM=y
923CONFIG_FB_MATROX_MYSTIQUE=y 1033CONFIG_FB_MATROX_MYSTIQUE=y
924# CONFIG_FB_MATROX_G450 is not set 1034CONFIG_FB_MATROX_G=y
925# CONFIG_FB_MATROX_G100A is not set
926CONFIG_FB_MATROX_I2C=y 1035CONFIG_FB_MATROX_I2C=y
1036CONFIG_FB_MATROX_MAVEN=m
927# CONFIG_FB_MATROX_MULTIHEAD is not set 1037# CONFIG_FB_MATROX_MULTIHEAD is not set
928# CONFIG_FB_RADEON_OLD is not set 1038# CONFIG_FB_RADEON_OLD is not set
929CONFIG_FB_RADEON=y 1039CONFIG_FB_RADEON=y
@@ -932,8 +1042,8 @@ CONFIG_FB_RADEON_I2C=y
932CONFIG_FB_ATY128=y 1042CONFIG_FB_ATY128=y
933CONFIG_FB_ATY=y 1043CONFIG_FB_ATY=y
934CONFIG_FB_ATY_CT=y 1044CONFIG_FB_ATY_CT=y
935# CONFIG_FB_ATY_GENERIC_LCD is not set 1045CONFIG_FB_ATY_GENERIC_LCD=y
936# CONFIG_FB_ATY_XL_INIT is not set 1046CONFIG_FB_ATY_XL_INIT=y
937CONFIG_FB_ATY_GX=y 1047CONFIG_FB_ATY_GX=y
938# CONFIG_FB_SAVAGE is not set 1048# CONFIG_FB_SAVAGE is not set
939# CONFIG_FB_SIS is not set 1049# CONFIG_FB_SIS is not set
@@ -943,6 +1053,7 @@ CONFIG_FB_3DFX=y
943# CONFIG_FB_3DFX_ACCEL is not set 1053# CONFIG_FB_3DFX_ACCEL is not set
944# CONFIG_FB_VOODOO1 is not set 1054# CONFIG_FB_VOODOO1 is not set
945# CONFIG_FB_TRIDENT is not set 1055# CONFIG_FB_TRIDENT is not set
1056# CONFIG_FB_S1D13XXX is not set
946# CONFIG_FB_VIRTUAL is not set 1057# CONFIG_FB_VIRTUAL is not set
947 1058
948# 1059#
@@ -960,9 +1071,10 @@ CONFIG_FONT_8x16=y
960# Logo configuration 1071# Logo configuration
961# 1072#
962CONFIG_LOGO=y 1073CONFIG_LOGO=y
963CONFIG_LOGO_LINUX_MONO=y 1074# CONFIG_LOGO_LINUX_MONO is not set
964CONFIG_LOGO_LINUX_VGA16=y 1075# CONFIG_LOGO_LINUX_VGA16 is not set
965CONFIG_LOGO_LINUX_CLUT224=y 1076CONFIG_LOGO_LINUX_CLUT224=y
1077# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
966 1078
967# 1079#
968# Sound 1080# Sound
@@ -987,6 +1099,7 @@ CONFIG_SND_PCM_OSS=m
987CONFIG_SND_SEQUENCER_OSS=y 1099CONFIG_SND_SEQUENCER_OSS=y
988# CONFIG_SND_VERBOSE_PRINTK is not set 1100# CONFIG_SND_VERBOSE_PRINTK is not set
989# CONFIG_SND_DEBUG is not set 1101# CONFIG_SND_DEBUG is not set
1102CONFIG_SND_GENERIC_PM=y
990 1103
991# 1104#
992# Generic devices 1105# Generic devices
@@ -1002,6 +1115,7 @@ CONFIG_SND_OPL3_LIB=m
1002# 1115#
1003# ISA devices 1116# ISA devices
1004# 1117#
1118CONFIG_SND_CS4231_LIB=m
1005# CONFIG_SND_AD1848 is not set 1119# CONFIG_SND_AD1848 is not set
1006# CONFIG_SND_CS4231 is not set 1120# CONFIG_SND_CS4231 is not set
1007CONFIG_SND_CS4232=m 1121CONFIG_SND_CS4232=m
@@ -1039,6 +1153,8 @@ CONFIG_SND_CS4232=m
1039# CONFIG_SND_CS46XX is not set 1153# CONFIG_SND_CS46XX is not set
1040# CONFIG_SND_CS4281 is not set 1154# CONFIG_SND_CS4281 is not set
1041# CONFIG_SND_EMU10K1 is not set 1155# CONFIG_SND_EMU10K1 is not set
1156# CONFIG_SND_EMU10K1X is not set
1157# CONFIG_SND_CA0106 is not set
1042# CONFIG_SND_KORG1212 is not set 1158# CONFIG_SND_KORG1212 is not set
1043# CONFIG_SND_MIXART is not set 1159# CONFIG_SND_MIXART is not set
1044# CONFIG_SND_NM256 is not set 1160# CONFIG_SND_NM256 is not set
@@ -1046,6 +1162,7 @@ CONFIG_SND_CS4232=m
1046# CONFIG_SND_RME96 is not set 1162# CONFIG_SND_RME96 is not set
1047# CONFIG_SND_RME9652 is not set 1163# CONFIG_SND_RME9652 is not set
1048# CONFIG_SND_HDSP is not set 1164# CONFIG_SND_HDSP is not set
1165# CONFIG_SND_HDSPM is not set
1049# CONFIG_SND_TRIDENT is not set 1166# CONFIG_SND_TRIDENT is not set
1050# CONFIG_SND_YMFPCI is not set 1167# CONFIG_SND_YMFPCI is not set
1051# CONFIG_SND_ALS4000 is not set 1168# CONFIG_SND_ALS4000 is not set
@@ -1062,7 +1179,9 @@ CONFIG_SND_CS4232=m
1062# CONFIG_SND_INTEL8X0M is not set 1179# CONFIG_SND_INTEL8X0M is not set
1063# CONFIG_SND_SONICVIBES is not set 1180# CONFIG_SND_SONICVIBES is not set
1064# CONFIG_SND_VIA82XX is not set 1181# CONFIG_SND_VIA82XX is not set
1182# CONFIG_SND_VIA82XX_MODEM is not set
1065# CONFIG_SND_VX222 is not set 1183# CONFIG_SND_VX222 is not set
1184# CONFIG_SND_HDA_INTEL is not set
1066 1185
1067# 1186#
1068# ALSA PowerMac devices 1187# ALSA PowerMac devices
@@ -1083,6 +1202,8 @@ CONFIG_SND_USB_AUDIO=m
1083# 1202#
1084# USB support 1203# USB support
1085# 1204#
1205CONFIG_USB_ARCH_HAS_HCD=y
1206CONFIG_USB_ARCH_HAS_OHCI=y
1086CONFIG_USB=y 1207CONFIG_USB=y
1087# CONFIG_USB_DEBUG is not set 1208# CONFIG_USB_DEBUG is not set
1088 1209
@@ -1094,15 +1215,19 @@ CONFIG_USB_DEVICEFS=y
1094# CONFIG_USB_DYNAMIC_MINORS is not set 1215# CONFIG_USB_DYNAMIC_MINORS is not set
1095# CONFIG_USB_SUSPEND is not set 1216# CONFIG_USB_SUSPEND is not set
1096# CONFIG_USB_OTG is not set 1217# CONFIG_USB_OTG is not set
1097CONFIG_USB_ARCH_HAS_HCD=y
1098CONFIG_USB_ARCH_HAS_OHCI=y
1099 1218
1100# 1219#
1101# USB Host Controller Drivers 1220# USB Host Controller Drivers
1102# 1221#
1103# CONFIG_USB_EHCI_HCD is not set 1222CONFIG_USB_EHCI_HCD=m
1223CONFIG_USB_EHCI_SPLIT_ISO=y
1224CONFIG_USB_EHCI_ROOT_HUB_TT=y
1225# CONFIG_USB_ISP116X_HCD is not set
1104CONFIG_USB_OHCI_HCD=y 1226CONFIG_USB_OHCI_HCD=y
1105# CONFIG_USB_UHCI_HCD is not set 1227# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1228CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1229CONFIG_USB_UHCI_HCD=m
1230# CONFIG_USB_SL811_HCD is not set
1106 1231
1107# 1232#
1108# USB Device Class drivers 1233# USB Device Class drivers
@@ -1112,17 +1237,20 @@ CONFIG_USB_OHCI_HCD=y
1112# CONFIG_USB_MIDI is not set 1237# CONFIG_USB_MIDI is not set
1113CONFIG_USB_ACM=m 1238CONFIG_USB_ACM=m
1114CONFIG_USB_PRINTER=m 1239CONFIG_USB_PRINTER=m
1240
1241#
1242# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
1243#
1115CONFIG_USB_STORAGE=m 1244CONFIG_USB_STORAGE=m
1116# CONFIG_USB_STORAGE_DEBUG is not set 1245# CONFIG_USB_STORAGE_DEBUG is not set
1117# CONFIG_USB_STORAGE_RW_DETECT is not set 1246CONFIG_USB_STORAGE_DATAFAB=y
1118# CONFIG_USB_STORAGE_DATAFAB is not set
1119CONFIG_USB_STORAGE_FREECOM=y 1247CONFIG_USB_STORAGE_FREECOM=y
1120# CONFIG_USB_STORAGE_ISD200 is not set 1248CONFIG_USB_STORAGE_ISD200=y
1121CONFIG_USB_STORAGE_DPCM=y 1249CONFIG_USB_STORAGE_DPCM=y
1122# CONFIG_USB_STORAGE_HP8200e is not set 1250CONFIG_USB_STORAGE_USBAT=y
1123# CONFIG_USB_STORAGE_SDDR09 is not set 1251CONFIG_USB_STORAGE_SDDR09=y
1124# CONFIG_USB_STORAGE_SDDR55 is not set 1252CONFIG_USB_STORAGE_SDDR55=y
1125# CONFIG_USB_STORAGE_JUMPSHOT is not set 1253CONFIG_USB_STORAGE_JUMPSHOT=y
1126 1254
1127# 1255#
1128# USB Input Devices 1256# USB Input Devices
@@ -1130,22 +1258,24 @@ CONFIG_USB_STORAGE_DPCM=y
1130CONFIG_USB_HID=y 1258CONFIG_USB_HID=y
1131CONFIG_USB_HIDINPUT=y 1259CONFIG_USB_HIDINPUT=y
1132# CONFIG_HID_FF is not set 1260# CONFIG_HID_FF is not set
1133# CONFIG_USB_HIDDEV is not set 1261CONFIG_USB_HIDDEV=y
1134# CONFIG_USB_AIPTEK is not set 1262# CONFIG_USB_AIPTEK is not set
1135# CONFIG_USB_WACOM is not set 1263# CONFIG_USB_WACOM is not set
1264# CONFIG_USB_ACECAD is not set
1136# CONFIG_USB_KBTAB is not set 1265# CONFIG_USB_KBTAB is not set
1137# CONFIG_USB_POWERMATE is not set 1266# CONFIG_USB_POWERMATE is not set
1138# CONFIG_USB_MTOUCH is not set 1267# CONFIG_USB_MTOUCH is not set
1268# CONFIG_USB_ITMTOUCH is not set
1139# CONFIG_USB_EGALAX is not set 1269# CONFIG_USB_EGALAX is not set
1140# CONFIG_USB_XPAD is not set 1270# CONFIG_USB_XPAD is not set
1141# CONFIG_USB_ATI_REMOTE is not set 1271# CONFIG_USB_ATI_REMOTE is not set
1272# CONFIG_USB_KEYSPAN_REMOTE is not set
1142 1273
1143# 1274#
1144# USB Imaging devices 1275# USB Imaging devices
1145# 1276#
1146# CONFIG_USB_MDC800 is not set 1277# CONFIG_USB_MDC800 is not set
1147# CONFIG_USB_MICROTEK is not set 1278# CONFIG_USB_MICROTEK is not set
1148# CONFIG_USB_HPUSBSCSI is not set
1149 1279
1150# 1280#
1151# USB Multimedia devices 1281# USB Multimedia devices
@@ -1161,22 +1291,27 @@ CONFIG_USB_HIDINPUT=y
1161# 1291#
1162# CONFIG_USB_CATC is not set 1292# CONFIG_USB_CATC is not set
1163# CONFIG_USB_KAWETH is not set 1293# CONFIG_USB_KAWETH is not set
1164# CONFIG_USB_PEGASUS is not set 1294CONFIG_USB_PEGASUS=m
1165# CONFIG_USB_RTL8150 is not set 1295# CONFIG_USB_RTL8150 is not set
1166# CONFIG_USB_USBNET is not set 1296# CONFIG_USB_USBNET is not set
1297# CONFIG_USB_ZD1201 is not set
1298# CONFIG_USB_MON is not set
1167 1299
1168# 1300#
1169# USB port drivers 1301# USB port drivers
1170# 1302#
1303# CONFIG_USB_USS720 is not set
1171 1304
1172# 1305#
1173# USB Serial Converter support 1306# USB Serial Converter support
1174# 1307#
1175CONFIG_USB_SERIAL=m 1308CONFIG_USB_SERIAL=m
1176# CONFIG_USB_SERIAL_GENERIC is not set 1309# CONFIG_USB_SERIAL_GENERIC is not set
1310# CONFIG_USB_SERIAL_AIRPRIME is not set
1177# CONFIG_USB_SERIAL_BELKIN is not set 1311# CONFIG_USB_SERIAL_BELKIN is not set
1178# CONFIG_USB_SERIAL_WHITEHEAT is not set 1312# CONFIG_USB_SERIAL_WHITEHEAT is not set
1179# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 1313# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1314# CONFIG_USB_SERIAL_CP2101 is not set
1180# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 1315# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1181# CONFIG_USB_SERIAL_EMPEG is not set 1316# CONFIG_USB_SERIAL_EMPEG is not set
1182# CONFIG_USB_SERIAL_FTDI_SIO is not set 1317# CONFIG_USB_SERIAL_FTDI_SIO is not set
@@ -1185,28 +1320,32 @@ CONFIG_USB_SERIAL_VISOR=m
1185# CONFIG_USB_SERIAL_IR is not set 1320# CONFIG_USB_SERIAL_IR is not set
1186# CONFIG_USB_SERIAL_EDGEPORT is not set 1321# CONFIG_USB_SERIAL_EDGEPORT is not set
1187# CONFIG_USB_SERIAL_EDGEPORT_TI is not set 1322# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1323# CONFIG_USB_SERIAL_GARMIN is not set
1188# CONFIG_USB_SERIAL_IPW is not set 1324# CONFIG_USB_SERIAL_IPW is not set
1189# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set 1325# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1190CONFIG_USB_SERIAL_KEYSPAN=m 1326CONFIG_USB_SERIAL_KEYSPAN=m
1191# CONFIG_USB_SERIAL_KEYSPAN_MPR is not set 1327CONFIG_USB_SERIAL_KEYSPAN_MPR=y
1192CONFIG_USB_SERIAL_KEYSPAN_USA28=y 1328CONFIG_USB_SERIAL_KEYSPAN_USA28=y
1193CONFIG_USB_SERIAL_KEYSPAN_USA28X=y 1329CONFIG_USB_SERIAL_KEYSPAN_USA28X=y
1194# CONFIG_USB_SERIAL_KEYSPAN_USA28XA is not set 1330CONFIG_USB_SERIAL_KEYSPAN_USA28XA=y
1195# CONFIG_USB_SERIAL_KEYSPAN_USA28XB is not set 1331CONFIG_USB_SERIAL_KEYSPAN_USA28XB=y
1196CONFIG_USB_SERIAL_KEYSPAN_USA19=y 1332CONFIG_USB_SERIAL_KEYSPAN_USA19=y
1197CONFIG_USB_SERIAL_KEYSPAN_USA18X=y 1333CONFIG_USB_SERIAL_KEYSPAN_USA18X=y
1198CONFIG_USB_SERIAL_KEYSPAN_USA19W=y 1334CONFIG_USB_SERIAL_KEYSPAN_USA19W=y
1199CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y 1335CONFIG_USB_SERIAL_KEYSPAN_USA19QW=y
1200CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y 1336CONFIG_USB_SERIAL_KEYSPAN_USA19QI=y
1201CONFIG_USB_SERIAL_KEYSPAN_USA49W=y 1337CONFIG_USB_SERIAL_KEYSPAN_USA49W=y
1202# CONFIG_USB_SERIAL_KEYSPAN_USA49WLC is not set 1338CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1203# CONFIG_USB_SERIAL_KLSI is not set 1339# CONFIG_USB_SERIAL_KLSI is not set
1204# CONFIG_USB_SERIAL_KOBIL_SCT is not set 1340# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1205# CONFIG_USB_SERIAL_MCT_U232 is not set 1341# CONFIG_USB_SERIAL_MCT_U232 is not set
1206# CONFIG_USB_SERIAL_PL2303 is not set 1342# CONFIG_USB_SERIAL_PL2303 is not set
1343# CONFIG_USB_SERIAL_HP4X is not set
1207# CONFIG_USB_SERIAL_SAFE is not set 1344# CONFIG_USB_SERIAL_SAFE is not set
1345# CONFIG_USB_SERIAL_TI is not set
1208# CONFIG_USB_SERIAL_CYBERJACK is not set 1346# CONFIG_USB_SERIAL_CYBERJACK is not set
1209# CONFIG_USB_SERIAL_XIRCOM is not set 1347# CONFIG_USB_SERIAL_XIRCOM is not set
1348# CONFIG_USB_SERIAL_OPTION is not set
1210# CONFIG_USB_SERIAL_OMNINET is not set 1349# CONFIG_USB_SERIAL_OMNINET is not set
1211CONFIG_USB_EZUSB=y 1350CONFIG_USB_EZUSB=y
1212 1351
@@ -1215,7 +1354,6 @@ CONFIG_USB_EZUSB=y
1215# 1354#
1216# CONFIG_USB_EMI62 is not set 1355# CONFIG_USB_EMI62 is not set
1217# CONFIG_USB_EMI26 is not set 1356# CONFIG_USB_EMI26 is not set
1218# CONFIG_USB_TIGL is not set
1219# CONFIG_USB_AUERSWALD is not set 1357# CONFIG_USB_AUERSWALD is not set
1220# CONFIG_USB_RIO500 is not set 1358# CONFIG_USB_RIO500 is not set
1221# CONFIG_USB_LEGOTOWER is not set 1359# CONFIG_USB_LEGOTOWER is not set
@@ -1224,10 +1362,13 @@ CONFIG_USB_EZUSB=y
1224# CONFIG_USB_CYTHERM is not set 1362# CONFIG_USB_CYTHERM is not set
1225# CONFIG_USB_PHIDGETKIT is not set 1363# CONFIG_USB_PHIDGETKIT is not set
1226# CONFIG_USB_PHIDGETSERVO is not set 1364# CONFIG_USB_PHIDGETSERVO is not set
1365# CONFIG_USB_IDMOUSE is not set
1366# CONFIG_USB_SISUSBVGA is not set
1367# CONFIG_USB_LD is not set
1227# CONFIG_USB_TEST is not set 1368# CONFIG_USB_TEST is not set
1228 1369
1229# 1370#
1230# USB ATM/DSL drivers 1371# USB DSL modem support
1231# 1372#
1232 1373
1233# 1374#
@@ -1236,21 +1377,63 @@ CONFIG_USB_EZUSB=y
1236# CONFIG_USB_GADGET is not set 1377# CONFIG_USB_GADGET is not set
1237 1378
1238# 1379#
1380# MMC/SD Card support
1381#
1382# CONFIG_MMC is not set
1383
1384#
1385# InfiniBand support
1386#
1387# CONFIG_INFINIBAND is not set
1388
1389#
1390# SN Devices
1391#
1392
1393#
1239# File systems 1394# File systems
1240# 1395#
1241CONFIG_EXT2_FS=y 1396CONFIG_EXT2_FS=y
1242# CONFIG_EXT2_FS_XATTR is not set 1397CONFIG_EXT2_FS_XATTR=y
1243# CONFIG_EXT3_FS is not set 1398CONFIG_EXT2_FS_POSIX_ACL=y
1244# CONFIG_JBD is not set 1399CONFIG_EXT2_FS_SECURITY=y
1245# CONFIG_REISERFS_FS is not set 1400# CONFIG_EXT2_FS_XIP is not set
1246# CONFIG_JFS_FS is not set 1401CONFIG_EXT3_FS=y
1247# CONFIG_XFS_FS is not set 1402CONFIG_EXT3_FS_XATTR=y
1403CONFIG_EXT3_FS_POSIX_ACL=y
1404CONFIG_EXT3_FS_SECURITY=y
1405CONFIG_JBD=y
1406# CONFIG_JBD_DEBUG is not set
1407CONFIG_FS_MBCACHE=y
1408CONFIG_REISERFS_FS=y
1409# CONFIG_REISERFS_CHECK is not set
1410# CONFIG_REISERFS_PROC_INFO is not set
1411CONFIG_REISERFS_FS_XATTR=y
1412CONFIG_REISERFS_FS_POSIX_ACL=y
1413CONFIG_REISERFS_FS_SECURITY=y
1414CONFIG_JFS_FS=m
1415CONFIG_JFS_POSIX_ACL=y
1416CONFIG_JFS_SECURITY=y
1417# CONFIG_JFS_DEBUG is not set
1418# CONFIG_JFS_STATISTICS is not set
1419CONFIG_FS_POSIX_ACL=y
1420
1421#
1422# XFS support
1423#
1424CONFIG_XFS_FS=m
1425CONFIG_XFS_EXPORT=y
1426# CONFIG_XFS_RT is not set
1427# CONFIG_XFS_QUOTA is not set
1428CONFIG_XFS_SECURITY=y
1429CONFIG_XFS_POSIX_ACL=y
1248# CONFIG_MINIX_FS is not set 1430# CONFIG_MINIX_FS is not set
1249# CONFIG_ROMFS_FS is not set 1431# CONFIG_ROMFS_FS is not set
1432CONFIG_INOTIFY=y
1250# CONFIG_QUOTA is not set 1433# CONFIG_QUOTA is not set
1251CONFIG_DNOTIFY=y 1434CONFIG_DNOTIFY=y
1252# CONFIG_AUTOFS_FS is not set 1435# CONFIG_AUTOFS_FS is not set
1253# CONFIG_AUTOFS4_FS is not set 1436CONFIG_AUTOFS4_FS=m
1254 1437
1255# 1438#
1256# CD-ROM/DVD Filesystems 1439# CD-ROM/DVD Filesystems
@@ -1258,7 +1441,8 @@ CONFIG_DNOTIFY=y
1258CONFIG_ISO9660_FS=y 1441CONFIG_ISO9660_FS=y
1259# CONFIG_JOLIET is not set 1442# CONFIG_JOLIET is not set
1260# CONFIG_ZISOFS is not set 1443# CONFIG_ZISOFS is not set
1261# CONFIG_UDF_FS is not set 1444CONFIG_UDF_FS=m
1445CONFIG_UDF_NLS=y
1262 1446
1263# 1447#
1264# DOS/FAT/NT Filesystems 1448# DOS/FAT/NT Filesystems
@@ -1276,12 +1460,11 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1276CONFIG_PROC_FS=y 1460CONFIG_PROC_FS=y
1277CONFIG_PROC_KCORE=y 1461CONFIG_PROC_KCORE=y
1278CONFIG_SYSFS=y 1462CONFIG_SYSFS=y
1279CONFIG_DEVFS_FS=y 1463CONFIG_DEVPTS_FS_XATTR=y
1280# CONFIG_DEVFS_MOUNT is not set 1464CONFIG_DEVPTS_FS_SECURITY=y
1281# CONFIG_DEVFS_DEBUG is not set
1282# CONFIG_DEVPTS_FS_XATTR is not set
1283CONFIG_TMPFS=y 1465CONFIG_TMPFS=y
1284# CONFIG_TMPFS_XATTR is not set 1466CONFIG_TMPFS_XATTR=y
1467CONFIG_TMPFS_SECURITY=y
1285# CONFIG_HUGETLB_PAGE is not set 1468# CONFIG_HUGETLB_PAGE is not set
1286CONFIG_RAMFS=y 1469CONFIG_RAMFS=y
1287 1470
@@ -1295,27 +1478,33 @@ CONFIG_HFSPLUS_FS=m
1295# CONFIG_BEFS_FS is not set 1478# CONFIG_BEFS_FS is not set
1296# CONFIG_BFS_FS is not set 1479# CONFIG_BFS_FS is not set
1297# CONFIG_EFS_FS is not set 1480# CONFIG_EFS_FS is not set
1298# CONFIG_CRAMFS is not set 1481CONFIG_CRAMFS=m
1299# CONFIG_VXFS_FS is not set 1482# CONFIG_VXFS_FS is not set
1300# CONFIG_HPFS_FS is not set 1483# CONFIG_HPFS_FS is not set
1301# CONFIG_QNX4FS_FS is not set 1484# CONFIG_QNX4FS_FS is not set
1302# CONFIG_SYSV_FS is not set 1485# CONFIG_SYSV_FS is not set
1303# CONFIG_UFS_FS is not set 1486CONFIG_UFS_FS=m
1487# CONFIG_UFS_FS_WRITE is not set
1304 1488
1305# 1489#
1306# Network File Systems 1490# Network File Systems
1307# 1491#
1308CONFIG_NFS_FS=y 1492CONFIG_NFS_FS=y
1309CONFIG_NFS_V3=y 1493CONFIG_NFS_V3=y
1494CONFIG_NFS_V3_ACL=y
1310# CONFIG_NFS_V4 is not set 1495# CONFIG_NFS_V4 is not set
1311# CONFIG_NFS_DIRECTIO is not set 1496# CONFIG_NFS_DIRECTIO is not set
1312CONFIG_NFSD=y 1497CONFIG_NFSD=y
1498CONFIG_NFSD_V2_ACL=y
1313CONFIG_NFSD_V3=y 1499CONFIG_NFSD_V3=y
1500CONFIG_NFSD_V3_ACL=y
1314# CONFIG_NFSD_V4 is not set 1501# CONFIG_NFSD_V4 is not set
1315CONFIG_NFSD_TCP=y 1502CONFIG_NFSD_TCP=y
1316CONFIG_LOCKD=y 1503CONFIG_LOCKD=y
1317CONFIG_LOCKD_V4=y 1504CONFIG_LOCKD_V4=y
1318CONFIG_EXPORTFS=y 1505CONFIG_EXPORTFS=y
1506CONFIG_NFS_ACL_SUPPORT=y
1507CONFIG_NFS_COMMON=y
1319CONFIG_SUNRPC=y 1508CONFIG_SUNRPC=y
1320# CONFIG_RPCSEC_GSS_KRB5 is not set 1509# CONFIG_RPCSEC_GSS_KRB5 is not set
1321# CONFIG_RPCSEC_GSS_SPKM3 is not set 1510# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -1348,46 +1537,46 @@ CONFIG_MSDOS_PARTITION=y
1348# 1537#
1349# Native Language Support 1538# Native Language Support
1350# 1539#
1351CONFIG_NLS=y 1540CONFIG_NLS=m
1352CONFIG_NLS_DEFAULT="iso8859-1" 1541CONFIG_NLS_DEFAULT="iso8859-1"
1353# CONFIG_NLS_CODEPAGE_437 is not set 1542CONFIG_NLS_CODEPAGE_437=m
1354# CONFIG_NLS_CODEPAGE_737 is not set 1543CONFIG_NLS_CODEPAGE_737=m
1355# CONFIG_NLS_CODEPAGE_775 is not set 1544CONFIG_NLS_CODEPAGE_775=m
1356# CONFIG_NLS_CODEPAGE_850 is not set 1545CONFIG_NLS_CODEPAGE_850=m
1357# CONFIG_NLS_CODEPAGE_852 is not set 1546CONFIG_NLS_CODEPAGE_852=m
1358# CONFIG_NLS_CODEPAGE_855 is not set 1547CONFIG_NLS_CODEPAGE_855=m
1359# CONFIG_NLS_CODEPAGE_857 is not set 1548CONFIG_NLS_CODEPAGE_857=m
1360# CONFIG_NLS_CODEPAGE_860 is not set 1549CONFIG_NLS_CODEPAGE_860=m
1361# CONFIG_NLS_CODEPAGE_861 is not set 1550CONFIG_NLS_CODEPAGE_861=m
1362# CONFIG_NLS_CODEPAGE_862 is not set 1551CONFIG_NLS_CODEPAGE_862=m
1363# CONFIG_NLS_CODEPAGE_863 is not set 1552CONFIG_NLS_CODEPAGE_863=m
1364# CONFIG_NLS_CODEPAGE_864 is not set 1553CONFIG_NLS_CODEPAGE_864=m
1365# CONFIG_NLS_CODEPAGE_865 is not set 1554CONFIG_NLS_CODEPAGE_865=m
1366# CONFIG_NLS_CODEPAGE_866 is not set 1555CONFIG_NLS_CODEPAGE_866=m
1367# CONFIG_NLS_CODEPAGE_869 is not set 1556CONFIG_NLS_CODEPAGE_869=m
1368# CONFIG_NLS_CODEPAGE_936 is not set 1557CONFIG_NLS_CODEPAGE_936=m
1369# CONFIG_NLS_CODEPAGE_950 is not set 1558CONFIG_NLS_CODEPAGE_950=m
1370# CONFIG_NLS_CODEPAGE_932 is not set 1559CONFIG_NLS_CODEPAGE_932=m
1371# CONFIG_NLS_CODEPAGE_949 is not set 1560CONFIG_NLS_CODEPAGE_949=m
1372# CONFIG_NLS_CODEPAGE_874 is not set 1561CONFIG_NLS_CODEPAGE_874=m
1373# CONFIG_NLS_ISO8859_8 is not set 1562CONFIG_NLS_ISO8859_8=m
1374# CONFIG_NLS_CODEPAGE_1250 is not set 1563CONFIG_NLS_CODEPAGE_1250=m
1375# CONFIG_NLS_CODEPAGE_1251 is not set 1564CONFIG_NLS_CODEPAGE_1251=m
1376# CONFIG_NLS_ASCII is not set 1565CONFIG_NLS_ASCII=m
1377CONFIG_NLS_ISO8859_1=m 1566CONFIG_NLS_ISO8859_1=m
1378# CONFIG_NLS_ISO8859_2 is not set 1567CONFIG_NLS_ISO8859_2=m
1379# CONFIG_NLS_ISO8859_3 is not set 1568CONFIG_NLS_ISO8859_3=m
1380# CONFIG_NLS_ISO8859_4 is not set 1569CONFIG_NLS_ISO8859_4=m
1381# CONFIG_NLS_ISO8859_5 is not set 1570CONFIG_NLS_ISO8859_5=m
1382# CONFIG_NLS_ISO8859_6 is not set 1571CONFIG_NLS_ISO8859_6=m
1383# CONFIG_NLS_ISO8859_7 is not set 1572CONFIG_NLS_ISO8859_7=m
1384# CONFIG_NLS_ISO8859_9 is not set 1573CONFIG_NLS_ISO8859_9=m
1385# CONFIG_NLS_ISO8859_13 is not set 1574CONFIG_NLS_ISO8859_13=m
1386# CONFIG_NLS_ISO8859_14 is not set 1575CONFIG_NLS_ISO8859_14=m
1387# CONFIG_NLS_ISO8859_15 is not set 1576CONFIG_NLS_ISO8859_15=m
1388# CONFIG_NLS_KOI8_R is not set 1577CONFIG_NLS_KOI8_R=m
1389# CONFIG_NLS_KOI8_U is not set 1578CONFIG_NLS_KOI8_U=m
1390# CONFIG_NLS_UTF8 is not set 1579CONFIG_NLS_UTF8=m
1391 1580
1392# 1581#
1393# Library routines 1582# Library routines
@@ -1406,7 +1595,19 @@ CONFIG_ZLIB_DEFLATE=y
1406# 1595#
1407# Kernel hacking 1596# Kernel hacking
1408# 1597#
1409# CONFIG_DEBUG_KERNEL is not set 1598# CONFIG_PRINTK_TIME is not set
1599CONFIG_DEBUG_KERNEL=y
1600CONFIG_MAGIC_SYSRQ=y
1601CONFIG_LOG_BUF_SHIFT=14
1602# CONFIG_SCHEDSTATS is not set
1603# CONFIG_DEBUG_SLAB is not set
1604# CONFIG_DEBUG_SPINLOCK is not set
1605# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1606# CONFIG_DEBUG_KOBJECT is not set
1607# CONFIG_DEBUG_INFO is not set
1608# CONFIG_DEBUG_FS is not set
1609# CONFIG_XMON is not set
1610# CONFIG_BDI_SWITCH is not set
1410CONFIG_BOOTX_TEXT=y 1611CONFIG_BOOTX_TEXT=y
1411 1612
1412# 1613#
@@ -1419,3 +1620,7 @@ CONFIG_BOOTX_TEXT=y
1419# Cryptographic options 1620# Cryptographic options
1420# 1621#
1421# CONFIG_CRYPTO is not set 1622# CONFIG_CRYPTO is not set
1623
1624#
1625# Hardware crypto devices
1626#
diff --git a/arch/ppc/configs/pmac_defconfig b/arch/ppc/configs/pmac_defconfig
index 8eebb0455766..a2db8b541c9b 100644
--- a/arch/ppc/configs/pmac_defconfig
+++ b/arch/ppc/configs/pmac_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc4 3# Linux kernel version: 2.6.13-rc3
4# Sun Feb 13 14:56:58 2005 4# Wed Jul 13 14:13:13 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
@@ -11,6 +11,7 @@ CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y 11CONFIG_PPC=y
12CONFIG_PPC32=y 12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y 13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14 15
15# 16#
16# Code maturity level options 17# Code maturity level options
@@ -18,6 +19,7 @@ CONFIG_GENERIC_NVRAM=y
18CONFIG_EXPERIMENTAL=y 19CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y 20CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y 21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
21 23
22# 24#
23# General setup 25# General setup
@@ -28,7 +30,7 @@ CONFIG_SYSVIPC=y
28CONFIG_POSIX_MQUEUE=y 30CONFIG_POSIX_MQUEUE=y
29# CONFIG_BSD_PROCESS_ACCT is not set 31# CONFIG_BSD_PROCESS_ACCT is not set
30CONFIG_SYSCTL=y 32CONFIG_SYSCTL=y
31CONFIG_LOG_BUF_SHIFT=16 33# CONFIG_AUDIT is not set
32CONFIG_HOTPLUG=y 34CONFIG_HOTPLUG=y
33CONFIG_KOBJECT_UEVENT=y 35CONFIG_KOBJECT_UEVENT=y
34CONFIG_IKCONFIG=y 36CONFIG_IKCONFIG=y
@@ -37,15 +39,18 @@ CONFIG_IKCONFIG_PROC=y
37CONFIG_KALLSYMS=y 39CONFIG_KALLSYMS=y
38# CONFIG_KALLSYMS_ALL is not set 40# CONFIG_KALLSYMS_ALL is not set
39# CONFIG_KALLSYMS_EXTRA_PASS is not set 41# CONFIG_KALLSYMS_EXTRA_PASS is not set
42CONFIG_PRINTK=y
43CONFIG_BUG=y
44CONFIG_BASE_FULL=y
40CONFIG_FUTEX=y 45CONFIG_FUTEX=y
41CONFIG_EPOLL=y 46CONFIG_EPOLL=y
42# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
43CONFIG_SHMEM=y 47CONFIG_SHMEM=y
44CONFIG_CC_ALIGN_FUNCTIONS=0 48CONFIG_CC_ALIGN_FUNCTIONS=0
45CONFIG_CC_ALIGN_LABELS=0 49CONFIG_CC_ALIGN_LABELS=0
46CONFIG_CC_ALIGN_LOOPS=0 50CONFIG_CC_ALIGN_LOOPS=0
47CONFIG_CC_ALIGN_JUMPS=0 51CONFIG_CC_ALIGN_JUMPS=0
48# CONFIG_TINY_SHMEM is not set 52# CONFIG_TINY_SHMEM is not set
53CONFIG_BASE_SMALL=0
49 54
50# 55#
51# Loadable module support 56# Loadable module support
@@ -67,12 +72,16 @@ CONFIG_6xx=y
67# CONFIG_POWER3 is not set 72# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set 73# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set 74# CONFIG_8xx is not set
75# CONFIG_E200 is not set
70# CONFIG_E500 is not set 76# CONFIG_E500 is not set
77CONFIG_PPC_FPU=y
71CONFIG_ALTIVEC=y 78CONFIG_ALTIVEC=y
72CONFIG_TAU=y 79CONFIG_TAU=y
73# CONFIG_TAU_INT is not set 80# CONFIG_TAU_INT is not set
74# CONFIG_TAU_AVERAGE is not set 81# CONFIG_TAU_AVERAGE is not set
82# CONFIG_KEXEC is not set
75CONFIG_CPU_FREQ=y 83CONFIG_CPU_FREQ=y
84CONFIG_CPU_FREQ_TABLE=y
76# CONFIG_CPU_FREQ_DEBUG is not set 85# CONFIG_CPU_FREQ_DEBUG is not set
77CONFIG_CPU_FREQ_STAT=m 86CONFIG_CPU_FREQ_STAT=m
78CONFIG_CPU_FREQ_STAT_DETAILS=y 87CONFIG_CPU_FREQ_STAT_DETAILS=y
@@ -82,8 +91,8 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
82CONFIG_CPU_FREQ_GOV_POWERSAVE=m 91CONFIG_CPU_FREQ_GOV_POWERSAVE=m
83CONFIG_CPU_FREQ_GOV_USERSPACE=m 92CONFIG_CPU_FREQ_GOV_USERSPACE=m
84CONFIG_CPU_FREQ_GOV_ONDEMAND=m 93CONFIG_CPU_FREQ_GOV_ONDEMAND=m
94CONFIG_CPU_FREQ_GOV_CONSERVATIVE=m
85CONFIG_CPU_FREQ_PMAC=y 95CONFIG_CPU_FREQ_PMAC=y
86CONFIG_CPU_FREQ_TABLE=y
87CONFIG_PPC601_SYNC_FIX=y 96CONFIG_PPC601_SYNC_FIX=y
88CONFIG_PM=y 97CONFIG_PM=y
89CONFIG_PPC_STD_MMU=y 98CONFIG_PPC_STD_MMU=y
@@ -100,6 +109,7 @@ CONFIG_PPC_MULTIPLATFORM=y
100# CONFIG_POWERPMC250 is not set 109# CONFIG_POWERPMC250 is not set
101# CONFIG_CHESTNUT is not set 110# CONFIG_CHESTNUT is not set
102# CONFIG_SPRUCE is not set 111# CONFIG_SPRUCE is not set
112# CONFIG_HDPU is not set
103# CONFIG_EV64260 is not set 113# CONFIG_EV64260 is not set
104# CONFIG_LOPEC is not set 114# CONFIG_LOPEC is not set
105# CONFIG_MCPN765 is not set 115# CONFIG_MCPN765 is not set
@@ -108,6 +118,7 @@ CONFIG_PPC_MULTIPLATFORM=y
108# CONFIG_PRPMC750 is not set 118# CONFIG_PRPMC750 is not set
109# CONFIG_PRPMC800 is not set 119# CONFIG_PRPMC800 is not set
110# CONFIG_SANDPOINT is not set 120# CONFIG_SANDPOINT is not set
121# CONFIG_RADSTONE_PPC7D is not set
111# CONFIG_ADIR is not set 122# CONFIG_ADIR is not set
112# CONFIG_K2 is not set 123# CONFIG_K2 is not set
113# CONFIG_PAL4 is not set 124# CONFIG_PAL4 is not set
@@ -120,19 +131,37 @@ CONFIG_PPC_MULTIPLATFORM=y
120# CONFIG_ADS8272 is not set 131# CONFIG_ADS8272 is not set
121# CONFIG_PQ2FADS is not set 132# CONFIG_PQ2FADS is not set
122# CONFIG_LITE5200 is not set 133# CONFIG_LITE5200 is not set
134# CONFIG_MPC834x_SYS is not set
123CONFIG_PPC_CHRP=y 135CONFIG_PPC_CHRP=y
124CONFIG_PPC_PMAC=y 136CONFIG_PPC_PMAC=y
125CONFIG_PPC_PREP=y 137CONFIG_PPC_PREP=y
126CONFIG_PPC_OF=y 138CONFIG_PPC_OF=y
127CONFIG_PPCBUG_NVRAM=y 139CONFIG_PPCBUG_NVRAM=y
128# CONFIG_SMP is not set 140# CONFIG_SMP is not set
129# CONFIG_PREEMPT is not set
130# CONFIG_HIGHMEM is not set 141# CONFIG_HIGHMEM is not set
142# CONFIG_HZ_100 is not set
143CONFIG_HZ_250=y
144# CONFIG_HZ_1000 is not set
145CONFIG_HZ=250
146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set
149CONFIG_SELECT_MEMORY_MODEL=y
150CONFIG_FLATMEM_MANUAL=y
151# CONFIG_DISCONTIGMEM_MANUAL is not set
152# CONFIG_SPARSEMEM_MANUAL is not set
153CONFIG_FLATMEM=y
154CONFIG_FLAT_NODE_MEM_MAP=y
131CONFIG_BINFMT_ELF=y 155CONFIG_BINFMT_ELF=y
132CONFIG_BINFMT_MISC=m 156CONFIG_BINFMT_MISC=m
133CONFIG_PROC_DEVICETREE=y 157CONFIG_PROC_DEVICETREE=y
134# CONFIG_PREP_RESIDUAL is not set 158# CONFIG_PREP_RESIDUAL is not set
135# CONFIG_CMDLINE_BOOL is not set 159# CONFIG_CMDLINE_BOOL is not set
160# CONFIG_PM_DEBUG is not set
161CONFIG_SOFTWARE_SUSPEND=y
162CONFIG_PM_STD_PARTITION=""
163# CONFIG_SECCOMP is not set
164CONFIG_ISA_DMA_API=y
136 165
137# 166#
138# Bus options 167# Bus options
@@ -143,6 +172,7 @@ CONFIG_PCI=y
143CONFIG_PCI_DOMAINS=y 172CONFIG_PCI_DOMAINS=y
144CONFIG_PCI_LEGACY_PROC=y 173CONFIG_PCI_LEGACY_PROC=y
145CONFIG_PCI_NAMES=y 174CONFIG_PCI_NAMES=y
175# CONFIG_PCI_DEBUG is not set
146 176
147# 177#
148# PCCARD (PCMCIA/CardBus) support 178# PCCARD (PCMCIA/CardBus) support
@@ -150,6 +180,8 @@ CONFIG_PCI_NAMES=y
150CONFIG_PCCARD=m 180CONFIG_PCCARD=m
151# CONFIG_PCMCIA_DEBUG is not set 181# CONFIG_PCMCIA_DEBUG is not set
152CONFIG_PCMCIA=m 182CONFIG_PCMCIA=m
183# CONFIG_PCMCIA_LOAD_CIS is not set
184# CONFIG_PCMCIA_IOCTL is not set
153CONFIG_CARDBUS=y 185CONFIG_CARDBUS=y
154 186
155# 187#
@@ -175,6 +207,194 @@ CONFIG_TASK_SIZE=0xc0000000
175CONFIG_BOOT_LOAD=0x00800000 207CONFIG_BOOT_LOAD=0x00800000
176 208
177# 209#
210# Networking
211#
212CONFIG_NET=y
213
214#
215# Networking options
216#
217CONFIG_PACKET=y
218# CONFIG_PACKET_MMAP is not set
219CONFIG_UNIX=y
220# CONFIG_NET_KEY is not set
221CONFIG_INET=y
222CONFIG_IP_MULTICAST=y
223# CONFIG_IP_ADVANCED_ROUTER is not set
224CONFIG_IP_FIB_HASH=y
225# CONFIG_IP_PNP is not set
226# CONFIG_NET_IPIP is not set
227# CONFIG_NET_IPGRE is not set
228# CONFIG_IP_MROUTE is not set
229# CONFIG_ARPD is not set
230CONFIG_SYN_COOKIES=y
231# CONFIG_INET_AH is not set
232# CONFIG_INET_ESP is not set
233# CONFIG_INET_IPCOMP is not set
234# CONFIG_INET_TUNNEL is not set
235CONFIG_IP_TCPDIAG=y
236# CONFIG_IP_TCPDIAG_IPV6 is not set
237# CONFIG_TCP_CONG_ADVANCED is not set
238CONFIG_TCP_CONG_BIC=y
239
240#
241# IP: Virtual Server Configuration
242#
243# CONFIG_IP_VS is not set
244# CONFIG_IPV6 is not set
245CONFIG_NETFILTER=y
246# CONFIG_NETFILTER_DEBUG is not set
247
248#
249# IP: Netfilter Configuration
250#
251CONFIG_IP_NF_CONNTRACK=m
252CONFIG_IP_NF_CT_ACCT=y
253CONFIG_IP_NF_CONNTRACK_MARK=y
254CONFIG_IP_NF_CT_PROTO_SCTP=m
255CONFIG_IP_NF_FTP=m
256CONFIG_IP_NF_IRC=m
257CONFIG_IP_NF_TFTP=m
258CONFIG_IP_NF_AMANDA=m
259CONFIG_IP_NF_QUEUE=m
260CONFIG_IP_NF_IPTABLES=m
261CONFIG_IP_NF_MATCH_LIMIT=m
262CONFIG_IP_NF_MATCH_IPRANGE=m
263CONFIG_IP_NF_MATCH_MAC=m
264CONFIG_IP_NF_MATCH_PKTTYPE=m
265CONFIG_IP_NF_MATCH_MARK=m
266CONFIG_IP_NF_MATCH_MULTIPORT=m
267CONFIG_IP_NF_MATCH_TOS=m
268CONFIG_IP_NF_MATCH_RECENT=m
269CONFIG_IP_NF_MATCH_ECN=m
270CONFIG_IP_NF_MATCH_DSCP=m
271CONFIG_IP_NF_MATCH_AH_ESP=m
272CONFIG_IP_NF_MATCH_LENGTH=m
273CONFIG_IP_NF_MATCH_TTL=m
274CONFIG_IP_NF_MATCH_TCPMSS=m
275CONFIG_IP_NF_MATCH_HELPER=m
276CONFIG_IP_NF_MATCH_STATE=m
277CONFIG_IP_NF_MATCH_CONNTRACK=m
278CONFIG_IP_NF_MATCH_OWNER=m
279CONFIG_IP_NF_MATCH_ADDRTYPE=m
280CONFIG_IP_NF_MATCH_REALM=m
281CONFIG_IP_NF_MATCH_SCTP=m
282CONFIG_IP_NF_MATCH_COMMENT=m
283CONFIG_IP_NF_MATCH_CONNMARK=m
284CONFIG_IP_NF_MATCH_HASHLIMIT=m
285CONFIG_IP_NF_FILTER=m
286CONFIG_IP_NF_TARGET_REJECT=m
287CONFIG_IP_NF_TARGET_LOG=m
288CONFIG_IP_NF_TARGET_ULOG=m
289CONFIG_IP_NF_TARGET_TCPMSS=m
290CONFIG_IP_NF_NAT=m
291CONFIG_IP_NF_NAT_NEEDED=y
292CONFIG_IP_NF_TARGET_MASQUERADE=m
293CONFIG_IP_NF_TARGET_REDIRECT=m
294CONFIG_IP_NF_TARGET_NETMAP=m
295CONFIG_IP_NF_TARGET_SAME=m
296CONFIG_IP_NF_NAT_SNMP_BASIC=m
297CONFIG_IP_NF_NAT_IRC=m
298CONFIG_IP_NF_NAT_FTP=m
299CONFIG_IP_NF_NAT_TFTP=m
300CONFIG_IP_NF_NAT_AMANDA=m
301CONFIG_IP_NF_MANGLE=m
302CONFIG_IP_NF_TARGET_TOS=m
303CONFIG_IP_NF_TARGET_ECN=m
304CONFIG_IP_NF_TARGET_DSCP=m
305CONFIG_IP_NF_TARGET_MARK=m
306CONFIG_IP_NF_TARGET_CLASSIFY=m
307CONFIG_IP_NF_TARGET_CONNMARK=m
308CONFIG_IP_NF_TARGET_CLUSTERIP=m
309CONFIG_IP_NF_RAW=m
310CONFIG_IP_NF_TARGET_NOTRACK=m
311CONFIG_IP_NF_ARPTABLES=m
312CONFIG_IP_NF_ARPFILTER=m
313CONFIG_IP_NF_ARP_MANGLE=m
314
315#
316# SCTP Configuration (EXPERIMENTAL)
317#
318# CONFIG_IP_SCTP is not set
319# CONFIG_ATM is not set
320# CONFIG_BRIDGE is not set
321# CONFIG_VLAN_8021Q is not set
322# CONFIG_DECNET is not set
323# CONFIG_LLC2 is not set
324# CONFIG_IPX is not set
325# CONFIG_ATALK is not set
326# CONFIG_X25 is not set
327# CONFIG_LAPB is not set
328# CONFIG_NET_DIVERT is not set
329# CONFIG_ECONET is not set
330# CONFIG_WAN_ROUTER is not set
331# CONFIG_NET_SCHED is not set
332CONFIG_NET_CLS_ROUTE=y
333
334#
335# Network testing
336#
337# CONFIG_NET_PKTGEN is not set
338CONFIG_NETPOLL=y
339# CONFIG_NETPOLL_RX is not set
340# CONFIG_NETPOLL_TRAP is not set
341CONFIG_NET_POLL_CONTROLLER=y
342# CONFIG_HAMRADIO is not set
343CONFIG_IRDA=m
344
345#
346# IrDA protocols
347#
348CONFIG_IRLAN=m
349CONFIG_IRNET=m
350CONFIG_IRCOMM=m
351# CONFIG_IRDA_ULTRA is not set
352
353#
354# IrDA options
355#
356CONFIG_IRDA_CACHE_LAST_LSAP=y
357CONFIG_IRDA_FAST_RR=y
358# CONFIG_IRDA_DEBUG is not set
359
360#
361# Infrared-port device drivers
362#
363
364#
365# SIR device drivers
366#
367CONFIG_IRTTY_SIR=m
368
369#
370# Dongle support
371#
372# CONFIG_DONGLE is not set
373
374#
375# Old SIR device drivers
376#
377# CONFIG_IRPORT_SIR is not set
378
379#
380# Old Serial dongle support
381#
382
383#
384# FIR device drivers
385#
386# CONFIG_USB_IRDA is not set
387# CONFIG_SIGMATEL_FIR is not set
388# CONFIG_NSC_FIR is not set
389# CONFIG_WINBOND_FIR is not set
390# CONFIG_TOSHIBA_FIR is not set
391# CONFIG_SMC_IRCC_FIR is not set
392# CONFIG_ALI_FIR is not set
393# CONFIG_VLSI_FIR is not set
394# CONFIG_VIA_FIR is not set
395# CONFIG_BT is not set
396
397#
178# Device Drivers 398# Device Drivers
179# 399#
180 400
@@ -183,7 +403,7 @@ CONFIG_BOOT_LOAD=0x00800000
183# 403#
184# CONFIG_STANDALONE is not set 404# CONFIG_STANDALONE is not set
185CONFIG_PREVENT_FIRMWARE_BUILD=y 405CONFIG_PREVENT_FIRMWARE_BUILD=y
186# CONFIG_FW_LOADER is not set 406CONFIG_FW_LOADER=m
187# CONFIG_DEBUG_DRIVER is not set 407# CONFIG_DEBUG_DRIVER is not set
188 408
189# 409#
@@ -279,6 +499,7 @@ CONFIG_BLK_DEV_CMD64X=y
279# CONFIG_BLK_DEV_HPT366 is not set 499# CONFIG_BLK_DEV_HPT366 is not set
280# CONFIG_BLK_DEV_SC1200 is not set 500# CONFIG_BLK_DEV_SC1200 is not set
281# CONFIG_BLK_DEV_PIIX is not set 501# CONFIG_BLK_DEV_PIIX is not set
502# CONFIG_BLK_DEV_IT821X is not set
282# CONFIG_BLK_DEV_NS87415 is not set 503# CONFIG_BLK_DEV_NS87415 is not set
283# CONFIG_BLK_DEV_PDC202XX_OLD is not set 504# CONFIG_BLK_DEV_PDC202XX_OLD is not set
284CONFIG_BLK_DEV_PDC202XX_NEW=y 505CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -313,6 +534,7 @@ CONFIG_CHR_DEV_ST=y
313CONFIG_BLK_DEV_SR=y 534CONFIG_BLK_DEV_SR=y
314CONFIG_BLK_DEV_SR_VENDOR=y 535CONFIG_BLK_DEV_SR_VENDOR=y
315CONFIG_CHR_DEV_SG=y 536CONFIG_CHR_DEV_SG=y
537# CONFIG_CHR_DEV_SCH is not set
316 538
317# 539#
318# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 540# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -350,7 +572,6 @@ CONFIG_SCSI_AIC7XXX_OLD=m
350# CONFIG_SCSI_BUSLOGIC is not set 572# CONFIG_SCSI_BUSLOGIC is not set
351# CONFIG_SCSI_DMX3191D is not set 573# CONFIG_SCSI_DMX3191D is not set
352# CONFIG_SCSI_EATA is not set 574# CONFIG_SCSI_EATA is not set
353# CONFIG_SCSI_EATA_PIO is not set
354# CONFIG_SCSI_FUTURE_DOMAIN is not set 575# CONFIG_SCSI_FUTURE_DOMAIN is not set
355# CONFIG_SCSI_GDTH is not set 576# CONFIG_SCSI_GDTH is not set
356# CONFIG_SCSI_IPS is not set 577# CONFIG_SCSI_IPS is not set
@@ -362,7 +583,6 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
362CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 583CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
363# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 584# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
364# CONFIG_SCSI_IPR is not set 585# CONFIG_SCSI_IPR is not set
365# CONFIG_SCSI_QLOGIC_ISP is not set
366# CONFIG_SCSI_QLOGIC_FC is not set 586# CONFIG_SCSI_QLOGIC_FC is not set
367# CONFIG_SCSI_QLOGIC_1280 is not set 587# CONFIG_SCSI_QLOGIC_1280 is not set
368CONFIG_SCSI_QLA2XXX=y 588CONFIG_SCSI_QLA2XXX=y
@@ -371,6 +591,7 @@ CONFIG_SCSI_QLA2XXX=y
371# CONFIG_SCSI_QLA2300 is not set 591# CONFIG_SCSI_QLA2300 is not set
372# CONFIG_SCSI_QLA2322 is not set 592# CONFIG_SCSI_QLA2322 is not set
373# CONFIG_SCSI_QLA6312 is not set 593# CONFIG_SCSI_QLA6312 is not set
594# CONFIG_SCSI_LPFC is not set
374# CONFIG_SCSI_DC395x is not set 595# CONFIG_SCSI_DC395x is not set
375# CONFIG_SCSI_DC390T is not set 596# CONFIG_SCSI_DC390T is not set
376# CONFIG_SCSI_NSP32 is not set 597# CONFIG_SCSI_NSP32 is not set
@@ -398,6 +619,8 @@ CONFIG_SCSI_MAC53C94=y
398# Fusion MPT device support 619# Fusion MPT device support
399# 620#
400# CONFIG_FUSION is not set 621# CONFIG_FUSION is not set
622# CONFIG_FUSION_SPI is not set
623# CONFIG_FUSION_FC is not set
401 624
402# 625#
403# IEEE 1394 (FireWire) support 626# IEEE 1394 (FireWire) support
@@ -411,6 +634,7 @@ CONFIG_IEEE1394=m
411# CONFIG_IEEE1394_OUI_DB is not set 634# CONFIG_IEEE1394_OUI_DB is not set
412CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y 635CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
413CONFIG_IEEE1394_CONFIG_ROM_IP1394=y 636CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
637# CONFIG_IEEE1394_EXPORT_FULL_API is not set
414 638
415# 639#
416# Device Drivers 640# Device Drivers
@@ -441,8 +665,8 @@ CONFIG_IEEE1394_AMDTP=m
441CONFIG_ADB=y 665CONFIG_ADB=y
442CONFIG_ADB_CUDA=y 666CONFIG_ADB_CUDA=y
443CONFIG_ADB_PMU=y 667CONFIG_ADB_PMU=y
444CONFIG_PMAC_PBOOK=y
445CONFIG_PMAC_APM_EMU=y 668CONFIG_PMAC_APM_EMU=y
669CONFIG_PMAC_MEDIABAY=y
446CONFIG_PMAC_BACKLIGHT=y 670CONFIG_PMAC_BACKLIGHT=y
447CONFIG_ADB_MACIO=y 671CONFIG_ADB_MACIO=y
448CONFIG_INPUT_ADBHID=y 672CONFIG_INPUT_ADBHID=y
@@ -452,192 +676,13 @@ CONFIG_THERM_ADT746X=m
452# CONFIG_ANSLCD is not set 676# CONFIG_ANSLCD is not set
453 677
454# 678#
455# Networking support 679# Network device support
456#
457CONFIG_NET=y
458
459#
460# Networking options
461#
462CONFIG_PACKET=y
463# CONFIG_PACKET_MMAP is not set
464# CONFIG_NETLINK_DEV is not set
465CONFIG_UNIX=y
466# CONFIG_NET_KEY is not set
467CONFIG_INET=y
468CONFIG_IP_MULTICAST=y
469# CONFIG_IP_ADVANCED_ROUTER is not set
470# CONFIG_IP_PNP is not set
471# CONFIG_NET_IPIP is not set
472# CONFIG_NET_IPGRE is not set
473# CONFIG_IP_MROUTE is not set
474# CONFIG_ARPD is not set
475CONFIG_SYN_COOKIES=y
476# CONFIG_INET_AH is not set
477# CONFIG_INET_ESP is not set
478# CONFIG_INET_IPCOMP is not set
479# CONFIG_INET_TUNNEL is not set
480CONFIG_IP_TCPDIAG=y
481# CONFIG_IP_TCPDIAG_IPV6 is not set
482
483#
484# IP: Virtual Server Configuration
485#
486# CONFIG_IP_VS is not set
487# CONFIG_IPV6 is not set
488CONFIG_NETFILTER=y
489# CONFIG_NETFILTER_DEBUG is not set
490
491#
492# IP: Netfilter Configuration
493#
494CONFIG_IP_NF_CONNTRACK=m
495CONFIG_IP_NF_CT_ACCT=y
496CONFIG_IP_NF_CONNTRACK_MARK=y
497CONFIG_IP_NF_CT_PROTO_SCTP=m
498CONFIG_IP_NF_FTP=m
499CONFIG_IP_NF_IRC=m
500CONFIG_IP_NF_TFTP=m
501CONFIG_IP_NF_AMANDA=m
502CONFIG_IP_NF_QUEUE=m
503CONFIG_IP_NF_IPTABLES=m
504CONFIG_IP_NF_MATCH_LIMIT=m
505CONFIG_IP_NF_MATCH_IPRANGE=m
506CONFIG_IP_NF_MATCH_MAC=m
507CONFIG_IP_NF_MATCH_PKTTYPE=m
508CONFIG_IP_NF_MATCH_MARK=m
509CONFIG_IP_NF_MATCH_MULTIPORT=m
510CONFIG_IP_NF_MATCH_TOS=m
511CONFIG_IP_NF_MATCH_RECENT=m
512CONFIG_IP_NF_MATCH_ECN=m
513CONFIG_IP_NF_MATCH_DSCP=m
514CONFIG_IP_NF_MATCH_AH_ESP=m
515CONFIG_IP_NF_MATCH_LENGTH=m
516CONFIG_IP_NF_MATCH_TTL=m
517CONFIG_IP_NF_MATCH_TCPMSS=m
518CONFIG_IP_NF_MATCH_HELPER=m
519CONFIG_IP_NF_MATCH_STATE=m
520CONFIG_IP_NF_MATCH_CONNTRACK=m
521CONFIG_IP_NF_MATCH_OWNER=m
522CONFIG_IP_NF_MATCH_ADDRTYPE=m
523CONFIG_IP_NF_MATCH_REALM=m
524CONFIG_IP_NF_MATCH_SCTP=m
525CONFIG_IP_NF_MATCH_COMMENT=m
526CONFIG_IP_NF_MATCH_CONNMARK=m
527CONFIG_IP_NF_MATCH_HASHLIMIT=m
528CONFIG_IP_NF_FILTER=m
529CONFIG_IP_NF_TARGET_REJECT=m
530CONFIG_IP_NF_TARGET_LOG=m
531CONFIG_IP_NF_TARGET_ULOG=m
532CONFIG_IP_NF_TARGET_TCPMSS=m
533CONFIG_IP_NF_NAT=m
534CONFIG_IP_NF_NAT_NEEDED=y
535CONFIG_IP_NF_TARGET_MASQUERADE=m
536CONFIG_IP_NF_TARGET_REDIRECT=m
537CONFIG_IP_NF_TARGET_NETMAP=m
538CONFIG_IP_NF_TARGET_SAME=m
539CONFIG_IP_NF_NAT_SNMP_BASIC=m
540CONFIG_IP_NF_NAT_IRC=m
541CONFIG_IP_NF_NAT_FTP=m
542CONFIG_IP_NF_NAT_TFTP=m
543CONFIG_IP_NF_NAT_AMANDA=m
544CONFIG_IP_NF_MANGLE=m
545CONFIG_IP_NF_TARGET_TOS=m
546CONFIG_IP_NF_TARGET_ECN=m
547CONFIG_IP_NF_TARGET_DSCP=m
548CONFIG_IP_NF_TARGET_MARK=m
549CONFIG_IP_NF_TARGET_CLASSIFY=m
550CONFIG_IP_NF_TARGET_CONNMARK=m
551CONFIG_IP_NF_TARGET_CLUSTERIP=m
552CONFIG_IP_NF_RAW=m
553CONFIG_IP_NF_TARGET_NOTRACK=m
554CONFIG_IP_NF_ARPTABLES=m
555CONFIG_IP_NF_ARPFILTER=m
556CONFIG_IP_NF_ARP_MANGLE=m
557
558#
559# SCTP Configuration (EXPERIMENTAL)
560#
561# CONFIG_IP_SCTP is not set
562# CONFIG_ATM is not set
563# CONFIG_BRIDGE is not set
564# CONFIG_VLAN_8021Q is not set
565# CONFIG_DECNET is not set
566# CONFIG_LLC2 is not set
567# CONFIG_IPX is not set
568# CONFIG_ATALK is not set
569# CONFIG_X25 is not set
570# CONFIG_LAPB is not set
571# CONFIG_NET_DIVERT is not set
572# CONFIG_ECONET is not set
573# CONFIG_WAN_ROUTER is not set
574
575#
576# QoS and/or fair queueing
577#
578# CONFIG_NET_SCHED is not set
579CONFIG_NET_CLS_ROUTE=y
580
581#
582# Network testing
583#
584# CONFIG_NET_PKTGEN is not set
585# CONFIG_NETPOLL is not set
586# CONFIG_NET_POLL_CONTROLLER is not set
587# CONFIG_HAMRADIO is not set
588CONFIG_IRDA=m
589
590#
591# IrDA protocols
592#
593CONFIG_IRLAN=m
594CONFIG_IRNET=m
595CONFIG_IRCOMM=m
596# CONFIG_IRDA_ULTRA is not set
597
598#
599# IrDA options
600#
601CONFIG_IRDA_CACHE_LAST_LSAP=y
602CONFIG_IRDA_FAST_RR=y
603# CONFIG_IRDA_DEBUG is not set
604
605#
606# Infrared-port device drivers
607#
608
609#
610# SIR device drivers
611#
612CONFIG_IRTTY_SIR=m
613
614#
615# Dongle support
616#
617# CONFIG_DONGLE is not set
618
619#
620# Old SIR device drivers
621#
622# CONFIG_IRPORT_SIR is not set
623
624#
625# Old Serial dongle support
626#
627
628#
629# FIR device drivers
630# 680#
631# CONFIG_USB_IRDA is not set
632# CONFIG_SIGMATEL_FIR is not set
633# CONFIG_TOSHIBA_FIR is not set
634# CONFIG_VLSI_FIR is not set
635# CONFIG_BT is not set
636CONFIG_NETDEVICES=y 681CONFIG_NETDEVICES=y
637# CONFIG_DUMMY is not set 682# CONFIG_DUMMY is not set
638# CONFIG_BONDING is not set 683# CONFIG_BONDING is not set
639# CONFIG_EQUALIZER is not set 684# CONFIG_EQUALIZER is not set
640# CONFIG_TUN is not set 685CONFIG_TUN=m
641 686
642# 687#
643# ARCnet devices 688# ARCnet devices
@@ -691,9 +736,12 @@ CONFIG_PCNET32=y
691# CONFIG_HAMACHI is not set 736# CONFIG_HAMACHI is not set
692# CONFIG_YELLOWFIN is not set 737# CONFIG_YELLOWFIN is not set
693# CONFIG_R8169 is not set 738# CONFIG_R8169 is not set
739# CONFIG_SKGE is not set
694# CONFIG_SK98LIN is not set 740# CONFIG_SK98LIN is not set
695# CONFIG_VIA_VELOCITY is not set 741# CONFIG_VIA_VELOCITY is not set
696# CONFIG_TIGON3 is not set 742# CONFIG_TIGON3 is not set
743# CONFIG_BNX2 is not set
744# CONFIG_MV643XX_ETH is not set
697 745
698# 746#
699# Ethernet (10000 Mbit) 747# Ethernet (10000 Mbit)
@@ -768,7 +816,7 @@ CONFIG_PPPOE=m
768# CONFIG_SLIP is not set 816# CONFIG_SLIP is not set
769# CONFIG_NET_FC is not set 817# CONFIG_NET_FC is not set
770# CONFIG_SHAPER is not set 818# CONFIG_SHAPER is not set
771# CONFIG_NETCONSOLE is not set 819CONFIG_NETCONSOLE=m
772 820
773# 821#
774# ISDN subsystem 822# ISDN subsystem
@@ -798,14 +846,6 @@ CONFIG_INPUT_EVDEV=y
798# CONFIG_INPUT_EVBUG is not set 846# CONFIG_INPUT_EVBUG is not set
799 847
800# 848#
801# Input I/O drivers
802#
803# CONFIG_GAMEPORT is not set
804CONFIG_SOUND_GAMEPORT=y
805# CONFIG_SERIO is not set
806# CONFIG_SERIO_I8042 is not set
807
808#
809# Input Device Drivers 849# Input Device Drivers
810# 850#
811CONFIG_INPUT_KEYBOARD=y 851CONFIG_INPUT_KEYBOARD=y
@@ -823,6 +863,12 @@ CONFIG_INPUT_MOUSE=y
823# CONFIG_INPUT_MISC is not set 863# CONFIG_INPUT_MISC is not set
824 864
825# 865#
866# Hardware I/O ports
867#
868# CONFIG_SERIO is not set
869# CONFIG_GAMEPORT is not set
870
871#
826# Character devices 872# Character devices
827# 873#
828CONFIG_VT=y 874CONFIG_VT=y
@@ -845,6 +891,7 @@ CONFIG_SERIAL_CORE=y
845CONFIG_SERIAL_CORE_CONSOLE=y 891CONFIG_SERIAL_CORE_CONSOLE=y
846CONFIG_SERIAL_PMACZILOG=y 892CONFIG_SERIAL_PMACZILOG=y
847CONFIG_SERIAL_PMACZILOG_CONSOLE=y 893CONFIG_SERIAL_PMACZILOG_CONSOLE=y
894# CONFIG_SERIAL_JSM is not set
848CONFIG_UNIX98_PTYS=y 895CONFIG_UNIX98_PTYS=y
849CONFIG_LEGACY_PTYS=y 896CONFIG_LEGACY_PTYS=y
850CONFIG_LEGACY_PTY_COUNT=256 897CONFIG_LEGACY_PTY_COUNT=256
@@ -876,6 +923,7 @@ CONFIG_DRM_R128=m
876CONFIG_DRM_RADEON=m 923CONFIG_DRM_RADEON=m
877# CONFIG_DRM_MGA is not set 924# CONFIG_DRM_MGA is not set
878# CONFIG_DRM_SIS is not set 925# CONFIG_DRM_SIS is not set
926# CONFIG_DRM_VIA is not set
879 927
880# 928#
881# PCMCIA character devices 929# PCMCIA character devices
@@ -884,6 +932,11 @@ CONFIG_DRM_RADEON=m
884# CONFIG_RAW_DRIVER is not set 932# CONFIG_RAW_DRIVER is not set
885 933
886# 934#
935# TPM devices
936#
937# CONFIG_TCG_TPM is not set
938
939#
887# I2C support 940# I2C support
888# 941#
889CONFIG_I2C=y 942CONFIG_I2C=y
@@ -907,12 +960,12 @@ CONFIG_I2C_ALGOBIT=y
907# CONFIG_I2C_HYDRA is not set 960# CONFIG_I2C_HYDRA is not set
908# CONFIG_I2C_I801 is not set 961# CONFIG_I2C_I801 is not set
909# CONFIG_I2C_I810 is not set 962# CONFIG_I2C_I810 is not set
963# CONFIG_I2C_PIIX4 is not set
910# CONFIG_I2C_ISA is not set 964# CONFIG_I2C_ISA is not set
911CONFIG_I2C_KEYWEST=m 965CONFIG_I2C_KEYWEST=m
912# CONFIG_I2C_MPC is not set 966# CONFIG_I2C_MPC is not set
913# CONFIG_I2C_NFORCE2 is not set 967# CONFIG_I2C_NFORCE2 is not set
914# CONFIG_I2C_PARPORT_LIGHT is not set 968# CONFIG_I2C_PARPORT_LIGHT is not set
915# CONFIG_I2C_PIIX4 is not set
916# CONFIG_I2C_PROSAVAGE is not set 969# CONFIG_I2C_PROSAVAGE is not set
917# CONFIG_I2C_SAVAGE4 is not set 970# CONFIG_I2C_SAVAGE4 is not set
918# CONFIG_SCx200_ACB is not set 971# CONFIG_SCx200_ACB is not set
@@ -924,45 +977,20 @@ CONFIG_I2C_KEYWEST=m
924# CONFIG_I2C_VIAPRO is not set 977# CONFIG_I2C_VIAPRO is not set
925# CONFIG_I2C_VOODOO3 is not set 978# CONFIG_I2C_VOODOO3 is not set
926# CONFIG_I2C_PCA_ISA is not set 979# CONFIG_I2C_PCA_ISA is not set
980# CONFIG_I2C_SENSOR is not set
927 981
928# 982#
929# Hardware Sensors Chip support 983# Miscellaneous I2C Chip support
930#
931# CONFIG_I2C_SENSOR is not set
932# CONFIG_SENSORS_ADM1021 is not set
933# CONFIG_SENSORS_ADM1025 is not set
934# CONFIG_SENSORS_ADM1026 is not set
935# CONFIG_SENSORS_ADM1031 is not set
936# CONFIG_SENSORS_ASB100 is not set
937# CONFIG_SENSORS_DS1621 is not set
938# CONFIG_SENSORS_FSCHER is not set
939# CONFIG_SENSORS_GL518SM is not set
940# CONFIG_SENSORS_IT87 is not set
941# CONFIG_SENSORS_LM63 is not set
942# CONFIG_SENSORS_LM75 is not set
943# CONFIG_SENSORS_LM77 is not set
944# CONFIG_SENSORS_LM78 is not set
945# CONFIG_SENSORS_LM80 is not set
946# CONFIG_SENSORS_LM83 is not set
947# CONFIG_SENSORS_LM85 is not set
948# CONFIG_SENSORS_LM87 is not set
949# CONFIG_SENSORS_LM90 is not set
950# CONFIG_SENSORS_MAX1619 is not set
951# CONFIG_SENSORS_PC87360 is not set
952# CONFIG_SENSORS_SMSC47B397 is not set
953# CONFIG_SENSORS_SMSC47M1 is not set
954# CONFIG_SENSORS_VIA686A is not set
955# CONFIG_SENSORS_W83781D is not set
956# CONFIG_SENSORS_W83L785TS is not set
957# CONFIG_SENSORS_W83627HF is not set
958
959#
960# Other I2C Chip support
961# 984#
985# CONFIG_SENSORS_DS1337 is not set
986# CONFIG_SENSORS_DS1374 is not set
962# CONFIG_SENSORS_EEPROM is not set 987# CONFIG_SENSORS_EEPROM is not set
963# CONFIG_SENSORS_PCF8574 is not set 988# CONFIG_SENSORS_PCF8574 is not set
989# CONFIG_SENSORS_PCA9539 is not set
964# CONFIG_SENSORS_PCF8591 is not set 990# CONFIG_SENSORS_PCF8591 is not set
965# CONFIG_SENSORS_RTC8564 is not set 991# CONFIG_SENSORS_RTC8564 is not set
992# CONFIG_SENSORS_M41T00 is not set
993# CONFIG_SENSORS_MAX6875 is not set
966# CONFIG_I2C_DEBUG_CORE is not set 994# CONFIG_I2C_DEBUG_CORE is not set
967# CONFIG_I2C_DEBUG_ALGO is not set 995# CONFIG_I2C_DEBUG_ALGO is not set
968# CONFIG_I2C_DEBUG_BUS is not set 996# CONFIG_I2C_DEBUG_BUS is not set
@@ -974,6 +1002,11 @@ CONFIG_I2C_KEYWEST=m
974# CONFIG_W1 is not set 1002# CONFIG_W1 is not set
975 1003
976# 1004#
1005# Hardware Monitoring support
1006#
1007# CONFIG_HWMON is not set
1008
1009#
977# Misc devices 1010# Misc devices
978# 1011#
979 1012
@@ -991,6 +1024,11 @@ CONFIG_I2C_KEYWEST=m
991# Graphics support 1024# Graphics support
992# 1025#
993CONFIG_FB=y 1026CONFIG_FB=y
1027CONFIG_FB_CFB_FILLRECT=y
1028CONFIG_FB_CFB_COPYAREA=y
1029CONFIG_FB_CFB_IMAGEBLIT=y
1030CONFIG_FB_SOFT_CURSOR=y
1031CONFIG_FB_MACMODES=y
994CONFIG_FB_MODE_HELPERS=y 1032CONFIG_FB_MODE_HELPERS=y
995CONFIG_FB_TILEBLITTING=y 1033CONFIG_FB_TILEBLITTING=y
996# CONFIG_FB_CIRRUS is not set 1034# CONFIG_FB_CIRRUS is not set
@@ -1004,6 +1042,7 @@ CONFIG_FB_CT65550=y
1004# CONFIG_FB_ASILIANT is not set 1042# CONFIG_FB_ASILIANT is not set
1005CONFIG_FB_IMSTT=y 1043CONFIG_FB_IMSTT=y
1006# CONFIG_FB_VGA16 is not set 1044# CONFIG_FB_VGA16 is not set
1045# CONFIG_FB_NVIDIA is not set
1007# CONFIG_FB_RIVA is not set 1046# CONFIG_FB_RIVA is not set
1008CONFIG_FB_MATROX=y 1047CONFIG_FB_MATROX=y
1009CONFIG_FB_MATROX_MILLENIUM=y 1048CONFIG_FB_MATROX_MILLENIUM=y
@@ -1029,6 +1068,7 @@ CONFIG_FB_3DFX=y
1029CONFIG_FB_3DFX_ACCEL=y 1068CONFIG_FB_3DFX_ACCEL=y
1030# CONFIG_FB_VOODOO1 is not set 1069# CONFIG_FB_VOODOO1 is not set
1031# CONFIG_FB_TRIDENT is not set 1070# CONFIG_FB_TRIDENT is not set
1071# CONFIG_FB_S1D13XXX is not set
1032# CONFIG_FB_VIRTUAL is not set 1072# CONFIG_FB_VIRTUAL is not set
1033 1073
1034# 1074#
@@ -1110,6 +1150,7 @@ CONFIG_SND_DUMMY=m
1110# CONFIG_SND_RME96 is not set 1150# CONFIG_SND_RME96 is not set
1111# CONFIG_SND_RME9652 is not set 1151# CONFIG_SND_RME9652 is not set
1112# CONFIG_SND_HDSP is not set 1152# CONFIG_SND_HDSP is not set
1153# CONFIG_SND_HDSPM is not set
1113# CONFIG_SND_TRIDENT is not set 1154# CONFIG_SND_TRIDENT is not set
1114# CONFIG_SND_YMFPCI is not set 1155# CONFIG_SND_YMFPCI is not set
1115# CONFIG_SND_ALS4000 is not set 1156# CONFIG_SND_ALS4000 is not set
@@ -1128,6 +1169,7 @@ CONFIG_SND_DUMMY=m
1128# CONFIG_SND_VIA82XX is not set 1169# CONFIG_SND_VIA82XX is not set
1129# CONFIG_SND_VIA82XX_MODEM is not set 1170# CONFIG_SND_VIA82XX_MODEM is not set
1130# CONFIG_SND_VX222 is not set 1171# CONFIG_SND_VX222 is not set
1172# CONFIG_SND_HDA_INTEL is not set
1131 1173
1132# 1174#
1133# ALSA PowerMac devices 1175# ALSA PowerMac devices
@@ -1152,6 +1194,8 @@ CONFIG_SND_USB_USX2Y=m
1152# 1194#
1153# USB support 1195# USB support
1154# 1196#
1197CONFIG_USB_ARCH_HAS_HCD=y
1198CONFIG_USB_ARCH_HAS_OHCI=y
1155CONFIG_USB=y 1199CONFIG_USB=y
1156# CONFIG_USB_DEBUG is not set 1200# CONFIG_USB_DEBUG is not set
1157 1201
@@ -1163,14 +1207,15 @@ CONFIG_USB_DEVICEFS=y
1163CONFIG_USB_DYNAMIC_MINORS=y 1207CONFIG_USB_DYNAMIC_MINORS=y
1164CONFIG_USB_SUSPEND=y 1208CONFIG_USB_SUSPEND=y
1165# CONFIG_USB_OTG is not set 1209# CONFIG_USB_OTG is not set
1166CONFIG_USB_ARCH_HAS_HCD=y
1167CONFIG_USB_ARCH_HAS_OHCI=y
1168 1210
1169# 1211#
1170# USB Host Controller Drivers 1212# USB Host Controller Drivers
1171# 1213#
1172# CONFIG_USB_EHCI_HCD is not set 1214# CONFIG_USB_EHCI_HCD is not set
1215# CONFIG_USB_ISP116X_HCD is not set
1173CONFIG_USB_OHCI_HCD=y 1216CONFIG_USB_OHCI_HCD=y
1217# CONFIG_USB_OHCI_BIG_ENDIAN is not set
1218CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1174# CONFIG_USB_UHCI_HCD is not set 1219# CONFIG_USB_UHCI_HCD is not set
1175# CONFIG_USB_SL811_HCD is not set 1220# CONFIG_USB_SL811_HCD is not set
1176 1221
@@ -1197,12 +1242,15 @@ CONFIG_USB_HIDINPUT=y
1197CONFIG_USB_HIDDEV=y 1242CONFIG_USB_HIDDEV=y
1198# CONFIG_USB_AIPTEK is not set 1243# CONFIG_USB_AIPTEK is not set
1199# CONFIG_USB_WACOM is not set 1244# CONFIG_USB_WACOM is not set
1245# CONFIG_USB_ACECAD is not set
1200# CONFIG_USB_KBTAB is not set 1246# CONFIG_USB_KBTAB is not set
1201# CONFIG_USB_POWERMATE is not set 1247# CONFIG_USB_POWERMATE is not set
1202# CONFIG_USB_MTOUCH is not set 1248# CONFIG_USB_MTOUCH is not set
1249# CONFIG_USB_ITMTOUCH is not set
1203# CONFIG_USB_EGALAX is not set 1250# CONFIG_USB_EGALAX is not set
1204# CONFIG_USB_XPAD is not set 1251# CONFIG_USB_XPAD is not set
1205# CONFIG_USB_ATI_REMOTE is not set 1252# CONFIG_USB_ATI_REMOTE is not set
1253# CONFIG_USB_KEYSPAN_REMOTE is not set
1206 1254
1207# 1255#
1208# USB Imaging devices 1256# USB Imaging devices
@@ -1227,6 +1275,8 @@ CONFIG_USB_HIDDEV=y
1227CONFIG_USB_PEGASUS=m 1275CONFIG_USB_PEGASUS=m
1228# CONFIG_USB_RTL8150 is not set 1276# CONFIG_USB_RTL8150 is not set
1229# CONFIG_USB_USBNET is not set 1277# CONFIG_USB_USBNET is not set
1278# CONFIG_USB_ZD1201 is not set
1279# CONFIG_USB_MON is not set
1230 1280
1231# 1281#
1232# USB port drivers 1282# USB port drivers
@@ -1237,9 +1287,11 @@ CONFIG_USB_PEGASUS=m
1237# 1287#
1238CONFIG_USB_SERIAL=m 1288CONFIG_USB_SERIAL=m
1239# CONFIG_USB_SERIAL_GENERIC is not set 1289# CONFIG_USB_SERIAL_GENERIC is not set
1290# CONFIG_USB_SERIAL_AIRPRIME is not set
1240# CONFIG_USB_SERIAL_BELKIN is not set 1291# CONFIG_USB_SERIAL_BELKIN is not set
1241# CONFIG_USB_SERIAL_WHITEHEAT is not set 1292# CONFIG_USB_SERIAL_WHITEHEAT is not set
1242# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 1293# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1294# CONFIG_USB_SERIAL_CP2101 is not set
1243# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 1295# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1244# CONFIG_USB_SERIAL_EMPEG is not set 1296# CONFIG_USB_SERIAL_EMPEG is not set
1245# CONFIG_USB_SERIAL_FTDI_SIO is not set 1297# CONFIG_USB_SERIAL_FTDI_SIO is not set
@@ -1268,10 +1320,12 @@ CONFIG_USB_SERIAL_KEYSPAN_USA49WLC=y
1268# CONFIG_USB_SERIAL_KOBIL_SCT is not set 1320# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1269# CONFIG_USB_SERIAL_MCT_U232 is not set 1321# CONFIG_USB_SERIAL_MCT_U232 is not set
1270# CONFIG_USB_SERIAL_PL2303 is not set 1322# CONFIG_USB_SERIAL_PL2303 is not set
1323# CONFIG_USB_SERIAL_HP4X is not set
1271# CONFIG_USB_SERIAL_SAFE is not set 1324# CONFIG_USB_SERIAL_SAFE is not set
1272# CONFIG_USB_SERIAL_TI is not set 1325# CONFIG_USB_SERIAL_TI is not set
1273# CONFIG_USB_SERIAL_CYBERJACK is not set 1326# CONFIG_USB_SERIAL_CYBERJACK is not set
1274# CONFIG_USB_SERIAL_XIRCOM is not set 1327# CONFIG_USB_SERIAL_XIRCOM is not set
1328# CONFIG_USB_SERIAL_OPTION is not set
1275# CONFIG_USB_SERIAL_OMNINET is not set 1329# CONFIG_USB_SERIAL_OMNINET is not set
1276CONFIG_USB_EZUSB=y 1330CONFIG_USB_EZUSB=y
1277 1331
@@ -1289,10 +1343,11 @@ CONFIG_USB_EZUSB=y
1289# CONFIG_USB_PHIDGETKIT is not set 1343# CONFIG_USB_PHIDGETKIT is not set
1290# CONFIG_USB_PHIDGETSERVO is not set 1344# CONFIG_USB_PHIDGETSERVO is not set
1291# CONFIG_USB_IDMOUSE is not set 1345# CONFIG_USB_IDMOUSE is not set
1346# CONFIG_USB_LD is not set
1292# CONFIG_USB_TEST is not set 1347# CONFIG_USB_TEST is not set
1293 1348
1294# 1349#
1295# USB ATM/DSL drivers 1350# USB DSL modem support
1296# 1351#
1297 1352
1298# 1353#
@@ -1311,12 +1366,17 @@ CONFIG_USB_EZUSB=y
1311# CONFIG_INFINIBAND is not set 1366# CONFIG_INFINIBAND is not set
1312 1367
1313# 1368#
1369# SN Devices
1370#
1371
1372#
1314# File systems 1373# File systems
1315# 1374#
1316CONFIG_EXT2_FS=y 1375CONFIG_EXT2_FS=y
1317CONFIG_EXT2_FS_XATTR=y 1376CONFIG_EXT2_FS_XATTR=y
1318# CONFIG_EXT2_FS_POSIX_ACL is not set 1377# CONFIG_EXT2_FS_POSIX_ACL is not set
1319# CONFIG_EXT2_FS_SECURITY is not set 1378# CONFIG_EXT2_FS_SECURITY is not set
1379# CONFIG_EXT2_FS_XIP is not set
1320CONFIG_EXT3_FS=y 1380CONFIG_EXT3_FS=y
1321CONFIG_EXT3_FS_XATTR=y 1381CONFIG_EXT3_FS_XATTR=y
1322# CONFIG_EXT3_FS_POSIX_ACL is not set 1382# CONFIG_EXT3_FS_POSIX_ACL is not set
@@ -1326,6 +1386,7 @@ CONFIG_JBD=y
1326CONFIG_FS_MBCACHE=y 1386CONFIG_FS_MBCACHE=y
1327# CONFIG_REISERFS_FS is not set 1387# CONFIG_REISERFS_FS is not set
1328# CONFIG_JFS_FS is not set 1388# CONFIG_JFS_FS is not set
1389CONFIG_FS_POSIX_ACL=y
1329 1390
1330# 1391#
1331# XFS support 1392# XFS support
@@ -1333,6 +1394,7 @@ CONFIG_FS_MBCACHE=y
1333# CONFIG_XFS_FS is not set 1394# CONFIG_XFS_FS is not set
1334# CONFIG_MINIX_FS is not set 1395# CONFIG_MINIX_FS is not set
1335# CONFIG_ROMFS_FS is not set 1396# CONFIG_ROMFS_FS is not set
1397CONFIG_INOTIFY=y
1336# CONFIG_QUOTA is not set 1398# CONFIG_QUOTA is not set
1337CONFIG_DNOTIFY=y 1399CONFIG_DNOTIFY=y
1338# CONFIG_AUTOFS_FS is not set 1400# CONFIG_AUTOFS_FS is not set
@@ -1363,7 +1425,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1363CONFIG_PROC_FS=y 1425CONFIG_PROC_FS=y
1364CONFIG_PROC_KCORE=y 1426CONFIG_PROC_KCORE=y
1365CONFIG_SYSFS=y 1427CONFIG_SYSFS=y
1366# CONFIG_DEVFS_FS is not set
1367CONFIG_DEVPTS_FS_XATTR=y 1428CONFIG_DEVPTS_FS_XATTR=y
1368CONFIG_DEVPTS_FS_SECURITY=y 1429CONFIG_DEVPTS_FS_SECURITY=y
1369CONFIG_TMPFS=y 1430CONFIG_TMPFS=y
@@ -1394,15 +1455,20 @@ CONFIG_CRAMFS=m
1394# 1455#
1395CONFIG_NFS_FS=y 1456CONFIG_NFS_FS=y
1396CONFIG_NFS_V3=y 1457CONFIG_NFS_V3=y
1458CONFIG_NFS_V3_ACL=y
1397# CONFIG_NFS_V4 is not set 1459# CONFIG_NFS_V4 is not set
1398# CONFIG_NFS_DIRECTIO is not set 1460# CONFIG_NFS_DIRECTIO is not set
1399CONFIG_NFSD=y 1461CONFIG_NFSD=y
1462CONFIG_NFSD_V2_ACL=y
1400CONFIG_NFSD_V3=y 1463CONFIG_NFSD_V3=y
1464CONFIG_NFSD_V3_ACL=y
1401# CONFIG_NFSD_V4 is not set 1465# CONFIG_NFSD_V4 is not set
1402CONFIG_NFSD_TCP=y 1466CONFIG_NFSD_TCP=y
1403CONFIG_LOCKD=y 1467CONFIG_LOCKD=y
1404CONFIG_LOCKD_V4=y 1468CONFIG_LOCKD_V4=y
1405CONFIG_EXPORTFS=y 1469CONFIG_EXPORTFS=y
1470CONFIG_NFS_ACL_SUPPORT=y
1471CONFIG_NFS_COMMON=y
1406CONFIG_SUNRPC=y 1472CONFIG_SUNRPC=y
1407# CONFIG_RPCSEC_GSS_KRB5 is not set 1473# CONFIG_RPCSEC_GSS_KRB5 is not set
1408# CONFIG_RPCSEC_GSS_SPKM3 is not set 1474# CONFIG_RPCSEC_GSS_SPKM3 is not set
@@ -1494,8 +1560,10 @@ CONFIG_ZLIB_DEFLATE=y
1494# 1560#
1495# Kernel hacking 1561# Kernel hacking
1496# 1562#
1563# CONFIG_PRINTK_TIME is not set
1497CONFIG_DEBUG_KERNEL=y 1564CONFIG_DEBUG_KERNEL=y
1498CONFIG_MAGIC_SYSRQ=y 1565CONFIG_MAGIC_SYSRQ=y
1566CONFIG_LOG_BUF_SHIFT=16
1499# CONFIG_SCHEDSTATS is not set 1567# CONFIG_SCHEDSTATS is not set
1500# CONFIG_DEBUG_SLAB is not set 1568# CONFIG_DEBUG_SLAB is not set
1501# CONFIG_DEBUG_SPINLOCK is not set 1569# CONFIG_DEBUG_SPINLOCK is not set
diff --git a/arch/ppc/configs/radstone_ppc7d_defconfig b/arch/ppc/configs/radstone_ppc7d_defconfig
index 7f6467e77949..ca4d1fd0ca05 100644
--- a/arch/ppc/configs/radstone_ppc7d_defconfig
+++ b/arch/ppc/configs/radstone_ppc7d_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11 3# Linux kernel version: 2.6.13-rc3
4# Tue Mar 15 14:31:19 2005 4# Tue Jul 26 00:02:09 2005
5# 5#
6CONFIG_MMU=y 6CONFIG_MMU=y
7CONFIG_GENERIC_HARDIRQS=y 7CONFIG_GENERIC_HARDIRQS=y
@@ -11,6 +11,7 @@ CONFIG_HAVE_DEC_LOCK=y
11CONFIG_PPC=y 11CONFIG_PPC=y
12CONFIG_PPC32=y 12CONFIG_PPC32=y
13CONFIG_GENERIC_NVRAM=y 13CONFIG_GENERIC_NVRAM=y
14CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
14 15
15# 16#
16# Code maturity level options 17# Code maturity level options
@@ -18,6 +19,7 @@ CONFIG_GENERIC_NVRAM=y
18CONFIG_EXPERIMENTAL=y 19CONFIG_EXPERIMENTAL=y
19CONFIG_CLEAN_COMPILE=y 20CONFIG_CLEAN_COMPILE=y
20CONFIG_BROKEN_ON_SMP=y 21CONFIG_BROKEN_ON_SMP=y
22CONFIG_INIT_ENV_ARG_LIMIT=32
21 23
22# 24#
23# General setup 25# General setup
@@ -35,6 +37,8 @@ CONFIG_KOBJECT_UEVENT=y
35CONFIG_EMBEDDED=y 37CONFIG_EMBEDDED=y
36CONFIG_KALLSYMS=y 38CONFIG_KALLSYMS=y
37CONFIG_KALLSYMS_EXTRA_PASS=y 39CONFIG_KALLSYMS_EXTRA_PASS=y
40CONFIG_PRINTK=y
41CONFIG_BUG=y
38CONFIG_BASE_FULL=y 42CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y 43CONFIG_FUTEX=y
40CONFIG_EPOLL=y 44CONFIG_EPOLL=y
@@ -67,9 +71,12 @@ CONFIG_6xx=y
67# CONFIG_POWER3 is not set 71# CONFIG_POWER3 is not set
68# CONFIG_POWER4 is not set 72# CONFIG_POWER4 is not set
69# CONFIG_8xx is not set 73# CONFIG_8xx is not set
74# CONFIG_E200 is not set
70# CONFIG_E500 is not set 75# CONFIG_E500 is not set
76CONFIG_PPC_FPU=y
71CONFIG_ALTIVEC=y 77CONFIG_ALTIVEC=y
72# CONFIG_TAU is not set 78# CONFIG_TAU is not set
79# CONFIG_KEXEC is not set
73# CONFIG_CPU_FREQ is not set 80# CONFIG_CPU_FREQ is not set
74CONFIG_PPC_GEN550=y 81CONFIG_PPC_GEN550=y
75# CONFIG_PM is not set 82# CONFIG_PM is not set
@@ -84,21 +91,18 @@ CONFIG_PPC_STD_MMU=y
84# CONFIG_KATANA is not set 91# CONFIG_KATANA is not set
85# CONFIG_WILLOW is not set 92# CONFIG_WILLOW is not set
86# CONFIG_CPCI690 is not set 93# CONFIG_CPCI690 is not set
87# CONFIG_PCORE is not set
88# CONFIG_POWERPMC250 is not set 94# CONFIG_POWERPMC250 is not set
89# CONFIG_CHESTNUT is not set 95# CONFIG_CHESTNUT is not set
90# CONFIG_SPRUCE is not set 96# CONFIG_SPRUCE is not set
97# CONFIG_HDPU is not set
91# CONFIG_EV64260 is not set 98# CONFIG_EV64260 is not set
92# CONFIG_LOPEC is not set 99# CONFIG_LOPEC is not set
93# CONFIG_MCPN765 is not set
94# CONFIG_MVME5100 is not set 100# CONFIG_MVME5100 is not set
95# CONFIG_PPLUS is not set 101# CONFIG_PPLUS is not set
96# CONFIG_PRPMC750 is not set 102# CONFIG_PRPMC750 is not set
97# CONFIG_PRPMC800 is not set 103# CONFIG_PRPMC800 is not set
98# CONFIG_SANDPOINT is not set 104# CONFIG_SANDPOINT is not set
99CONFIG_RADSTONE_PPC7D=y 105CONFIG_RADSTONE_PPC7D=y
100# CONFIG_ADIR is not set
101# CONFIG_K2 is not set
102# CONFIG_PAL4 is not set 106# CONFIG_PAL4 is not set
103# CONFIG_GEMINI is not set 107# CONFIG_GEMINI is not set
104# CONFIG_EST8260 is not set 108# CONFIG_EST8260 is not set
@@ -121,10 +125,18 @@ CONFIG_MV64X60_NEW_BASE=0xfef00000
121# CONFIG_SMP is not set 125# CONFIG_SMP is not set
122# CONFIG_PREEMPT is not set 126# CONFIG_PREEMPT is not set
123# CONFIG_HIGHMEM is not set 127# CONFIG_HIGHMEM is not set
128CONFIG_SELECT_MEMORY_MODEL=y
129CONFIG_FLATMEM_MANUAL=y
130# CONFIG_DISCONTIGMEM_MANUAL is not set
131# CONFIG_SPARSEMEM_MANUAL is not set
132CONFIG_FLATMEM=y
133CONFIG_FLAT_NODE_MEM_MAP=y
124CONFIG_BINFMT_ELF=y 134CONFIG_BINFMT_ELF=y
125CONFIG_BINFMT_MISC=y 135CONFIG_BINFMT_MISC=y
126CONFIG_CMDLINE_BOOL=y 136CONFIG_CMDLINE_BOOL=y
127CONFIG_CMDLINE="console=ttyS0,9600" 137CONFIG_CMDLINE="console=ttyS0,9600"
138CONFIG_SECCOMP=y
139CONFIG_ISA_DMA_API=y
128 140
129# 141#
130# Bus options 142# Bus options
@@ -155,6 +167,69 @@ CONFIG_TASK_SIZE=0x80000000
155CONFIG_BOOT_LOAD=0x00800000 167CONFIG_BOOT_LOAD=0x00800000
156 168
157# 169#
170# Networking
171#
172CONFIG_NET=y
173
174#
175# Networking options
176#
177CONFIG_PACKET=y
178# CONFIG_PACKET_MMAP is not set
179CONFIG_UNIX=y
180# CONFIG_NET_KEY is not set
181CONFIG_INET=y
182CONFIG_IP_MULTICAST=y
183# CONFIG_IP_ADVANCED_ROUTER is not set
184CONFIG_IP_FIB_HASH=y
185CONFIG_IP_PNP=y
186CONFIG_IP_PNP_DHCP=y
187CONFIG_IP_PNP_BOOTP=y
188# CONFIG_IP_PNP_RARP is not set
189# CONFIG_NET_IPIP is not set
190# CONFIG_NET_IPGRE is not set
191# CONFIG_IP_MROUTE is not set
192# CONFIG_ARPD is not set
193CONFIG_SYN_COOKIES=y
194# CONFIG_INET_AH is not set
195# CONFIG_INET_ESP is not set
196# CONFIG_INET_IPCOMP is not set
197# CONFIG_INET_TUNNEL is not set
198CONFIG_IP_TCPDIAG=y
199# CONFIG_IP_TCPDIAG_IPV6 is not set
200# CONFIG_TCP_CONG_ADVANCED is not set
201CONFIG_TCP_CONG_BIC=y
202# CONFIG_IPV6 is not set
203# CONFIG_NETFILTER is not set
204
205#
206# SCTP Configuration (EXPERIMENTAL)
207#
208# CONFIG_IP_SCTP is not set
209# CONFIG_ATM is not set
210CONFIG_BRIDGE=y
211# CONFIG_VLAN_8021Q is not set
212# CONFIG_DECNET is not set
213# CONFIG_LLC2 is not set
214# CONFIG_IPX is not set
215# CONFIG_ATALK is not set
216# CONFIG_X25 is not set
217# CONFIG_LAPB is not set
218# CONFIG_NET_DIVERT is not set
219# CONFIG_ECONET is not set
220# CONFIG_WAN_ROUTER is not set
221# CONFIG_NET_SCHED is not set
222# CONFIG_NET_CLS_ROUTE is not set
223
224#
225# Network testing
226#
227# CONFIG_NET_PKTGEN is not set
228# CONFIG_HAMRADIO is not set
229# CONFIG_IRDA is not set
230# CONFIG_BT is not set
231
232#
158# Device Drivers 233# Device Drivers
159# 234#
160 235
@@ -203,6 +278,7 @@ CONFIG_MTD_CFI_I1=y
203CONFIG_MTD_CFI_I2=y 278CONFIG_MTD_CFI_I2=y
204# CONFIG_MTD_CFI_I4 is not set 279# CONFIG_MTD_CFI_I4 is not set
205# CONFIG_MTD_CFI_I8 is not set 280# CONFIG_MTD_CFI_I8 is not set
281# CONFIG_MTD_OTP is not set
206CONFIG_MTD_CFI_INTELEXT=y 282CONFIG_MTD_CFI_INTELEXT=y
207# CONFIG_MTD_CFI_AMDSTD is not set 283# CONFIG_MTD_CFI_AMDSTD is not set
208# CONFIG_MTD_CFI_STAA is not set 284# CONFIG_MTD_CFI_STAA is not set
@@ -210,13 +286,13 @@ CONFIG_MTD_CFI_UTIL=y
210# CONFIG_MTD_RAM is not set 286# CONFIG_MTD_RAM is not set
211# CONFIG_MTD_ROM is not set 287# CONFIG_MTD_ROM is not set
212# CONFIG_MTD_ABSENT is not set 288# CONFIG_MTD_ABSENT is not set
213# CONFIG_MTD_XIP is not set
214 289
215# 290#
216# Mapping drivers for chip access 291# Mapping drivers for chip access
217# 292#
218# CONFIG_MTD_COMPLEX_MAPPINGS is not set 293# CONFIG_MTD_COMPLEX_MAPPINGS is not set
219# CONFIG_MTD_PHYSMAP is not set 294# CONFIG_MTD_PHYSMAP is not set
295# CONFIG_MTD_PLATRAM is not set
220 296
221# 297#
222# Self-contained MTD device drivers 298# Self-contained MTD device drivers
@@ -299,6 +375,7 @@ CONFIG_BLK_DEV_SD=y
299CONFIG_BLK_DEV_SR=y 375CONFIG_BLK_DEV_SR=y
300CONFIG_BLK_DEV_SR_VENDOR=y 376CONFIG_BLK_DEV_SR_VENDOR=y
301CONFIG_CHR_DEV_SG=y 377CONFIG_CHR_DEV_SG=y
378# CONFIG_CHR_DEV_SCH is not set
302 379
303# 380#
304# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 381# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -331,7 +408,6 @@ CONFIG_SCSI_SPI_ATTRS=y
331# CONFIG_SCSI_BUSLOGIC is not set 408# CONFIG_SCSI_BUSLOGIC is not set
332# CONFIG_SCSI_DMX3191D is not set 409# CONFIG_SCSI_DMX3191D is not set
333# CONFIG_SCSI_EATA is not set 410# CONFIG_SCSI_EATA is not set
334# CONFIG_SCSI_EATA_PIO is not set
335# CONFIG_SCSI_FUTURE_DOMAIN is not set 411# CONFIG_SCSI_FUTURE_DOMAIN is not set
336# CONFIG_SCSI_GDTH is not set 412# CONFIG_SCSI_GDTH is not set
337# CONFIG_SCSI_IPS is not set 413# CONFIG_SCSI_IPS is not set
@@ -343,7 +419,6 @@ CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
343CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64 419CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
344# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set 420# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
345# CONFIG_SCSI_IPR is not set 421# CONFIG_SCSI_IPR is not set
346# CONFIG_SCSI_QLOGIC_ISP is not set
347# CONFIG_SCSI_QLOGIC_FC is not set 422# CONFIG_SCSI_QLOGIC_FC is not set
348# CONFIG_SCSI_QLOGIC_1280 is not set 423# CONFIG_SCSI_QLOGIC_1280 is not set
349CONFIG_SCSI_QLA2XXX=y 424CONFIG_SCSI_QLA2XXX=y
@@ -352,6 +427,7 @@ CONFIG_SCSI_QLA2XXX=y
352# CONFIG_SCSI_QLA2300 is not set 427# CONFIG_SCSI_QLA2300 is not set
353# CONFIG_SCSI_QLA2322 is not set 428# CONFIG_SCSI_QLA2322 is not set
354# CONFIG_SCSI_QLA6312 is not set 429# CONFIG_SCSI_QLA6312 is not set
430# CONFIG_SCSI_LPFC is not set
355# CONFIG_SCSI_DC395x is not set 431# CONFIG_SCSI_DC395x is not set
356# CONFIG_SCSI_DC390T is not set 432# CONFIG_SCSI_DC390T is not set
357# CONFIG_SCSI_NSP32 is not set 433# CONFIG_SCSI_NSP32 is not set
@@ -366,6 +442,8 @@ CONFIG_SCSI_QLA2XXX=y
366# Fusion MPT device support 442# Fusion MPT device support
367# 443#
368# CONFIG_FUSION is not set 444# CONFIG_FUSION is not set
445# CONFIG_FUSION_SPI is not set
446# CONFIG_FUSION_FC is not set
369 447
370# 448#
371# IEEE 1394 (FireWire) support 449# IEEE 1394 (FireWire) support
@@ -382,71 +460,8 @@ CONFIG_SCSI_QLA2XXX=y
382# 460#
383 461
384# 462#
385# Networking support 463# Network device support
386# 464#
387CONFIG_NET=y
388
389#
390# Networking options
391#
392CONFIG_PACKET=y
393# CONFIG_PACKET_MMAP is not set
394# CONFIG_NETLINK_DEV is not set
395CONFIG_UNIX=y
396# CONFIG_NET_KEY is not set
397CONFIG_INET=y
398CONFIG_IP_MULTICAST=y
399# CONFIG_IP_ADVANCED_ROUTER is not set
400CONFIG_IP_PNP=y
401CONFIG_IP_PNP_DHCP=y
402CONFIG_IP_PNP_BOOTP=y
403# CONFIG_IP_PNP_RARP is not set
404# CONFIG_NET_IPIP is not set
405# CONFIG_NET_IPGRE is not set
406# CONFIG_IP_MROUTE is not set
407# CONFIG_ARPD is not set
408CONFIG_SYN_COOKIES=y
409# CONFIG_INET_AH is not set
410# CONFIG_INET_ESP is not set
411# CONFIG_INET_IPCOMP is not set
412# CONFIG_INET_TUNNEL is not set
413CONFIG_IP_TCPDIAG=y
414# CONFIG_IP_TCPDIAG_IPV6 is not set
415# CONFIG_IPV6 is not set
416# CONFIG_NETFILTER is not set
417
418#
419# SCTP Configuration (EXPERIMENTAL)
420#
421# CONFIG_IP_SCTP is not set
422# CONFIG_ATM is not set
423CONFIG_BRIDGE=y
424# CONFIG_VLAN_8021Q is not set
425# CONFIG_DECNET is not set
426# CONFIG_LLC2 is not set
427# CONFIG_IPX is not set
428# CONFIG_ATALK is not set
429# CONFIG_X25 is not set
430# CONFIG_LAPB is not set
431# CONFIG_NET_DIVERT is not set
432# CONFIG_ECONET is not set
433# CONFIG_WAN_ROUTER is not set
434
435#
436# QoS and/or fair queueing
437#
438# CONFIG_NET_SCHED is not set
439# CONFIG_NET_CLS_ROUTE is not set
440
441#
442# Network testing
443#
444# CONFIG_NET_PKTGEN is not set
445# CONFIG_NETPOLL is not set
446# CONFIG_NET_POLL_CONTROLLER is not set
447# CONFIG_HAMRADIO is not set
448# CONFIG_IRDA is not set
449# CONFIG_BT is not set
450CONFIG_NETDEVICES=y 465CONFIG_NETDEVICES=y
451# CONFIG_DUMMY is not set 466# CONFIG_DUMMY is not set
452# CONFIG_BONDING is not set 467# CONFIG_BONDING is not set
@@ -511,9 +526,11 @@ CONFIG_E100=y
511# CONFIG_YELLOWFIN is not set 526# CONFIG_YELLOWFIN is not set
512CONFIG_R8169=y 527CONFIG_R8169=y
513CONFIG_R8169_NAPI=y 528CONFIG_R8169_NAPI=y
529# CONFIG_SKGE is not set
514CONFIG_SK98LIN=y 530CONFIG_SK98LIN=y
515# CONFIG_VIA_VELOCITY is not set 531# CONFIG_VIA_VELOCITY is not set
516CONFIG_TIGON3=y 532CONFIG_TIGON3=y
533# CONFIG_BNX2 is not set
517CONFIG_MV643XX_ETH=y 534CONFIG_MV643XX_ETH=y
518CONFIG_MV643XX_ETH_0=y 535CONFIG_MV643XX_ETH_0=y
519CONFIG_MV643XX_ETH_1=y 536CONFIG_MV643XX_ETH_1=y
@@ -546,6 +563,8 @@ CONFIG_MV643XX_ETH_1=y
546# CONFIG_NET_FC is not set 563# CONFIG_NET_FC is not set
547# CONFIG_SHAPER is not set 564# CONFIG_SHAPER is not set
548# CONFIG_NETCONSOLE is not set 565# CONFIG_NETCONSOLE is not set
566# CONFIG_NETPOLL is not set
567# CONFIG_NET_POLL_CONTROLLER is not set
549 568
550# 569#
551# ISDN subsystem 570# ISDN subsystem
@@ -598,7 +617,6 @@ CONFIG_SERIO_SERPORT=y
598CONFIG_SERIO_LIBPS2=y 617CONFIG_SERIO_LIBPS2=y
599# CONFIG_SERIO_RAW is not set 618# CONFIG_SERIO_RAW is not set
600# CONFIG_GAMEPORT is not set 619# CONFIG_GAMEPORT is not set
601CONFIG_SOUND_GAMEPORT=y
602 620
603# 621#
604# Character devices 622# Character devices
@@ -623,6 +641,7 @@ CONFIG_SERIAL_MPSC=y
623# CONFIG_SERIAL_MPSC_CONSOLE is not set 641# CONFIG_SERIAL_MPSC_CONSOLE is not set
624CONFIG_SERIAL_CORE=y 642CONFIG_SERIAL_CORE=y
625CONFIG_SERIAL_CORE_CONSOLE=y 643CONFIG_SERIAL_CORE_CONSOLE=y
644# CONFIG_SERIAL_JSM is not set
626CONFIG_UNIX98_PTYS=y 645CONFIG_UNIX98_PTYS=y
627CONFIG_LEGACY_PTYS=y 646CONFIG_LEGACY_PTYS=y
628CONFIG_LEGACY_PTY_COUNT=256 647CONFIG_LEGACY_PTY_COUNT=256
@@ -690,11 +709,11 @@ CONFIG_I2C_CHARDEV=y
690# CONFIG_I2C_AMD8111 is not set 709# CONFIG_I2C_AMD8111 is not set
691# CONFIG_I2C_I801 is not set 710# CONFIG_I2C_I801 is not set
692# CONFIG_I2C_I810 is not set 711# CONFIG_I2C_I810 is not set
712# CONFIG_I2C_PIIX4 is not set
693# CONFIG_I2C_ISA is not set 713# CONFIG_I2C_ISA is not set
694# CONFIG_I2C_MPC is not set 714# CONFIG_I2C_MPC is not set
695# CONFIG_I2C_NFORCE2 is not set 715# CONFIG_I2C_NFORCE2 is not set
696# CONFIG_I2C_PARPORT_LIGHT is not set 716# CONFIG_I2C_PARPORT_LIGHT is not set
697# CONFIG_I2C_PIIX4 is not set
698# CONFIG_I2C_PROSAVAGE is not set 717# CONFIG_I2C_PROSAVAGE is not set
699# CONFIG_I2C_SAVAGE4 is not set 718# CONFIG_I2C_SAVAGE4 is not set
700# CONFIG_SCx200_ACB is not set 719# CONFIG_SCx200_ACB is not set
@@ -707,16 +726,41 @@ CONFIG_I2C_CHARDEV=y
707# CONFIG_I2C_VOODOO3 is not set 726# CONFIG_I2C_VOODOO3 is not set
708# CONFIG_I2C_PCA_ISA is not set 727# CONFIG_I2C_PCA_ISA is not set
709CONFIG_I2C_MV64XXX=y 728CONFIG_I2C_MV64XXX=y
729CONFIG_I2C_SENSOR=y
710 730
711# 731#
712# Hardware Sensors Chip support 732# Miscellaneous I2C Chip support
713# 733#
714CONFIG_I2C_SENSOR=y 734CONFIG_SENSORS_DS1337=y
735# CONFIG_SENSORS_DS1374 is not set
736# CONFIG_SENSORS_EEPROM is not set
737# CONFIG_SENSORS_PCF8574 is not set
738# CONFIG_SENSORS_PCA9539 is not set
739# CONFIG_SENSORS_PCF8591 is not set
740# CONFIG_SENSORS_RTC8564 is not set
741# CONFIG_SENSORS_M41T00 is not set
742# CONFIG_SENSORS_MAX6875 is not set
743# CONFIG_I2C_DEBUG_CORE is not set
744# CONFIG_I2C_DEBUG_ALGO is not set
745# CONFIG_I2C_DEBUG_BUS is not set
746# CONFIG_I2C_DEBUG_CHIP is not set
747
748#
749# Dallas's 1-wire bus
750#
751# CONFIG_W1 is not set
752
753#
754# Hardware Monitoring support
755#
756CONFIG_HWMON=y
715# CONFIG_SENSORS_ADM1021 is not set 757# CONFIG_SENSORS_ADM1021 is not set
716# CONFIG_SENSORS_ADM1025 is not set 758# CONFIG_SENSORS_ADM1025 is not set
717# CONFIG_SENSORS_ADM1026 is not set 759# CONFIG_SENSORS_ADM1026 is not set
718# CONFIG_SENSORS_ADM1031 is not set 760# CONFIG_SENSORS_ADM1031 is not set
761# CONFIG_SENSORS_ADM9240 is not set
719# CONFIG_SENSORS_ASB100 is not set 762# CONFIG_SENSORS_ASB100 is not set
763# CONFIG_SENSORS_ATXP1 is not set
720# CONFIG_SENSORS_DS1621 is not set 764# CONFIG_SENSORS_DS1621 is not set
721# CONFIG_SENSORS_FSCHER is not set 765# CONFIG_SENSORS_FSCHER is not set
722# CONFIG_SENSORS_FSCPOS is not set 766# CONFIG_SENSORS_FSCPOS is not set
@@ -732,33 +776,18 @@ CONFIG_I2C_SENSOR=y
732# CONFIG_SENSORS_LM85 is not set 776# CONFIG_SENSORS_LM85 is not set
733# CONFIG_SENSORS_LM87 is not set 777# CONFIG_SENSORS_LM87 is not set
734CONFIG_SENSORS_LM90=y 778CONFIG_SENSORS_LM90=y
779# CONFIG_SENSORS_LM92 is not set
735# CONFIG_SENSORS_MAX1619 is not set 780# CONFIG_SENSORS_MAX1619 is not set
736# CONFIG_SENSORS_PC87360 is not set 781# CONFIG_SENSORS_PC87360 is not set
737# CONFIG_SENSORS_SMSC47B397 is not set
738# CONFIG_SENSORS_SIS5595 is not set 782# CONFIG_SENSORS_SIS5595 is not set
739# CONFIG_SENSORS_SMSC47M1 is not set 783# CONFIG_SENSORS_SMSC47M1 is not set
784# CONFIG_SENSORS_SMSC47B397 is not set
740# CONFIG_SENSORS_VIA686A is not set 785# CONFIG_SENSORS_VIA686A is not set
741# CONFIG_SENSORS_W83781D is not set 786# CONFIG_SENSORS_W83781D is not set
742# CONFIG_SENSORS_W83L785TS is not set 787# CONFIG_SENSORS_W83L785TS is not set
743# CONFIG_SENSORS_W83627HF is not set 788# CONFIG_SENSORS_W83627HF is not set
744 789# CONFIG_SENSORS_W83627EHF is not set
745# 790# CONFIG_HWMON_DEBUG_CHIP is not set
746# Other I2C Chip support
747#
748# CONFIG_SENSORS_EEPROM is not set
749# CONFIG_SENSORS_PCF8574 is not set
750# CONFIG_SENSORS_PCF8591 is not set
751# CONFIG_SENSORS_RTC8564 is not set
752# CONFIG_SENSORS_M41T00 is not set
753# CONFIG_I2C_DEBUG_CORE is not set
754# CONFIG_I2C_DEBUG_ALGO is not set
755# CONFIG_I2C_DEBUG_BUS is not set
756# CONFIG_I2C_DEBUG_CHIP is not set
757
758#
759# Dallas's 1-wire bus
760#
761# CONFIG_W1 is not set
762 791
763# 792#
764# Misc devices 793# Misc devices
@@ -813,14 +842,20 @@ CONFIG_USB_ARCH_HAS_OHCI=y
813# CONFIG_INFINIBAND is not set 842# CONFIG_INFINIBAND is not set
814 843
815# 844#
845# SN Devices
846#
847
848#
816# File systems 849# File systems
817# 850#
818CONFIG_EXT2_FS=y 851CONFIG_EXT2_FS=y
819# CONFIG_EXT2_FS_XATTR is not set 852# CONFIG_EXT2_FS_XATTR is not set
853# CONFIG_EXT2_FS_XIP is not set
820# CONFIG_EXT3_FS is not set 854# CONFIG_EXT3_FS is not set
821# CONFIG_JBD is not set 855# CONFIG_JBD is not set
822# CONFIG_REISERFS_FS is not set 856# CONFIG_REISERFS_FS is not set
823# CONFIG_JFS_FS is not set 857# CONFIG_JFS_FS is not set
858# CONFIG_FS_POSIX_ACL is not set
824 859
825# 860#
826# XFS support 861# XFS support
@@ -828,6 +863,7 @@ CONFIG_EXT2_FS=y
828# CONFIG_XFS_FS is not set 863# CONFIG_XFS_FS is not set
829# CONFIG_MINIX_FS is not set 864# CONFIG_MINIX_FS is not set
830# CONFIG_ROMFS_FS is not set 865# CONFIG_ROMFS_FS is not set
866CONFIG_INOTIFY=y
831# CONFIG_QUOTA is not set 867# CONFIG_QUOTA is not set
832CONFIG_DNOTIFY=y 868CONFIG_DNOTIFY=y
833# CONFIG_AUTOFS_FS is not set 869# CONFIG_AUTOFS_FS is not set
@@ -854,7 +890,6 @@ CONFIG_ISO9660_FS=y
854CONFIG_PROC_FS=y 890CONFIG_PROC_FS=y
855CONFIG_PROC_KCORE=y 891CONFIG_PROC_KCORE=y
856CONFIG_SYSFS=y 892CONFIG_SYSFS=y
857# CONFIG_DEVFS_FS is not set
858# CONFIG_DEVPTS_FS_XATTR is not set 893# CONFIG_DEVPTS_FS_XATTR is not set
859CONFIG_TMPFS=y 894CONFIG_TMPFS=y
860# CONFIG_TMPFS_XATTR is not set 895# CONFIG_TMPFS_XATTR is not set
@@ -874,8 +909,7 @@ CONFIG_RAMFS=y
874# CONFIG_JFFS_FS is not set 909# CONFIG_JFFS_FS is not set
875CONFIG_JFFS2_FS=y 910CONFIG_JFFS2_FS=y
876CONFIG_JFFS2_FS_DEBUG=0 911CONFIG_JFFS2_FS_DEBUG=0
877# CONFIG_JFFS2_FS_NAND is not set 912CONFIG_JFFS2_FS_WRITEBUFFER=y
878# CONFIG_JFFS2_FS_NOR_ECC is not set
879# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set 913# CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
880CONFIG_JFFS2_ZLIB=y 914CONFIG_JFFS2_ZLIB=y
881CONFIG_JFFS2_RTIME=y 915CONFIG_JFFS2_RTIME=y
@@ -892,12 +926,14 @@ CONFIG_JFFS2_RTIME=y
892# 926#
893CONFIG_NFS_FS=y 927CONFIG_NFS_FS=y
894CONFIG_NFS_V3=y 928CONFIG_NFS_V3=y
929# CONFIG_NFS_V3_ACL is not set
895# CONFIG_NFS_V4 is not set 930# CONFIG_NFS_V4 is not set
896# CONFIG_NFS_DIRECTIO is not set 931# CONFIG_NFS_DIRECTIO is not set
897# CONFIG_NFSD is not set 932# CONFIG_NFSD is not set
898CONFIG_ROOT_NFS=y 933CONFIG_ROOT_NFS=y
899CONFIG_LOCKD=y 934CONFIG_LOCKD=y
900CONFIG_LOCKD_V4=y 935CONFIG_LOCKD_V4=y
936CONFIG_NFS_COMMON=y
901CONFIG_SUNRPC=y 937CONFIG_SUNRPC=y
902# CONFIG_RPCSEC_GSS_KRB5 is not set 938# CONFIG_RPCSEC_GSS_KRB5 is not set
903# CONFIG_RPCSEC_GSS_SPKM3 is not set 939# CONFIG_RPCSEC_GSS_SPKM3 is not set
diff --git a/arch/ppc/configs/sandpoint_defconfig b/arch/ppc/configs/sandpoint_defconfig
index 0f4393a07f82..fb493a67c60d 100644
--- a/arch/ppc/configs/sandpoint_defconfig
+++ b/arch/ppc/configs/sandpoint_defconfig
@@ -437,7 +437,7 @@ CONFIG_SOUND_GAMEPORT=y
437# 437#
438CONFIG_SERIAL_8250=y 438CONFIG_SERIAL_8250=y
439CONFIG_SERIAL_8250_CONSOLE=y 439CONFIG_SERIAL_8250_CONSOLE=y
440CONFIG_SERIAL_8250_NR_UARTS=2 440CONFIG_SERIAL_8250_NR_UARTS=4
441# CONFIG_SERIAL_8250_EXTENDED is not set 441# CONFIG_SERIAL_8250_EXTENDED is not set
442 442
443# 443#
diff --git a/arch/ppc/kernel/head_8xx.S b/arch/ppc/kernel/head_8xx.S
index 5a7a64e91fc5..eb18cadb3755 100644
--- a/arch/ppc/kernel/head_8xx.S
+++ b/arch/ppc/kernel/head_8xx.S
@@ -288,13 +288,11 @@ SystemCall:
288 * For the MPC8xx, this is a software tablewalk to load the instruction 288 * For the MPC8xx, this is a software tablewalk to load the instruction
289 * TLB. It is modelled after the example in the Motorola manual. The task 289 * TLB. It is modelled after the example in the Motorola manual. The task
290 * switch loads the M_TWB register with the pointer to the first level table. 290 * switch loads the M_TWB register with the pointer to the first level table.
291 * If we discover there is no second level table (the value is zero), the 291 * If we discover there is no second level table (value is zero) or if there
292 * plan was to load that into the TLB, which causes another fault into the 292 * is an invalid pte, we load that into the TLB, which causes another fault
293 * TLB Error interrupt where we can handle such problems. However, that did 293 * into the TLB Error interrupt where we can handle such problems.
294 * not work, so if we discover there is no second level table, we restore 294 * We have to use the MD_xxx registers for the tablewalk because the
295 * registers and branch to the error exception. We have to use the MD_xxx 295 * equivalent MI_xxx registers only perform the attribute functions.
296 * registers for the tablewalk because the equivalent MI_xxx registers
297 * only perform the attribute functions.
298 */ 296 */
299InstructionTLBMiss: 297InstructionTLBMiss:
300#ifdef CONFIG_8xx_CPU6 298#ifdef CONFIG_8xx_CPU6
diff --git a/arch/ppc/kernel/setup.c b/arch/ppc/kernel/setup.c
index c42f75326939..929e5d1cc7fe 100644
--- a/arch/ppc/kernel/setup.c
+++ b/arch/ppc/kernel/setup.c
@@ -121,8 +121,6 @@ void machine_restart(char *cmd)
121 ppc_md.restart(cmd); 121 ppc_md.restart(cmd);
122} 122}
123 123
124EXPORT_SYMBOL(machine_restart);
125
126void machine_power_off(void) 124void machine_power_off(void)
127{ 125{
128#ifdef CONFIG_NVRAM 126#ifdef CONFIG_NVRAM
@@ -131,8 +129,6 @@ void machine_power_off(void)
131 ppc_md.power_off(); 129 ppc_md.power_off();
132} 130}
133 131
134EXPORT_SYMBOL(machine_power_off);
135
136void machine_halt(void) 132void machine_halt(void)
137{ 133{
138#ifdef CONFIG_NVRAM 134#ifdef CONFIG_NVRAM
@@ -141,8 +137,6 @@ void machine_halt(void)
141 ppc_md.halt(); 137 ppc_md.halt();
142} 138}
143 139
144EXPORT_SYMBOL(machine_halt);
145
146void (*pm_power_off)(void) = machine_power_off; 140void (*pm_power_off)(void) = machine_power_off;
147 141
148#ifdef CONFIG_TAU 142#ifdef CONFIG_TAU
diff --git a/arch/ppc/mm/init.c b/arch/ppc/mm/init.c
index 6164a2b34733..33ada72c7330 100644
--- a/arch/ppc/mm/init.c
+++ b/arch/ppc/mm/init.c
@@ -562,6 +562,9 @@ void flush_dcache_icache_page(struct page *page)
562#ifdef CONFIG_BOOKE 562#ifdef CONFIG_BOOKE
563 __flush_dcache_icache(kmap(page)); 563 __flush_dcache_icache(kmap(page));
564 kunmap(page); 564 kunmap(page);
565#elif CONFIG_8xx
566 /* On 8xx there is no need to kmap since highmem is not supported */
567 __flush_dcache_icache(page_address(page));
565#else 568#else
566 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT); 569 __flush_dcache_icache_phys(page_to_pfn(page) << PAGE_SHIFT);
567#endif 570#endif
diff --git a/arch/ppc/platforms/4xx/ibm440sp.c b/arch/ppc/platforms/4xx/ibm440sp.c
index a203efb47aba..fa3e003a0db9 100644
--- a/arch/ppc/platforms/4xx/ibm440sp.c
+++ b/arch/ppc/platforms/4xx/ibm440sp.c
@@ -36,8 +36,8 @@ static struct ocp_func_emac_data ibm440sp_emac0_def = {
36OCP_SYSFS_EMAC_DATA() 36OCP_SYSFS_EMAC_DATA()
37 37
38static struct ocp_func_mal_data ibm440sp_mal0_def = { 38static struct ocp_func_mal_data ibm440sp_mal0_def = {
39 .num_tx_chans = 4, /* Number of TX channels */ 39 .num_tx_chans = 1, /* Number of TX channels */
40 .num_rx_chans = 4, /* Number of RX channels */ 40 .num_rx_chans = 1, /* Number of RX channels */
41 .txeob_irq = 38, /* TX End Of Buffer IRQ */ 41 .txeob_irq = 38, /* TX End Of Buffer IRQ */
42 .rxeob_irq = 39, /* RX End Of Buffer IRQ */ 42 .rxeob_irq = 39, /* RX End Of Buffer IRQ */
43 .txde_irq = 34, /* TX Descriptor Error IRQ */ 43 .txde_irq = 34, /* TX Descriptor Error IRQ */
diff --git a/arch/ppc/platforms/85xx/mpc8560_ads.c b/arch/ppc/platforms/85xx/mpc8560_ads.c
index e18380258b68..f2748c88665a 100644
--- a/arch/ppc/platforms/85xx/mpc8560_ads.c
+++ b/arch/ppc/platforms/85xx/mpc8560_ads.c
@@ -56,7 +56,6 @@
56#include <syslib/ppc85xx_common.h> 56#include <syslib/ppc85xx_common.h>
57#include <syslib/ppc85xx_setup.h> 57#include <syslib/ppc85xx_setup.h>
58 58
59extern void cpm2_reset(void);
60 59
61/* ************************************************************************ 60/* ************************************************************************
62 * 61 *
diff --git a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
index b52c4317fefd..6267b294f704 100644
--- a/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
+++ b/arch/ppc/platforms/85xx/mpc85xx_cds_common.c
@@ -49,7 +49,7 @@
49#include <asm/mpc85xx.h> 49#include <asm/mpc85xx.h>
50#include <asm/irq.h> 50#include <asm/irq.h>
51#include <asm/immap_85xx.h> 51#include <asm/immap_85xx.h>
52#include <asm/immap_cpm2.h> 52#include <asm/cpm2.h>
53#include <asm/ppc_sys.h> 53#include <asm/ppc_sys.h>
54#include <asm/kgdb.h> 54#include <asm/kgdb.h>
55 55
diff --git a/arch/ppc/platforms/85xx/stx_gp3.c b/arch/ppc/platforms/85xx/stx_gp3.c
index bb41265cfc85..c99b365d6110 100644
--- a/arch/ppc/platforms/85xx/stx_gp3.c
+++ b/arch/ppc/platforms/85xx/stx_gp3.c
@@ -52,14 +52,13 @@
52#include <asm/mpc85xx.h> 52#include <asm/mpc85xx.h>
53#include <asm/irq.h> 53#include <asm/irq.h>
54#include <asm/immap_85xx.h> 54#include <asm/immap_85xx.h>
55#include <asm/immap_cpm2.h> 55#include <asm/cpm2.h>
56#include <asm/mpc85xx.h> 56#include <asm/mpc85xx.h>
57#include <asm/ppc_sys.h> 57#include <asm/ppc_sys.h>
58 58
59#include <syslib/cpm2_pic.h> 59#include <syslib/cpm2_pic.h>
60#include <syslib/ppc85xx_common.h> 60#include <syslib/ppc85xx_common.h>
61 61
62extern void cpm2_reset(void);
63 62
64unsigned char __res[sizeof(bd_t)]; 63unsigned char __res[sizeof(bd_t)];
65 64
diff --git a/arch/ppc/platforms/pmac_setup.c b/arch/ppc/platforms/pmac_setup.c
index 4d324b630f4f..b392b9a15987 100644
--- a/arch/ppc/platforms/pmac_setup.c
+++ b/arch/ppc/platforms/pmac_setup.c
@@ -113,7 +113,7 @@ extern int pmac_newworld;
113extern void zs_kgdb_hook(int tty_num); 113extern void zs_kgdb_hook(int tty_num);
114static void ohare_init(void); 114static void ohare_init(void);
115#ifdef CONFIG_BOOTX_TEXT 115#ifdef CONFIG_BOOTX_TEXT
116void pmac_progress(char *s, unsigned short hex); 116static void pmac_progress(char *s, unsigned short hex);
117#endif 117#endif
118 118
119sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN; 119sys_ctrler_t sys_ctrler = SYS_CTRLER_UNKNOWN;
@@ -123,7 +123,7 @@ extern struct smp_ops_t psurge_smp_ops;
123extern struct smp_ops_t core99_smp_ops; 123extern struct smp_ops_t core99_smp_ops;
124#endif /* CONFIG_SMP */ 124#endif /* CONFIG_SMP */
125 125
126int __pmac 126static int __pmac
127pmac_show_cpuinfo(struct seq_file *m) 127pmac_show_cpuinfo(struct seq_file *m)
128{ 128{
129 struct device_node *np; 129 struct device_node *np;
@@ -227,7 +227,7 @@ pmac_show_cpuinfo(struct seq_file *m)
227 return 0; 227 return 0;
228} 228}
229 229
230int __openfirmware 230static int __openfirmware
231pmac_show_percpuinfo(struct seq_file *m, int i) 231pmac_show_percpuinfo(struct seq_file *m, int i)
232{ 232{
233#ifdef CONFIG_CPU_FREQ_PMAC 233#ifdef CONFIG_CPU_FREQ_PMAC
@@ -415,7 +415,7 @@ find_ide_boot(void)
415} 415}
416#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */ 416#endif /* CONFIG_BLK_DEV_IDE && CONFIG_BLK_DEV_IDE_PMAC */
417 417
418void __init 418static void __init
419find_boot_device(void) 419find_boot_device(void)
420{ 420{
421#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC) 421#if defined(CONFIG_BLK_DEV_IDE) && defined(CONFIG_BLK_DEV_IDE_PMAC)
@@ -512,7 +512,7 @@ note_bootable_part(dev_t dev, int part, int goodness)
512 } 512 }
513} 513}
514 514
515void __pmac 515static void __pmac
516pmac_restart(char *cmd) 516pmac_restart(char *cmd)
517{ 517{
518#ifdef CONFIG_ADB_CUDA 518#ifdef CONFIG_ADB_CUDA
@@ -537,7 +537,7 @@ pmac_restart(char *cmd)
537 } 537 }
538} 538}
539 539
540void __pmac 540static void __pmac
541pmac_power_off(void) 541pmac_power_off(void)
542{ 542{
543#ifdef CONFIG_ADB_CUDA 543#ifdef CONFIG_ADB_CUDA
@@ -562,7 +562,7 @@ pmac_power_off(void)
562 } 562 }
563} 563}
564 564
565void __pmac 565static void __pmac
566pmac_halt(void) 566pmac_halt(void)
567{ 567{
568 pmac_power_off(); 568 pmac_power_off();
@@ -700,7 +700,7 @@ pmac_init(unsigned long r3, unsigned long r4, unsigned long r5,
700} 700}
701 701
702#ifdef CONFIG_BOOTX_TEXT 702#ifdef CONFIG_BOOTX_TEXT
703void __init 703static void __init
704pmac_progress(char *s, unsigned short hex) 704pmac_progress(char *s, unsigned short hex)
705{ 705{
706 if (boot_text_mapped) { 706 if (boot_text_mapped) {
diff --git a/arch/ppc/platforms/prpmc750.c b/arch/ppc/platforms/prpmc750.c
index c894e1ab5934..24ae1caafc61 100644
--- a/arch/ppc/platforms/prpmc750.c
+++ b/arch/ppc/platforms/prpmc750.c
@@ -29,6 +29,7 @@
29#include <linux/ide.h> 29#include <linux/ide.h>
30#include <linux/root_dev.h> 30#include <linux/root_dev.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/serial_reg.h>
32 33
33#include <asm/byteorder.h> 34#include <asm/byteorder.h>
34#include <asm/system.h> 35#include <asm/system.h>
diff --git a/arch/ppc/platforms/sandpoint.c b/arch/ppc/platforms/sandpoint.c
index 8b149c2fc54f..21e31346b12b 100644
--- a/arch/ppc/platforms/sandpoint.c
+++ b/arch/ppc/platforms/sandpoint.c
@@ -311,19 +311,22 @@ sandpoint_setup_arch(void)
311 { 311 {
312 bd_t *bp = (bd_t *)__res; 312 bd_t *bp = (bd_t *)__res;
313 struct plat_serial8250_port *pdata; 313 struct plat_serial8250_port *pdata;
314 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_DUART);
315 314
315 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_UART0);
316 if (pdata) 316 if (pdata)
317 { 317 {
318 pdata[0].uartclk = bp->bi_busfreq; 318 pdata[0].uartclk = bp->bi_busfreq;
319 pdata[0].membase = ioremap(pdata[0].mapbase, 0x100); 319 }
320 320
321 /* this disables the 2nd serial port on the DUART 321#ifdef CONFIG_SANDPOINT_ENABLE_UART1
322 * since the sandpoint does not have it connected */ 322 pdata = (struct plat_serial8250_port *) ppc_sys_get_pdata(MPC10X_UART1);
323 pdata[1].uartclk = 0; 323 if (pdata)
324 pdata[1].irq = 0; 324 {
325 pdata[1].mapbase = 0; 325 pdata[0].uartclk = bp->bi_busfreq;
326 } 326 }
327#else
328 ppc_sys_device_remove(MPC10X_UART1);
329#endif
327 } 330 }
328 331
329 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n"); 332 printk(KERN_INFO "Motorola SPS Sandpoint Test Platform\n");
diff --git a/arch/ppc/platforms/tqm8260_setup.c b/arch/ppc/platforms/tqm8260_setup.c
index a8880bfc034b..3409139330b1 100644
--- a/arch/ppc/platforms/tqm8260_setup.c
+++ b/arch/ppc/platforms/tqm8260_setup.c
@@ -16,8 +16,8 @@
16 16
17#include <linux/init.h> 17#include <linux/init.h>
18 18
19#include <asm/immap_cpm2.h>
20#include <asm/mpc8260.h> 19#include <asm/mpc8260.h>
20#include <asm/cpm2.h>
21#include <asm/machdep.h> 21#include <asm/machdep.h>
22 22
23static int 23static int
diff --git a/arch/ppc/syslib/cpm2_common.c b/arch/ppc/syslib/cpm2_common.c
index 4c19a4ac7163..cbac44b1620c 100644
--- a/arch/ppc/syslib/cpm2_common.c
+++ b/arch/ppc/syslib/cpm2_common.c
@@ -27,7 +27,6 @@
27#include <asm/mpc8260.h> 27#include <asm/mpc8260.h>
28#include <asm/page.h> 28#include <asm/page.h>
29#include <asm/pgtable.h> 29#include <asm/pgtable.h>
30#include <asm/immap_cpm2.h>
31#include <asm/cpm2.h> 30#include <asm/cpm2.h>
32#include <asm/rheap.h> 31#include <asm/rheap.h>
33 32
diff --git a/arch/ppc/syslib/m8260_setup.c b/arch/ppc/syslib/m8260_setup.c
index fda75d79050c..8f80a42dfdb7 100644
--- a/arch/ppc/syslib/m8260_setup.c
+++ b/arch/ppc/syslib/m8260_setup.c
@@ -24,7 +24,7 @@
24#include <asm/io.h> 24#include <asm/io.h>
25#include <asm/pgtable.h> 25#include <asm/pgtable.h>
26#include <asm/mpc8260.h> 26#include <asm/mpc8260.h>
27#include <asm/immap_cpm2.h> 27#include <asm/cpm2.h>
28#include <asm/machdep.h> 28#include <asm/machdep.h>
29#include <asm/bootinfo.h> 29#include <asm/bootinfo.h>
30#include <asm/time.h> 30#include <asm/time.h>
@@ -33,7 +33,6 @@
33 33
34unsigned char __res[sizeof(bd_t)]; 34unsigned char __res[sizeof(bd_t)];
35 35
36extern void cpm2_reset(void);
37extern void pq2_find_bridges(void); 36extern void pq2_find_bridges(void);
38extern void pq2pci_init_irq(void); 37extern void pq2pci_init_irq(void);
39extern void idma_pci9_init(void); 38extern void idma_pci9_init(void);
diff --git a/arch/ppc/syslib/m82xx_pci.c b/arch/ppc/syslib/m82xx_pci.c
index 5e7a7edcea74..9db58c587b46 100644
--- a/arch/ppc/syslib/m82xx_pci.c
+++ b/arch/ppc/syslib/m82xx_pci.c
@@ -238,9 +238,9 @@ pq2ads_setup_pci(struct pci_controller *hose)
238 * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]), 238 * Setting required to enable IRQ1-IRQ7 (SIUMCR [DPPC]),
239 * and local bus for PCI (SIUMCR [LBPC]). 239 * and local bus for PCI (SIUMCR [LBPC]).
240 */ 240 */
241 immap->im_siu_conf.siu_82xx.sc_siumcr = (immap->im_siu_conf.sc_siumcr & 241 immap->im_siu_conf.siu_82xx.sc_siumcr = (immap->im_siu_conf.siu_82xx.sc_siumcr &
242 ~(SIUMCR_L2PC11 | SIUMCR_LBPC11 | SIUMCR_CS10PC11 | SIUMCR_APPC11) | 242 ~(SIUMCR_L2CPC11 | SIUMCR_LBPC11 | SIUMCR_CS10PC11 | SIUMCR_APPC11) |
243 SIUMCR_BBD | SIUMCR_LBPC01 | SIUMCR_DPPC11 | SIUMCR_APPC10; 243 SIUMCR_BBD | SIUMCR_LBPC01 | SIUMCR_DPPC11 | SIUMCR_APPC10);
244#endif 244#endif
245 /* Enable PCI */ 245 /* Enable PCI */
246 immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN); 246 immap->im_pci.pci_gcr = cpu_to_le32(PCIGCR_PCI_BUS_EN);
diff --git a/arch/ppc/syslib/mpc10x_common.c b/arch/ppc/syslib/mpc10x_common.c
index 8fc5f4154521..87065e2e4c5f 100644
--- a/arch/ppc/syslib/mpc10x_common.c
+++ b/arch/ppc/syslib/mpc10x_common.c
@@ -45,24 +45,29 @@
45#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS) 45#define MPC10X_DMA0_IRQ (EPIC_IRQ_BASE + 1 + NUM_8259_INTERRUPTS)
46#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS) 46#define MPC10X_DMA1_IRQ (EPIC_IRQ_BASE + 2 + NUM_8259_INTERRUPTS)
47#define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS) 47#define MPC10X_UART0_IRQ (EPIC_IRQ_BASE + 4 + NUM_8259_INTERRUPTS)
48#define MPC10X_UART1_IRQ (EPIC_IRQ_BASE + 5 + NUM_8259_INTERRUPTS)
48#else 49#else
49#define MPC10X_I2C_IRQ -1 50#define MPC10X_I2C_IRQ -1
50#define MPC10X_DMA0_IRQ -1 51#define MPC10X_DMA0_IRQ -1
51#define MPC10X_DMA1_IRQ -1 52#define MPC10X_DMA1_IRQ -1
52#define MPC10X_UART0_IRQ -1 53#define MPC10X_UART0_IRQ -1
54#define MPC10X_UART1_IRQ -1
53#endif 55#endif
54 56
55static struct fsl_i2c_platform_data mpc10x_i2c_pdata = { 57static struct fsl_i2c_platform_data mpc10x_i2c_pdata = {
56 .device_flags = 0, 58 .device_flags = 0,
57}; 59};
58 60
59static struct plat_serial8250_port serial_platform_data[] = { 61static struct plat_serial8250_port serial_plat_uart0[] = {
60 [0] = { 62 [0] = {
61 .mapbase = 0x4500, 63 .mapbase = 0x4500,
62 .iotype = UPIO_MEM, 64 .iotype = UPIO_MEM,
63 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 65 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
64 }, 66 },
65 [1] = { 67 { },
68};
69static struct plat_serial8250_port serial_plat_uart1[] = {
70 [0] = {
66 .mapbase = 0x4600, 71 .mapbase = 0x4600,
67 .iotype = UPIO_MEM, 72 .iotype = UPIO_MEM,
68 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST, 73 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST,
@@ -133,11 +138,17 @@ struct platform_device ppc_sys_platform_devices[] = {
133 }, 138 },
134 }, 139 },
135 }, 140 },
136 [MPC10X_DUART] = { 141 [MPC10X_UART0] = {
137 .name = "serial8250", 142 .name = "serial8250",
138 .id = 0, 143 .id = 0,
139 .dev.platform_data = serial_platform_data, 144 .dev.platform_data = serial_plat_uart0,
140 }, 145 },
146 [MPC10X_UART1] = {
147 .name = "serial8250",
148 .id = 1,
149 .dev.platform_data = serial_plat_uart1,
150 },
151
141}; 152};
142 153
143/* We use the PCI ID to match on */ 154/* We use the PCI ID to match on */
@@ -147,10 +158,10 @@ struct ppc_sys_spec ppc_sys_specs[] = {
147 .ppc_sys_name = "8245", 158 .ppc_sys_name = "8245",
148 .mask = 0xFFFFFFFF, 159 .mask = 0xFFFFFFFF,
149 .value = MPC10X_BRIDGE_8245, 160 .value = MPC10X_BRIDGE_8245,
150 .num_devices = 4, 161 .num_devices = 5,
151 .device_list = (enum ppc_sys_devices[]) 162 .device_list = (enum ppc_sys_devices[])
152 { 163 {
153 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_DUART, 164 MPC10X_IIC1, MPC10X_DMA0, MPC10X_DMA1, MPC10X_UART0, MPC10X_UART1,
154 }, 165 },
155 }, 166 },
156 { 167 {
@@ -180,6 +191,25 @@ struct ppc_sys_spec ppc_sys_specs[] = {
180 }, 191 },
181}; 192};
182 193
194/*
195 * mach_mpc10x_fixup: This function enables DUART mode if it detects
196 * if it detects two UARTS in the platform device entries.
197 */
198static int __init mach_mpc10x_fixup(struct platform_device *pdev)
199{
200 if (strncmp (pdev->name, "serial8250", 10) == 0 && pdev->id == 1)
201 writeb(readb(serial_plat_uart1[0].membase + 0x11) | 0x1,
202 serial_plat_uart1[0].membase + 0x11);
203 return 0;
204}
205
206static int __init mach_mpc10x_init(void)
207{
208 ppc_sys_device_fixup = mach_mpc10x_fixup;
209 return 0;
210}
211postcore_initcall(mach_mpc10x_init);
212
183/* Set resources to match bridge memory map */ 213/* Set resources to match bridge memory map */
184void __init 214void __init
185mpc10x_bridge_set_resources(int map, struct pci_controller *hose) 215mpc10x_bridge_set_resources(int map, struct pci_controller *hose)
@@ -219,6 +249,7 @@ mpc10x_bridge_set_resources(int map, struct pci_controller *hose)
219 ppc_md.progress("mpc10x:exit1", 0x100); 249 ppc_md.progress("mpc10x:exit1", 0x100);
220 } 250 }
221} 251}
252
222/* 253/*
223 * Do some initialization and put the EUMB registers at the specified address 254 * Do some initialization and put the EUMB registers at the specified address
224 * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set). 255 * (also map the EPIC registers into virtual space--OpenPIC_Addr will be set).
@@ -411,11 +442,13 @@ mpc10x_bridge_init(struct pci_controller *hose,
411 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ; 442 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].start = MPC10X_DMA1_IRQ;
412 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ; 443 ppc_sys_platform_devices[MPC10X_DMA1].resource[1].end = MPC10X_DMA1_IRQ;
413 444
414 serial_platform_data[0].mapbase += phys_eumb_base; 445 serial_plat_uart0[0].mapbase += phys_eumb_base;
415 serial_platform_data[0].irq = MPC10X_UART0_IRQ; 446 serial_plat_uart0[0].irq = MPC10X_UART0_IRQ;
447 serial_plat_uart0[0].membase = ioremap(serial_plat_uart0[0].mapbase, 0x100);
416 448
417 serial_platform_data[1].mapbase += phys_eumb_base; 449 serial_plat_uart1[0].mapbase += phys_eumb_base;
418 serial_platform_data[1].irq = MPC10X_UART0_IRQ + 1; 450 serial_plat_uart1[0].irq = MPC10X_UART1_IRQ;
451 serial_plat_uart1[0].membase = ioremap(serial_plat_uart1[0].mapbase, 0x100);
419 452
420 /* 453 /*
421 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative 454 * 8240 erratum 26, 8241/8245 erratum 29, 107 erratum 23: speculative
diff --git a/arch/ppc/syslib/ppc85xx_setup.c b/arch/ppc/syslib/ppc85xx_setup.c
index ca95d79a704e..b7242f1bd931 100644
--- a/arch/ppc/syslib/ppc85xx_setup.c
+++ b/arch/ppc/syslib/ppc85xx_setup.c
@@ -233,14 +233,14 @@ mpc85xx_setup_pci2(struct pci_controller *hose)
233 pci->powbar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff; 233 pci->powbar1 = (MPC85XX_PCI2_LOWER_MEM >> 12) & 0x000fffff;
234 /* Enable, Mem R/W */ 234 /* Enable, Mem R/W */
235 pci->powar1 = 0x80044000 | 235 pci->powar1 = 0x80044000 |
236 (__ilog2(MPC85XX_PCI1_UPPER_MEM - MPC85XX_PCI1_LOWER_MEM + 1) - 1); 236 (__ilog2(MPC85XX_PCI2_UPPER_MEM - MPC85XX_PCI2_LOWER_MEM + 1) - 1);
237 237
238 /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */ 238 /* Setup outboud IO windows @ MPC85XX_PCI2_IO_BASE */
239 pci->potar2 = 0x00000000; 239 pci->potar2 = 0x00000000;
240 pci->potear2 = 0x00000000; 240 pci->potear2 = 0x00000000;
241 pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff; 241 pci->powbar2 = (MPC85XX_PCI2_IO_BASE >> 12) & 0x000fffff;
242 /* Enable, IO R/W */ 242 /* Enable, IO R/W */
243 pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI1_IO_SIZE) - 1); 243 pci->powar2 = 0x80088000 | (__ilog2(MPC85XX_PCI2_IO_SIZE) - 1);
244 244
245 /* Setup 2G inbound Memory Window @ 0 */ 245 /* Setup 2G inbound Memory Window @ 0 */
246 pci->pitar1 = 0x00000000; 246 pci->pitar1 = 0x00000000;
diff --git a/arch/ppc64/Kconfig b/arch/ppc64/Kconfig
index fdd8afba7152..2ce87836c671 100644
--- a/arch/ppc64/Kconfig
+++ b/arch/ppc64/Kconfig
@@ -288,6 +288,7 @@ config SCHED_SMT
288 overhead in some places. If unsure say N here. 288 overhead in some places. If unsure say N here.
289 289
290source "kernel/Kconfig.preempt" 290source "kernel/Kconfig.preempt"
291source kernel/Kconfig.hz
291 292
292config EEH 293config EEH
293 bool "PCI Extended Error Handling (EEH)" if EMBEDDED 294 bool "PCI Extended Error Handling (EEH)" if EMBEDDED
diff --git a/arch/ppc64/configs/g5_defconfig b/arch/ppc64/configs/g5_defconfig
index 1eb33398648e..9e0abe8392fc 100644
--- a/arch/ppc64/configs/g5_defconfig
+++ b/arch/ppc64/configs/g5_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc3
4# Tue Jun 14 16:59:20 2005 4# Wed Jul 13 14:40:34 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -73,12 +73,15 @@ CONFIG_SYSVIPC_COMPAT=y
73# CONFIG_PPC_ISERIES is not set 73# CONFIG_PPC_ISERIES is not set
74CONFIG_PPC_MULTIPLATFORM=y 74CONFIG_PPC_MULTIPLATFORM=y
75# CONFIG_PPC_PSERIES is not set 75# CONFIG_PPC_PSERIES is not set
76# CONFIG_PPC_BPA is not set
76CONFIG_PPC_PMAC=y 77CONFIG_PPC_PMAC=y
77# CONFIG_PPC_MAPLE is not set 78# CONFIG_PPC_MAPLE is not set
78CONFIG_PPC=y 79CONFIG_PPC=y
79CONFIG_PPC64=y 80CONFIG_PPC64=y
80CONFIG_PPC_OF=y 81CONFIG_PPC_OF=y
82CONFIG_MPIC=y
81CONFIG_ALTIVEC=y 83CONFIG_ALTIVEC=y
84CONFIG_KEXEC=y
82CONFIG_U3_DART=y 85CONFIG_U3_DART=y
83CONFIG_PPC_PMAC64=y 86CONFIG_PPC_PMAC64=y
84CONFIG_BOOTX_TEXT=y 87CONFIG_BOOTX_TEXT=y
@@ -86,8 +89,24 @@ CONFIG_POWER4_ONLY=y
86CONFIG_IOMMU_VMERGE=y 89CONFIG_IOMMU_VMERGE=y
87CONFIG_SMP=y 90CONFIG_SMP=y
88CONFIG_NR_CPUS=2 91CONFIG_NR_CPUS=2
92CONFIG_ARCH_SELECT_MEMORY_MODEL=y
93CONFIG_ARCH_FLATMEM_ENABLE=y
94CONFIG_SELECT_MEMORY_MODEL=y
95CONFIG_FLATMEM_MANUAL=y
96# CONFIG_DISCONTIGMEM_MANUAL is not set
97# CONFIG_SPARSEMEM_MANUAL is not set
98CONFIG_FLATMEM=y
99CONFIG_FLAT_NODE_MEM_MAP=y
100# CONFIG_NUMA is not set
89# CONFIG_SCHED_SMT is not set 101# CONFIG_SCHED_SMT is not set
102CONFIG_PREEMPT_NONE=y
103# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set 104# CONFIG_PREEMPT is not set
105# CONFIG_PREEMPT_BKL is not set
106CONFIG_HZ_100=y
107# CONFIG_HZ_250 is not set
108# CONFIG_HZ_1000 is not set
109CONFIG_HZ=100
91CONFIG_GENERIC_HARDIRQS=y 110CONFIG_GENERIC_HARDIRQS=y
92CONFIG_SECCOMP=y 111CONFIG_SECCOMP=y
93CONFIG_ISA_DMA_API=y 112CONFIG_ISA_DMA_API=y
@@ -117,6 +136,144 @@ CONFIG_PROC_DEVICETREE=y
117# CONFIG_CMDLINE_BOOL is not set 136# CONFIG_CMDLINE_BOOL is not set
118 137
119# 138#
139# Networking
140#
141CONFIG_NET=y
142
143#
144# Networking options
145#
146CONFIG_PACKET=y
147# CONFIG_PACKET_MMAP is not set
148CONFIG_UNIX=y
149CONFIG_XFRM=y
150CONFIG_XFRM_USER=m
151CONFIG_NET_KEY=m
152CONFIG_INET=y
153CONFIG_IP_MULTICAST=y
154# CONFIG_IP_ADVANCED_ROUTER is not set
155CONFIG_IP_FIB_HASH=y
156# CONFIG_IP_PNP is not set
157CONFIG_NET_IPIP=y
158# CONFIG_NET_IPGRE is not set
159# CONFIG_IP_MROUTE is not set
160# CONFIG_ARPD is not set
161CONFIG_SYN_COOKIES=y
162CONFIG_INET_AH=m
163CONFIG_INET_ESP=m
164CONFIG_INET_IPCOMP=m
165CONFIG_INET_TUNNEL=y
166CONFIG_IP_TCPDIAG=m
167# CONFIG_IP_TCPDIAG_IPV6 is not set
168# CONFIG_TCP_CONG_ADVANCED is not set
169CONFIG_TCP_CONG_BIC=y
170
171#
172# IP: Virtual Server Configuration
173#
174# CONFIG_IP_VS is not set
175# CONFIG_IPV6 is not set
176CONFIG_NETFILTER=y
177# CONFIG_NETFILTER_DEBUG is not set
178
179#
180# IP: Netfilter Configuration
181#
182CONFIG_IP_NF_CONNTRACK=m
183CONFIG_IP_NF_CT_ACCT=y
184CONFIG_IP_NF_CONNTRACK_MARK=y
185CONFIG_IP_NF_CT_PROTO_SCTP=m
186CONFIG_IP_NF_FTP=m
187CONFIG_IP_NF_IRC=m
188CONFIG_IP_NF_TFTP=m
189CONFIG_IP_NF_AMANDA=m
190CONFIG_IP_NF_QUEUE=m
191CONFIG_IP_NF_IPTABLES=m
192CONFIG_IP_NF_MATCH_LIMIT=m
193CONFIG_IP_NF_MATCH_IPRANGE=m
194CONFIG_IP_NF_MATCH_MAC=m
195CONFIG_IP_NF_MATCH_PKTTYPE=m
196CONFIG_IP_NF_MATCH_MARK=m
197CONFIG_IP_NF_MATCH_MULTIPORT=m
198CONFIG_IP_NF_MATCH_TOS=m
199CONFIG_IP_NF_MATCH_RECENT=m
200CONFIG_IP_NF_MATCH_ECN=m
201CONFIG_IP_NF_MATCH_DSCP=m
202CONFIG_IP_NF_MATCH_AH_ESP=m
203CONFIG_IP_NF_MATCH_LENGTH=m
204CONFIG_IP_NF_MATCH_TTL=m
205CONFIG_IP_NF_MATCH_TCPMSS=m
206CONFIG_IP_NF_MATCH_HELPER=m
207CONFIG_IP_NF_MATCH_STATE=m
208CONFIG_IP_NF_MATCH_CONNTRACK=m
209CONFIG_IP_NF_MATCH_OWNER=m
210CONFIG_IP_NF_MATCH_ADDRTYPE=m
211CONFIG_IP_NF_MATCH_REALM=m
212CONFIG_IP_NF_MATCH_SCTP=m
213CONFIG_IP_NF_MATCH_COMMENT=m
214CONFIG_IP_NF_MATCH_CONNMARK=m
215CONFIG_IP_NF_MATCH_HASHLIMIT=m
216CONFIG_IP_NF_FILTER=m
217CONFIG_IP_NF_TARGET_REJECT=m
218CONFIG_IP_NF_TARGET_LOG=m
219CONFIG_IP_NF_TARGET_ULOG=m
220CONFIG_IP_NF_TARGET_TCPMSS=m
221CONFIG_IP_NF_NAT=m
222CONFIG_IP_NF_NAT_NEEDED=y
223CONFIG_IP_NF_TARGET_MASQUERADE=m
224CONFIG_IP_NF_TARGET_REDIRECT=m
225CONFIG_IP_NF_TARGET_NETMAP=m
226CONFIG_IP_NF_TARGET_SAME=m
227CONFIG_IP_NF_NAT_SNMP_BASIC=m
228CONFIG_IP_NF_NAT_IRC=m
229CONFIG_IP_NF_NAT_FTP=m
230CONFIG_IP_NF_NAT_TFTP=m
231CONFIG_IP_NF_NAT_AMANDA=m
232CONFIG_IP_NF_MANGLE=m
233CONFIG_IP_NF_TARGET_TOS=m
234CONFIG_IP_NF_TARGET_ECN=m
235CONFIG_IP_NF_TARGET_DSCP=m
236CONFIG_IP_NF_TARGET_MARK=m
237CONFIG_IP_NF_TARGET_CLASSIFY=m
238CONFIG_IP_NF_TARGET_CONNMARK=m
239CONFIG_IP_NF_TARGET_CLUSTERIP=m
240CONFIG_IP_NF_RAW=m
241CONFIG_IP_NF_TARGET_NOTRACK=m
242CONFIG_IP_NF_ARPTABLES=m
243CONFIG_IP_NF_ARPFILTER=m
244CONFIG_IP_NF_ARP_MANGLE=m
245
246#
247# SCTP Configuration (EXPERIMENTAL)
248#
249# CONFIG_IP_SCTP is not set
250# CONFIG_ATM is not set
251# CONFIG_BRIDGE is not set
252# CONFIG_VLAN_8021Q is not set
253# CONFIG_DECNET is not set
254CONFIG_LLC=y
255# CONFIG_LLC2 is not set
256# CONFIG_IPX is not set
257# CONFIG_ATALK is not set
258# CONFIG_X25 is not set
259# CONFIG_LAPB is not set
260# CONFIG_NET_DIVERT is not set
261# CONFIG_ECONET is not set
262# CONFIG_WAN_ROUTER is not set
263# CONFIG_NET_SCHED is not set
264CONFIG_NET_CLS_ROUTE=y
265
266#
267# Network testing
268#
269# CONFIG_NET_PKTGEN is not set
270# CONFIG_NETPOLL is not set
271# CONFIG_NET_POLL_CONTROLLER is not set
272# CONFIG_HAMRADIO is not set
273# CONFIG_IRDA is not set
274# CONFIG_BT is not set
275
276#
120# Device Drivers 277# Device Drivers
121# 278#
122 279
@@ -218,6 +375,7 @@ CONFIG_IDEDMA_PCI_AUTO=y
218# CONFIG_BLK_DEV_HPT366 is not set 375# CONFIG_BLK_DEV_HPT366 is not set
219# CONFIG_BLK_DEV_SC1200 is not set 376# CONFIG_BLK_DEV_SC1200 is not set
220# CONFIG_BLK_DEV_PIIX is not set 377# CONFIG_BLK_DEV_PIIX is not set
378# CONFIG_BLK_DEV_IT821X is not set
221# CONFIG_BLK_DEV_NS87415 is not set 379# CONFIG_BLK_DEV_NS87415 is not set
222# CONFIG_BLK_DEV_PDC202XX_OLD is not set 380# CONFIG_BLK_DEV_PDC202XX_OLD is not set
223# CONFIG_BLK_DEV_PDC202XX_NEW is not set 381# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -251,6 +409,7 @@ CONFIG_CHR_DEV_ST=y
251CONFIG_BLK_DEV_SR=y 409CONFIG_BLK_DEV_SR=y
252CONFIG_BLK_DEV_SR_VENDOR=y 410CONFIG_BLK_DEV_SR_VENDOR=y
253CONFIG_CHR_DEV_SG=y 411CONFIG_CHR_DEV_SG=y
412# CONFIG_CHR_DEV_SCH is not set
254 413
255# 414#
256# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 415# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -338,6 +497,8 @@ CONFIG_DM_ZERO=m
338# Fusion MPT device support 497# Fusion MPT device support
339# 498#
340# CONFIG_FUSION is not set 499# CONFIG_FUSION is not set
500# CONFIG_FUSION_SPI is not set
501# CONFIG_FUSION_FC is not set
341 502
342# 503#
343# IEEE 1394 (FireWire) support 504# IEEE 1394 (FireWire) support
@@ -351,6 +512,7 @@ CONFIG_IEEE1394=y
351CONFIG_IEEE1394_OUI_DB=y 512CONFIG_IEEE1394_OUI_DB=y
352CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y 513CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
353CONFIG_IEEE1394_CONFIG_ROM_IP1394=y 514CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
515# CONFIG_IEEE1394_EXPORT_FULL_API is not set
354 516
355# 517#
356# Device Drivers 518# Device Drivers
@@ -380,149 +542,13 @@ CONFIG_IEEE1394_RAWIO=y
380CONFIG_ADB=y 542CONFIG_ADB=y
381CONFIG_ADB_PMU=y 543CONFIG_ADB_PMU=y
382CONFIG_PMAC_SMU=y 544CONFIG_PMAC_SMU=y
383# CONFIG_PMAC_PBOOK is not set
384# CONFIG_PMAC_BACKLIGHT is not set 545# CONFIG_PMAC_BACKLIGHT is not set
385# CONFIG_INPUT_ADBHID is not set 546# CONFIG_INPUT_ADBHID is not set
386CONFIG_THERM_PM72=y 547CONFIG_THERM_PM72=y
387 548
388# 549#
389# Networking support 550# Network device support
390#
391CONFIG_NET=y
392
393#
394# Networking options
395# 551#
396CONFIG_PACKET=y
397# CONFIG_PACKET_MMAP is not set
398CONFIG_UNIX=y
399CONFIG_NET_KEY=m
400CONFIG_INET=y
401CONFIG_IP_MULTICAST=y
402# CONFIG_IP_ADVANCED_ROUTER is not set
403# CONFIG_IP_PNP is not set
404CONFIG_NET_IPIP=y
405# CONFIG_NET_IPGRE is not set
406# CONFIG_IP_MROUTE is not set
407# CONFIG_ARPD is not set
408CONFIG_SYN_COOKIES=y
409CONFIG_INET_AH=m
410CONFIG_INET_ESP=m
411CONFIG_INET_IPCOMP=m
412CONFIG_INET_TUNNEL=y
413CONFIG_IP_TCPDIAG=m
414# CONFIG_IP_TCPDIAG_IPV6 is not set
415
416#
417# IP: Virtual Server Configuration
418#
419# CONFIG_IP_VS is not set
420# CONFIG_IPV6 is not set
421CONFIG_NETFILTER=y
422# CONFIG_NETFILTER_DEBUG is not set
423
424#
425# IP: Netfilter Configuration
426#
427CONFIG_IP_NF_CONNTRACK=m
428CONFIG_IP_NF_CT_ACCT=y
429CONFIG_IP_NF_CONNTRACK_MARK=y
430CONFIG_IP_NF_CT_PROTO_SCTP=m
431CONFIG_IP_NF_FTP=m
432CONFIG_IP_NF_IRC=m
433CONFIG_IP_NF_TFTP=m
434CONFIG_IP_NF_AMANDA=m
435CONFIG_IP_NF_QUEUE=m
436CONFIG_IP_NF_IPTABLES=m
437CONFIG_IP_NF_MATCH_LIMIT=m
438CONFIG_IP_NF_MATCH_IPRANGE=m
439CONFIG_IP_NF_MATCH_MAC=m
440CONFIG_IP_NF_MATCH_PKTTYPE=m
441CONFIG_IP_NF_MATCH_MARK=m
442CONFIG_IP_NF_MATCH_MULTIPORT=m
443CONFIG_IP_NF_MATCH_TOS=m
444CONFIG_IP_NF_MATCH_RECENT=m
445CONFIG_IP_NF_MATCH_ECN=m
446CONFIG_IP_NF_MATCH_DSCP=m
447CONFIG_IP_NF_MATCH_AH_ESP=m
448CONFIG_IP_NF_MATCH_LENGTH=m
449CONFIG_IP_NF_MATCH_TTL=m
450CONFIG_IP_NF_MATCH_TCPMSS=m
451CONFIG_IP_NF_MATCH_HELPER=m
452CONFIG_IP_NF_MATCH_STATE=m
453CONFIG_IP_NF_MATCH_CONNTRACK=m
454CONFIG_IP_NF_MATCH_OWNER=m
455CONFIG_IP_NF_MATCH_ADDRTYPE=m
456CONFIG_IP_NF_MATCH_REALM=m
457CONFIG_IP_NF_MATCH_SCTP=m
458CONFIG_IP_NF_MATCH_COMMENT=m
459CONFIG_IP_NF_MATCH_CONNMARK=m
460CONFIG_IP_NF_MATCH_HASHLIMIT=m
461CONFIG_IP_NF_FILTER=m
462CONFIG_IP_NF_TARGET_REJECT=m
463CONFIG_IP_NF_TARGET_LOG=m
464CONFIG_IP_NF_TARGET_ULOG=m
465CONFIG_IP_NF_TARGET_TCPMSS=m
466CONFIG_IP_NF_NAT=m
467CONFIG_IP_NF_NAT_NEEDED=y
468CONFIG_IP_NF_TARGET_MASQUERADE=m
469CONFIG_IP_NF_TARGET_REDIRECT=m
470CONFIG_IP_NF_TARGET_NETMAP=m
471CONFIG_IP_NF_TARGET_SAME=m
472CONFIG_IP_NF_NAT_SNMP_BASIC=m
473CONFIG_IP_NF_NAT_IRC=m
474CONFIG_IP_NF_NAT_FTP=m
475CONFIG_IP_NF_NAT_TFTP=m
476CONFIG_IP_NF_NAT_AMANDA=m
477CONFIG_IP_NF_MANGLE=m
478CONFIG_IP_NF_TARGET_TOS=m
479CONFIG_IP_NF_TARGET_ECN=m
480CONFIG_IP_NF_TARGET_DSCP=m
481CONFIG_IP_NF_TARGET_MARK=m
482CONFIG_IP_NF_TARGET_CLASSIFY=m
483CONFIG_IP_NF_TARGET_CONNMARK=m
484CONFIG_IP_NF_TARGET_CLUSTERIP=m
485CONFIG_IP_NF_RAW=m
486CONFIG_IP_NF_TARGET_NOTRACK=m
487CONFIG_IP_NF_ARPTABLES=m
488CONFIG_IP_NF_ARPFILTER=m
489CONFIG_IP_NF_ARP_MANGLE=m
490CONFIG_XFRM=y
491CONFIG_XFRM_USER=m
492
493#
494# SCTP Configuration (EXPERIMENTAL)
495#
496# CONFIG_IP_SCTP is not set
497# CONFIG_ATM is not set
498# CONFIG_BRIDGE is not set
499# CONFIG_VLAN_8021Q is not set
500# CONFIG_DECNET is not set
501CONFIG_LLC=y
502# CONFIG_LLC2 is not set
503# CONFIG_IPX is not set
504# CONFIG_ATALK is not set
505# CONFIG_X25 is not set
506# CONFIG_LAPB is not set
507# CONFIG_NET_DIVERT is not set
508# CONFIG_ECONET is not set
509# CONFIG_WAN_ROUTER is not set
510
511#
512# QoS and/or fair queueing
513#
514# CONFIG_NET_SCHED is not set
515CONFIG_NET_CLS_ROUTE=y
516
517#
518# Network testing
519#
520# CONFIG_NET_PKTGEN is not set
521# CONFIG_NETPOLL is not set
522# CONFIG_NET_POLL_CONTROLLER is not set
523# CONFIG_HAMRADIO is not set
524# CONFIG_IRDA is not set
525# CONFIG_BT is not set
526CONFIG_NETDEVICES=y 552CONFIG_NETDEVICES=y
527CONFIG_DUMMY=m 553CONFIG_DUMMY=m
528CONFIG_BONDING=m 554CONFIG_BONDING=m
@@ -562,6 +588,7 @@ CONFIG_E1000=y
562# CONFIG_HAMACHI is not set 588# CONFIG_HAMACHI is not set
563# CONFIG_YELLOWFIN is not set 589# CONFIG_YELLOWFIN is not set
564# CONFIG_R8169 is not set 590# CONFIG_R8169 is not set
591# CONFIG_SKGE is not set
565# CONFIG_SK98LIN is not set 592# CONFIG_SK98LIN is not set
566CONFIG_TIGON3=m 593CONFIG_TIGON3=m
567# CONFIG_BNX2 is not set 594# CONFIG_BNX2 is not set
@@ -750,50 +777,19 @@ CONFIG_I2C_KEYWEST=y
750# CONFIG_I2C_VIAPRO is not set 777# CONFIG_I2C_VIAPRO is not set
751# CONFIG_I2C_VOODOO3 is not set 778# CONFIG_I2C_VOODOO3 is not set
752# CONFIG_I2C_PCA_ISA is not set 779# CONFIG_I2C_PCA_ISA is not set
780# CONFIG_I2C_SENSOR is not set
753 781
754# 782#
755# Hardware Sensors Chip support 783# Miscellaneous I2C Chip support
756#
757# CONFIG_I2C_SENSOR is not set
758# CONFIG_SENSORS_ADM1021 is not set
759# CONFIG_SENSORS_ADM1025 is not set
760# CONFIG_SENSORS_ADM1026 is not set
761# CONFIG_SENSORS_ADM1031 is not set
762# CONFIG_SENSORS_ASB100 is not set
763# CONFIG_SENSORS_DS1621 is not set
764# CONFIG_SENSORS_FSCHER is not set
765# CONFIG_SENSORS_FSCPOS is not set
766# CONFIG_SENSORS_GL518SM is not set
767# CONFIG_SENSORS_GL520SM is not set
768# CONFIG_SENSORS_IT87 is not set
769# CONFIG_SENSORS_LM63 is not set
770# CONFIG_SENSORS_LM75 is not set
771# CONFIG_SENSORS_LM77 is not set
772# CONFIG_SENSORS_LM78 is not set
773# CONFIG_SENSORS_LM80 is not set
774# CONFIG_SENSORS_LM83 is not set
775# CONFIG_SENSORS_LM85 is not set
776# CONFIG_SENSORS_LM87 is not set
777# CONFIG_SENSORS_LM90 is not set
778# CONFIG_SENSORS_LM92 is not set
779# CONFIG_SENSORS_MAX1619 is not set
780# CONFIG_SENSORS_PC87360 is not set
781# CONFIG_SENSORS_SMSC47B397 is not set
782# CONFIG_SENSORS_SIS5595 is not set
783# CONFIG_SENSORS_SMSC47M1 is not set
784# CONFIG_SENSORS_VIA686A is not set
785# CONFIG_SENSORS_W83781D is not set
786# CONFIG_SENSORS_W83L785TS is not set
787# CONFIG_SENSORS_W83627HF is not set
788
789#
790# Other I2C Chip support
791# 784#
792# CONFIG_SENSORS_DS1337 is not set 785# CONFIG_SENSORS_DS1337 is not set
786# CONFIG_SENSORS_DS1374 is not set
793# CONFIG_SENSORS_EEPROM is not set 787# CONFIG_SENSORS_EEPROM is not set
794# CONFIG_SENSORS_PCF8574 is not set 788# CONFIG_SENSORS_PCF8574 is not set
789# CONFIG_SENSORS_PCA9539 is not set
795# CONFIG_SENSORS_PCF8591 is not set 790# CONFIG_SENSORS_PCF8591 is not set
796# CONFIG_SENSORS_RTC8564 is not set 791# CONFIG_SENSORS_RTC8564 is not set
792# CONFIG_SENSORS_MAX6875 is not set
797# CONFIG_I2C_DEBUG_CORE is not set 793# CONFIG_I2C_DEBUG_CORE is not set
798# CONFIG_I2C_DEBUG_ALGO is not set 794# CONFIG_I2C_DEBUG_ALGO is not set
799# CONFIG_I2C_DEBUG_BUS is not set 795# CONFIG_I2C_DEBUG_BUS is not set
@@ -805,6 +801,11 @@ CONFIG_I2C_KEYWEST=y
805# CONFIG_W1 is not set 801# CONFIG_W1 is not set
806 802
807# 803#
804# Hardware Monitoring support
805#
806# CONFIG_HWMON is not set
807
808#
808# Misc devices 809# Misc devices
809# 810#
810 811
@@ -911,6 +912,7 @@ CONFIG_USB_DEVICEFS=y
911CONFIG_USB_EHCI_HCD=y 912CONFIG_USB_EHCI_HCD=y
912# CONFIG_USB_EHCI_SPLIT_ISO is not set 913# CONFIG_USB_EHCI_SPLIT_ISO is not set
913# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 914# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
915# CONFIG_USB_ISP116X_HCD is not set
914CONFIG_USB_OHCI_HCD=y 916CONFIG_USB_OHCI_HCD=y
915# CONFIG_USB_OHCI_BIG_ENDIAN is not set 917# CONFIG_USB_OHCI_BIG_ENDIAN is not set
916CONFIG_USB_OHCI_LITTLE_ENDIAN=y 918CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -950,12 +952,15 @@ CONFIG_THRUSTMASTER_FF=y
950CONFIG_USB_HIDDEV=y 952CONFIG_USB_HIDDEV=y
951# CONFIG_USB_AIPTEK is not set 953# CONFIG_USB_AIPTEK is not set
952# CONFIG_USB_WACOM is not set 954# CONFIG_USB_WACOM is not set
955# CONFIG_USB_ACECAD is not set
953# CONFIG_USB_KBTAB is not set 956# CONFIG_USB_KBTAB is not set
954# CONFIG_USB_POWERMATE is not set 957# CONFIG_USB_POWERMATE is not set
955# CONFIG_USB_MTOUCH is not set 958# CONFIG_USB_MTOUCH is not set
959# CONFIG_USB_ITMTOUCH is not set
956# CONFIG_USB_EGALAX is not set 960# CONFIG_USB_EGALAX is not set
957# CONFIG_USB_XPAD is not set 961# CONFIG_USB_XPAD is not set
958# CONFIG_USB_ATI_REMOTE is not set 962# CONFIG_USB_ATI_REMOTE is not set
963# CONFIG_USB_KEYSPAN_REMOTE is not set
959 964
960# 965#
961# USB Imaging devices 966# USB Imaging devices
@@ -1071,10 +1076,11 @@ CONFIG_USB_EZUSB=y
1071# CONFIG_USB_PHIDGETSERVO is not set 1076# CONFIG_USB_PHIDGETSERVO is not set
1072# CONFIG_USB_IDMOUSE is not set 1077# CONFIG_USB_IDMOUSE is not set
1073# CONFIG_USB_SISUSBVGA is not set 1078# CONFIG_USB_SISUSBVGA is not set
1079# CONFIG_USB_LD is not set
1074# CONFIG_USB_TEST is not set 1080# CONFIG_USB_TEST is not set
1075 1081
1076# 1082#
1077# USB ATM/DSL drivers 1083# USB DSL modem support
1078# 1084#
1079 1085
1080# 1086#
@@ -1093,12 +1099,18 @@ CONFIG_USB_EZUSB=y
1093# CONFIG_INFINIBAND is not set 1099# CONFIG_INFINIBAND is not set
1094 1100
1095# 1101#
1102# SN Devices
1103#
1104
1105#
1096# File systems 1106# File systems
1097# 1107#
1098CONFIG_EXT2_FS=y 1108CONFIG_EXT2_FS=y
1099CONFIG_EXT2_FS_XATTR=y 1109CONFIG_EXT2_FS_XATTR=y
1100CONFIG_EXT2_FS_POSIX_ACL=y 1110CONFIG_EXT2_FS_POSIX_ACL=y
1101CONFIG_EXT2_FS_SECURITY=y 1111CONFIG_EXT2_FS_SECURITY=y
1112CONFIG_EXT2_FS_XIP=y
1113CONFIG_FS_XIP=y
1102CONFIG_EXT3_FS=y 1114CONFIG_EXT3_FS=y
1103CONFIG_EXT3_FS_XATTR=y 1115CONFIG_EXT3_FS_XATTR=y
1104CONFIG_EXT3_FS_POSIX_ACL=y 1116CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1126,6 +1138,7 @@ CONFIG_XFS_SECURITY=y
1126CONFIG_XFS_POSIX_ACL=y 1138CONFIG_XFS_POSIX_ACL=y
1127# CONFIG_MINIX_FS is not set 1139# CONFIG_MINIX_FS is not set
1128# CONFIG_ROMFS_FS is not set 1140# CONFIG_ROMFS_FS is not set
1141CONFIG_INOTIFY=y
1129# CONFIG_QUOTA is not set 1142# CONFIG_QUOTA is not set
1130CONFIG_DNOTIFY=y 1143CONFIG_DNOTIFY=y
1131CONFIG_AUTOFS_FS=m 1144CONFIG_AUTOFS_FS=m
@@ -1157,7 +1170,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1157CONFIG_PROC_FS=y 1170CONFIG_PROC_FS=y
1158CONFIG_PROC_KCORE=y 1171CONFIG_PROC_KCORE=y
1159CONFIG_SYSFS=y 1172CONFIG_SYSFS=y
1160# CONFIG_DEVFS_FS is not set
1161CONFIG_DEVPTS_FS_XATTR=y 1173CONFIG_DEVPTS_FS_XATTR=y
1162# CONFIG_DEVPTS_FS_SECURITY is not set 1174# CONFIG_DEVPTS_FS_SECURITY is not set
1163CONFIG_TMPFS=y 1175CONFIG_TMPFS=y
@@ -1189,15 +1201,20 @@ CONFIG_CRAMFS=y
1189# 1201#
1190CONFIG_NFS_FS=y 1202CONFIG_NFS_FS=y
1191CONFIG_NFS_V3=y 1203CONFIG_NFS_V3=y
1204CONFIG_NFS_V3_ACL=y
1192CONFIG_NFS_V4=y 1205CONFIG_NFS_V4=y
1193# CONFIG_NFS_DIRECTIO is not set 1206# CONFIG_NFS_DIRECTIO is not set
1194CONFIG_NFSD=y 1207CONFIG_NFSD=y
1208CONFIG_NFSD_V2_ACL=y
1195CONFIG_NFSD_V3=y 1209CONFIG_NFSD_V3=y
1210CONFIG_NFSD_V3_ACL=y
1196CONFIG_NFSD_V4=y 1211CONFIG_NFSD_V4=y
1197CONFIG_NFSD_TCP=y 1212CONFIG_NFSD_TCP=y
1198CONFIG_LOCKD=y 1213CONFIG_LOCKD=y
1199CONFIG_LOCKD_V4=y 1214CONFIG_LOCKD_V4=y
1200CONFIG_EXPORTFS=y 1215CONFIG_EXPORTFS=y
1216CONFIG_NFS_ACL_SUPPORT=y
1217CONFIG_NFS_COMMON=y
1201CONFIG_SUNRPC=y 1218CONFIG_SUNRPC=y
1202CONFIG_SUNRPC_GSS=y 1219CONFIG_SUNRPC_GSS=y
1203CONFIG_RPCSEC_GSS_KRB5=y 1220CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/configs/iSeries_defconfig b/arch/ppc64/configs/iSeries_defconfig
index f6a2b99afd63..dbd54d188c2b 100644
--- a/arch/ppc64/configs/iSeries_defconfig
+++ b/arch/ppc64/configs/iSeries_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc3
4# Tue Jun 14 17:01:28 2005 4# Wed Jul 13 14:43:39 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -80,8 +80,24 @@ CONFIG_IBMVIO=y
80CONFIG_IOMMU_VMERGE=y 80CONFIG_IOMMU_VMERGE=y
81CONFIG_SMP=y 81CONFIG_SMP=y
82CONFIG_NR_CPUS=32 82CONFIG_NR_CPUS=32
83CONFIG_ARCH_SELECT_MEMORY_MODEL=y
84CONFIG_ARCH_FLATMEM_ENABLE=y
85CONFIG_SELECT_MEMORY_MODEL=y
86CONFIG_FLATMEM_MANUAL=y
87# CONFIG_DISCONTIGMEM_MANUAL is not set
88# CONFIG_SPARSEMEM_MANUAL is not set
89CONFIG_FLATMEM=y
90CONFIG_FLAT_NODE_MEM_MAP=y
91# CONFIG_NUMA is not set
83# CONFIG_SCHED_SMT is not set 92# CONFIG_SCHED_SMT is not set
93CONFIG_PREEMPT_NONE=y
94# CONFIG_PREEMPT_VOLUNTARY is not set
84# CONFIG_PREEMPT is not set 95# CONFIG_PREEMPT is not set
96# CONFIG_PREEMPT_BKL is not set
97CONFIG_HZ_100=y
98# CONFIG_HZ_250 is not set
99# CONFIG_HZ_1000 is not set
100CONFIG_HZ=100
85CONFIG_GENERIC_HARDIRQS=y 101CONFIG_GENERIC_HARDIRQS=y
86CONFIG_MSCHUNKS=y 102CONFIG_MSCHUNKS=y
87CONFIG_LPARCFG=y 103CONFIG_LPARCFG=y
@@ -110,6 +126,146 @@ CONFIG_PCI_NAMES=y
110# CONFIG_HOTPLUG_PCI is not set 126# CONFIG_HOTPLUG_PCI is not set
111 127
112# 128#
129# Networking
130#
131CONFIG_NET=y
132
133#
134# Networking options
135#
136CONFIG_PACKET=y
137# CONFIG_PACKET_MMAP is not set
138CONFIG_UNIX=y
139CONFIG_XFRM=y
140CONFIG_XFRM_USER=m
141CONFIG_NET_KEY=m
142CONFIG_INET=y
143CONFIG_IP_MULTICAST=y
144# CONFIG_IP_ADVANCED_ROUTER is not set
145CONFIG_IP_FIB_HASH=y
146# CONFIG_IP_PNP is not set
147CONFIG_NET_IPIP=y
148# CONFIG_NET_IPGRE is not set
149# CONFIG_IP_MROUTE is not set
150# CONFIG_ARPD is not set
151CONFIG_SYN_COOKIES=y
152CONFIG_INET_AH=m
153CONFIG_INET_ESP=m
154CONFIG_INET_IPCOMP=m
155CONFIG_INET_TUNNEL=y
156CONFIG_IP_TCPDIAG=m
157# CONFIG_IP_TCPDIAG_IPV6 is not set
158# CONFIG_TCP_CONG_ADVANCED is not set
159CONFIG_TCP_CONG_BIC=y
160
161#
162# IP: Virtual Server Configuration
163#
164# CONFIG_IP_VS is not set
165# CONFIG_IPV6 is not set
166CONFIG_NETFILTER=y
167# CONFIG_NETFILTER_DEBUG is not set
168
169#
170# IP: Netfilter Configuration
171#
172CONFIG_IP_NF_CONNTRACK=m
173CONFIG_IP_NF_CT_ACCT=y
174CONFIG_IP_NF_CONNTRACK_MARK=y
175CONFIG_IP_NF_CT_PROTO_SCTP=m
176CONFIG_IP_NF_FTP=m
177CONFIG_IP_NF_IRC=m
178CONFIG_IP_NF_TFTP=m
179CONFIG_IP_NF_AMANDA=m
180CONFIG_IP_NF_QUEUE=m
181CONFIG_IP_NF_IPTABLES=m
182CONFIG_IP_NF_MATCH_LIMIT=m
183CONFIG_IP_NF_MATCH_IPRANGE=m
184CONFIG_IP_NF_MATCH_MAC=m
185CONFIG_IP_NF_MATCH_PKTTYPE=m
186CONFIG_IP_NF_MATCH_MARK=m
187CONFIG_IP_NF_MATCH_MULTIPORT=m
188CONFIG_IP_NF_MATCH_TOS=m
189CONFIG_IP_NF_MATCH_RECENT=m
190CONFIG_IP_NF_MATCH_ECN=m
191CONFIG_IP_NF_MATCH_DSCP=m
192CONFIG_IP_NF_MATCH_AH_ESP=m
193CONFIG_IP_NF_MATCH_LENGTH=m
194CONFIG_IP_NF_MATCH_TTL=m
195CONFIG_IP_NF_MATCH_TCPMSS=m
196CONFIG_IP_NF_MATCH_HELPER=m
197CONFIG_IP_NF_MATCH_STATE=m
198CONFIG_IP_NF_MATCH_CONNTRACK=m
199CONFIG_IP_NF_MATCH_OWNER=m
200CONFIG_IP_NF_MATCH_ADDRTYPE=m
201CONFIG_IP_NF_MATCH_REALM=m
202CONFIG_IP_NF_MATCH_SCTP=m
203CONFIG_IP_NF_MATCH_COMMENT=m
204CONFIG_IP_NF_MATCH_CONNMARK=m
205CONFIG_IP_NF_MATCH_HASHLIMIT=m
206CONFIG_IP_NF_FILTER=m
207CONFIG_IP_NF_TARGET_REJECT=m
208CONFIG_IP_NF_TARGET_LOG=m
209CONFIG_IP_NF_TARGET_ULOG=m
210CONFIG_IP_NF_TARGET_TCPMSS=m
211CONFIG_IP_NF_NAT=m
212CONFIG_IP_NF_NAT_NEEDED=y
213CONFIG_IP_NF_TARGET_MASQUERADE=m
214CONFIG_IP_NF_TARGET_REDIRECT=m
215CONFIG_IP_NF_TARGET_NETMAP=m
216CONFIG_IP_NF_TARGET_SAME=m
217CONFIG_IP_NF_NAT_SNMP_BASIC=m
218CONFIG_IP_NF_NAT_IRC=m
219CONFIG_IP_NF_NAT_FTP=m
220CONFIG_IP_NF_NAT_TFTP=m
221CONFIG_IP_NF_NAT_AMANDA=m
222CONFIG_IP_NF_MANGLE=m
223CONFIG_IP_NF_TARGET_TOS=m
224CONFIG_IP_NF_TARGET_ECN=m
225CONFIG_IP_NF_TARGET_DSCP=m
226CONFIG_IP_NF_TARGET_MARK=m
227CONFIG_IP_NF_TARGET_CLASSIFY=m
228CONFIG_IP_NF_TARGET_CONNMARK=m
229CONFIG_IP_NF_TARGET_CLUSTERIP=m
230CONFIG_IP_NF_RAW=m
231CONFIG_IP_NF_TARGET_NOTRACK=m
232CONFIG_IP_NF_ARPTABLES=m
233CONFIG_IP_NF_ARPFILTER=m
234CONFIG_IP_NF_ARP_MANGLE=m
235
236#
237# SCTP Configuration (EXPERIMENTAL)
238#
239# CONFIG_IP_SCTP is not set
240# CONFIG_ATM is not set
241# CONFIG_BRIDGE is not set
242# CONFIG_VLAN_8021Q is not set
243# CONFIG_DECNET is not set
244CONFIG_LLC=y
245# CONFIG_LLC2 is not set
246# CONFIG_IPX is not set
247# CONFIG_ATALK is not set
248# CONFIG_X25 is not set
249# CONFIG_LAPB is not set
250# CONFIG_NET_DIVERT is not set
251# CONFIG_ECONET is not set
252# CONFIG_WAN_ROUTER is not set
253# CONFIG_NET_SCHED is not set
254CONFIG_NET_CLS_ROUTE=y
255
256#
257# Network testing
258#
259# CONFIG_NET_PKTGEN is not set
260CONFIG_NETPOLL=y
261CONFIG_NETPOLL_RX=y
262CONFIG_NETPOLL_TRAP=y
263CONFIG_NET_POLL_CONTROLLER=y
264# CONFIG_HAMRADIO is not set
265# CONFIG_IRDA is not set
266# CONFIG_BT is not set
267
268#
113# Device Drivers 269# Device Drivers
114# 270#
115 271
@@ -184,6 +340,7 @@ CONFIG_CHR_DEV_ST=y
184CONFIG_BLK_DEV_SR=y 340CONFIG_BLK_DEV_SR=y
185CONFIG_BLK_DEV_SR_VENDOR=y 341CONFIG_BLK_DEV_SR_VENDOR=y
186CONFIG_CHR_DEV_SG=y 342CONFIG_CHR_DEV_SG=y
343# CONFIG_CHR_DEV_SCH is not set
187 344
188# 345#
189# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 346# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -260,6 +417,8 @@ CONFIG_DM_ZERO=m
260# Fusion MPT device support 417# Fusion MPT device support
261# 418#
262# CONFIG_FUSION is not set 419# CONFIG_FUSION is not set
420# CONFIG_FUSION_SPI is not set
421# CONFIG_FUSION_FC is not set
263 422
264# 423#
265# IEEE 1394 (FireWire) support 424# IEEE 1394 (FireWire) support
@@ -276,145 +435,8 @@ CONFIG_DM_ZERO=m
276# 435#
277 436
278# 437#
279# Networking support 438# Network device support
280#
281CONFIG_NET=y
282
283#
284# Networking options
285# 439#
286CONFIG_PACKET=y
287# CONFIG_PACKET_MMAP is not set
288CONFIG_UNIX=y
289CONFIG_NET_KEY=m
290CONFIG_INET=y
291CONFIG_IP_MULTICAST=y
292# CONFIG_IP_ADVANCED_ROUTER is not set
293# CONFIG_IP_PNP is not set
294CONFIG_NET_IPIP=y
295# CONFIG_NET_IPGRE is not set
296# CONFIG_IP_MROUTE is not set
297# CONFIG_ARPD is not set
298CONFIG_SYN_COOKIES=y
299CONFIG_INET_AH=m
300CONFIG_INET_ESP=m
301CONFIG_INET_IPCOMP=m
302CONFIG_INET_TUNNEL=y
303CONFIG_IP_TCPDIAG=m
304# CONFIG_IP_TCPDIAG_IPV6 is not set
305
306#
307# IP: Virtual Server Configuration
308#
309# CONFIG_IP_VS is not set
310# CONFIG_IPV6 is not set
311CONFIG_NETFILTER=y
312# CONFIG_NETFILTER_DEBUG is not set
313
314#
315# IP: Netfilter Configuration
316#
317CONFIG_IP_NF_CONNTRACK=m
318CONFIG_IP_NF_CT_ACCT=y
319CONFIG_IP_NF_CONNTRACK_MARK=y
320CONFIG_IP_NF_CT_PROTO_SCTP=m
321CONFIG_IP_NF_FTP=m
322CONFIG_IP_NF_IRC=m
323CONFIG_IP_NF_TFTP=m
324CONFIG_IP_NF_AMANDA=m
325CONFIG_IP_NF_QUEUE=m
326CONFIG_IP_NF_IPTABLES=m
327CONFIG_IP_NF_MATCH_LIMIT=m
328CONFIG_IP_NF_MATCH_IPRANGE=m
329CONFIG_IP_NF_MATCH_MAC=m
330CONFIG_IP_NF_MATCH_PKTTYPE=m
331CONFIG_IP_NF_MATCH_MARK=m
332CONFIG_IP_NF_MATCH_MULTIPORT=m
333CONFIG_IP_NF_MATCH_TOS=m
334CONFIG_IP_NF_MATCH_RECENT=m
335CONFIG_IP_NF_MATCH_ECN=m
336CONFIG_IP_NF_MATCH_DSCP=m
337CONFIG_IP_NF_MATCH_AH_ESP=m
338CONFIG_IP_NF_MATCH_LENGTH=m
339CONFIG_IP_NF_MATCH_TTL=m
340CONFIG_IP_NF_MATCH_TCPMSS=m
341CONFIG_IP_NF_MATCH_HELPER=m
342CONFIG_IP_NF_MATCH_STATE=m
343CONFIG_IP_NF_MATCH_CONNTRACK=m
344CONFIG_IP_NF_MATCH_OWNER=m
345CONFIG_IP_NF_MATCH_ADDRTYPE=m
346CONFIG_IP_NF_MATCH_REALM=m
347CONFIG_IP_NF_MATCH_SCTP=m
348CONFIG_IP_NF_MATCH_COMMENT=m
349CONFIG_IP_NF_MATCH_CONNMARK=m
350CONFIG_IP_NF_MATCH_HASHLIMIT=m
351CONFIG_IP_NF_FILTER=m
352CONFIG_IP_NF_TARGET_REJECT=m
353CONFIG_IP_NF_TARGET_LOG=m
354CONFIG_IP_NF_TARGET_ULOG=m
355CONFIG_IP_NF_TARGET_TCPMSS=m
356CONFIG_IP_NF_NAT=m
357CONFIG_IP_NF_NAT_NEEDED=y
358CONFIG_IP_NF_TARGET_MASQUERADE=m
359CONFIG_IP_NF_TARGET_REDIRECT=m
360CONFIG_IP_NF_TARGET_NETMAP=m
361CONFIG_IP_NF_TARGET_SAME=m
362CONFIG_IP_NF_NAT_SNMP_BASIC=m
363CONFIG_IP_NF_NAT_IRC=m
364CONFIG_IP_NF_NAT_FTP=m
365CONFIG_IP_NF_NAT_TFTP=m
366CONFIG_IP_NF_NAT_AMANDA=m
367CONFIG_IP_NF_MANGLE=m
368CONFIG_IP_NF_TARGET_TOS=m
369CONFIG_IP_NF_TARGET_ECN=m
370CONFIG_IP_NF_TARGET_DSCP=m
371CONFIG_IP_NF_TARGET_MARK=m
372CONFIG_IP_NF_TARGET_CLASSIFY=m
373CONFIG_IP_NF_TARGET_CONNMARK=m
374CONFIG_IP_NF_TARGET_CLUSTERIP=m
375CONFIG_IP_NF_RAW=m
376CONFIG_IP_NF_TARGET_NOTRACK=m
377CONFIG_IP_NF_ARPTABLES=m
378CONFIG_IP_NF_ARPFILTER=m
379CONFIG_IP_NF_ARP_MANGLE=m
380CONFIG_XFRM=y
381CONFIG_XFRM_USER=m
382
383#
384# SCTP Configuration (EXPERIMENTAL)
385#
386# CONFIG_IP_SCTP is not set
387# CONFIG_ATM is not set
388# CONFIG_BRIDGE is not set
389# CONFIG_VLAN_8021Q is not set
390# CONFIG_DECNET is not set
391CONFIG_LLC=y
392# CONFIG_LLC2 is not set
393# CONFIG_IPX is not set
394# CONFIG_ATALK is not set
395# CONFIG_X25 is not set
396# CONFIG_LAPB is not set
397# CONFIG_NET_DIVERT is not set
398# CONFIG_ECONET is not set
399# CONFIG_WAN_ROUTER is not set
400
401#
402# QoS and/or fair queueing
403#
404# CONFIG_NET_SCHED is not set
405CONFIG_NET_CLS_ROUTE=y
406
407#
408# Network testing
409#
410# CONFIG_NET_PKTGEN is not set
411CONFIG_NETPOLL=y
412CONFIG_NETPOLL_RX=y
413CONFIG_NETPOLL_TRAP=y
414CONFIG_NET_POLL_CONTROLLER=y
415# CONFIG_HAMRADIO is not set
416# CONFIG_IRDA is not set
417# CONFIG_BT is not set
418CONFIG_NETDEVICES=y 440CONFIG_NETDEVICES=y
419CONFIG_DUMMY=m 441CONFIG_DUMMY=m
420CONFIG_BONDING=m 442CONFIG_BONDING=m
@@ -471,6 +493,7 @@ CONFIG_E1000=m
471# CONFIG_HAMACHI is not set 493# CONFIG_HAMACHI is not set
472# CONFIG_YELLOWFIN is not set 494# CONFIG_YELLOWFIN is not set
473# CONFIG_R8169 is not set 495# CONFIG_R8169 is not set
496# CONFIG_SKGE is not set
474# CONFIG_SK98LIN is not set 497# CONFIG_SK98LIN is not set
475# CONFIG_VIA_VELOCITY is not set 498# CONFIG_VIA_VELOCITY is not set
476# CONFIG_TIGON3 is not set 499# CONFIG_TIGON3 is not set
@@ -610,6 +633,7 @@ CONFIG_MAX_RAW_DEVS=256
610# I2C support 633# I2C support
611# 634#
612# CONFIG_I2C is not set 635# CONFIG_I2C is not set
636# CONFIG_I2C_SENSOR is not set
613 637
614# 638#
615# Dallas's 1-wire bus 639# Dallas's 1-wire bus
@@ -617,6 +641,11 @@ CONFIG_MAX_RAW_DEVS=256
617# CONFIG_W1 is not set 641# CONFIG_W1 is not set
618 642
619# 643#
644# Hardware Monitoring support
645#
646# CONFIG_HWMON is not set
647
648#
620# Misc devices 649# Misc devices
621# 650#
622 651
@@ -663,12 +692,18 @@ CONFIG_USB_ARCH_HAS_OHCI=y
663# CONFIG_INFINIBAND is not set 692# CONFIG_INFINIBAND is not set
664 693
665# 694#
695# SN Devices
696#
697
698#
666# File systems 699# File systems
667# 700#
668CONFIG_EXT2_FS=y 701CONFIG_EXT2_FS=y
669CONFIG_EXT2_FS_XATTR=y 702CONFIG_EXT2_FS_XATTR=y
670CONFIG_EXT2_FS_POSIX_ACL=y 703CONFIG_EXT2_FS_POSIX_ACL=y
671CONFIG_EXT2_FS_SECURITY=y 704CONFIG_EXT2_FS_SECURITY=y
705CONFIG_EXT2_FS_XIP=y
706CONFIG_FS_XIP=y
672CONFIG_EXT3_FS=y 707CONFIG_EXT3_FS=y
673CONFIG_EXT3_FS_XATTR=y 708CONFIG_EXT3_FS_XATTR=y
674CONFIG_EXT3_FS_POSIX_ACL=y 709CONFIG_EXT3_FS_POSIX_ACL=y
@@ -700,6 +735,7 @@ CONFIG_XFS_SECURITY=y
700CONFIG_XFS_POSIX_ACL=y 735CONFIG_XFS_POSIX_ACL=y
701# CONFIG_MINIX_FS is not set 736# CONFIG_MINIX_FS is not set
702# CONFIG_ROMFS_FS is not set 737# CONFIG_ROMFS_FS is not set
738CONFIG_INOTIFY=y
703# CONFIG_QUOTA is not set 739# CONFIG_QUOTA is not set
704CONFIG_DNOTIFY=y 740CONFIG_DNOTIFY=y
705CONFIG_AUTOFS_FS=m 741CONFIG_AUTOFS_FS=m
@@ -731,7 +767,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
731CONFIG_PROC_FS=y 767CONFIG_PROC_FS=y
732CONFIG_PROC_KCORE=y 768CONFIG_PROC_KCORE=y
733CONFIG_SYSFS=y 769CONFIG_SYSFS=y
734# CONFIG_DEVFS_FS is not set
735CONFIG_DEVPTS_FS_XATTR=y 770CONFIG_DEVPTS_FS_XATTR=y
736CONFIG_DEVPTS_FS_SECURITY=y 771CONFIG_DEVPTS_FS_SECURITY=y
737CONFIG_TMPFS=y 772CONFIG_TMPFS=y
@@ -763,15 +798,20 @@ CONFIG_CRAMFS=y
763# 798#
764CONFIG_NFS_FS=y 799CONFIG_NFS_FS=y
765CONFIG_NFS_V3=y 800CONFIG_NFS_V3=y
801CONFIG_NFS_V3_ACL=y
766CONFIG_NFS_V4=y 802CONFIG_NFS_V4=y
767# CONFIG_NFS_DIRECTIO is not set 803# CONFIG_NFS_DIRECTIO is not set
768CONFIG_NFSD=m 804CONFIG_NFSD=m
805CONFIG_NFSD_V2_ACL=y
769CONFIG_NFSD_V3=y 806CONFIG_NFSD_V3=y
807CONFIG_NFSD_V3_ACL=y
770CONFIG_NFSD_V4=y 808CONFIG_NFSD_V4=y
771CONFIG_NFSD_TCP=y 809CONFIG_NFSD_TCP=y
772CONFIG_LOCKD=y 810CONFIG_LOCKD=y
773CONFIG_LOCKD_V4=y 811CONFIG_LOCKD_V4=y
774CONFIG_EXPORTFS=m 812CONFIG_EXPORTFS=m
813CONFIG_NFS_ACL_SUPPORT=y
814CONFIG_NFS_COMMON=y
775CONFIG_SUNRPC=y 815CONFIG_SUNRPC=y
776CONFIG_SUNRPC_GSS=y 816CONFIG_SUNRPC_GSS=y
777CONFIG_RPCSEC_GSS_KRB5=y 817CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/configs/maple_defconfig b/arch/ppc64/configs/maple_defconfig
index 8051b0f47b6f..cda8e8cb6d1d 100644
--- a/arch/ppc64/configs/maple_defconfig
+++ b/arch/ppc64/configs/maple_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc3
4# Tue Jun 14 17:12:48 2005 4# Wed Jul 13 14:46:18 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -73,12 +73,15 @@ CONFIG_SYSVIPC_COMPAT=y
73# CONFIG_PPC_ISERIES is not set 73# CONFIG_PPC_ISERIES is not set
74CONFIG_PPC_MULTIPLATFORM=y 74CONFIG_PPC_MULTIPLATFORM=y
75# CONFIG_PPC_PSERIES is not set 75# CONFIG_PPC_PSERIES is not set
76# CONFIG_PPC_BPA is not set
76# CONFIG_PPC_PMAC is not set 77# CONFIG_PPC_PMAC is not set
77CONFIG_PPC_MAPLE=y 78CONFIG_PPC_MAPLE=y
78CONFIG_PPC=y 79CONFIG_PPC=y
79CONFIG_PPC64=y 80CONFIG_PPC64=y
80CONFIG_PPC_OF=y 81CONFIG_PPC_OF=y
82CONFIG_MPIC=y
81# CONFIG_ALTIVEC is not set 83# CONFIG_ALTIVEC is not set
84CONFIG_KEXEC=y
82CONFIG_U3_DART=y 85CONFIG_U3_DART=y
83CONFIG_MPIC_BROKEN_U3=y 86CONFIG_MPIC_BROKEN_U3=y
84CONFIG_BOOTX_TEXT=y 87CONFIG_BOOTX_TEXT=y
@@ -86,8 +89,24 @@ CONFIG_POWER4_ONLY=y
86CONFIG_IOMMU_VMERGE=y 89CONFIG_IOMMU_VMERGE=y
87CONFIG_SMP=y 90CONFIG_SMP=y
88CONFIG_NR_CPUS=2 91CONFIG_NR_CPUS=2
92CONFIG_ARCH_SELECT_MEMORY_MODEL=y
93CONFIG_ARCH_FLATMEM_ENABLE=y
94CONFIG_SELECT_MEMORY_MODEL=y
95CONFIG_FLATMEM_MANUAL=y
96# CONFIG_DISCONTIGMEM_MANUAL is not set
97# CONFIG_SPARSEMEM_MANUAL is not set
98CONFIG_FLATMEM=y
99CONFIG_FLAT_NODE_MEM_MAP=y
100# CONFIG_NUMA is not set
89# CONFIG_SCHED_SMT is not set 101# CONFIG_SCHED_SMT is not set
102CONFIG_PREEMPT_NONE=y
103# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set 104# CONFIG_PREEMPT is not set
105# CONFIG_PREEMPT_BKL is not set
106CONFIG_HZ_100=y
107# CONFIG_HZ_250 is not set
108# CONFIG_HZ_1000 is not set
109CONFIG_HZ=100
91CONFIG_GENERIC_HARDIRQS=y 110CONFIG_GENERIC_HARDIRQS=y
92CONFIG_SECCOMP=y 111CONFIG_SECCOMP=y
93CONFIG_ISA_DMA_API=y 112CONFIG_ISA_DMA_API=y
@@ -116,6 +135,71 @@ CONFIG_PROC_DEVICETREE=y
116# CONFIG_CMDLINE_BOOL is not set 135# CONFIG_CMDLINE_BOOL is not set
117 136
118# 137#
138# Networking
139#
140CONFIG_NET=y
141
142#
143# Networking options
144#
145CONFIG_PACKET=y
146CONFIG_PACKET_MMAP=y
147CONFIG_UNIX=y
148# CONFIG_NET_KEY is not set
149CONFIG_INET=y
150CONFIG_IP_MULTICAST=y
151# CONFIG_IP_ADVANCED_ROUTER is not set
152CONFIG_IP_FIB_HASH=y
153CONFIG_IP_PNP=y
154CONFIG_IP_PNP_DHCP=y
155# CONFIG_IP_PNP_BOOTP is not set
156# CONFIG_IP_PNP_RARP is not set
157# CONFIG_NET_IPIP is not set
158# CONFIG_NET_IPGRE is not set
159# CONFIG_IP_MROUTE is not set
160# CONFIG_ARPD is not set
161# CONFIG_SYN_COOKIES is not set
162# CONFIG_INET_AH is not set
163# CONFIG_INET_ESP is not set
164# CONFIG_INET_IPCOMP is not set
165# CONFIG_INET_TUNNEL is not set
166CONFIG_IP_TCPDIAG=y
167# CONFIG_IP_TCPDIAG_IPV6 is not set
168# CONFIG_TCP_CONG_ADVANCED is not set
169CONFIG_TCP_CONG_BIC=y
170# CONFIG_IPV6 is not set
171# CONFIG_NETFILTER is not set
172
173#
174# SCTP Configuration (EXPERIMENTAL)
175#
176# CONFIG_IP_SCTP is not set
177# CONFIG_ATM is not set
178# CONFIG_BRIDGE is not set
179# CONFIG_VLAN_8021Q is not set
180# CONFIG_DECNET is not set
181# CONFIG_LLC2 is not set
182# CONFIG_IPX is not set
183# CONFIG_ATALK is not set
184# CONFIG_X25 is not set
185# CONFIG_LAPB is not set
186# CONFIG_NET_DIVERT is not set
187# CONFIG_ECONET is not set
188# CONFIG_WAN_ROUTER is not set
189# CONFIG_NET_SCHED is not set
190# CONFIG_NET_CLS_ROUTE is not set
191
192#
193# Network testing
194#
195# CONFIG_NET_PKTGEN is not set
196# CONFIG_NETPOLL is not set
197# CONFIG_NET_POLL_CONTROLLER is not set
198# CONFIG_HAMRADIO is not set
199# CONFIG_IRDA is not set
200# CONFIG_BT is not set
201
202#
119# Device Drivers 203# Device Drivers
120# 204#
121 205
@@ -213,6 +297,7 @@ CONFIG_BLK_DEV_AMD74XX=y
213# CONFIG_BLK_DEV_HPT366 is not set 297# CONFIG_BLK_DEV_HPT366 is not set
214# CONFIG_BLK_DEV_SC1200 is not set 298# CONFIG_BLK_DEV_SC1200 is not set
215# CONFIG_BLK_DEV_PIIX is not set 299# CONFIG_BLK_DEV_PIIX is not set
300# CONFIG_BLK_DEV_IT821X is not set
216# CONFIG_BLK_DEV_NS87415 is not set 301# CONFIG_BLK_DEV_NS87415 is not set
217# CONFIG_BLK_DEV_PDC202XX_OLD is not set 302# CONFIG_BLK_DEV_PDC202XX_OLD is not set
218# CONFIG_BLK_DEV_PDC202XX_NEW is not set 303# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -240,6 +325,7 @@ CONFIG_IDEDMA_AUTO=y
240# 325#
241# Fusion MPT device support 326# Fusion MPT device support
242# 327#
328# CONFIG_FUSION is not set
243 329
244# 330#
245# IEEE 1394 (FireWire) support 331# IEEE 1394 (FireWire) support
@@ -256,70 +342,8 @@ CONFIG_IDEDMA_AUTO=y
256# 342#
257 343
258# 344#
259# Networking support 345# Network device support
260#
261CONFIG_NET=y
262
263#
264# Networking options
265# 346#
266CONFIG_PACKET=y
267CONFIG_PACKET_MMAP=y
268CONFIG_UNIX=y
269# CONFIG_NET_KEY is not set
270CONFIG_INET=y
271CONFIG_IP_MULTICAST=y
272# CONFIG_IP_ADVANCED_ROUTER is not set
273CONFIG_IP_PNP=y
274CONFIG_IP_PNP_DHCP=y
275# CONFIG_IP_PNP_BOOTP is not set
276# CONFIG_IP_PNP_RARP is not set
277# CONFIG_NET_IPIP is not set
278# CONFIG_NET_IPGRE is not set
279# CONFIG_IP_MROUTE is not set
280# CONFIG_ARPD is not set
281# CONFIG_SYN_COOKIES is not set
282# CONFIG_INET_AH is not set
283# CONFIG_INET_ESP is not set
284# CONFIG_INET_IPCOMP is not set
285# CONFIG_INET_TUNNEL is not set
286CONFIG_IP_TCPDIAG=y
287# CONFIG_IP_TCPDIAG_IPV6 is not set
288# CONFIG_IPV6 is not set
289# CONFIG_NETFILTER is not set
290
291#
292# SCTP Configuration (EXPERIMENTAL)
293#
294# CONFIG_IP_SCTP is not set
295# CONFIG_ATM is not set
296# CONFIG_BRIDGE is not set
297# CONFIG_VLAN_8021Q is not set
298# CONFIG_DECNET is not set
299# CONFIG_LLC2 is not set
300# CONFIG_IPX is not set
301# CONFIG_ATALK is not set
302# CONFIG_X25 is not set
303# CONFIG_LAPB is not set
304# CONFIG_NET_DIVERT is not set
305# CONFIG_ECONET is not set
306# CONFIG_WAN_ROUTER is not set
307
308#
309# QoS and/or fair queueing
310#
311# CONFIG_NET_SCHED is not set
312# CONFIG_NET_CLS_ROUTE is not set
313
314#
315# Network testing
316#
317# CONFIG_NET_PKTGEN is not set
318# CONFIG_NETPOLL is not set
319# CONFIG_NET_POLL_CONTROLLER is not set
320# CONFIG_HAMRADIO is not set
321# CONFIG_IRDA is not set
322# CONFIG_BT is not set
323CONFIG_NETDEVICES=y 347CONFIG_NETDEVICES=y
324# CONFIG_DUMMY is not set 348# CONFIG_DUMMY is not set
325# CONFIG_BONDING is not set 349# CONFIG_BONDING is not set
@@ -376,6 +400,7 @@ CONFIG_E1000=y
376# CONFIG_HAMACHI is not set 400# CONFIG_HAMACHI is not set
377# CONFIG_YELLOWFIN is not set 401# CONFIG_YELLOWFIN is not set
378# CONFIG_R8169 is not set 402# CONFIG_R8169 is not set
403# CONFIG_SKGE is not set
379# CONFIG_SK98LIN is not set 404# CONFIG_SK98LIN is not set
380# CONFIG_VIA_VELOCITY is not set 405# CONFIG_VIA_VELOCITY is not set
381# CONFIG_TIGON3 is not set 406# CONFIG_TIGON3 is not set
@@ -543,50 +568,19 @@ CONFIG_I2C_AMD8111=y
543# CONFIG_I2C_VIAPRO is not set 568# CONFIG_I2C_VIAPRO is not set
544# CONFIG_I2C_VOODOO3 is not set 569# CONFIG_I2C_VOODOO3 is not set
545# CONFIG_I2C_PCA_ISA is not set 570# CONFIG_I2C_PCA_ISA is not set
571# CONFIG_I2C_SENSOR is not set
546 572
547# 573#
548# Hardware Sensors Chip support 574# Miscellaneous I2C Chip support
549#
550# CONFIG_I2C_SENSOR is not set
551# CONFIG_SENSORS_ADM1021 is not set
552# CONFIG_SENSORS_ADM1025 is not set
553# CONFIG_SENSORS_ADM1026 is not set
554# CONFIG_SENSORS_ADM1031 is not set
555# CONFIG_SENSORS_ASB100 is not set
556# CONFIG_SENSORS_DS1621 is not set
557# CONFIG_SENSORS_FSCHER is not set
558# CONFIG_SENSORS_FSCPOS is not set
559# CONFIG_SENSORS_GL518SM is not set
560# CONFIG_SENSORS_GL520SM is not set
561# CONFIG_SENSORS_IT87 is not set
562# CONFIG_SENSORS_LM63 is not set
563# CONFIG_SENSORS_LM75 is not set
564# CONFIG_SENSORS_LM77 is not set
565# CONFIG_SENSORS_LM78 is not set
566# CONFIG_SENSORS_LM80 is not set
567# CONFIG_SENSORS_LM83 is not set
568# CONFIG_SENSORS_LM85 is not set
569# CONFIG_SENSORS_LM87 is not set
570# CONFIG_SENSORS_LM90 is not set
571# CONFIG_SENSORS_LM92 is not set
572# CONFIG_SENSORS_MAX1619 is not set
573# CONFIG_SENSORS_PC87360 is not set
574# CONFIG_SENSORS_SMSC47B397 is not set
575# CONFIG_SENSORS_SIS5595 is not set
576# CONFIG_SENSORS_SMSC47M1 is not set
577# CONFIG_SENSORS_VIA686A is not set
578# CONFIG_SENSORS_W83781D is not set
579# CONFIG_SENSORS_W83L785TS is not set
580# CONFIG_SENSORS_W83627HF is not set
581
582#
583# Other I2C Chip support
584# 575#
585# CONFIG_SENSORS_DS1337 is not set 576# CONFIG_SENSORS_DS1337 is not set
577# CONFIG_SENSORS_DS1374 is not set
586# CONFIG_SENSORS_EEPROM is not set 578# CONFIG_SENSORS_EEPROM is not set
587# CONFIG_SENSORS_PCF8574 is not set 579# CONFIG_SENSORS_PCF8574 is not set
580# CONFIG_SENSORS_PCA9539 is not set
588# CONFIG_SENSORS_PCF8591 is not set 581# CONFIG_SENSORS_PCF8591 is not set
589# CONFIG_SENSORS_RTC8564 is not set 582# CONFIG_SENSORS_RTC8564 is not set
583# CONFIG_SENSORS_MAX6875 is not set
590# CONFIG_I2C_DEBUG_CORE is not set 584# CONFIG_I2C_DEBUG_CORE is not set
591# CONFIG_I2C_DEBUG_ALGO is not set 585# CONFIG_I2C_DEBUG_ALGO is not set
592# CONFIG_I2C_DEBUG_BUS is not set 586# CONFIG_I2C_DEBUG_BUS is not set
@@ -598,6 +592,11 @@ CONFIG_I2C_AMD8111=y
598# CONFIG_W1 is not set 592# CONFIG_W1 is not set
599 593
600# 594#
595# Hardware Monitoring support
596#
597# CONFIG_HWMON is not set
598
599#
601# Misc devices 600# Misc devices
602# 601#
603 602
@@ -649,6 +648,7 @@ CONFIG_USB_DEVICEFS=y
649CONFIG_USB_EHCI_HCD=y 648CONFIG_USB_EHCI_HCD=y
650CONFIG_USB_EHCI_SPLIT_ISO=y 649CONFIG_USB_EHCI_SPLIT_ISO=y
651CONFIG_USB_EHCI_ROOT_HUB_TT=y 650CONFIG_USB_EHCI_ROOT_HUB_TT=y
651# CONFIG_USB_ISP116X_HCD is not set
652CONFIG_USB_OHCI_HCD=y 652CONFIG_USB_OHCI_HCD=y
653# CONFIG_USB_OHCI_BIG_ENDIAN is not set 653# CONFIG_USB_OHCI_BIG_ENDIAN is not set
654CONFIG_USB_OHCI_LITTLE_ENDIAN=y 654CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -676,12 +676,15 @@ CONFIG_USB_HIDINPUT=y
676# CONFIG_USB_HIDDEV is not set 676# CONFIG_USB_HIDDEV is not set
677# CONFIG_USB_AIPTEK is not set 677# CONFIG_USB_AIPTEK is not set
678# CONFIG_USB_WACOM is not set 678# CONFIG_USB_WACOM is not set
679# CONFIG_USB_ACECAD is not set
679# CONFIG_USB_KBTAB is not set 680# CONFIG_USB_KBTAB is not set
680# CONFIG_USB_POWERMATE is not set 681# CONFIG_USB_POWERMATE is not set
681# CONFIG_USB_MTOUCH is not set 682# CONFIG_USB_MTOUCH is not set
683# CONFIG_USB_ITMTOUCH is not set
682# CONFIG_USB_EGALAX is not set 684# CONFIG_USB_EGALAX is not set
683# CONFIG_USB_XPAD is not set 685# CONFIG_USB_XPAD is not set
684# CONFIG_USB_ATI_REMOTE is not set 686# CONFIG_USB_ATI_REMOTE is not set
687# CONFIG_USB_KEYSPAN_REMOTE is not set
685 688
686# 689#
687# USB Imaging devices 690# USB Imaging devices
@@ -772,10 +775,11 @@ CONFIG_USB_EZUSB=y
772# CONFIG_USB_PHIDGETSERVO is not set 775# CONFIG_USB_PHIDGETSERVO is not set
773# CONFIG_USB_IDMOUSE is not set 776# CONFIG_USB_IDMOUSE is not set
774# CONFIG_USB_SISUSBVGA is not set 777# CONFIG_USB_SISUSBVGA is not set
778# CONFIG_USB_LD is not set
775# CONFIG_USB_TEST is not set 779# CONFIG_USB_TEST is not set
776 780
777# 781#
778# USB ATM/DSL drivers 782# USB DSL modem support
779# 783#
780 784
781# 785#
@@ -794,16 +798,23 @@ CONFIG_USB_EZUSB=y
794# CONFIG_INFINIBAND is not set 798# CONFIG_INFINIBAND is not set
795 799
796# 800#
801# SN Devices
802#
803
804#
797# File systems 805# File systems
798# 806#
799CONFIG_EXT2_FS=y 807CONFIG_EXT2_FS=y
800# CONFIG_EXT2_FS_XATTR is not set 808# CONFIG_EXT2_FS_XATTR is not set
809CONFIG_EXT2_FS_XIP=y
810CONFIG_FS_XIP=y
801CONFIG_EXT3_FS=y 811CONFIG_EXT3_FS=y
802# CONFIG_EXT3_FS_XATTR is not set 812# CONFIG_EXT3_FS_XATTR is not set
803CONFIG_JBD=y 813CONFIG_JBD=y
804# CONFIG_JBD_DEBUG is not set 814# CONFIG_JBD_DEBUG is not set
805# CONFIG_REISERFS_FS is not set 815# CONFIG_REISERFS_FS is not set
806# CONFIG_JFS_FS is not set 816# CONFIG_JFS_FS is not set
817CONFIG_FS_POSIX_ACL=y
807 818
808# 819#
809# XFS support 820# XFS support
@@ -811,6 +822,7 @@ CONFIG_JBD=y
811# CONFIG_XFS_FS is not set 822# CONFIG_XFS_FS is not set
812# CONFIG_MINIX_FS is not set 823# CONFIG_MINIX_FS is not set
813# CONFIG_ROMFS_FS is not set 824# CONFIG_ROMFS_FS is not set
825CONFIG_INOTIFY=y
814# CONFIG_QUOTA is not set 826# CONFIG_QUOTA is not set
815CONFIG_DNOTIFY=y 827CONFIG_DNOTIFY=y
816# CONFIG_AUTOFS_FS is not set 828# CONFIG_AUTOFS_FS is not set
@@ -838,7 +850,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
838CONFIG_PROC_FS=y 850CONFIG_PROC_FS=y
839CONFIG_PROC_KCORE=y 851CONFIG_PROC_KCORE=y
840CONFIG_SYSFS=y 852CONFIG_SYSFS=y
841# CONFIG_DEVFS_FS is not set
842CONFIG_DEVPTS_FS_XATTR=y 853CONFIG_DEVPTS_FS_XATTR=y
843# CONFIG_DEVPTS_FS_SECURITY is not set 854# CONFIG_DEVPTS_FS_SECURITY is not set
844CONFIG_TMPFS=y 855CONFIG_TMPFS=y
@@ -870,12 +881,15 @@ CONFIG_CRAMFS=y
870# 881#
871CONFIG_NFS_FS=y 882CONFIG_NFS_FS=y
872CONFIG_NFS_V3=y 883CONFIG_NFS_V3=y
884CONFIG_NFS_V3_ACL=y
873CONFIG_NFS_V4=y 885CONFIG_NFS_V4=y
874# CONFIG_NFS_DIRECTIO is not set 886# CONFIG_NFS_DIRECTIO is not set
875# CONFIG_NFSD is not set 887# CONFIG_NFSD is not set
876CONFIG_ROOT_NFS=y 888CONFIG_ROOT_NFS=y
877CONFIG_LOCKD=y 889CONFIG_LOCKD=y
878CONFIG_LOCKD_V4=y 890CONFIG_LOCKD_V4=y
891CONFIG_NFS_ACL_SUPPORT=y
892CONFIG_NFS_COMMON=y
879CONFIG_SUNRPC=y 893CONFIG_SUNRPC=y
880CONFIG_SUNRPC_GSS=y 894CONFIG_SUNRPC_GSS=y
881CONFIG_RPCSEC_GSS_KRB5=y 895CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/configs/pSeries_defconfig b/arch/ppc64/configs/pSeries_defconfig
index d0db8b5966c0..5112edf18181 100644
--- a/arch/ppc64/configs/pSeries_defconfig
+++ b/arch/ppc64/configs/pSeries_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc6 3# Linux kernel version: 2.6.13-rc3
4# Tue Jun 14 17:13:47 2005 4# Wed Jul 13 14:47:54 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -74,13 +74,17 @@ CONFIG_SYSVIPC_COMPAT=y
74# CONFIG_PPC_ISERIES is not set 74# CONFIG_PPC_ISERIES is not set
75CONFIG_PPC_MULTIPLATFORM=y 75CONFIG_PPC_MULTIPLATFORM=y
76CONFIG_PPC_PSERIES=y 76CONFIG_PPC_PSERIES=y
77# CONFIG_PPC_BPA is not set
77# CONFIG_PPC_PMAC is not set 78# CONFIG_PPC_PMAC is not set
78# CONFIG_PPC_MAPLE is not set 79# CONFIG_PPC_MAPLE is not set
79CONFIG_PPC=y 80CONFIG_PPC=y
80CONFIG_PPC64=y 81CONFIG_PPC64=y
81CONFIG_PPC_OF=y 82CONFIG_PPC_OF=y
83CONFIG_XICS=y
84CONFIG_MPIC=y
82CONFIG_ALTIVEC=y 85CONFIG_ALTIVEC=y
83CONFIG_PPC_SPLPAR=y 86CONFIG_PPC_SPLPAR=y
87CONFIG_KEXEC=y
84CONFIG_IBMVIO=y 88CONFIG_IBMVIO=y
85# CONFIG_U3_DART is not set 89# CONFIG_U3_DART is not set
86# CONFIG_BOOTX_TEXT is not set 90# CONFIG_BOOTX_TEXT is not set
@@ -88,10 +92,30 @@ CONFIG_IBMVIO=y
88CONFIG_IOMMU_VMERGE=y 92CONFIG_IOMMU_VMERGE=y
89CONFIG_SMP=y 93CONFIG_SMP=y
90CONFIG_NR_CPUS=128 94CONFIG_NR_CPUS=128
95CONFIG_ARCH_SELECT_MEMORY_MODEL=y
96CONFIG_ARCH_FLATMEM_ENABLE=y
91CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 97CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
98CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
99CONFIG_ARCH_SPARSEMEM_ENABLE=y
100CONFIG_SELECT_MEMORY_MODEL=y
101# CONFIG_FLATMEM_MANUAL is not set
102CONFIG_DISCONTIGMEM_MANUAL=y
103# CONFIG_SPARSEMEM_MANUAL is not set
104CONFIG_DISCONTIGMEM=y
105CONFIG_FLAT_NODE_MEM_MAP=y
106CONFIG_NEED_MULTIPLE_NODES=y
107CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
108CONFIG_NODES_SPAN_OTHER_NODES=y
92CONFIG_NUMA=y 109CONFIG_NUMA=y
93CONFIG_SCHED_SMT=y 110CONFIG_SCHED_SMT=y
111CONFIG_PREEMPT_NONE=y
112# CONFIG_PREEMPT_VOLUNTARY is not set
94# CONFIG_PREEMPT is not set 113# CONFIG_PREEMPT is not set
114# CONFIG_PREEMPT_BKL is not set
115CONFIG_HZ_100=y
116# CONFIG_HZ_250 is not set
117# CONFIG_HZ_1000 is not set
118CONFIG_HZ=100
95CONFIG_EEH=y 119CONFIG_EEH=y
96CONFIG_GENERIC_HARDIRQS=y 120CONFIG_GENERIC_HARDIRQS=y
97CONFIG_PPC_RTAS=y 121CONFIG_PPC_RTAS=y
@@ -132,6 +156,146 @@ CONFIG_PROC_DEVICETREE=y
132# CONFIG_CMDLINE_BOOL is not set 156# CONFIG_CMDLINE_BOOL is not set
133 157
134# 158#
159# Networking
160#
161CONFIG_NET=y
162
163#
164# Networking options
165#
166CONFIG_PACKET=y
167# CONFIG_PACKET_MMAP is not set
168CONFIG_UNIX=y
169CONFIG_XFRM=y
170CONFIG_XFRM_USER=m
171CONFIG_NET_KEY=m
172CONFIG_INET=y
173CONFIG_IP_MULTICAST=y
174# CONFIG_IP_ADVANCED_ROUTER is not set
175CONFIG_IP_FIB_HASH=y
176# CONFIG_IP_PNP is not set
177CONFIG_NET_IPIP=y
178# CONFIG_NET_IPGRE is not set
179# CONFIG_IP_MROUTE is not set
180# CONFIG_ARPD is not set
181CONFIG_SYN_COOKIES=y
182CONFIG_INET_AH=m
183CONFIG_INET_ESP=m
184CONFIG_INET_IPCOMP=m
185CONFIG_INET_TUNNEL=y
186CONFIG_IP_TCPDIAG=m
187# CONFIG_IP_TCPDIAG_IPV6 is not set
188# CONFIG_TCP_CONG_ADVANCED is not set
189CONFIG_TCP_CONG_BIC=y
190
191#
192# IP: Virtual Server Configuration
193#
194# CONFIG_IP_VS is not set
195# CONFIG_IPV6 is not set
196CONFIG_NETFILTER=y
197# CONFIG_NETFILTER_DEBUG is not set
198
199#
200# IP: Netfilter Configuration
201#
202CONFIG_IP_NF_CONNTRACK=m
203CONFIG_IP_NF_CT_ACCT=y
204CONFIG_IP_NF_CONNTRACK_MARK=y
205CONFIG_IP_NF_CT_PROTO_SCTP=m
206CONFIG_IP_NF_FTP=m
207CONFIG_IP_NF_IRC=m
208CONFIG_IP_NF_TFTP=m
209CONFIG_IP_NF_AMANDA=m
210CONFIG_IP_NF_QUEUE=m
211CONFIG_IP_NF_IPTABLES=m
212CONFIG_IP_NF_MATCH_LIMIT=m
213CONFIG_IP_NF_MATCH_IPRANGE=m
214CONFIG_IP_NF_MATCH_MAC=m
215CONFIG_IP_NF_MATCH_PKTTYPE=m
216CONFIG_IP_NF_MATCH_MARK=m
217CONFIG_IP_NF_MATCH_MULTIPORT=m
218CONFIG_IP_NF_MATCH_TOS=m
219CONFIG_IP_NF_MATCH_RECENT=m
220CONFIG_IP_NF_MATCH_ECN=m
221CONFIG_IP_NF_MATCH_DSCP=m
222CONFIG_IP_NF_MATCH_AH_ESP=m
223CONFIG_IP_NF_MATCH_LENGTH=m
224CONFIG_IP_NF_MATCH_TTL=m
225CONFIG_IP_NF_MATCH_TCPMSS=m
226CONFIG_IP_NF_MATCH_HELPER=m
227CONFIG_IP_NF_MATCH_STATE=m
228CONFIG_IP_NF_MATCH_CONNTRACK=m
229CONFIG_IP_NF_MATCH_OWNER=m
230CONFIG_IP_NF_MATCH_ADDRTYPE=m
231CONFIG_IP_NF_MATCH_REALM=m
232CONFIG_IP_NF_MATCH_SCTP=m
233CONFIG_IP_NF_MATCH_COMMENT=m
234CONFIG_IP_NF_MATCH_CONNMARK=m
235CONFIG_IP_NF_MATCH_HASHLIMIT=m
236CONFIG_IP_NF_FILTER=m
237CONFIG_IP_NF_TARGET_REJECT=m
238CONFIG_IP_NF_TARGET_LOG=m
239CONFIG_IP_NF_TARGET_ULOG=m
240CONFIG_IP_NF_TARGET_TCPMSS=m
241CONFIG_IP_NF_NAT=m
242CONFIG_IP_NF_NAT_NEEDED=y
243CONFIG_IP_NF_TARGET_MASQUERADE=m
244CONFIG_IP_NF_TARGET_REDIRECT=m
245CONFIG_IP_NF_TARGET_NETMAP=m
246CONFIG_IP_NF_TARGET_SAME=m
247CONFIG_IP_NF_NAT_SNMP_BASIC=m
248CONFIG_IP_NF_NAT_IRC=m
249CONFIG_IP_NF_NAT_FTP=m
250CONFIG_IP_NF_NAT_TFTP=m
251CONFIG_IP_NF_NAT_AMANDA=m
252CONFIG_IP_NF_MANGLE=m
253CONFIG_IP_NF_TARGET_TOS=m
254CONFIG_IP_NF_TARGET_ECN=m
255CONFIG_IP_NF_TARGET_DSCP=m
256CONFIG_IP_NF_TARGET_MARK=m
257CONFIG_IP_NF_TARGET_CLASSIFY=m
258CONFIG_IP_NF_TARGET_CONNMARK=m
259CONFIG_IP_NF_TARGET_CLUSTERIP=m
260CONFIG_IP_NF_RAW=m
261CONFIG_IP_NF_TARGET_NOTRACK=m
262CONFIG_IP_NF_ARPTABLES=m
263CONFIG_IP_NF_ARPFILTER=m
264CONFIG_IP_NF_ARP_MANGLE=m
265
266#
267# SCTP Configuration (EXPERIMENTAL)
268#
269# CONFIG_IP_SCTP is not set
270# CONFIG_ATM is not set
271# CONFIG_BRIDGE is not set
272# CONFIG_VLAN_8021Q is not set
273# CONFIG_DECNET is not set
274CONFIG_LLC=y
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278# CONFIG_X25 is not set
279# CONFIG_LAPB is not set
280# CONFIG_NET_DIVERT is not set
281# CONFIG_ECONET is not set
282# CONFIG_WAN_ROUTER is not set
283# CONFIG_NET_SCHED is not set
284CONFIG_NET_CLS_ROUTE=y
285
286#
287# Network testing
288#
289# CONFIG_NET_PKTGEN is not set
290CONFIG_NETPOLL=y
291CONFIG_NETPOLL_RX=y
292CONFIG_NETPOLL_TRAP=y
293CONFIG_NET_POLL_CONTROLLER=y
294# CONFIG_HAMRADIO is not set
295# CONFIG_IRDA is not set
296# CONFIG_BT is not set
297
298#
135# Device Drivers 299# Device Drivers
136# 300#
137 301
@@ -238,6 +402,7 @@ CONFIG_BLK_DEV_AMD74XX=y
238# CONFIG_BLK_DEV_HPT366 is not set 402# CONFIG_BLK_DEV_HPT366 is not set
239# CONFIG_BLK_DEV_SC1200 is not set 403# CONFIG_BLK_DEV_SC1200 is not set
240# CONFIG_BLK_DEV_PIIX is not set 404# CONFIG_BLK_DEV_PIIX is not set
405# CONFIG_BLK_DEV_IT821X is not set
241# CONFIG_BLK_DEV_NS87415 is not set 406# CONFIG_BLK_DEV_NS87415 is not set
242# CONFIG_BLK_DEV_PDC202XX_OLD is not set 407# CONFIG_BLK_DEV_PDC202XX_OLD is not set
243# CONFIG_BLK_DEV_PDC202XX_NEW is not set 408# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -267,6 +432,7 @@ CONFIG_CHR_DEV_ST=y
267CONFIG_BLK_DEV_SR=y 432CONFIG_BLK_DEV_SR=y
268CONFIG_BLK_DEV_SR_VENDOR=y 433CONFIG_BLK_DEV_SR_VENDOR=y
269CONFIG_CHR_DEV_SG=y 434CONFIG_CHR_DEV_SG=y
435# CONFIG_CHR_DEV_SCH is not set
270 436
271# 437#
272# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 438# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -352,6 +518,8 @@ CONFIG_DM_MULTIPATH_EMC=m
352# Fusion MPT device support 518# Fusion MPT device support
353# 519#
354# CONFIG_FUSION is not set 520# CONFIG_FUSION is not set
521# CONFIG_FUSION_SPI is not set
522# CONFIG_FUSION_FC is not set
355 523
356# 524#
357# IEEE 1394 (FireWire) support 525# IEEE 1394 (FireWire) support
@@ -368,145 +536,8 @@ CONFIG_DM_MULTIPATH_EMC=m
368# 536#
369 537
370# 538#
371# Networking support 539# Network device support
372#
373CONFIG_NET=y
374
375#
376# Networking options
377# 540#
378CONFIG_PACKET=y
379# CONFIG_PACKET_MMAP is not set
380CONFIG_UNIX=y
381CONFIG_NET_KEY=m
382CONFIG_INET=y
383CONFIG_IP_MULTICAST=y
384# CONFIG_IP_ADVANCED_ROUTER is not set
385# CONFIG_IP_PNP is not set
386CONFIG_NET_IPIP=y
387# CONFIG_NET_IPGRE is not set
388# CONFIG_IP_MROUTE is not set
389# CONFIG_ARPD is not set
390CONFIG_SYN_COOKIES=y
391CONFIG_INET_AH=m
392CONFIG_INET_ESP=m
393CONFIG_INET_IPCOMP=m
394CONFIG_INET_TUNNEL=y
395CONFIG_IP_TCPDIAG=m
396# CONFIG_IP_TCPDIAG_IPV6 is not set
397
398#
399# IP: Virtual Server Configuration
400#
401# CONFIG_IP_VS is not set
402# CONFIG_IPV6 is not set
403CONFIG_NETFILTER=y
404# CONFIG_NETFILTER_DEBUG is not set
405
406#
407# IP: Netfilter Configuration
408#
409CONFIG_IP_NF_CONNTRACK=m
410CONFIG_IP_NF_CT_ACCT=y
411CONFIG_IP_NF_CONNTRACK_MARK=y
412CONFIG_IP_NF_CT_PROTO_SCTP=m
413CONFIG_IP_NF_FTP=m
414CONFIG_IP_NF_IRC=m
415CONFIG_IP_NF_TFTP=m
416CONFIG_IP_NF_AMANDA=m
417CONFIG_IP_NF_QUEUE=m
418CONFIG_IP_NF_IPTABLES=m
419CONFIG_IP_NF_MATCH_LIMIT=m
420CONFIG_IP_NF_MATCH_IPRANGE=m
421CONFIG_IP_NF_MATCH_MAC=m
422CONFIG_IP_NF_MATCH_PKTTYPE=m
423CONFIG_IP_NF_MATCH_MARK=m
424CONFIG_IP_NF_MATCH_MULTIPORT=m
425CONFIG_IP_NF_MATCH_TOS=m
426CONFIG_IP_NF_MATCH_RECENT=m
427CONFIG_IP_NF_MATCH_ECN=m
428CONFIG_IP_NF_MATCH_DSCP=m
429CONFIG_IP_NF_MATCH_AH_ESP=m
430CONFIG_IP_NF_MATCH_LENGTH=m
431CONFIG_IP_NF_MATCH_TTL=m
432CONFIG_IP_NF_MATCH_TCPMSS=m
433CONFIG_IP_NF_MATCH_HELPER=m
434CONFIG_IP_NF_MATCH_STATE=m
435CONFIG_IP_NF_MATCH_CONNTRACK=m
436CONFIG_IP_NF_MATCH_OWNER=m
437CONFIG_IP_NF_MATCH_ADDRTYPE=m
438CONFIG_IP_NF_MATCH_REALM=m
439CONFIG_IP_NF_MATCH_SCTP=m
440CONFIG_IP_NF_MATCH_COMMENT=m
441CONFIG_IP_NF_MATCH_CONNMARK=m
442CONFIG_IP_NF_MATCH_HASHLIMIT=m
443CONFIG_IP_NF_FILTER=m
444CONFIG_IP_NF_TARGET_REJECT=m
445CONFIG_IP_NF_TARGET_LOG=m
446CONFIG_IP_NF_TARGET_ULOG=m
447CONFIG_IP_NF_TARGET_TCPMSS=m
448CONFIG_IP_NF_NAT=m
449CONFIG_IP_NF_NAT_NEEDED=y
450CONFIG_IP_NF_TARGET_MASQUERADE=m
451CONFIG_IP_NF_TARGET_REDIRECT=m
452CONFIG_IP_NF_TARGET_NETMAP=m
453CONFIG_IP_NF_TARGET_SAME=m
454CONFIG_IP_NF_NAT_SNMP_BASIC=m
455CONFIG_IP_NF_NAT_IRC=m
456CONFIG_IP_NF_NAT_FTP=m
457CONFIG_IP_NF_NAT_TFTP=m
458CONFIG_IP_NF_NAT_AMANDA=m
459CONFIG_IP_NF_MANGLE=m
460CONFIG_IP_NF_TARGET_TOS=m
461CONFIG_IP_NF_TARGET_ECN=m
462CONFIG_IP_NF_TARGET_DSCP=m
463CONFIG_IP_NF_TARGET_MARK=m
464CONFIG_IP_NF_TARGET_CLASSIFY=m
465CONFIG_IP_NF_TARGET_CONNMARK=m
466CONFIG_IP_NF_TARGET_CLUSTERIP=m
467CONFIG_IP_NF_RAW=m
468CONFIG_IP_NF_TARGET_NOTRACK=m
469CONFIG_IP_NF_ARPTABLES=m
470CONFIG_IP_NF_ARPFILTER=m
471CONFIG_IP_NF_ARP_MANGLE=m
472CONFIG_XFRM=y
473CONFIG_XFRM_USER=m
474
475#
476# SCTP Configuration (EXPERIMENTAL)
477#
478# CONFIG_IP_SCTP is not set
479# CONFIG_ATM is not set
480# CONFIG_BRIDGE is not set
481# CONFIG_VLAN_8021Q is not set
482# CONFIG_DECNET is not set
483CONFIG_LLC=y
484# CONFIG_LLC2 is not set
485# CONFIG_IPX is not set
486# CONFIG_ATALK is not set
487# CONFIG_X25 is not set
488# CONFIG_LAPB is not set
489# CONFIG_NET_DIVERT is not set
490# CONFIG_ECONET is not set
491# CONFIG_WAN_ROUTER is not set
492
493#
494# QoS and/or fair queueing
495#
496# CONFIG_NET_SCHED is not set
497CONFIG_NET_CLS_ROUTE=y
498
499#
500# Network testing
501#
502# CONFIG_NET_PKTGEN is not set
503CONFIG_NETPOLL=y
504CONFIG_NETPOLL_RX=y
505CONFIG_NETPOLL_TRAP=y
506CONFIG_NET_POLL_CONTROLLER=y
507# CONFIG_HAMRADIO is not set
508# CONFIG_IRDA is not set
509# CONFIG_BT is not set
510CONFIG_NETDEVICES=y 541CONFIG_NETDEVICES=y
511CONFIG_DUMMY=m 542CONFIG_DUMMY=m
512CONFIG_BONDING=m 543CONFIG_BONDING=m
@@ -566,6 +597,7 @@ CONFIG_E1000=y
566# CONFIG_HAMACHI is not set 597# CONFIG_HAMACHI is not set
567# CONFIG_YELLOWFIN is not set 598# CONFIG_YELLOWFIN is not set
568# CONFIG_R8169 is not set 599# CONFIG_R8169 is not set
600# CONFIG_SKGE is not set
569# CONFIG_SK98LIN is not set 601# CONFIG_SK98LIN is not set
570# CONFIG_VIA_VELOCITY is not set 602# CONFIG_VIA_VELOCITY is not set
571CONFIG_TIGON3=y 603CONFIG_TIGON3=y
@@ -772,50 +804,19 @@ CONFIG_I2C_ALGOBIT=y
772# CONFIG_I2C_VIAPRO is not set 804# CONFIG_I2C_VIAPRO is not set
773# CONFIG_I2C_VOODOO3 is not set 805# CONFIG_I2C_VOODOO3 is not set
774# CONFIG_I2C_PCA_ISA is not set 806# CONFIG_I2C_PCA_ISA is not set
807# CONFIG_I2C_SENSOR is not set
775 808
776# 809#
777# Hardware Sensors Chip support 810# Miscellaneous I2C Chip support
778#
779# CONFIG_I2C_SENSOR is not set
780# CONFIG_SENSORS_ADM1021 is not set
781# CONFIG_SENSORS_ADM1025 is not set
782# CONFIG_SENSORS_ADM1026 is not set
783# CONFIG_SENSORS_ADM1031 is not set
784# CONFIG_SENSORS_ASB100 is not set
785# CONFIG_SENSORS_DS1621 is not set
786# CONFIG_SENSORS_FSCHER is not set
787# CONFIG_SENSORS_FSCPOS is not set
788# CONFIG_SENSORS_GL518SM is not set
789# CONFIG_SENSORS_GL520SM is not set
790# CONFIG_SENSORS_IT87 is not set
791# CONFIG_SENSORS_LM63 is not set
792# CONFIG_SENSORS_LM75 is not set
793# CONFIG_SENSORS_LM77 is not set
794# CONFIG_SENSORS_LM78 is not set
795# CONFIG_SENSORS_LM80 is not set
796# CONFIG_SENSORS_LM83 is not set
797# CONFIG_SENSORS_LM85 is not set
798# CONFIG_SENSORS_LM87 is not set
799# CONFIG_SENSORS_LM90 is not set
800# CONFIG_SENSORS_LM92 is not set
801# CONFIG_SENSORS_MAX1619 is not set
802# CONFIG_SENSORS_PC87360 is not set
803# CONFIG_SENSORS_SMSC47B397 is not set
804# CONFIG_SENSORS_SIS5595 is not set
805# CONFIG_SENSORS_SMSC47M1 is not set
806# CONFIG_SENSORS_VIA686A is not set
807# CONFIG_SENSORS_W83781D is not set
808# CONFIG_SENSORS_W83L785TS is not set
809# CONFIG_SENSORS_W83627HF is not set
810
811#
812# Other I2C Chip support
813# 811#
814# CONFIG_SENSORS_DS1337 is not set 812# CONFIG_SENSORS_DS1337 is not set
813# CONFIG_SENSORS_DS1374 is not set
815# CONFIG_SENSORS_EEPROM is not set 814# CONFIG_SENSORS_EEPROM is not set
816# CONFIG_SENSORS_PCF8574 is not set 815# CONFIG_SENSORS_PCF8574 is not set
816# CONFIG_SENSORS_PCA9539 is not set
817# CONFIG_SENSORS_PCF8591 is not set 817# CONFIG_SENSORS_PCF8591 is not set
818# CONFIG_SENSORS_RTC8564 is not set 818# CONFIG_SENSORS_RTC8564 is not set
819# CONFIG_SENSORS_MAX6875 is not set
819# CONFIG_I2C_DEBUG_CORE is not set 820# CONFIG_I2C_DEBUG_CORE is not set
820# CONFIG_I2C_DEBUG_ALGO is not set 821# CONFIG_I2C_DEBUG_ALGO is not set
821# CONFIG_I2C_DEBUG_BUS is not set 822# CONFIG_I2C_DEBUG_BUS is not set
@@ -827,6 +828,11 @@ CONFIG_I2C_ALGOBIT=y
827# CONFIG_W1 is not set 828# CONFIG_W1 is not set
828 829
829# 830#
831# Hardware Monitoring support
832#
833# CONFIG_HWMON is not set
834
835#
830# Misc devices 836# Misc devices
831# 837#
832 838
@@ -933,6 +939,7 @@ CONFIG_USB_DEVICEFS=y
933CONFIG_USB_EHCI_HCD=y 939CONFIG_USB_EHCI_HCD=y
934# CONFIG_USB_EHCI_SPLIT_ISO is not set 940# CONFIG_USB_EHCI_SPLIT_ISO is not set
935# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 941# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
942# CONFIG_USB_ISP116X_HCD is not set
936CONFIG_USB_OHCI_HCD=y 943CONFIG_USB_OHCI_HCD=y
937# CONFIG_USB_OHCI_BIG_ENDIAN is not set 944# CONFIG_USB_OHCI_BIG_ENDIAN is not set
938CONFIG_USB_OHCI_LITTLE_ENDIAN=y 945CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -969,12 +976,15 @@ CONFIG_USB_HIDINPUT=y
969CONFIG_USB_HIDDEV=y 976CONFIG_USB_HIDDEV=y
970# CONFIG_USB_AIPTEK is not set 977# CONFIG_USB_AIPTEK is not set
971# CONFIG_USB_WACOM is not set 978# CONFIG_USB_WACOM is not set
979# CONFIG_USB_ACECAD is not set
972# CONFIG_USB_KBTAB is not set 980# CONFIG_USB_KBTAB is not set
973# CONFIG_USB_POWERMATE is not set 981# CONFIG_USB_POWERMATE is not set
974# CONFIG_USB_MTOUCH is not set 982# CONFIG_USB_MTOUCH is not set
983# CONFIG_USB_ITMTOUCH is not set
975# CONFIG_USB_EGALAX is not set 984# CONFIG_USB_EGALAX is not set
976# CONFIG_USB_XPAD is not set 985# CONFIG_USB_XPAD is not set
977# CONFIG_USB_ATI_REMOTE is not set 986# CONFIG_USB_ATI_REMOTE is not set
987# CONFIG_USB_KEYSPAN_REMOTE is not set
978 988
979# 989#
980# USB Imaging devices 990# USB Imaging devices
@@ -1026,10 +1036,11 @@ CONFIG_USB_MON=y
1026# CONFIG_USB_PHIDGETSERVO is not set 1036# CONFIG_USB_PHIDGETSERVO is not set
1027# CONFIG_USB_IDMOUSE is not set 1037# CONFIG_USB_IDMOUSE is not set
1028# CONFIG_USB_SISUSBVGA is not set 1038# CONFIG_USB_SISUSBVGA is not set
1039# CONFIG_USB_LD is not set
1029# CONFIG_USB_TEST is not set 1040# CONFIG_USB_TEST is not set
1030 1041
1031# 1042#
1032# USB ATM/DSL drivers 1043# USB DSL modem support
1033# 1044#
1034 1045
1035# 1046#
@@ -1046,18 +1057,25 @@ CONFIG_USB_MON=y
1046# InfiniBand support 1057# InfiniBand support
1047# 1058#
1048CONFIG_INFINIBAND=m 1059CONFIG_INFINIBAND=m
1060CONFIG_INFINIBAND_USER_VERBS=m
1049CONFIG_INFINIBAND_MTHCA=m 1061CONFIG_INFINIBAND_MTHCA=m
1050# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1062# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1051CONFIG_INFINIBAND_IPOIB=m 1063CONFIG_INFINIBAND_IPOIB=m
1052# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1064# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1053 1065
1054# 1066#
1067# SN Devices
1068#
1069
1070#
1055# File systems 1071# File systems
1056# 1072#
1057CONFIG_EXT2_FS=y 1073CONFIG_EXT2_FS=y
1058CONFIG_EXT2_FS_XATTR=y 1074CONFIG_EXT2_FS_XATTR=y
1059CONFIG_EXT2_FS_POSIX_ACL=y 1075CONFIG_EXT2_FS_POSIX_ACL=y
1060CONFIG_EXT2_FS_SECURITY=y 1076CONFIG_EXT2_FS_SECURITY=y
1077CONFIG_EXT2_FS_XIP=y
1078CONFIG_FS_XIP=y
1061CONFIG_EXT3_FS=y 1079CONFIG_EXT3_FS=y
1062CONFIG_EXT3_FS_XATTR=y 1080CONFIG_EXT3_FS_XATTR=y
1063CONFIG_EXT3_FS_POSIX_ACL=y 1081CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1089,6 +1107,7 @@ CONFIG_XFS_SECURITY=y
1089CONFIG_XFS_POSIX_ACL=y 1107CONFIG_XFS_POSIX_ACL=y
1090# CONFIG_MINIX_FS is not set 1108# CONFIG_MINIX_FS is not set
1091# CONFIG_ROMFS_FS is not set 1109# CONFIG_ROMFS_FS is not set
1110CONFIG_INOTIFY=y
1092# CONFIG_QUOTA is not set 1111# CONFIG_QUOTA is not set
1093CONFIG_DNOTIFY=y 1112CONFIG_DNOTIFY=y
1094CONFIG_AUTOFS_FS=m 1113CONFIG_AUTOFS_FS=m
@@ -1120,7 +1139,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1120CONFIG_PROC_FS=y 1139CONFIG_PROC_FS=y
1121CONFIG_PROC_KCORE=y 1140CONFIG_PROC_KCORE=y
1122CONFIG_SYSFS=y 1141CONFIG_SYSFS=y
1123# CONFIG_DEVFS_FS is not set
1124CONFIG_DEVPTS_FS_XATTR=y 1142CONFIG_DEVPTS_FS_XATTR=y
1125CONFIG_DEVPTS_FS_SECURITY=y 1143CONFIG_DEVPTS_FS_SECURITY=y
1126CONFIG_TMPFS=y 1144CONFIG_TMPFS=y
@@ -1152,15 +1170,20 @@ CONFIG_CRAMFS=y
1152# 1170#
1153CONFIG_NFS_FS=y 1171CONFIG_NFS_FS=y
1154CONFIG_NFS_V3=y 1172CONFIG_NFS_V3=y
1173CONFIG_NFS_V3_ACL=y
1155CONFIG_NFS_V4=y 1174CONFIG_NFS_V4=y
1156# CONFIG_NFS_DIRECTIO is not set 1175# CONFIG_NFS_DIRECTIO is not set
1157CONFIG_NFSD=y 1176CONFIG_NFSD=y
1177CONFIG_NFSD_V2_ACL=y
1158CONFIG_NFSD_V3=y 1178CONFIG_NFSD_V3=y
1179CONFIG_NFSD_V3_ACL=y
1159CONFIG_NFSD_V4=y 1180CONFIG_NFSD_V4=y
1160CONFIG_NFSD_TCP=y 1181CONFIG_NFSD_TCP=y
1161CONFIG_LOCKD=y 1182CONFIG_LOCKD=y
1162CONFIG_LOCKD_V4=y 1183CONFIG_LOCKD_V4=y
1163CONFIG_EXPORTFS=y 1184CONFIG_EXPORTFS=y
1185CONFIG_NFS_ACL_SUPPORT=y
1186CONFIG_NFS_COMMON=y
1164CONFIG_SUNRPC=y 1187CONFIG_SUNRPC=y
1165CONFIG_SUNRPC_GSS=y 1188CONFIG_SUNRPC_GSS=y
1166CONFIG_RPCSEC_GSS_KRB5=y 1189CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/defconfig b/arch/ppc64/defconfig
index b8e2066dde77..fbf1f427ad35 100644
--- a/arch/ppc64/defconfig
+++ b/arch/ppc64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc5-git9 3# Linux kernel version: 2.6.13-rc3
4# Sun Jun 5 09:26:47 2005 4# Wed Jul 13 14:37:07 2005
5# 5#
6CONFIG_64BIT=y 6CONFIG_64BIT=y
7CONFIG_MMU=y 7CONFIG_MMU=y
@@ -73,13 +73,18 @@ CONFIG_SYSVIPC_COMPAT=y
73# CONFIG_PPC_ISERIES is not set 73# CONFIG_PPC_ISERIES is not set
74CONFIG_PPC_MULTIPLATFORM=y 74CONFIG_PPC_MULTIPLATFORM=y
75CONFIG_PPC_PSERIES=y 75CONFIG_PPC_PSERIES=y
76CONFIG_PPC_BPA=y
76CONFIG_PPC_PMAC=y 77CONFIG_PPC_PMAC=y
77CONFIG_PPC_MAPLE=y 78CONFIG_PPC_MAPLE=y
78CONFIG_PPC=y 79CONFIG_PPC=y
79CONFIG_PPC64=y 80CONFIG_PPC64=y
80CONFIG_PPC_OF=y 81CONFIG_PPC_OF=y
82CONFIG_XICS=y
83CONFIG_MPIC=y
84CONFIG_BPA_IIC=y
81CONFIG_ALTIVEC=y 85CONFIG_ALTIVEC=y
82CONFIG_PPC_SPLPAR=y 86CONFIG_PPC_SPLPAR=y
87CONFIG_KEXEC=y
83CONFIG_IBMVIO=y 88CONFIG_IBMVIO=y
84CONFIG_U3_DART=y 89CONFIG_U3_DART=y
85CONFIG_MPIC_BROKEN_U3=y 90CONFIG_MPIC_BROKEN_U3=y
@@ -89,10 +94,30 @@ CONFIG_BOOTX_TEXT=y
89CONFIG_IOMMU_VMERGE=y 94CONFIG_IOMMU_VMERGE=y
90CONFIG_SMP=y 95CONFIG_SMP=y
91CONFIG_NR_CPUS=32 96CONFIG_NR_CPUS=32
97CONFIG_ARCH_SELECT_MEMORY_MODEL=y
98CONFIG_ARCH_FLATMEM_ENABLE=y
92CONFIG_ARCH_DISCONTIGMEM_ENABLE=y 99CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
100CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
101CONFIG_ARCH_SPARSEMEM_ENABLE=y
102CONFIG_SELECT_MEMORY_MODEL=y
103# CONFIG_FLATMEM_MANUAL is not set
104CONFIG_DISCONTIGMEM_MANUAL=y
105# CONFIG_SPARSEMEM_MANUAL is not set
106CONFIG_DISCONTIGMEM=y
107CONFIG_FLAT_NODE_MEM_MAP=y
108CONFIG_NEED_MULTIPLE_NODES=y
109CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
110CONFIG_NODES_SPAN_OTHER_NODES=y
93# CONFIG_NUMA is not set 111# CONFIG_NUMA is not set
94# CONFIG_SCHED_SMT is not set 112# CONFIG_SCHED_SMT is not set
113CONFIG_PREEMPT_NONE=y
114# CONFIG_PREEMPT_VOLUNTARY is not set
95# CONFIG_PREEMPT is not set 115# CONFIG_PREEMPT is not set
116# CONFIG_PREEMPT_BKL is not set
117CONFIG_HZ_100=y
118# CONFIG_HZ_250 is not set
119# CONFIG_HZ_1000 is not set
120CONFIG_HZ=100
96CONFIG_EEH=y 121CONFIG_EEH=y
97CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
98CONFIG_PPC_RTAS=y 123CONFIG_PPC_RTAS=y
@@ -133,6 +158,146 @@ CONFIG_PROC_DEVICETREE=y
133# CONFIG_CMDLINE_BOOL is not set 158# CONFIG_CMDLINE_BOOL is not set
134 159
135# 160#
161# Networking
162#
163CONFIG_NET=y
164
165#
166# Networking options
167#
168CONFIG_PACKET=y
169# CONFIG_PACKET_MMAP is not set
170CONFIG_UNIX=y
171CONFIG_XFRM=y
172CONFIG_XFRM_USER=m
173CONFIG_NET_KEY=m
174CONFIG_INET=y
175CONFIG_IP_MULTICAST=y
176# CONFIG_IP_ADVANCED_ROUTER is not set
177CONFIG_IP_FIB_HASH=y
178# CONFIG_IP_PNP is not set
179CONFIG_NET_IPIP=y
180# CONFIG_NET_IPGRE is not set
181# CONFIG_IP_MROUTE is not set
182# CONFIG_ARPD is not set
183CONFIG_SYN_COOKIES=y
184CONFIG_INET_AH=m
185CONFIG_INET_ESP=m
186CONFIG_INET_IPCOMP=m
187CONFIG_INET_TUNNEL=y
188# CONFIG_IP_TCPDIAG is not set
189# CONFIG_IP_TCPDIAG_IPV6 is not set
190# CONFIG_TCP_CONG_ADVANCED is not set
191CONFIG_TCP_CONG_BIC=y
192
193#
194# IP: Virtual Server Configuration
195#
196# CONFIG_IP_VS is not set
197# CONFIG_IPV6 is not set
198CONFIG_NETFILTER=y
199# CONFIG_NETFILTER_DEBUG is not set
200
201#
202# IP: Netfilter Configuration
203#
204CONFIG_IP_NF_CONNTRACK=m
205CONFIG_IP_NF_CT_ACCT=y
206CONFIG_IP_NF_CONNTRACK_MARK=y
207CONFIG_IP_NF_CT_PROTO_SCTP=m
208CONFIG_IP_NF_FTP=m
209CONFIG_IP_NF_IRC=m
210CONFIG_IP_NF_TFTP=m
211CONFIG_IP_NF_AMANDA=m
212CONFIG_IP_NF_QUEUE=m
213CONFIG_IP_NF_IPTABLES=m
214CONFIG_IP_NF_MATCH_LIMIT=m
215CONFIG_IP_NF_MATCH_IPRANGE=m
216CONFIG_IP_NF_MATCH_MAC=m
217CONFIG_IP_NF_MATCH_PKTTYPE=m
218CONFIG_IP_NF_MATCH_MARK=m
219CONFIG_IP_NF_MATCH_MULTIPORT=m
220CONFIG_IP_NF_MATCH_TOS=m
221CONFIG_IP_NF_MATCH_RECENT=m
222CONFIG_IP_NF_MATCH_ECN=m
223CONFIG_IP_NF_MATCH_DSCP=m
224CONFIG_IP_NF_MATCH_AH_ESP=m
225CONFIG_IP_NF_MATCH_LENGTH=m
226CONFIG_IP_NF_MATCH_TTL=m
227CONFIG_IP_NF_MATCH_TCPMSS=m
228CONFIG_IP_NF_MATCH_HELPER=m
229CONFIG_IP_NF_MATCH_STATE=m
230CONFIG_IP_NF_MATCH_CONNTRACK=m
231CONFIG_IP_NF_MATCH_OWNER=m
232CONFIG_IP_NF_MATCH_ADDRTYPE=m
233CONFIG_IP_NF_MATCH_REALM=m
234CONFIG_IP_NF_MATCH_SCTP=m
235CONFIG_IP_NF_MATCH_COMMENT=m
236CONFIG_IP_NF_MATCH_CONNMARK=m
237CONFIG_IP_NF_MATCH_HASHLIMIT=m
238CONFIG_IP_NF_FILTER=m
239CONFIG_IP_NF_TARGET_REJECT=m
240CONFIG_IP_NF_TARGET_LOG=m
241CONFIG_IP_NF_TARGET_ULOG=m
242CONFIG_IP_NF_TARGET_TCPMSS=m
243CONFIG_IP_NF_NAT=m
244CONFIG_IP_NF_NAT_NEEDED=y
245CONFIG_IP_NF_TARGET_MASQUERADE=m
246CONFIG_IP_NF_TARGET_REDIRECT=m
247CONFIG_IP_NF_TARGET_NETMAP=m
248CONFIG_IP_NF_TARGET_SAME=m
249CONFIG_IP_NF_NAT_SNMP_BASIC=m
250CONFIG_IP_NF_NAT_IRC=m
251CONFIG_IP_NF_NAT_FTP=m
252CONFIG_IP_NF_NAT_TFTP=m
253CONFIG_IP_NF_NAT_AMANDA=m
254CONFIG_IP_NF_MANGLE=m
255CONFIG_IP_NF_TARGET_TOS=m
256CONFIG_IP_NF_TARGET_ECN=m
257CONFIG_IP_NF_TARGET_DSCP=m
258CONFIG_IP_NF_TARGET_MARK=m
259CONFIG_IP_NF_TARGET_CLASSIFY=m
260CONFIG_IP_NF_TARGET_CONNMARK=m
261CONFIG_IP_NF_TARGET_CLUSTERIP=m
262CONFIG_IP_NF_RAW=m
263CONFIG_IP_NF_TARGET_NOTRACK=m
264CONFIG_IP_NF_ARPTABLES=m
265CONFIG_IP_NF_ARPFILTER=m
266CONFIG_IP_NF_ARP_MANGLE=m
267
268#
269# SCTP Configuration (EXPERIMENTAL)
270#
271# CONFIG_IP_SCTP is not set
272# CONFIG_ATM is not set
273# CONFIG_BRIDGE is not set
274# CONFIG_VLAN_8021Q is not set
275# CONFIG_DECNET is not set
276CONFIG_LLC=y
277# CONFIG_LLC2 is not set
278# CONFIG_IPX is not set
279# CONFIG_ATALK is not set
280# CONFIG_X25 is not set
281# CONFIG_LAPB is not set
282# CONFIG_NET_DIVERT is not set
283# CONFIG_ECONET is not set
284# CONFIG_WAN_ROUTER is not set
285# CONFIG_NET_SCHED is not set
286CONFIG_NET_CLS_ROUTE=y
287
288#
289# Network testing
290#
291# CONFIG_NET_PKTGEN is not set
292CONFIG_NETPOLL=y
293CONFIG_NETPOLL_RX=y
294CONFIG_NETPOLL_TRAP=y
295CONFIG_NET_POLL_CONTROLLER=y
296# CONFIG_HAMRADIO is not set
297# CONFIG_IRDA is not set
298# CONFIG_BT is not set
299
300#
136# Device Drivers 301# Device Drivers
137# 302#
138 303
@@ -239,6 +404,7 @@ CONFIG_BLK_DEV_AMD74XX=y
239# CONFIG_BLK_DEV_HPT366 is not set 404# CONFIG_BLK_DEV_HPT366 is not set
240# CONFIG_BLK_DEV_SC1200 is not set 405# CONFIG_BLK_DEV_SC1200 is not set
241# CONFIG_BLK_DEV_PIIX is not set 406# CONFIG_BLK_DEV_PIIX is not set
407# CONFIG_BLK_DEV_IT821X is not set
242# CONFIG_BLK_DEV_NS87415 is not set 408# CONFIG_BLK_DEV_NS87415 is not set
243# CONFIG_BLK_DEV_PDC202XX_OLD is not set 409# CONFIG_BLK_DEV_PDC202XX_OLD is not set
244# CONFIG_BLK_DEV_PDC202XX_NEW is not set 410# CONFIG_BLK_DEV_PDC202XX_NEW is not set
@@ -272,6 +438,7 @@ CONFIG_CHR_DEV_ST=y
272CONFIG_BLK_DEV_SR=y 438CONFIG_BLK_DEV_SR=y
273CONFIG_BLK_DEV_SR_VENDOR=y 439CONFIG_BLK_DEV_SR_VENDOR=y
274CONFIG_CHR_DEV_SG=y 440CONFIG_CHR_DEV_SG=y
441# CONFIG_CHR_DEV_SCH is not set
275 442
276# 443#
277# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 444# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -369,6 +536,8 @@ CONFIG_DM_MULTIPATH_EMC=m
369# Fusion MPT device support 536# Fusion MPT device support
370# 537#
371# CONFIG_FUSION is not set 538# CONFIG_FUSION is not set
539# CONFIG_FUSION_SPI is not set
540# CONFIG_FUSION_FC is not set
372 541
373# 542#
374# IEEE 1394 (FireWire) support 543# IEEE 1394 (FireWire) support
@@ -382,6 +551,7 @@ CONFIG_IEEE1394=y
382# CONFIG_IEEE1394_OUI_DB is not set 551# CONFIG_IEEE1394_OUI_DB is not set
383CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y 552CONFIG_IEEE1394_EXTRA_CONFIG_ROMS=y
384CONFIG_IEEE1394_CONFIG_ROM_IP1394=y 553CONFIG_IEEE1394_CONFIG_ROM_IP1394=y
554# CONFIG_IEEE1394_EXPORT_FULL_API is not set
385 555
386# 556#
387# Device Drivers 557# Device Drivers
@@ -412,151 +582,13 @@ CONFIG_IEEE1394_AMDTP=m
412CONFIG_ADB=y 582CONFIG_ADB=y
413CONFIG_ADB_PMU=y 583CONFIG_ADB_PMU=y
414CONFIG_PMAC_SMU=y 584CONFIG_PMAC_SMU=y
415# CONFIG_PMAC_PBOOK is not set
416# CONFIG_PMAC_BACKLIGHT is not set 585# CONFIG_PMAC_BACKLIGHT is not set
417# CONFIG_INPUT_ADBHID is not set 586# CONFIG_INPUT_ADBHID is not set
418CONFIG_THERM_PM72=y 587CONFIG_THERM_PM72=y
419 588
420# 589#
421# Networking support 590# Network device support
422#
423CONFIG_NET=y
424
425#
426# Networking options
427# 591#
428CONFIG_PACKET=y
429# CONFIG_PACKET_MMAP is not set
430CONFIG_UNIX=y
431CONFIG_NET_KEY=m
432CONFIG_INET=y
433CONFIG_IP_MULTICAST=y
434# CONFIG_IP_ADVANCED_ROUTER is not set
435# CONFIG_IP_PNP is not set
436CONFIG_NET_IPIP=y
437# CONFIG_NET_IPGRE is not set
438# CONFIG_IP_MROUTE is not set
439# CONFIG_ARPD is not set
440CONFIG_SYN_COOKIES=y
441CONFIG_INET_AH=m
442CONFIG_INET_ESP=m
443CONFIG_INET_IPCOMP=m
444CONFIG_INET_TUNNEL=y
445# CONFIG_IP_TCPDIAG is not set
446# CONFIG_IP_TCPDIAG_IPV6 is not set
447
448#
449# IP: Virtual Server Configuration
450#
451# CONFIG_IP_VS is not set
452# CONFIG_IPV6 is not set
453CONFIG_NETFILTER=y
454# CONFIG_NETFILTER_DEBUG is not set
455
456#
457# IP: Netfilter Configuration
458#
459CONFIG_IP_NF_CONNTRACK=m
460CONFIG_IP_NF_CT_ACCT=y
461CONFIG_IP_NF_CONNTRACK_MARK=y
462CONFIG_IP_NF_CT_PROTO_SCTP=m
463CONFIG_IP_NF_FTP=m
464CONFIG_IP_NF_IRC=m
465CONFIG_IP_NF_TFTP=m
466CONFIG_IP_NF_AMANDA=m
467CONFIG_IP_NF_QUEUE=m
468CONFIG_IP_NF_IPTABLES=m
469CONFIG_IP_NF_MATCH_LIMIT=m
470CONFIG_IP_NF_MATCH_IPRANGE=m
471CONFIG_IP_NF_MATCH_MAC=m
472CONFIG_IP_NF_MATCH_PKTTYPE=m
473CONFIG_IP_NF_MATCH_MARK=m
474CONFIG_IP_NF_MATCH_MULTIPORT=m
475CONFIG_IP_NF_MATCH_TOS=m
476CONFIG_IP_NF_MATCH_RECENT=m
477CONFIG_IP_NF_MATCH_ECN=m
478CONFIG_IP_NF_MATCH_DSCP=m
479CONFIG_IP_NF_MATCH_AH_ESP=m
480CONFIG_IP_NF_MATCH_LENGTH=m
481CONFIG_IP_NF_MATCH_TTL=m
482CONFIG_IP_NF_MATCH_TCPMSS=m
483CONFIG_IP_NF_MATCH_HELPER=m
484CONFIG_IP_NF_MATCH_STATE=m
485CONFIG_IP_NF_MATCH_CONNTRACK=m
486CONFIG_IP_NF_MATCH_OWNER=m
487CONFIG_IP_NF_MATCH_ADDRTYPE=m
488CONFIG_IP_NF_MATCH_REALM=m
489CONFIG_IP_NF_MATCH_SCTP=m
490CONFIG_IP_NF_MATCH_COMMENT=m
491CONFIG_IP_NF_MATCH_CONNMARK=m
492CONFIG_IP_NF_MATCH_HASHLIMIT=m
493CONFIG_IP_NF_FILTER=m
494CONFIG_IP_NF_TARGET_REJECT=m
495CONFIG_IP_NF_TARGET_LOG=m
496CONFIG_IP_NF_TARGET_ULOG=m
497CONFIG_IP_NF_TARGET_TCPMSS=m
498CONFIG_IP_NF_NAT=m
499CONFIG_IP_NF_NAT_NEEDED=y
500CONFIG_IP_NF_TARGET_MASQUERADE=m
501CONFIG_IP_NF_TARGET_REDIRECT=m
502CONFIG_IP_NF_TARGET_NETMAP=m
503CONFIG_IP_NF_TARGET_SAME=m
504CONFIG_IP_NF_NAT_SNMP_BASIC=m
505CONFIG_IP_NF_NAT_IRC=m
506CONFIG_IP_NF_NAT_FTP=m
507CONFIG_IP_NF_NAT_TFTP=m
508CONFIG_IP_NF_NAT_AMANDA=m
509CONFIG_IP_NF_MANGLE=m
510CONFIG_IP_NF_TARGET_TOS=m
511CONFIG_IP_NF_TARGET_ECN=m
512CONFIG_IP_NF_TARGET_DSCP=m
513CONFIG_IP_NF_TARGET_MARK=m
514CONFIG_IP_NF_TARGET_CLASSIFY=m
515CONFIG_IP_NF_TARGET_CONNMARK=m
516CONFIG_IP_NF_TARGET_CLUSTERIP=m
517CONFIG_IP_NF_RAW=m
518CONFIG_IP_NF_TARGET_NOTRACK=m
519CONFIG_IP_NF_ARPTABLES=m
520CONFIG_IP_NF_ARPFILTER=m
521CONFIG_IP_NF_ARP_MANGLE=m
522CONFIG_XFRM=y
523CONFIG_XFRM_USER=m
524
525#
526# SCTP Configuration (EXPERIMENTAL)
527#
528# CONFIG_IP_SCTP is not set
529# CONFIG_ATM is not set
530# CONFIG_BRIDGE is not set
531# CONFIG_VLAN_8021Q is not set
532# CONFIG_DECNET is not set
533CONFIG_LLC=y
534# CONFIG_LLC2 is not set
535# CONFIG_IPX is not set
536# CONFIG_ATALK is not set
537# CONFIG_X25 is not set
538# CONFIG_LAPB is not set
539# CONFIG_NET_DIVERT is not set
540# CONFIG_ECONET is not set
541# CONFIG_WAN_ROUTER is not set
542
543#
544# QoS and/or fair queueing
545#
546# CONFIG_NET_SCHED is not set
547CONFIG_NET_CLS_ROUTE=y
548
549#
550# Network testing
551#
552# CONFIG_NET_PKTGEN is not set
553CONFIG_NETPOLL=y
554CONFIG_NETPOLL_RX=y
555CONFIG_NETPOLL_TRAP=y
556CONFIG_NET_POLL_CONTROLLER=y
557# CONFIG_HAMRADIO is not set
558# CONFIG_IRDA is not set
559# CONFIG_BT is not set
560CONFIG_NETDEVICES=y 592CONFIG_NETDEVICES=y
561CONFIG_DUMMY=m 593CONFIG_DUMMY=m
562CONFIG_BONDING=m 594CONFIG_BONDING=m
@@ -616,6 +648,7 @@ CONFIG_E1000=y
616# CONFIG_HAMACHI is not set 648# CONFIG_HAMACHI is not set
617# CONFIG_YELLOWFIN is not set 649# CONFIG_YELLOWFIN is not set
618# CONFIG_R8169 is not set 650# CONFIG_R8169 is not set
651# CONFIG_SKGE is not set
619# CONFIG_SK98LIN is not set 652# CONFIG_SK98LIN is not set
620# CONFIG_VIA_VELOCITY is not set 653# CONFIG_VIA_VELOCITY is not set
621CONFIG_TIGON3=y 654CONFIG_TIGON3=y
@@ -823,50 +856,19 @@ CONFIG_I2C_KEYWEST=y
823# CONFIG_I2C_VIAPRO is not set 856# CONFIG_I2C_VIAPRO is not set
824# CONFIG_I2C_VOODOO3 is not set 857# CONFIG_I2C_VOODOO3 is not set
825# CONFIG_I2C_PCA_ISA is not set 858# CONFIG_I2C_PCA_ISA is not set
859# CONFIG_I2C_SENSOR is not set
826 860
827# 861#
828# Hardware Sensors Chip support 862# Miscellaneous I2C Chip support
829#
830# CONFIG_I2C_SENSOR is not set
831# CONFIG_SENSORS_ADM1021 is not set
832# CONFIG_SENSORS_ADM1025 is not set
833# CONFIG_SENSORS_ADM1026 is not set
834# CONFIG_SENSORS_ADM1031 is not set
835# CONFIG_SENSORS_ASB100 is not set
836# CONFIG_SENSORS_DS1621 is not set
837# CONFIG_SENSORS_FSCHER is not set
838# CONFIG_SENSORS_FSCPOS is not set
839# CONFIG_SENSORS_GL518SM is not set
840# CONFIG_SENSORS_GL520SM is not set
841# CONFIG_SENSORS_IT87 is not set
842# CONFIG_SENSORS_LM63 is not set
843# CONFIG_SENSORS_LM75 is not set
844# CONFIG_SENSORS_LM77 is not set
845# CONFIG_SENSORS_LM78 is not set
846# CONFIG_SENSORS_LM80 is not set
847# CONFIG_SENSORS_LM83 is not set
848# CONFIG_SENSORS_LM85 is not set
849# CONFIG_SENSORS_LM87 is not set
850# CONFIG_SENSORS_LM90 is not set
851# CONFIG_SENSORS_LM92 is not set
852# CONFIG_SENSORS_MAX1619 is not set
853# CONFIG_SENSORS_PC87360 is not set
854# CONFIG_SENSORS_SMSC47B397 is not set
855# CONFIG_SENSORS_SIS5595 is not set
856# CONFIG_SENSORS_SMSC47M1 is not set
857# CONFIG_SENSORS_VIA686A is not set
858# CONFIG_SENSORS_W83781D is not set
859# CONFIG_SENSORS_W83L785TS is not set
860# CONFIG_SENSORS_W83627HF is not set
861
862#
863# Other I2C Chip support
864# 863#
865# CONFIG_SENSORS_DS1337 is not set 864# CONFIG_SENSORS_DS1337 is not set
865# CONFIG_SENSORS_DS1374 is not set
866# CONFIG_SENSORS_EEPROM is not set 866# CONFIG_SENSORS_EEPROM is not set
867# CONFIG_SENSORS_PCF8574 is not set 867# CONFIG_SENSORS_PCF8574 is not set
868# CONFIG_SENSORS_PCA9539 is not set
868# CONFIG_SENSORS_PCF8591 is not set 869# CONFIG_SENSORS_PCF8591 is not set
869# CONFIG_SENSORS_RTC8564 is not set 870# CONFIG_SENSORS_RTC8564 is not set
871# CONFIG_SENSORS_MAX6875 is not set
870# CONFIG_I2C_DEBUG_CORE is not set 872# CONFIG_I2C_DEBUG_CORE is not set
871# CONFIG_I2C_DEBUG_ALGO is not set 873# CONFIG_I2C_DEBUG_ALGO is not set
872# CONFIG_I2C_DEBUG_BUS is not set 874# CONFIG_I2C_DEBUG_BUS is not set
@@ -878,6 +880,11 @@ CONFIG_I2C_KEYWEST=y
878# CONFIG_W1 is not set 880# CONFIG_W1 is not set
879 881
880# 882#
883# Hardware Monitoring support
884#
885# CONFIG_HWMON is not set
886
887#
881# Misc devices 888# Misc devices
882# 889#
883 890
@@ -988,6 +995,7 @@ CONFIG_USB_DEVICEFS=y
988CONFIG_USB_EHCI_HCD=y 995CONFIG_USB_EHCI_HCD=y
989# CONFIG_USB_EHCI_SPLIT_ISO is not set 996# CONFIG_USB_EHCI_SPLIT_ISO is not set
990# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 997# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
998# CONFIG_USB_ISP116X_HCD is not set
991CONFIG_USB_OHCI_HCD=y 999CONFIG_USB_OHCI_HCD=y
992# CONFIG_USB_OHCI_BIG_ENDIAN is not set 1000# CONFIG_USB_OHCI_BIG_ENDIAN is not set
993CONFIG_USB_OHCI_LITTLE_ENDIAN=y 1001CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -1024,12 +1032,15 @@ CONFIG_USB_HIDINPUT=y
1024CONFIG_USB_HIDDEV=y 1032CONFIG_USB_HIDDEV=y
1025# CONFIG_USB_AIPTEK is not set 1033# CONFIG_USB_AIPTEK is not set
1026# CONFIG_USB_WACOM is not set 1034# CONFIG_USB_WACOM is not set
1035# CONFIG_USB_ACECAD is not set
1027# CONFIG_USB_KBTAB is not set 1036# CONFIG_USB_KBTAB is not set
1028# CONFIG_USB_POWERMATE is not set 1037# CONFIG_USB_POWERMATE is not set
1029# CONFIG_USB_MTOUCH is not set 1038# CONFIG_USB_MTOUCH is not set
1039# CONFIG_USB_ITMTOUCH is not set
1030# CONFIG_USB_EGALAX is not set 1040# CONFIG_USB_EGALAX is not set
1031# CONFIG_USB_XPAD is not set 1041# CONFIG_USB_XPAD is not set
1032# CONFIG_USB_ATI_REMOTE is not set 1042# CONFIG_USB_ATI_REMOTE is not set
1043# CONFIG_USB_KEYSPAN_REMOTE is not set
1033 1044
1034# 1045#
1035# USB Imaging devices 1046# USB Imaging devices
@@ -1081,10 +1092,11 @@ CONFIG_USB_PEGASUS=y
1081# CONFIG_USB_PHIDGETSERVO is not set 1092# CONFIG_USB_PHIDGETSERVO is not set
1082# CONFIG_USB_IDMOUSE is not set 1093# CONFIG_USB_IDMOUSE is not set
1083# CONFIG_USB_SISUSBVGA is not set 1094# CONFIG_USB_SISUSBVGA is not set
1095# CONFIG_USB_LD is not set
1084# CONFIG_USB_TEST is not set 1096# CONFIG_USB_TEST is not set
1085 1097
1086# 1098#
1087# USB ATM/DSL drivers 1099# USB DSL modem support
1088# 1100#
1089 1101
1090# 1102#
@@ -1101,18 +1113,25 @@ CONFIG_USB_PEGASUS=y
1101# InfiniBand support 1113# InfiniBand support
1102# 1114#
1103CONFIG_INFINIBAND=m 1115CONFIG_INFINIBAND=m
1116CONFIG_INFINIBAND_USER_VERBS=m
1104CONFIG_INFINIBAND_MTHCA=m 1117CONFIG_INFINIBAND_MTHCA=m
1105# CONFIG_INFINIBAND_MTHCA_DEBUG is not set 1118# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1106CONFIG_INFINIBAND_IPOIB=m 1119CONFIG_INFINIBAND_IPOIB=m
1107# CONFIG_INFINIBAND_IPOIB_DEBUG is not set 1120# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1108 1121
1109# 1122#
1123# SN Devices
1124#
1125
1126#
1110# File systems 1127# File systems
1111# 1128#
1112CONFIG_EXT2_FS=y 1129CONFIG_EXT2_FS=y
1113CONFIG_EXT2_FS_XATTR=y 1130CONFIG_EXT2_FS_XATTR=y
1114CONFIG_EXT2_FS_POSIX_ACL=y 1131CONFIG_EXT2_FS_POSIX_ACL=y
1115CONFIG_EXT2_FS_SECURITY=y 1132CONFIG_EXT2_FS_SECURITY=y
1133CONFIG_EXT2_FS_XIP=y
1134CONFIG_FS_XIP=y
1116CONFIG_EXT3_FS=y 1135CONFIG_EXT3_FS=y
1117CONFIG_EXT3_FS_XATTR=y 1136CONFIG_EXT3_FS_XATTR=y
1118CONFIG_EXT3_FS_POSIX_ACL=y 1137CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1144,6 +1163,7 @@ CONFIG_XFS_SECURITY=y
1144CONFIG_XFS_POSIX_ACL=y 1163CONFIG_XFS_POSIX_ACL=y
1145# CONFIG_MINIX_FS is not set 1164# CONFIG_MINIX_FS is not set
1146# CONFIG_ROMFS_FS is not set 1165# CONFIG_ROMFS_FS is not set
1166CONFIG_INOTIFY=y
1147# CONFIG_QUOTA is not set 1167# CONFIG_QUOTA is not set
1148CONFIG_DNOTIFY=y 1168CONFIG_DNOTIFY=y
1149CONFIG_AUTOFS_FS=y 1169CONFIG_AUTOFS_FS=y
@@ -1174,7 +1194,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1174CONFIG_PROC_FS=y 1194CONFIG_PROC_FS=y
1175CONFIG_PROC_KCORE=y 1195CONFIG_PROC_KCORE=y
1176CONFIG_SYSFS=y 1196CONFIG_SYSFS=y
1177# CONFIG_DEVFS_FS is not set
1178CONFIG_DEVPTS_FS_XATTR=y 1197CONFIG_DEVPTS_FS_XATTR=y
1179CONFIG_DEVPTS_FS_SECURITY=y 1198CONFIG_DEVPTS_FS_SECURITY=y
1180CONFIG_TMPFS=y 1199CONFIG_TMPFS=y
@@ -1206,15 +1225,20 @@ CONFIG_CRAMFS=y
1206# 1225#
1207CONFIG_NFS_FS=y 1226CONFIG_NFS_FS=y
1208CONFIG_NFS_V3=y 1227CONFIG_NFS_V3=y
1228CONFIG_NFS_V3_ACL=y
1209CONFIG_NFS_V4=y 1229CONFIG_NFS_V4=y
1210# CONFIG_NFS_DIRECTIO is not set 1230# CONFIG_NFS_DIRECTIO is not set
1211CONFIG_NFSD=m 1231CONFIG_NFSD=m
1232CONFIG_NFSD_V2_ACL=y
1212CONFIG_NFSD_V3=y 1233CONFIG_NFSD_V3=y
1234CONFIG_NFSD_V3_ACL=y
1213CONFIG_NFSD_V4=y 1235CONFIG_NFSD_V4=y
1214CONFIG_NFSD_TCP=y 1236CONFIG_NFSD_TCP=y
1215CONFIG_LOCKD=y 1237CONFIG_LOCKD=y
1216CONFIG_LOCKD_V4=y 1238CONFIG_LOCKD_V4=y
1217CONFIG_EXPORTFS=m 1239CONFIG_EXPORTFS=m
1240CONFIG_NFS_ACL_SUPPORT=y
1241CONFIG_NFS_COMMON=y
1218CONFIG_SUNRPC=y 1242CONFIG_SUNRPC=y
1219CONFIG_SUNRPC_GSS=y 1243CONFIG_SUNRPC_GSS=y
1220CONFIG_RPCSEC_GSS_KRB5=y 1244CONFIG_RPCSEC_GSS_KRB5=y
diff --git a/arch/ppc64/kernel/LparData.c b/arch/ppc64/kernel/LparData.c
index 6ffcf67dd507..76cfd1449d52 100644
--- a/arch/ppc64/kernel/LparData.c
+++ b/arch/ppc64/kernel/LparData.c
@@ -33,17 +33,36 @@
33 * the hypervisor and Linux. 33 * the hypervisor and Linux.
34 */ 34 */
35 35
36/*
37 * WARNING - magic here
38 *
39 * Ok, this is a horrid hack below, but marginally better than the
40 * alternatives. What we really want is just to initialize
41 * hvReleaseData in C as in the #if 0 section here. However, gcc
42 * refuses to believe that (u32)&x is a constant expression, so will
43 * not allow the xMsNucDataOffset field to be properly initialized.
44 * So, we declare hvReleaseData in inline asm instead. We use inline
45 * asm, rather than a .S file, because the assembler won't generate
46 * the necessary relocation for the LparMap either, unless that symbol
47 * is declared in the same source file. Finally, we put the asm in a
48 * dummy, attribute-used function, instead of at file scope, because
49 * file scope asms don't allow contraints. We want to use the "i"
50 * constraints to put sizeof() and offsetof() expressions in there,
51 * because including asm/offsets.h in C code then stringifying causes
52 * all manner of warnings.
53 */
54#if 0
36struct HvReleaseData hvReleaseData = { 55struct HvReleaseData hvReleaseData = {
37 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */ 56 .xDesc = 0xc8a5d9c4, /* "HvRD" ebcdic */
38 .xSize = sizeof(struct HvReleaseData), 57 .xSize = sizeof(struct HvReleaseData),
39 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas), 58 .xVpdAreasPtrOffset = offsetof(struct naca_struct, xItVpdAreas),
40 .xSlicNacaAddr = &naca, /* 64-bit Naca address */ 59 .xSlicNacaAddr = &naca, /* 64-bit Naca address */
41 .xMsNucDataOffset = 0x4800, /* offset of LparMap within loadarea (see head.S) */ 60 .xMsNucDataOffset = (u32)((unsigned long)&xLparMap - KERNELBASE),
42 .xTagsMode = 1, /* tags inactive */ 61 .xFlags = HVREL_TAGSINACTIVE /* tags inactive */
43 .xAddressSize = 0, /* 64 bit */ 62 /* 64 bit */
44 .xNoSharedProcs = 0, /* shared processors */ 63 /* shared processors */
45 .xNoHMT = 0, /* HMT allowed */ 64 /* HMT allowed */
46 .xRsvd2 = 6, /* TEMP: This allows non-GA driver */ 65 | 6, /* TEMP: This allows non-GA driver */
47 .xVrmIndex = 4, /* We are v5r2m0 */ 66 .xVrmIndex = 4, /* We are v5r2m0 */
48 .xMinSupportedPlicVrmIndex = 3, /* v5r1m0 */ 67 .xMinSupportedPlicVrmIndex = 3, /* v5r1m0 */
49 .xMinCompatablePlicVrmIndex = 3, /* v5r1m0 */ 68 .xMinCompatablePlicVrmIndex = 3, /* v5r1m0 */
@@ -51,6 +70,63 @@ struct HvReleaseData hvReleaseData = {
51 0xa7, 0x40, 0xf2, 0x4b, 70 0xa7, 0x40, 0xf2, 0x4b,
52 0xf4, 0x4b, 0xf6, 0xf4 }, 71 0xf4, 0x4b, 0xf6, 0xf4 },
53}; 72};
73#endif
74
75
76extern struct HvReleaseData hvReleaseData;
77
78static void __attribute_used__ hvReleaseData_wrapper(void)
79{
80 /* This doesn't appear to need any alignment (even 4 byte) */
81 asm volatile (
82 " lparMapPhys = xLparMap - %3\n"
83 " .data\n"
84 " .globl hvReleaseData\n"
85 "hvReleaseData:\n"
86 " .long 0xc8a5d9c4\n" /* xDesc */
87 /* "HvRD" in ebcdic */
88 " .short %0\n" /* xSize */
89 " .short %1\n" /* xVpdAreasPtrOffset */
90 " .llong naca\n" /* xSlicNacaAddr */
91 " .long lparMapPhys\n" /* xMsNucDataOffset */
92 " .long 0\n" /* xRsvd1 */
93 " .short %2\n" /* xFlags */
94 " .short 4\n" /* xVrmIndex - v5r2m0 */
95 " .short 3\n" /* xMinSupportedPlicVrmIndex - v5r1m0 */
96 " .short 3\n" /* xMinCompatablePlicVrmIndex - v5r1m0 */
97 " .long 0xd38995a4\n" /* xVrmName */
98 " .long 0xa740f24b\n" /* "Linux 2.4.64" ebcdic */
99 " .long 0xf44bf6f4\n"
100 " . = hvReleaseData + %0\n"
101 " .previous\n"
102 : : "i"(sizeof(hvReleaseData)),
103 "i"(offsetof(struct naca_struct, xItVpdAreas)),
104 "i"(HVREL_TAGSINACTIVE /* tags inactive, 64 bit, */
105 /* shared processors, HMT allowed */
106 | 6), /* TEMP: This allows non-GA drivers */
107 "i"(KERNELBASE)
108 );
109}
110
111struct LparMap __attribute__((aligned (16))) xLparMap = {
112 .xNumberEsids = HvEsidsToMap,
113 .xNumberRanges = HvRangesToMap,
114 .xSegmentTableOffs = STAB0_PAGE,
115
116 .xEsids = {
117 { .xKernelEsid = GET_ESID(KERNELBASE),
118 .xKernelVsid = KERNEL_VSID(KERNELBASE), },
119 { .xKernelEsid = GET_ESID(VMALLOCBASE),
120 .xKernelVsid = KERNEL_VSID(VMALLOCBASE), },
121 },
122
123 .xRanges = {
124 { .xPages = HvPagesToMap,
125 .xOffset = 0,
126 .xVPN = KERNEL_VSID(KERNELBASE) << (SID_SHIFT - PAGE_SHIFT),
127 },
128 },
129};
54 130
55extern void system_reset_iSeries(void); 131extern void system_reset_iSeries(void);
56extern void machine_check_iSeries(void); 132extern void machine_check_iSeries(void);
diff --git a/arch/ppc64/kernel/head.S b/arch/ppc64/kernel/head.S
index 93ebcac0d5a2..74fc3bc68604 100644
--- a/arch/ppc64/kernel/head.S
+++ b/arch/ppc64/kernel/head.S
@@ -522,36 +522,9 @@ __end_interrupts:
522#ifdef CONFIG_PPC_ISERIES 522#ifdef CONFIG_PPC_ISERIES
523 .globl naca 523 .globl naca
524naca: 524naca:
525 .llong itVpdAreas 525 .llong itVpdAreas
526 526 .llong 0 /* xRamDisk */
527 /* 527 .llong 0 /* xRamDiskSize */
528 * The iSeries LPAR map is at this fixed address
529 * so that the HvReleaseData structure can address
530 * it with a 32-bit offset.
531 *
532 * The VSID values below are dependent on the
533 * VSID generation algorithm. See include/asm/mmu_context.h.
534 */
535
536 . = 0x4800
537
538 .llong 2 /* # ESIDs to be mapped by hypervisor */
539 .llong 1 /* # memory ranges to be mapped by hypervisor */
540 .llong STAB0_PAGE /* Page # of segment table within load area */
541 .llong 0 /* Reserved */
542 .llong 0 /* Reserved */
543 .llong 0 /* Reserved */
544 .llong 0 /* Reserved */
545 .llong 0 /* Reserved */
546 .llong (KERNELBASE>>SID_SHIFT)
547 .llong 0x408f92c94 /* KERNELBASE VSID */
548 /* We have to list the bolted VMALLOC segment here, too, so that it
549 * will be restored on shared processor switch */
550 .llong (VMALLOCBASE>>SID_SHIFT)
551 .llong 0xf09b89af5 /* VMALLOCBASE VSID */
552 .llong 8192 /* # pages to map (32 MB) */
553 .llong 0 /* Offset from start of loadarea to start of map */
554 .llong 0x408f92c940000 /* VPN of first page to map */
555 528
556 . = 0x6100 529 . = 0x6100
557 530
@@ -2131,13 +2104,6 @@ empty_zero_page:
2131swapper_pg_dir: 2104swapper_pg_dir:
2132 .space 4096 2105 .space 4096
2133 2106
2134#ifdef CONFIG_SMP
2135/* 1 page segment table per cpu (max 48, cpu0 allocated at STAB0_PHYS_ADDR) */
2136 .globl stab_array
2137stab_array:
2138 .space 4096 * 48
2139#endif
2140
2141/* 2107/*
2142 * This space gets a copy of optional info passed to us by the bootstrap 2108 * This space gets a copy of optional info passed to us by the bootstrap
2143 * Used to pass parameters into the kernel like root=/dev/sda1, etc. 2109 * Used to pass parameters into the kernel like root=/dev/sda1, etc.
diff --git a/arch/ppc64/kernel/pmac_setup.c b/arch/ppc64/kernel/pmac_setup.c
index 3013cdb5f933..e40877fa67cd 100644
--- a/arch/ppc64/kernel/pmac_setup.c
+++ b/arch/ppc64/kernel/pmac_setup.c
@@ -97,7 +97,7 @@ EXPORT_SYMBOL(smu_cmdbuf_abs);
97 97
98extern void udbg_init_scc(struct device_node *np); 98extern void udbg_init_scc(struct device_node *np);
99 99
100void __pmac pmac_show_cpuinfo(struct seq_file *m) 100static void __pmac pmac_show_cpuinfo(struct seq_file *m)
101{ 101{
102 struct device_node *np; 102 struct device_node *np;
103 char *pp; 103 char *pp;
@@ -144,7 +144,7 @@ void __pmac pmac_show_cpuinfo(struct seq_file *m)
144} 144}
145 145
146 146
147void __init pmac_setup_arch(void) 147static void __init pmac_setup_arch(void)
148{ 148{
149 /* init to some ~sane value until calibrate_delay() runs */ 149 /* init to some ~sane value until calibrate_delay() runs */
150 loops_per_jiffy = 50000000; 150 loops_per_jiffy = 50000000;
@@ -230,7 +230,7 @@ void __pmac note_bootable_part(dev_t dev, int part, int goodness)
230 } 230 }
231} 231}
232 232
233void __pmac pmac_restart(char *cmd) 233static void __pmac pmac_restart(char *cmd)
234{ 234{
235 switch(sys_ctrler) { 235 switch(sys_ctrler) {
236#ifdef CONFIG_ADB_PMU 236#ifdef CONFIG_ADB_PMU
@@ -249,7 +249,7 @@ void __pmac pmac_restart(char *cmd)
249 } 249 }
250} 250}
251 251
252void __pmac pmac_power_off(void) 252static void __pmac pmac_power_off(void)
253{ 253{
254 switch(sys_ctrler) { 254 switch(sys_ctrler) {
255#ifdef CONFIG_ADB_PMU 255#ifdef CONFIG_ADB_PMU
@@ -267,7 +267,7 @@ void __pmac pmac_power_off(void)
267 } 267 }
268} 268}
269 269
270void __pmac pmac_halt(void) 270static void __pmac pmac_halt(void)
271{ 271{
272 pmac_power_off(); 272 pmac_power_off();
273} 273}
@@ -327,7 +327,7 @@ static void __init init_boot_display(void)
327/* 327/*
328 * Early initialization. 328 * Early initialization.
329 */ 329 */
330void __init pmac_init_early(void) 330static void __init pmac_init_early(void)
331{ 331{
332 DBG(" -> pmac_init_early\n"); 332 DBG(" -> pmac_init_early\n");
333 333
diff --git a/arch/ppc64/kernel/setup.c b/arch/ppc64/kernel/setup.c
index d1b33f0b26cb..687e85595208 100644
--- a/arch/ppc64/kernel/setup.c
+++ b/arch/ppc64/kernel/setup.c
@@ -694,7 +694,6 @@ void machine_restart(char *cmd)
694 local_irq_disable(); 694 local_irq_disable();
695 while (1) ; 695 while (1) ;
696} 696}
697EXPORT_SYMBOL(machine_restart);
698 697
699void machine_power_off(void) 698void machine_power_off(void)
700{ 699{
@@ -707,7 +706,6 @@ void machine_power_off(void)
707 local_irq_disable(); 706 local_irq_disable();
708 while (1) ; 707 while (1) ;
709} 708}
710EXPORT_SYMBOL(machine_power_off);
711 709
712void machine_halt(void) 710void machine_halt(void)
713{ 711{
@@ -720,7 +718,6 @@ void machine_halt(void)
720 local_irq_disable(); 718 local_irq_disable();
721 while (1) ; 719 while (1) ;
722} 720}
723EXPORT_SYMBOL(machine_halt);
724 721
725static int ppc64_panic_event(struct notifier_block *this, 722static int ppc64_panic_event(struct notifier_block *this,
726 unsigned long event, void *ptr) 723 unsigned long event, void *ptr)
@@ -1071,6 +1068,8 @@ void __init setup_arch(char **cmdline_p)
1071 irqstack_early_init(); 1068 irqstack_early_init();
1072 emergency_stack_init(); 1069 emergency_stack_init();
1073 1070
1071 stabs_alloc();
1072
1074 /* set up the bootmem stuff with available memory */ 1073 /* set up the bootmem stuff with available memory */
1075 do_init_bootmem(); 1074 do_init_bootmem();
1076 sparse_init(); 1075 sparse_init();
diff --git a/arch/ppc64/kernel/smp.c b/arch/ppc64/kernel/smp.c
index 2fcddfcb594d..793b562da653 100644
--- a/arch/ppc64/kernel/smp.c
+++ b/arch/ppc64/kernel/smp.c
@@ -65,8 +65,6 @@ struct smp_ops_t *smp_ops;
65 65
66static volatile unsigned int cpu_callin_map[NR_CPUS]; 66static volatile unsigned int cpu_callin_map[NR_CPUS];
67 67
68extern unsigned char stab_array[];
69
70void smp_call_function_interrupt(void); 68void smp_call_function_interrupt(void);
71 69
72int smt_enabled_at_boot = 1; 70int smt_enabled_at_boot = 1;
@@ -492,19 +490,6 @@ int __devinit __cpu_up(unsigned int cpu)
492 490
493 paca[cpu].default_decr = tb_ticks_per_jiffy; 491 paca[cpu].default_decr = tb_ticks_per_jiffy;
494 492
495 if (!cpu_has_feature(CPU_FTR_SLB)) {
496 void *tmp;
497
498 /* maximum of 48 CPUs on machines with a segment table */
499 if (cpu >= 48)
500 BUG();
501
502 tmp = &stab_array[PAGE_SIZE * cpu];
503 memset(tmp, 0, PAGE_SIZE);
504 paca[cpu].stab_addr = (unsigned long)tmp;
505 paca[cpu].stab_real = virt_to_abs(tmp);
506 }
507
508 /* Make sure callin-map entry is 0 (can be leftover a CPU 493 /* Make sure callin-map entry is 0 (can be leftover a CPU
509 * hotplug 494 * hotplug
510 */ 495 */
diff --git a/arch/ppc64/kernel/udbg.c b/arch/ppc64/kernel/udbg.c
index d4ccd6f1ef47..c0da45540f0f 100644
--- a/arch/ppc64/kernel/udbg.c
+++ b/arch/ppc64/kernel/udbg.c
@@ -141,7 +141,7 @@ void udbg_init_scc(struct device_node *np)
141 141
142#endif /* CONFIG_PPC_PMAC */ 142#endif /* CONFIG_PPC_PMAC */
143 143
144#if CONFIG_PPC_PMAC 144#ifdef CONFIG_PPC_PMAC
145static void udbg_real_putc(unsigned char c) 145static void udbg_real_putc(unsigned char c)
146{ 146{
147 while ((real_readb(sccc) & SCC_TXRDY) == 0) 147 while ((real_readb(sccc) & SCC_TXRDY) == 0)
diff --git a/arch/ppc64/mm/stab.c b/arch/ppc64/mm/stab.c
index df4bbe14153c..1b83f002bf27 100644
--- a/arch/ppc64/mm/stab.c
+++ b/arch/ppc64/mm/stab.c
@@ -18,6 +18,8 @@
18#include <asm/mmu_context.h> 18#include <asm/mmu_context.h>
19#include <asm/paca.h> 19#include <asm/paca.h>
20#include <asm/cputable.h> 20#include <asm/cputable.h>
21#include <asm/lmb.h>
22#include <asm/abs_addr.h>
21 23
22struct stab_entry { 24struct stab_entry {
23 unsigned long esid_data; 25 unsigned long esid_data;
@@ -224,6 +226,39 @@ void switch_stab(struct task_struct *tsk, struct mm_struct *mm)
224extern void slb_initialize(void); 226extern void slb_initialize(void);
225 227
226/* 228/*
229 * Allocate segment tables for secondary CPUs. These must all go in
230 * the first (bolted) segment, so that do_stab_bolted won't get a
231 * recursive segment miss on the segment table itself.
232 */
233void stabs_alloc(void)
234{
235 int cpu;
236
237 if (cpu_has_feature(CPU_FTR_SLB))
238 return;
239
240 for_each_cpu(cpu) {
241 unsigned long newstab;
242
243 if (cpu == 0)
244 continue; /* stab for CPU 0 is statically allocated */
245
246 newstab = lmb_alloc_base(PAGE_SIZE, PAGE_SIZE, 1<<SID_SHIFT);
247 if (! newstab)
248 panic("Unable to allocate segment table for CPU %d.\n",
249 cpu);
250
251 newstab += KERNELBASE;
252
253 memset((void *)newstab, 0, PAGE_SIZE);
254
255 paca[cpu].stab_addr = newstab;
256 paca[cpu].stab_real = virt_to_abs(newstab);
257 printk(KERN_DEBUG "Segment table for CPU %d at 0x%lx virtual, 0x%lx absolute\n", cpu, paca[cpu].stab_addr, paca[cpu].stab_real);
258 }
259}
260
261/*
227 * Build an entry for the base kernel segment and put it into 262 * Build an entry for the base kernel segment and put it into
228 * the segment table or SLB. All other segment table or SLB 263 * the segment table or SLB. All other segment table or SLB
229 * entries are faulted in. 264 * entries are faulted in.
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index 5b262b5d869f..1a271b16cb5c 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -690,9 +690,9 @@ mcck_int_handler:
690 bo BASED(0f) 690 bo BASED(0f)
691 spt __LC_LAST_UPDATE_TIMER # revalidate cpu timer 691 spt __LC_LAST_UPDATE_TIMER # revalidate cpu timer
692#ifdef CONFIG_VIRT_CPU_ACCOUNTING 692#ifdef CONFIG_VIRT_CPU_ACCOUNTING
693 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 693 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
694 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 694 mvc __LC_SYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
695 mvc __LC_LAST_UPDATE_TIMER(8),__LC_EXIT_TIMER 695 mvc __LC_EXIT_TIMER(8),__LC_LAST_UPDATE_TIMER
6960: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? 6960: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid?
697 bno BASED(mcck_no_vtime) # no -> skip cleanup critical 697 bno BASED(mcck_no_vtime) # no -> skip cleanup critical
698 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ? 698 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ?
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 57ca75d0ad7f..d9f22915008c 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -727,9 +727,9 @@ mcck_int_handler:
727 jo 0f 727 jo 0f
728 spt __LC_LAST_UPDATE_TIMER 728 spt __LC_LAST_UPDATE_TIMER
729#ifdef CONFIG_VIRT_CPU_ACCOUNTING 729#ifdef CONFIG_VIRT_CPU_ACCOUNTING
730 mvc __LC_LAST_UPDATE_TIMER(8),__LC_ASYNC_ENTER_TIMER 730 mvc __LC_ASYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
731 mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER 731 mvc __LC_SYNC_ENTER_TIMER(8),__LC_LAST_UPDATE_TIMER
732 mvc __LC_LAST_UPDATE_TIMER(8),__LC_EXIT_TIMER 732 mvc __LC_EXIT_TIMER(8),__LC_LAST_UPDATE_TIMER
7330: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid? 7330: tm __LC_MCCK_CODE+2,0x08 # mwp of old psw valid?
734 jno mcck_no_vtime # no -> no timer update 734 jno mcck_no_vtime # no -> no timer update
735 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ? 735 tm __LC_MCK_OLD_PSW+1,0x01 # interrupting from user ?
diff --git a/arch/s390/kernel/head.S b/arch/s390/kernel/head.S
index fc8bf5e285f6..d12cff11b4bc 100644
--- a/arch/s390/kernel/head.S
+++ b/arch/s390/kernel/head.S
@@ -535,8 +535,13 @@ startup:basr %r13,0 # get base
535 lhi %r1,0 535 lhi %r1,0
536 icm %r1,3,.Lscpincr1-PARMAREA(%r4) # use this one if != 0 536 icm %r1,3,.Lscpincr1-PARMAREA(%r4) # use this one if != 0
537 jnz .Lscnd 537 jnz .Lscnd
538 l %r1,.Lscpincr2-PARMAREA+4(%r4) # otherwise use this one 538 lhi %r1,0x800 # otherwise report 2GB
539.Lscnd: 539.Lscnd:
540 lhi %r3,0x800 # limit reported memory size to 2GB
541 cr %r1,%r3
542 jl .Lno2gb
543 lr %r1,%r3
544.Lno2gb:
540 xr %r3,%r3 # same logic 545 xr %r3,%r3 # same logic
541 ic %r3,.Lscpa1-PARMAREA(%r4) 546 ic %r3,.Lscpa1-PARMAREA(%r4)
542 chi %r3,0x00 547 chi %r3,0x00
@@ -765,7 +770,7 @@ _stext: basr %r13,0 # get base
765 770
766# check control registers 771# check control registers
767 stctl %c0,%c15,0(%r15) 772 stctl %c0,%c15,0(%r15)
768 oi 2(%r15),0x20 # enable sigp external interrupts 773 oi 2(%r15),0x40 # enable sigp emergency signal
769 oi 0(%r15),0x10 # switch on low address protection 774 oi 0(%r15),0x10 # switch on low address protection
770 lctl %c0,%c15,0(%r15) 775 lctl %c0,%c15,0(%r15)
771 776
diff --git a/arch/s390/kernel/head64.S b/arch/s390/kernel/head64.S
index f525c0c21250..10bc592c3637 100644
--- a/arch/s390/kernel/head64.S
+++ b/arch/s390/kernel/head64.S
@@ -658,10 +658,8 @@ startup:basr %r13,0 # get base
658# 658#
659 la %r1,0f-.LPG1(%r13) # set program check address 659 la %r1,0f-.LPG1(%r13) # set program check address
660 stg %r1,__LC_PGM_NEW_PSW+8 660 stg %r1,__LC_PGM_NEW_PSW+8
661 mvc __LC_DIAG44_OPCODE(8),.Lnop-.LPG1(%r13)
662 diag 0,0,0x44 # test diag 0x44 661 diag 0,0,0x44 # test diag 0x44
663 oi 7(%r12),32 # set diag44 flag 662 oi 7(%r12),32 # set diag44 flag
664 mvc __LC_DIAG44_OPCODE(8),.Ldiag44-.LPG1(%r13)
6650: 6630:
666 664
667# 665#
@@ -702,7 +700,6 @@ startup:basr %r13,0 # get base
702.L4malign:.quad 0xffffffffffc00000 700.L4malign:.quad 0xffffffffffc00000
703.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8 701.Lscan2g:.quad 0x80000000 + 0x20000 - 8 # 2GB + 128K - 8
704.Lnop: .long 0x07000700 702.Lnop: .long 0x07000700
705.Ldiag44:.long 0x83000044
706 703
707 .org PARMAREA-64 704 .org PARMAREA-64
708.Lduct: .long 0,0,0,0,0,0,0,0 705.Lduct: .long 0,0,0,0,0,0,0,0
@@ -765,7 +762,7 @@ _stext: basr %r13,0 # get base
765 762
766# check control registers 763# check control registers
767 stctg %c0,%c15,0(%r15) 764 stctg %c0,%c15,0(%r15)
768 oi 6(%r15),0x20 # enable sigp external interrupts 765 oi 6(%r15),0x40 # enable sigp emergency signal
769 oi 4(%r15),0x10 # switch on low address proctection 766 oi 4(%r15),0x10 # switch on low address proctection
770 lctlg %c0,%c15,0(%r15) 767 lctlg %c0,%c15,0(%r15)
771 768
diff --git a/arch/s390/kernel/s390_ext.c b/arch/s390/kernel/s390_ext.c
index 3bdd38ec71da..207bc511a6e3 100644
--- a/arch/s390/kernel/s390_ext.c
+++ b/arch/s390/kernel/s390_ext.c
@@ -19,7 +19,6 @@
19#include <asm/irq.h> 19#include <asm/irq.h>
20 20
21/* 21/*
22 * Simple hash strategy: index = code & 0xff;
23 * ext_int_hash[index] is the start of the list for all external interrupts 22 * ext_int_hash[index] is the start of the list for all external interrupts
24 * that hash to this index. With the current set of external interrupts 23 * that hash to this index. With the current set of external interrupts
25 * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000 24 * (0x1202 external call, 0x1004 cpu timer, 0x2401 hwc console, 0x4000
@@ -27,6 +26,11 @@
27 */ 26 */
28ext_int_info_t *ext_int_hash[256] = { 0, }; 27ext_int_info_t *ext_int_hash[256] = { 0, };
29 28
29static inline int ext_hash(__u16 code)
30{
31 return (code + (code >> 9)) & 0xff;
32}
33
30int register_external_interrupt(__u16 code, ext_int_handler_t handler) 34int register_external_interrupt(__u16 code, ext_int_handler_t handler)
31{ 35{
32 ext_int_info_t *p; 36 ext_int_info_t *p;
@@ -37,7 +41,7 @@ int register_external_interrupt(__u16 code, ext_int_handler_t handler)
37 return -ENOMEM; 41 return -ENOMEM;
38 p->code = code; 42 p->code = code;
39 p->handler = handler; 43 p->handler = handler;
40 index = code & 0xff; 44 index = ext_hash(code);
41 p->next = ext_int_hash[index]; 45 p->next = ext_int_hash[index];
42 ext_int_hash[index] = p; 46 ext_int_hash[index] = p;
43 return 0; 47 return 0;
@@ -52,7 +56,7 @@ int register_early_external_interrupt(__u16 code, ext_int_handler_t handler,
52 return -EINVAL; 56 return -EINVAL;
53 p->code = code; 57 p->code = code;
54 p->handler = handler; 58 p->handler = handler;
55 index = code & 0xff; 59 index = ext_hash(code);
56 p->next = ext_int_hash[index]; 60 p->next = ext_int_hash[index];
57 ext_int_hash[index] = p; 61 ext_int_hash[index] = p;
58 return 0; 62 return 0;
@@ -63,7 +67,7 @@ int unregister_external_interrupt(__u16 code, ext_int_handler_t handler)
63 ext_int_info_t *p, *q; 67 ext_int_info_t *p, *q;
64 int index; 68 int index;
65 69
66 index = code & 0xff; 70 index = ext_hash(code);
67 q = NULL; 71 q = NULL;
68 p = ext_int_hash[index]; 72 p = ext_int_hash[index];
69 while (p != NULL) { 73 while (p != NULL) {
@@ -90,7 +94,7 @@ int unregister_early_external_interrupt(__u16 code, ext_int_handler_t handler,
90 94
91 if (p == NULL || p->code != code || p->handler != handler) 95 if (p == NULL || p->code != code || p->handler != handler)
92 return -EINVAL; 96 return -EINVAL;
93 index = code & 0xff; 97 index = ext_hash(code);
94 q = ext_int_hash[index]; 98 q = ext_int_hash[index];
95 if (p != q) { 99 if (p != q) {
96 while (q != NULL) { 100 while (q != NULL) {
@@ -120,7 +124,7 @@ void do_extint(struct pt_regs *regs, unsigned short code)
120 */ 124 */
121 account_ticks(regs); 125 account_ticks(regs);
122 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++; 126 kstat_cpu(smp_processor_id()).irqs[EXTERNAL_INTERRUPT]++;
123 index = code & 0xff; 127 index = ext_hash(code);
124 for (p = ext_int_hash[index]; p; p = p->next) { 128 for (p = ext_int_hash[index]; p; p = p->next) {
125 if (likely(p->code == code)) { 129 if (likely(p->code == code)) {
126 if (likely(p->handler)) 130 if (likely(p->handler))
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index b6d740ac0e6e..5ba5a5485da9 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -299,24 +299,18 @@ void machine_restart(char *command)
299 _machine_restart(command); 299 _machine_restart(command);
300} 300}
301 301
302EXPORT_SYMBOL(machine_restart);
303
304void machine_halt(void) 302void machine_halt(void)
305{ 303{
306 console_unblank(); 304 console_unblank();
307 _machine_halt(); 305 _machine_halt();
308} 306}
309 307
310EXPORT_SYMBOL(machine_halt);
311
312void machine_power_off(void) 308void machine_power_off(void)
313{ 309{
314 console_unblank(); 310 console_unblank();
315 _machine_power_off(); 311 _machine_power_off();
316} 312}
317 313
318EXPORT_SYMBOL(machine_power_off);
319
320static void __init 314static void __init
321add_memory_hole(unsigned long start, unsigned long end) 315add_memory_hole(unsigned long start, unsigned long end)
322{ 316{
@@ -437,12 +431,6 @@ setup_lowcore(void)
437 ctl_set_bit(14, 29); 431 ctl_set_bit(14, 29);
438 } 432 }
439#endif 433#endif
440#ifdef CONFIG_ARCH_S390X
441 if (MACHINE_HAS_DIAG44)
442 lc->diag44_opcode = 0x83000044;
443 else
444 lc->diag44_opcode = 0x07000700;
445#endif /* CONFIG_ARCH_S390X */
446 set_prefix((u32)(unsigned long) lc); 434 set_prefix((u32)(unsigned long) lc);
447} 435}
448 436
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 642572a8e334..da77f001af8d 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -375,7 +375,7 @@ static void smp_ext_bitcall(int cpu, ec_bit_sig sig)
375 * Set signaling bit in lowcore of target cpu and kick it 375 * Set signaling bit in lowcore of target cpu and kick it
376 */ 376 */
377 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 377 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
378 while(signal_processor(cpu, sigp_external_call) == sigp_busy) 378 while(signal_processor(cpu, sigp_emergency_signal) == sigp_busy)
379 udelay(10); 379 udelay(10);
380} 380}
381 381
@@ -394,7 +394,7 @@ static void smp_ext_bitcall_others(ec_bit_sig sig)
394 * Set signaling bit in lowcore of target cpu and kick it 394 * Set signaling bit in lowcore of target cpu and kick it
395 */ 395 */
396 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast); 396 set_bit(sig, (unsigned long *) &lowcore_ptr[cpu]->ext_call_fast);
397 while (signal_processor(cpu, sigp_external_call) == sigp_busy) 397 while (signal_processor(cpu, sigp_emergency_signal) == sigp_busy)
398 udelay(10); 398 udelay(10);
399 } 399 }
400} 400}
@@ -751,9 +751,9 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
751 unsigned int cpu; 751 unsigned int cpu;
752 int i; 752 int i;
753 753
754 /* request the 0x1202 external interrupt */ 754 /* request the 0x1201 emergency signal external interrupt */
755 if (register_external_interrupt(0x1202, do_ext_call_interrupt) != 0) 755 if (register_external_interrupt(0x1201, do_ext_call_interrupt) != 0)
756 panic("Couldn't request external interrupt 0x1202"); 756 panic("Couldn't request external interrupt 0x1201");
757 smp_check_cpus(max_cpus); 757 smp_check_cpus(max_cpus);
758 memset(lowcore_ptr,0,sizeof(lowcore_ptr)); 758 memset(lowcore_ptr,0,sizeof(lowcore_ptr));
759 /* 759 /*
diff --git a/arch/s390/lib/Makefile b/arch/s390/lib/Makefile
index a8758b1d20a9..b701efa1f00e 100644
--- a/arch/s390/lib/Makefile
+++ b/arch/s390/lib/Makefile
@@ -5,5 +5,5 @@
5EXTRA_AFLAGS := -traditional 5EXTRA_AFLAGS := -traditional
6 6
7lib-y += delay.o string.o 7lib-y += delay.o string.o
8lib-$(CONFIG_ARCH_S390_31) += uaccess.o 8lib-$(CONFIG_ARCH_S390_31) += uaccess.o spinlock.o
9lib-$(CONFIG_ARCH_S390X) += uaccess64.o 9lib-$(CONFIG_ARCH_S390X) += uaccess64.o spinlock.o
diff --git a/arch/s390/lib/spinlock.c b/arch/s390/lib/spinlock.c
new file mode 100644
index 000000000000..888b5596c195
--- /dev/null
+++ b/arch/s390/lib/spinlock.c
@@ -0,0 +1,133 @@
1/*
2 * arch/s390/lib/spinlock.c
3 * Out of line spinlock code.
4 *
5 * S390 version
6 * Copyright (C) 2004 IBM Deutschland Entwicklung GmbH, IBM Corporation
7 * Author(s): Martin Schwidefsky (schwidefsky@de.ibm.com)
8 */
9
10#include <linux/types.h>
11#include <linux/module.h>
12#include <linux/spinlock.h>
13#include <linux/init.h>
14#include <asm/io.h>
15
16atomic_t spin_retry_counter;
17int spin_retry = 1000;
18
19/**
20 * spin_retry= parameter
21 */
22static int __init spin_retry_setup(char *str)
23{
24 spin_retry = simple_strtoul(str, &str, 0);
25 return 1;
26}
27__setup("spin_retry=", spin_retry_setup);
28
29static inline void
30_diag44(void)
31{
32#ifdef __s390x__
33 if (MACHINE_HAS_DIAG44)
34#endif
35 asm volatile("diag 0,0,0x44");
36}
37
38void
39_raw_spin_lock_wait(spinlock_t *lp, unsigned int pc)
40{
41 int count = spin_retry;
42
43 while (1) {
44 if (count-- <= 0) {
45 _diag44();
46 count = spin_retry;
47 }
48 atomic_inc(&spin_retry_counter);
49 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
50 return;
51 }
52}
53EXPORT_SYMBOL(_raw_spin_lock_wait);
54
55int
56_raw_spin_trylock_retry(spinlock_t *lp, unsigned int pc)
57{
58 int count = spin_retry;
59
60 while (count-- > 0) {
61 atomic_inc(&spin_retry_counter);
62 if (_raw_compare_and_swap(&lp->lock, 0, pc) == 0)
63 return 1;
64 }
65 return 0;
66}
67EXPORT_SYMBOL(_raw_spin_trylock_retry);
68
69void
70_raw_read_lock_wait(rwlock_t *rw)
71{
72 unsigned int old;
73 int count = spin_retry;
74
75 while (1) {
76 if (count-- <= 0) {
77 _diag44();
78 count = spin_retry;
79 }
80 atomic_inc(&spin_retry_counter);
81 old = rw->lock & 0x7fffffffU;
82 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
83 return;
84 }
85}
86EXPORT_SYMBOL(_raw_read_lock_wait);
87
88int
89_raw_read_trylock_retry(rwlock_t *rw)
90{
91 unsigned int old;
92 int count = spin_retry;
93
94 while (count-- > 0) {
95 atomic_inc(&spin_retry_counter);
96 old = rw->lock & 0x7fffffffU;
97 if (_raw_compare_and_swap(&rw->lock, old, old + 1) == old)
98 return 1;
99 }
100 return 0;
101}
102EXPORT_SYMBOL(_raw_read_trylock_retry);
103
104void
105_raw_write_lock_wait(rwlock_t *rw)
106{
107 int count = spin_retry;
108
109 while (1) {
110 if (count-- <= 0) {
111 _diag44();
112 count = spin_retry;
113 }
114 atomic_inc(&spin_retry_counter);
115 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
116 return;
117 }
118}
119EXPORT_SYMBOL(_raw_write_lock_wait);
120
121int
122_raw_write_trylock_retry(rwlock_t *rw)
123{
124 int count = spin_retry;
125
126 while (count-- > 0) {
127 atomic_inc(&spin_retry_counter);
128 if (_raw_compare_and_swap(&rw->lock, 0, 0x80000000) == 0)
129 return 1;
130 }
131 return 0;
132}
133EXPORT_SYMBOL(_raw_write_trylock_retry);
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 3d024590c24e..6dce9d0b81f8 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -80,8 +80,6 @@ void machine_restart(char * __unused)
80 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001)); 80 "mov.l @%1, %0" : : "r" (0x10000000), "r" (0x80000001));
81} 81}
82 82
83EXPORT_SYMBOL(machine_restart);
84
85void machine_halt(void) 83void machine_halt(void)
86{ 84{
87#if defined(CONFIG_SH_HS7751RVOIP) 85#if defined(CONFIG_SH_HS7751RVOIP)
@@ -96,8 +94,6 @@ void machine_halt(void)
96 cpu_sleep(); 94 cpu_sleep();
97} 95}
98 96
99EXPORT_SYMBOL(machine_halt);
100
101void machine_power_off(void) 97void machine_power_off(void)
102{ 98{
103#if defined(CONFIG_SH_HS7751RVOIP) 99#if defined(CONFIG_SH_HS7751RVOIP)
@@ -110,8 +106,6 @@ void machine_power_off(void)
110#endif 106#endif
111} 107}
112 108
113EXPORT_SYMBOL(machine_power_off);
114
115void show_regs(struct pt_regs * regs) 109void show_regs(struct pt_regs * regs)
116{ 110{
117 printk("\n"); 111 printk("\n");
diff --git a/arch/sh/kernel/signal.c b/arch/sh/kernel/signal.c
index 06f1b47eded9..8022243f0178 100644
--- a/arch/sh/kernel/signal.c
+++ b/arch/sh/kernel/signal.c
@@ -579,7 +579,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
579 if (!user_mode(regs)) 579 if (!user_mode(regs))
580 return 1; 580 return 1;
581 581
582 if (try_to_freeze(0)) 582 if (try_to_freeze())
583 goto no_signal; 583 goto no_signal;
584 584
585 if (!oldset) 585 if (!oldset)
diff --git a/arch/sh64/kernel/signal.c b/arch/sh64/kernel/signal.c
index 45ad1026dde7..c6a14a87c59b 100644
--- a/arch/sh64/kernel/signal.c
+++ b/arch/sh64/kernel/signal.c
@@ -697,7 +697,7 @@ int do_signal(struct pt_regs *regs, sigset_t *oldset)
697 if (!user_mode(regs)) 697 if (!user_mode(regs))
698 return 1; 698 return 1;
699 699
700 if (try_to_freeze(0)) 700 if (try_to_freeze())
701 goto no_signal; 701 goto no_signal;
702 702
703 if (!oldset) 703 if (!oldset)
diff --git a/arch/sparc/kernel/process.c b/arch/sparc/kernel/process.c
index 2c216ffeea90..29e72b57d4fd 100644
--- a/arch/sparc/kernel/process.c
+++ b/arch/sparc/kernel/process.c
@@ -158,8 +158,6 @@ void machine_halt(void)
158 panic("Halt failed!"); 158 panic("Halt failed!");
159} 159}
160 160
161EXPORT_SYMBOL(machine_halt);
162
163void machine_restart(char * cmd) 161void machine_restart(char * cmd)
164{ 162{
165 char *p; 163 char *p;
@@ -180,8 +178,6 @@ void machine_restart(char * cmd)
180 panic("Reboot failed!"); 178 panic("Reboot failed!");
181} 179}
182 180
183EXPORT_SYMBOL(machine_restart);
184
185void machine_power_off(void) 181void machine_power_off(void)
186{ 182{
187#ifdef CONFIG_SUN_AUXIO 183#ifdef CONFIG_SUN_AUXIO
@@ -191,8 +187,6 @@ void machine_power_off(void)
191 machine_halt(); 187 machine_halt();
192} 188}
193 189
194EXPORT_SYMBOL(machine_power_off);
195
196static DEFINE_SPINLOCK(sparc_backtrace_lock); 190static DEFINE_SPINLOCK(sparc_backtrace_lock);
197 191
198void __show_backtrace(unsigned long fp) 192void __show_backtrace(unsigned long fp)
diff --git a/arch/sparc/kernel/systbls.S b/arch/sparc/kernel/systbls.S
index 025f4516e651..e457a40838fc 100644
--- a/arch/sparc/kernel/systbls.S
+++ b/arch/sparc/kernel/systbls.S
@@ -48,8 +48,8 @@ sys_call_table:
48/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64 48/*135*/ .long sys_nis_syscall, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
49/*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit 49/*140*/ .long sys_sendfile64, sys_nis_syscall, sys_futex, sys_gettid, sys_getrlimit
50/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write 50/*145*/ .long sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
51/*150*/ .long sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 51/*150*/ .long sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
52/*155*/ .long sys_fcntl64, sys_ni_syscall, sys_statfs, sys_fstatfs, sys_oldumount 52/*155*/ .long sys_fcntl64, sys_inotify_rm_watch, sys_statfs, sys_fstatfs, sys_oldumount
53/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall 53/*160*/ .long sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_nis_syscall
54/*165*/ .long sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr 54/*165*/ .long sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr
55/*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents 55/*170*/ .long sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
diff --git a/arch/sparc64/kernel/entry.S b/arch/sparc64/kernel/entry.S
index d781f10adc52..88332f00094a 100644
--- a/arch/sparc64/kernel/entry.S
+++ b/arch/sparc64/kernel/entry.S
@@ -1600,11 +1600,11 @@ sys_clone: flushw
1600 ba,pt %xcc, sparc_do_fork 1600 ba,pt %xcc, sparc_do_fork
1601 add %sp, PTREGS_OFF, %o2 1601 add %sp, PTREGS_OFF, %o2
1602ret_from_syscall: 1602ret_from_syscall:
1603 /* Clear SPARC_FLAG_NEWCHILD, switch_to leaves thread.flags in 1603 /* Clear current_thread_info()->new_child, and
1604 * %o7 for us. Check performance counter stuff too. 1604 * check performance counter stuff too.
1605 */ 1605 */
1606 andn %o7, _TIF_NEWCHILD, %l0 1606 stb %g0, [%g6 + TI_NEW_CHILD]
1607 stx %l0, [%g6 + TI_FLAGS] 1607 ldx [%g6 + TI_FLAGS], %l0
1608 call schedule_tail 1608 call schedule_tail
1609 mov %g7, %o0 1609 mov %g7, %o0
1610 andcc %l0, _TIF_PERFCTR, %g0 1610 andcc %l0, _TIF_PERFCTR, %g0
@@ -1720,12 +1720,11 @@ ret_sys_call:
1720 /* Check if force_successful_syscall_return() 1720 /* Check if force_successful_syscall_return()
1721 * was invoked. 1721 * was invoked.
1722 */ 1722 */
1723 ldx [%curptr + TI_FLAGS], %l0 1723 ldub [%curptr + TI_SYS_NOERROR], %l0
1724 andcc %l0, _TIF_SYSCALL_SUCCESS, %g0 1724 brz,pt %l0, 1f
1725 be,pt %icc, 1f 1725 nop
1726 andn %l0, _TIF_SYSCALL_SUCCESS, %l0
1727 ba,pt %xcc, 80f 1726 ba,pt %xcc, 80f
1728 stx %l0, [%curptr + TI_FLAGS] 1727 stb %g0, [%curptr + TI_SYS_NOERROR]
1729 1728
17301: 17291:
1731 cmp %o0, -ERESTART_RESTARTBLOCK 1730 cmp %o0, -ERESTART_RESTARTBLOCK
diff --git a/arch/sparc64/kernel/irq.c b/arch/sparc64/kernel/irq.c
index daa2fb93052c..c9b69167632a 100644
--- a/arch/sparc64/kernel/irq.c
+++ b/arch/sparc64/kernel/irq.c
@@ -782,8 +782,14 @@ static void distribute_irqs(void)
782} 782}
783#endif 783#endif
784 784
785struct sun5_timer {
786 u64 count0;
787 u64 limit0;
788 u64 count1;
789 u64 limit1;
790};
785 791
786struct sun5_timer *prom_timers; 792static struct sun5_timer *prom_timers;
787static u64 prom_limit0, prom_limit1; 793static u64 prom_limit0, prom_limit1;
788 794
789static void map_prom_timers(void) 795static void map_prom_timers(void)
@@ -839,18 +845,6 @@ static void kill_prom_timer(void)
839 : "g1", "g2"); 845 : "g1", "g2");
840} 846}
841 847
842void enable_prom_timer(void)
843{
844 if (!prom_timers)
845 return;
846
847 /* Set it to whatever was there before. */
848 prom_timers->limit1 = prom_limit1;
849 prom_timers->count1 = 0;
850 prom_timers->limit0 = prom_limit0;
851 prom_timers->count0 = 0;
852}
853
854void init_irqwork_curcpu(void) 848void init_irqwork_curcpu(void)
855{ 849{
856 register struct irq_work_struct *workp asm("o2"); 850 register struct irq_work_struct *workp asm("o2");
diff --git a/arch/sparc64/kernel/power.c b/arch/sparc64/kernel/power.c
index 533104c7907d..946cee0257ea 100644
--- a/arch/sparc64/kernel/power.c
+++ b/arch/sparc64/kernel/power.c
@@ -69,8 +69,6 @@ void machine_power_off(void)
69 machine_halt(); 69 machine_halt();
70} 70}
71 71
72EXPORT_SYMBOL(machine_power_off);
73
74#ifdef CONFIG_PCI 72#ifdef CONFIG_PCI
75static int powerd(void *__unused) 73static int powerd(void *__unused)
76{ 74{
diff --git a/arch/sparc64/kernel/process.c b/arch/sparc64/kernel/process.c
index a0cd2b2494d6..07424b075938 100644
--- a/arch/sparc64/kernel/process.c
+++ b/arch/sparc64/kernel/process.c
@@ -124,8 +124,6 @@ void machine_halt(void)
124 panic("Halt failed!"); 124 panic("Halt failed!");
125} 125}
126 126
127EXPORT_SYMBOL(machine_halt);
128
129void machine_alt_power_off(void) 127void machine_alt_power_off(void)
130{ 128{
131 if (!serial_console && prom_palette) 129 if (!serial_console && prom_palette)
@@ -154,8 +152,6 @@ void machine_restart(char * cmd)
154 panic("Reboot failed!"); 152 panic("Reboot failed!");
155} 153}
156 154
157EXPORT_SYMBOL(machine_restart);
158
159static void show_regwindow32(struct pt_regs *regs) 155static void show_regwindow32(struct pt_regs *regs)
160{ 156{
161 struct reg_window32 __user *rw; 157 struct reg_window32 __user *rw;
@@ -621,8 +617,8 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long sp,
621 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ)); 617 memcpy(child_trap_frame, (((struct sparc_stackf *)regs)-1), (TRACEREG_SZ+STACKFRAME_SZ));
622 618
623 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) | 619 t->flags = (t->flags & ~((0xffUL << TI_FLAG_CWP_SHIFT) | (0xffUL << TI_FLAG_CURRENT_DS_SHIFT))) |
624 _TIF_NEWCHILD |
625 (((regs->tstate + 1) & TSTATE_CWP) << TI_FLAG_CWP_SHIFT); 620 (((regs->tstate + 1) & TSTATE_CWP) << TI_FLAG_CWP_SHIFT);
621 t->new_child = 1;
626 t->ksp = ((unsigned long) child_trap_frame) - STACK_BIAS; 622 t->ksp = ((unsigned long) child_trap_frame) - STACK_BIAS;
627 t->kregs = (struct pt_regs *)(child_trap_frame+sizeof(struct sparc_stackf)); 623 t->kregs = (struct pt_regs *)(child_trap_frame+sizeof(struct sparc_stackf));
628 t->fpsaved[0] = 0; 624 t->fpsaved[0] = 0;
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 7e8e2919e186..b9b42491e118 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -137,7 +137,7 @@ void __init smp_callin(void)
137 /* Clear this or we will die instantly when we 137 /* Clear this or we will die instantly when we
138 * schedule back to this idler... 138 * schedule back to this idler...
139 */ 139 */
140 clear_thread_flag(TIF_NEWCHILD); 140 current_thread_info()->new_child = 0;
141 141
142 /* Attach to the address space of init_task. */ 142 /* Attach to the address space of init_task. */
143 atomic_inc(&init_mm.mm_count); 143 atomic_inc(&init_mm.mm_count);
diff --git a/arch/sparc64/kernel/systbls.S b/arch/sparc64/kernel/systbls.S
index bceb91a8a2bd..53eaf2345fe9 100644
--- a/arch/sparc64/kernel/systbls.S
+++ b/arch/sparc64/kernel/systbls.S
@@ -50,8 +50,8 @@ sys_call_table32:
50 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, compat_sys_stat64 50 .word sys_nis_syscall, sys32_mkdir, sys_rmdir, sys32_utimes, compat_sys_stat64
51/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit 51/*140*/ .word sys32_sendfile64, sys_nis_syscall, sys32_futex, sys_gettid, compat_sys_getrlimit
52 .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write 52 .word compat_sys_setrlimit, sys_pivot_root, sys32_prctl, sys_pciconfig_read, sys_pciconfig_write
53/*150*/ .word sys_nis_syscall, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 53/*150*/ .word sys_nis_syscall, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
54 .word compat_sys_fcntl64, sys_ni_syscall, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount 54 .word compat_sys_fcntl64, sys_inotify_rm_watch, compat_sys_statfs, compat_sys_fstatfs, sys_oldumount
55/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall 55/*160*/ .word compat_sys_sched_setaffinity, compat_sys_sched_getaffinity, sys32_getdomainname, sys32_setdomainname, sys_nis_syscall
56 .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr 56 .word sys_quotactl, sys_set_tid_address, compat_sys_mount, sys_ustat, sys32_setxattr
57/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents 57/*170*/ .word sys32_lsetxattr, sys32_fsetxattr, sys_getxattr, sys_lgetxattr, compat_sys_getdents
@@ -116,8 +116,8 @@ sys_call_table:
116 .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64 116 .word sys_socketpair, sys_mkdir, sys_rmdir, sys_utimes, sys_stat64
117/*140*/ .word sys_sendfile64, sys_getpeername, sys_futex, sys_gettid, sys_getrlimit 117/*140*/ .word sys_sendfile64, sys_getpeername, sys_futex, sys_gettid, sys_getrlimit
118 .word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write 118 .word sys_setrlimit, sys_pivot_root, sys_prctl, sys_pciconfig_read, sys_pciconfig_write
119/*150*/ .word sys_getsockname, sys_nis_syscall, sys_nis_syscall, sys_poll, sys_getdents64 119/*150*/ .word sys_getsockname, sys_inotify_init, sys_inotify_add_watch, sys_poll, sys_getdents64
120 .word sys_nis_syscall, sys_ni_syscall, sys_statfs, sys_fstatfs, sys_oldumount 120 .word sys_nis_syscall, sys_inotify_rm_watch, sys_statfs, sys_fstatfs, sys_oldumount
121/*160*/ .word sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_utrap_install 121/*160*/ .word sys_sched_setaffinity, sys_sched_getaffinity, sys_getdomainname, sys_setdomainname, sys_utrap_install
122 .word sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr 122 .word sys_quotactl, sys_set_tid_address, sys_mount, sys_ustat, sys_setxattr
123/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents 123/*170*/ .word sys_lsetxattr, sys_fsetxattr, sys_getxattr, sys_lgetxattr, sys_getdents
diff --git a/arch/sparc64/kernel/traps.c b/arch/sparc64/kernel/traps.c
index a9f4596d7c2b..100b0107c4be 100644
--- a/arch/sparc64/kernel/traps.c
+++ b/arch/sparc64/kernel/traps.c
@@ -2125,6 +2125,8 @@ void __init trap_init(void)
2125 TI_PCR != offsetof(struct thread_info, pcr_reg) || 2125 TI_PCR != offsetof(struct thread_info, pcr_reg) ||
2126 TI_CEE_STUFF != offsetof(struct thread_info, cee_stuff) || 2126 TI_CEE_STUFF != offsetof(struct thread_info, cee_stuff) ||
2127 TI_PRE_COUNT != offsetof(struct thread_info, preempt_count) || 2127 TI_PRE_COUNT != offsetof(struct thread_info, preempt_count) ||
2128 TI_NEW_CHILD != offsetof(struct thread_info, new_child) ||
2129 TI_SYS_NOERROR != offsetof(struct thread_info, syscall_noerror) ||
2128 TI_FPREGS != offsetof(struct thread_info, fpregs) || 2130 TI_FPREGS != offsetof(struct thread_info, fpregs) ||
2129 (TI_FPREGS & (64 - 1))) 2131 (TI_FPREGS & (64 - 1)))
2130 thread_info_offsets_are_bolixed_dave(); 2132 thread_info_offsets_are_bolixed_dave();
diff --git a/arch/sparc64/mm/init.c b/arch/sparc64/mm/init.c
index 8fc413cb6acd..3fbaf342a452 100644
--- a/arch/sparc64/mm/init.c
+++ b/arch/sparc64/mm/init.c
@@ -121,15 +121,24 @@ __inline__ void flush_dcache_page_impl(struct page *page)
121} 121}
122 122
123#define PG_dcache_dirty PG_arch_1 123#define PG_dcache_dirty PG_arch_1
124#define PG_dcache_cpu_shift 24
125#define PG_dcache_cpu_mask (256 - 1)
126
127#if NR_CPUS > 256
128#error D-cache dirty tracking and thread_info->cpu need fixing for > 256 cpus
129#endif
124 130
125#define dcache_dirty_cpu(page) \ 131#define dcache_dirty_cpu(page) \
126 (((page)->flags >> 24) & (NR_CPUS - 1UL)) 132 (((page)->flags >> PG_dcache_cpu_shift) & PG_dcache_cpu_mask)
127 133
128static __inline__ void set_dcache_dirty(struct page *page, int this_cpu) 134static __inline__ void set_dcache_dirty(struct page *page, int this_cpu)
129{ 135{
130 unsigned long mask = this_cpu; 136 unsigned long mask = this_cpu;
131 unsigned long non_cpu_bits = ~((NR_CPUS - 1UL) << 24UL); 137 unsigned long non_cpu_bits;
132 mask = (mask << 24) | (1UL << PG_dcache_dirty); 138
139 non_cpu_bits = ~(PG_dcache_cpu_mask << PG_dcache_cpu_shift);
140 mask = (mask << PG_dcache_cpu_shift) | (1UL << PG_dcache_dirty);
141
133 __asm__ __volatile__("1:\n\t" 142 __asm__ __volatile__("1:\n\t"
134 "ldx [%2], %%g7\n\t" 143 "ldx [%2], %%g7\n\t"
135 "and %%g7, %1, %%g1\n\t" 144 "and %%g7, %1, %%g1\n\t"
@@ -151,7 +160,7 @@ static __inline__ void clear_dcache_dirty_cpu(struct page *page, unsigned long c
151 __asm__ __volatile__("! test_and_clear_dcache_dirty\n" 160 __asm__ __volatile__("! test_and_clear_dcache_dirty\n"
152 "1:\n\t" 161 "1:\n\t"
153 "ldx [%2], %%g7\n\t" 162 "ldx [%2], %%g7\n\t"
154 "srlx %%g7, 24, %%g1\n\t" 163 "srlx %%g7, %4, %%g1\n\t"
155 "and %%g1, %3, %%g1\n\t" 164 "and %%g1, %3, %%g1\n\t"
156 "cmp %%g1, %0\n\t" 165 "cmp %%g1, %0\n\t"
157 "bne,pn %%icc, 2f\n\t" 166 "bne,pn %%icc, 2f\n\t"
@@ -164,7 +173,8 @@ static __inline__ void clear_dcache_dirty_cpu(struct page *page, unsigned long c
164 "2:" 173 "2:"
165 : /* no outputs */ 174 : /* no outputs */
166 : "r" (cpu), "r" (mask), "r" (&page->flags), 175 : "r" (cpu), "r" (mask), "r" (&page->flags),
167 "i" (NR_CPUS - 1UL) 176 "i" (PG_dcache_cpu_mask),
177 "i" (PG_dcache_cpu_shift)
168 : "g1", "g7"); 178 : "g1", "g7");
169} 179}
170 180
@@ -180,7 +190,8 @@ void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t p
180 if (pfn_valid(pfn) && 190 if (pfn_valid(pfn) &&
181 (page = pfn_to_page(pfn), page_mapping(page)) && 191 (page = pfn_to_page(pfn), page_mapping(page)) &&
182 ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) { 192 ((pg_flags = page->flags) & (1UL << PG_dcache_dirty))) {
183 int cpu = ((pg_flags >> 24) & (NR_CPUS - 1UL)); 193 int cpu = ((pg_flags >> PG_dcache_cpu_shift) &
194 PG_dcache_cpu_mask);
184 int this_cpu = get_cpu(); 195 int this_cpu = get_cpu();
185 196
186 /* This is just to optimize away some function calls 197 /* This is just to optimize away some function calls
diff --git a/arch/um/Makefile b/arch/um/Makefile
index eb4ac403bd93..f5a83a72aa75 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -245,7 +245,7 @@ $(ARCH_DIR)/util: scripts_basic $(SYS_DIR)/sc.h $(ARCH_DIR)/kernel-offsets.h FOR
245$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE 245$(ARCH_DIR)/kernel/skas/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
246 $(Q)$(MAKE) $(build)=$@ 246 $(Q)$(MAKE) $(build)=$@
247 247
248$(ARCH_DIR)/os-$(OS)/util: scripts_basic FORCE 248$(ARCH_DIR)/os-$(OS)/util: scripts_basic $(ARCH_DIR)/user-offsets.h FORCE
249 $(Q)$(MAKE) $(build)=$@ 249 $(Q)$(MAKE) $(build)=$@
250 250
251export SUBARCH USER_CFLAGS OS 251export SUBARCH USER_CFLAGS OS
diff --git a/arch/um/Makefile-i386 b/arch/um/Makefile-i386
index 93d0818fa816..a777e57dbf89 100644
--- a/arch/um/Makefile-i386
+++ b/arch/um/Makefile-i386
@@ -33,6 +33,7 @@ ifneq ($(CONFIG_GPROF),y)
33ARCH_CFLAGS += -DUM_FASTCALL 33ARCH_CFLAGS += -DUM_FASTCALL
34endif 34endif
35 35
36SYS_UTIL_DIR := $(ARCH_DIR)/sys-i386/util
36SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h 37SYS_HEADERS := $(SYS_DIR)/sc.h $(SYS_DIR)/thread.h
37 38
38prepare: $(SYS_HEADERS) 39prepare: $(SYS_HEADERS)
diff --git a/arch/um/drivers/Makefile b/arch/um/drivers/Makefile
index d6c31a95b887..de17d4c6e02d 100644
--- a/arch/um/drivers/Makefile
+++ b/arch/um/drivers/Makefile
@@ -19,6 +19,8 @@ harddog-objs := harddog_kern.o harddog_user.o
19 19
20LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a) 20LDFLAGS_pcap.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libpcap.a)
21 21
22targets := pcap_kern.o pcap_user.o
23
22$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o 24$(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
23 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o) 25 $(LD) -r -dp -o $@ $^ $(LDFLAGS) $(LDFLAGS_pcap.o)
24#XXX: The call below does not work because the flags are added before the 26#XXX: The call below does not work because the flags are added before the
@@ -26,7 +28,7 @@ $(obj)/pcap.o: $(obj)/pcap_kern.o $(obj)/pcap_user.o
26#$(call if_changed,ld) 28#$(call if_changed,ld)
27 29
28# When the above is fixed, don't forget to add this too! 30# When the above is fixed, don't forget to add this too!
29#targets := $(obj)/pcap.o 31#targets += $(obj)/pcap.o
30 32
31obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o 33obj-y := stdio_console.o fd.o chan_kern.o chan_user.o line.o
32obj-$(CONFIG_SSL) += ssl.o 34obj-$(CONFIG_SSL) += ssl.o
diff --git a/arch/um/drivers/cow.h b/arch/um/drivers/cow.h
index 4fcbe8b1b77e..4fcf3a8d13f4 100644
--- a/arch/um/drivers/cow.h
+++ b/arch/um/drivers/cow.h
@@ -3,10 +3,10 @@
3 3
4#include <asm/types.h> 4#include <asm/types.h>
5 5
6#if __BYTE_ORDER == __BIG_ENDIAN 6#if defined(__BIG_ENDIAN)
7# define ntohll(x) (x) 7# define ntohll(x) (x)
8# define htonll(x) (x) 8# define htonll(x) (x)
9#elif __BYTE_ORDER == __LITTLE_ENDIAN 9#elif defined(__LITTLE_ENDIAN)
10# define ntohll(x) bswap_64(x) 10# define ntohll(x) bswap_64(x)
11# define htonll(x) bswap_64(x) 11# define htonll(x) bswap_64(x)
12#else 12#else
diff --git a/arch/um/drivers/hostaudio_kern.c b/arch/um/drivers/hostaudio_kern.c
index d5742783e19d..59602b81b240 100644
--- a/arch/um/drivers/hostaudio_kern.c
+++ b/arch/um/drivers/hostaudio_kern.c
@@ -57,10 +57,10 @@ __uml_setup("mixer=", set_mixer, "mixer=<mixer device>\n" MIXER_HELP);
57 57
58#else /*MODULE*/ 58#else /*MODULE*/
59 59
60MODULE_PARM(dsp, "s"); 60module_param(dsp, charp, 0644);
61MODULE_PARM_DESC(dsp, DSP_HELP); 61MODULE_PARM_DESC(dsp, DSP_HELP);
62 62
63MODULE_PARM(mixer, "s"); 63module_param(mixer, charp, 0644);
64MODULE_PARM_DESC(mixer, MIXER_HELP); 64MODULE_PARM_DESC(mixer, MIXER_HELP);
65 65
66#endif 66#endif
diff --git a/arch/um/drivers/mconsole_kern.c b/arch/um/drivers/mconsole_kern.c
index 404de41a4f67..c190c2414197 100644
--- a/arch/um/drivers/mconsole_kern.c
+++ b/arch/um/drivers/mconsole_kern.c
@@ -557,7 +557,7 @@ static int create_proc_mconsole(void)
557 557
558 ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL); 558 ent = create_proc_entry("mconsole", S_IFREG | 0200, NULL);
559 if(ent == NULL){ 559 if(ent == NULL){
560 printk("create_proc_mconsole : create_proc_entry failed\n"); 560 printk(KERN_INFO "create_proc_mconsole : create_proc_entry failed\n");
561 return(0); 561 return(0);
562 } 562 }
563 563
diff --git a/arch/um/kernel/exitcode.c b/arch/um/kernel/exitcode.c
index 0ea87f24b36f..d21ebad666b4 100644
--- a/arch/um/kernel/exitcode.c
+++ b/arch/um/kernel/exitcode.c
@@ -48,7 +48,7 @@ static int make_proc_exitcode(void)
48 48
49 ent = create_proc_entry("exitcode", 0600, &proc_root); 49 ent = create_proc_entry("exitcode", 0600, &proc_root);
50 if(ent == NULL){ 50 if(ent == NULL){
51 printk("make_proc_exitcode : Failed to register " 51 printk(KERN_WARNING "make_proc_exitcode : Failed to register "
52 "/proc/exitcode\n"); 52 "/proc/exitcode\n");
53 return(0); 53 return(0);
54 } 54 }
diff --git a/arch/um/kernel/helper.c b/arch/um/kernel/helper.c
index 13b1f5c2f7ee..f83e1e8e2392 100644
--- a/arch/um/kernel/helper.c
+++ b/arch/um/kernel/helper.c
@@ -13,6 +13,7 @@
13#include "user.h" 13#include "user.h"
14#include "kern_util.h" 14#include "kern_util.h"
15#include "user_util.h" 15#include "user_util.h"
16#include "helper.h"
16#include "os.h" 17#include "os.h"
17 18
18struct helper_data { 19struct helper_data {
@@ -149,7 +150,7 @@ int run_helper_thread(int (*proc)(void *), void *arg, unsigned int flags,
149 return(pid); 150 return(pid);
150} 151}
151 152
152int helper_wait(int pid, int block) 153int helper_wait(int pid)
153{ 154{
154 int ret; 155 int ret;
155 156
@@ -160,14 +161,3 @@ int helper_wait(int pid, int block)
160 } 161 }
161 return(ret); 162 return(ret);
162} 163}
163
164/*
165 * Overrides for Emacs so that we follow Linus's tabbing style.
166 * Emacs will notice this stuff at the end of the file and automatically
167 * adjust the settings for this buffer only. This must remain at the end
168 * of the file.
169 * ---------------------------------------------------------------------------
170 * Local variables:
171 * c-file-style: "linux"
172 * End:
173 */
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index c45a60e9c92d..67acd92c5322 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -131,7 +131,7 @@ int start_fork_tramp(void *thread_arg, unsigned long temp_stack,
131 return(arg.pid); 131 return(arg.pid);
132} 132}
133 133
134static int ptrace_child(void) 134static int ptrace_child(void *arg)
135{ 135{
136 int ret; 136 int ret;
137 int pid = os_getpid(), ppid = getppid(); 137 int pid = os_getpid(), ppid = getppid();
@@ -160,16 +160,20 @@ static int ptrace_child(void)
160 _exit(ret); 160 _exit(ret);
161} 161}
162 162
163static int start_ptraced_child(void) 163static int start_ptraced_child(void **stack_out)
164{ 164{
165 void *stack;
166 unsigned long sp;
165 int pid, n, status; 167 int pid, n, status;
166 168
167 pid = fork(); 169 stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC,
168 if(pid == 0) 170 MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
169 ptrace_child(); 171 if(stack == MAP_FAILED)
170 172 panic("check_ptrace : mmap failed, errno = %d", errno);
173 sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *);
174 pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL);
171 if(pid < 0) 175 if(pid < 0)
172 panic("check_ptrace : fork failed, errno = %d", errno); 176 panic("check_ptrace : clone failed, errno = %d", errno);
173 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); 177 CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED));
174 if(n < 0) 178 if(n < 0)
175 panic("check_ptrace : wait failed, errno = %d", errno); 179 panic("check_ptrace : wait failed, errno = %d", errno);
@@ -177,6 +181,7 @@ static int start_ptraced_child(void)
177 panic("check_ptrace : expected SIGSTOP, got status = %d", 181 panic("check_ptrace : expected SIGSTOP, got status = %d",
178 status); 182 status);
179 183
184 *stack_out = stack;
180 return(pid); 185 return(pid);
181} 186}
182 187
@@ -184,12 +189,12 @@ static int start_ptraced_child(void)
184 * just avoid using sysemu, not panic, but only if SYSEMU features are broken. 189 * just avoid using sysemu, not panic, but only if SYSEMU features are broken.
185 * So only for SYSEMU features we test mustpanic, while normal host features 190 * So only for SYSEMU features we test mustpanic, while normal host features
186 * must work anyway!*/ 191 * must work anyway!*/
187static int stop_ptraced_child(int pid, int exitcode, int mustexit) 192static int stop_ptraced_child(int pid, void *stack, int exitcode, int mustpanic)
188{ 193{
189 int status, n, ret = 0; 194 int status, n, ret = 0;
190 195
191 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) 196 if(ptrace(PTRACE_CONT, pid, 0, 0) < 0)
192 panic("stop_ptraced_child : ptrace failed, errno = %d", errno); 197 panic("check_ptrace : ptrace failed, errno = %d", errno);
193 CATCH_EINTR(n = waitpid(pid, &status, 0)); 198 CATCH_EINTR(n = waitpid(pid, &status, 0));
194 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { 199 if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) {
195 int exit_with = WEXITSTATUS(status); 200 int exit_with = WEXITSTATUS(status);
@@ -200,24 +205,40 @@ static int stop_ptraced_child(int pid, int exitcode, int mustexit)
200 printk("check_ptrace : child exited with exitcode %d, while " 205 printk("check_ptrace : child exited with exitcode %d, while "
201 "expecting %d; status 0x%x", exit_with, 206 "expecting %d; status 0x%x", exit_with,
202 exitcode, status); 207 exitcode, status);
203 if (mustexit) 208 if (mustpanic)
204 panic("\n"); 209 panic("\n");
205 else 210 else
206 printk("\n"); 211 printk("\n");
207 ret = -1; 212 ret = -1;
208 } 213 }
209 214
215 if(munmap(stack, PAGE_SIZE) < 0)
216 panic("check_ptrace : munmap failed, errno = %d", errno);
210 return ret; 217 return ret;
211} 218}
212 219
213static int force_sysemu_disabled = 0; 220static int force_sysemu_disabled = 0;
214 221
222int ptrace_faultinfo = 1;
223int proc_mm = 1;
224
225static int __init skas0_cmd_param(char *str, int* add)
226{
227 ptrace_faultinfo = proc_mm = 0;
228 return 0;
229}
230
215static int __init nosysemu_cmd_param(char *str, int* add) 231static int __init nosysemu_cmd_param(char *str, int* add)
216{ 232{
217 force_sysemu_disabled = 1; 233 force_sysemu_disabled = 1;
218 return 0; 234 return 0;
219} 235}
220 236
237__uml_setup("skas0", skas0_cmd_param,
238 "skas0\n"
239 " Disables SKAS3 usage, so that SKAS0 is used, unless you \n"
240 " specify mode=tt.\n\n");
241
221__uml_setup("nosysemu", nosysemu_cmd_param, 242__uml_setup("nosysemu", nosysemu_cmd_param,
222 "nosysemu\n" 243 "nosysemu\n"
223 " Turns off syscall emulation patch for ptrace (SYSEMU) on.\n" 244 " Turns off syscall emulation patch for ptrace (SYSEMU) on.\n"
@@ -228,11 +249,12 @@ __uml_setup("nosysemu", nosysemu_cmd_param,
228 249
229static void __init check_sysemu(void) 250static void __init check_sysemu(void)
230{ 251{
252 void *stack;
231 int pid, syscall, n, status, count=0; 253 int pid, syscall, n, status, count=0;
232 254
233 printk("Checking syscall emulation patch for ptrace..."); 255 printk("Checking syscall emulation patch for ptrace...");
234 sysemu_supported = 0; 256 sysemu_supported = 0;
235 pid = start_ptraced_child(); 257 pid = start_ptraced_child(&stack);
236 258
237 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) 259 if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0)
238 goto fail; 260 goto fail;
@@ -250,7 +272,7 @@ static void __init check_sysemu(void)
250 panic("check_sysemu : failed to modify system " 272 panic("check_sysemu : failed to modify system "
251 "call return, errno = %d", errno); 273 "call return, errno = %d", errno);
252 274
253 if (stop_ptraced_child(pid, 0, 0) < 0) 275 if (stop_ptraced_child(pid, stack, 0, 0) < 0)
254 goto fail_stopped; 276 goto fail_stopped;
255 277
256 sysemu_supported = 1; 278 sysemu_supported = 1;
@@ -258,7 +280,7 @@ static void __init check_sysemu(void)
258 set_using_sysemu(!force_sysemu_disabled); 280 set_using_sysemu(!force_sysemu_disabled);
259 281
260 printk("Checking advanced syscall emulation patch for ptrace..."); 282 printk("Checking advanced syscall emulation patch for ptrace...");
261 pid = start_ptraced_child(); 283 pid = start_ptraced_child(&stack);
262 while(1){ 284 while(1){
263 count++; 285 count++;
264 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) 286 if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0)
@@ -283,7 +305,7 @@ static void __init check_sysemu(void)
283 break; 305 break;
284 } 306 }
285 } 307 }
286 if (stop_ptraced_child(pid, 0, 0) < 0) 308 if (stop_ptraced_child(pid, stack, 0, 0) < 0)
287 goto fail_stopped; 309 goto fail_stopped;
288 310
289 sysemu_supported = 2; 311 sysemu_supported = 2;
@@ -294,17 +316,18 @@ static void __init check_sysemu(void)
294 return; 316 return;
295 317
296fail: 318fail:
297 stop_ptraced_child(pid, 1, 0); 319 stop_ptraced_child(pid, stack, 1, 0);
298fail_stopped: 320fail_stopped:
299 printk("missing\n"); 321 printk("missing\n");
300} 322}
301 323
302void __init check_ptrace(void) 324void __init check_ptrace(void)
303{ 325{
326 void *stack;
304 int pid, syscall, n, status; 327 int pid, syscall, n, status;
305 328
306 printk("Checking that ptrace can change system call numbers..."); 329 printk("Checking that ptrace can change system call numbers...");
307 pid = start_ptraced_child(); 330 pid = start_ptraced_child(&stack);
308 331
309 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) 332 if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0)
310 panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno); 333 panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno);
@@ -331,7 +354,7 @@ void __init check_ptrace(void)
331 break; 354 break;
332 } 355 }
333 } 356 }
334 stop_ptraced_child(pid, 0, 1); 357 stop_ptraced_child(pid, stack, 0, 1);
335 printk("OK\n"); 358 printk("OK\n");
336 check_sysemu(); 359 check_sysemu();
337} 360}
@@ -359,22 +382,22 @@ void forward_pending_sigio(int target)
359 kill(target, SIGIO); 382 kill(target, SIGIO);
360} 383}
361 384
362int ptrace_faultinfo = 0;
363int proc_mm = 1;
364
365extern void *__syscall_stub_start, __syscall_stub_end; 385extern void *__syscall_stub_start, __syscall_stub_end;
366 386
367#ifdef UML_CONFIG_MODE_SKAS 387#ifdef UML_CONFIG_MODE_SKAS
388
368static inline void check_skas3_ptrace_support(void) 389static inline void check_skas3_ptrace_support(void)
369{ 390{
370 struct ptrace_faultinfo fi; 391 struct ptrace_faultinfo fi;
392 void *stack;
371 int pid, n; 393 int pid, n;
372 394
373 printf("Checking for the skas3 patch in the host..."); 395 printf("Checking for the skas3 patch in the host...");
374 pid = start_ptraced_child(); 396 pid = start_ptraced_child(&stack);
375 397
376 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); 398 n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi);
377 if (n < 0) { 399 if (n < 0) {
400 ptrace_faultinfo = 0;
378 if(errno == EIO) 401 if(errno == EIO)
379 printf("not found\n"); 402 printf("not found\n");
380 else { 403 else {
@@ -382,12 +405,14 @@ static inline void check_skas3_ptrace_support(void)
382 } 405 }
383 } 406 }
384 else { 407 else {
385 ptrace_faultinfo = 1; 408 if (!ptrace_faultinfo)
386 printf("found\n"); 409 printf("found but disabled on command line\n");
410 else
411 printf("found\n");
387 } 412 }
388 413
389 init_registers(pid); 414 init_registers(pid);
390 stop_ptraced_child(pid, 1, 1); 415 stop_ptraced_child(pid, stack, 1, 1);
391} 416}
392 417
393int can_do_skas(void) 418int can_do_skas(void)
@@ -396,13 +421,13 @@ int can_do_skas(void)
396 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) { 421 if (os_access("/proc/mm", OS_ACC_W_OK) < 0) {
397 proc_mm = 0; 422 proc_mm = 0;
398 printf("not found\n"); 423 printf("not found\n");
399 goto out; 424 } else {
400 } 425 if (!proc_mm)
401 else { 426 printf("found but disabled on command line\n");
402 printf("found\n"); 427 else
428 printf("found\n");
403 } 429 }
404 430
405out:
406 check_skas3_ptrace_support(); 431 check_skas3_ptrace_support();
407 return 1; 432 return 1;
408} 433}
diff --git a/arch/um/kernel/process_kern.c b/arch/um/kernel/process_kern.c
index d4036ed680bc..c23d8a08d0ff 100644
--- a/arch/um/kernel/process_kern.c
+++ b/arch/um/kernel/process_kern.c
@@ -412,7 +412,7 @@ int __init make_proc_sysemu(void)
412 412
413 if (ent == NULL) 413 if (ent == NULL)
414 { 414 {
415 printk("Failed to register /proc/sysemu\n"); 415 printk(KERN_WARNING "Failed to register /proc/sysemu\n");
416 return(0); 416 return(0);
417 } 417 }
418 418
diff --git a/arch/um/kernel/reboot.c b/arch/um/kernel/reboot.c
index fcec51da1d37..a637e885c583 100644
--- a/arch/um/kernel/reboot.c
+++ b/arch/um/kernel/reboot.c
@@ -49,23 +49,17 @@ void machine_restart(char * __unused)
49 CHOOSE_MODE(reboot_tt(), reboot_skas()); 49 CHOOSE_MODE(reboot_tt(), reboot_skas());
50} 50}
51 51
52EXPORT_SYMBOL(machine_restart);
53
54void machine_power_off(void) 52void machine_power_off(void)
55{ 53{
56 uml_cleanup(); 54 uml_cleanup();
57 CHOOSE_MODE(halt_tt(), halt_skas()); 55 CHOOSE_MODE(halt_tt(), halt_skas());
58} 56}
59 57
60EXPORT_SYMBOL(machine_power_off);
61
62void machine_halt(void) 58void machine_halt(void)
63{ 59{
64 machine_power_off(); 60 machine_power_off();
65} 61}
66 62
67EXPORT_SYMBOL(machine_halt);
68
69/* 63/*
70 * Overrides for Emacs so that we follow Linus's tabbing style. 64 * Overrides for Emacs so that we follow Linus's tabbing style.
71 * Emacs will notice this stuff at the end of the file and automatically 65 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/kernel/skas/process.c b/arch/um/kernel/skas/process.c
index ba671dab8878..6dd9e5bf18ed 100644
--- a/arch/um/kernel/skas/process.c
+++ b/arch/um/kernel/skas/process.c
@@ -64,7 +64,7 @@ void wait_stub_done(int pid, int sig, char * fname)
64 (WSTOPSIG(status) == SIGVTALRM)); 64 (WSTOPSIG(status) == SIGVTALRM));
65 65
66 if((n < 0) || !WIFSTOPPED(status) || 66 if((n < 0) || !WIFSTOPPED(status) ||
67 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status != SIGTRAP))){ 67 (WSTOPSIG(status) != SIGUSR1 && WSTOPSIG(status) != SIGTRAP)){
68 panic("%s : failed to wait for SIGUSR1/SIGTRAP, " 68 panic("%s : failed to wait for SIGUSR1/SIGTRAP, "
69 "pid = %d, n = %d, errno = %d, status = 0x%x\n", 69 "pid = %d, n = %d, errno = %d, status = 0x%x\n",
70 fname, pid, n, errno, status); 70 fname, pid, n, errno, status);
diff --git a/arch/um/kernel/skas/syscall_user.c b/arch/um/kernel/skas/syscall_user.c
index 2828e6e37721..6b0664970147 100644
--- a/arch/um/kernel/skas/syscall_user.c
+++ b/arch/um/kernel/skas/syscall_user.c
@@ -15,7 +15,7 @@
15void handle_syscall(union uml_pt_regs *regs) 15void handle_syscall(union uml_pt_regs *regs)
16{ 16{
17 long result; 17 long result;
18#if UML_CONFIG_SYSCALL_DEBUG 18#ifdef UML_CONFIG_SYSCALL_DEBUG
19 int index; 19 int index;
20 20
21 index = record_syscall_start(UPT_SYSCALL_NR(regs)); 21 index = record_syscall_start(UPT_SYSCALL_NR(regs));
@@ -27,7 +27,7 @@ void handle_syscall(union uml_pt_regs *regs)
27 REGS_SET_SYSCALL_RETURN(regs->skas.regs, result); 27 REGS_SET_SYSCALL_RETURN(regs->skas.regs, result);
28 28
29 syscall_trace(regs, 1); 29 syscall_trace(regs, 1);
30#if UML_CONFIG_SYSCALL_DEBUG 30#ifdef UML_CONFIG_SYSCALL_DEBUG
31 record_syscall_end(index, result); 31 record_syscall_end(index, result);
32#endif 32#endif
33} 33}
diff --git a/arch/um/kernel/skas/trap_user.c b/arch/um/kernel/skas/trap_user.c
index 0dee1d95c806..9950a6716fe5 100644
--- a/arch/um/kernel/skas/trap_user.c
+++ b/arch/um/kernel/skas/trap_user.c
@@ -58,7 +58,6 @@ void user_signal(int sig, union uml_pt_regs *regs, int pid)
58 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) || 58 int segv = ((sig == SIGFPE) || (sig == SIGSEGV) || (sig == SIGBUS) ||
59 (sig == SIGILL) || (sig == SIGTRAP)); 59 (sig == SIGILL) || (sig == SIGTRAP));
60 60
61 regs->skas.is_user = 1;
62 if (segv) 61 if (segv)
63 get_skas_faultinfo(pid, &regs->skas.faultinfo); 62 get_skas_faultinfo(pid, &regs->skas.faultinfo);
64 info = &sig_info[sig]; 63 info = &sig_info[sig];
diff --git a/arch/um/kernel/time_kern.c b/arch/um/kernel/time_kern.c
index a8b4ef601f59..4e08f7545d63 100644
--- a/arch/um/kernel/time_kern.c
+++ b/arch/um/kernel/time_kern.c
@@ -137,7 +137,10 @@ long um_stime(int __user *tptr)
137void timer_handler(int sig, union uml_pt_regs *regs) 137void timer_handler(int sig, union uml_pt_regs *regs)
138{ 138{
139 local_irq_disable(); 139 local_irq_disable();
140 update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)), (regs)->skas.is_user)); 140 irq_enter();
141 update_process_times(CHOOSE_MODE(user_context(UPT_SP(regs)),
142 (regs)->skas.is_user));
143 irq_exit();
141 local_irq_enable(); 144 local_irq_enable();
142 if(current_thread->cpu == 0) 145 if(current_thread->cpu == 0)
143 timer_irq(regs); 146 timer_irq(regs);
diff --git a/arch/um/kernel/um_arch.c b/arch/um/kernel/um_arch.c
index 8736d098f0ee..ca2bb6f09a7d 100644
--- a/arch/um/kernel/um_arch.c
+++ b/arch/um/kernel/um_arch.c
@@ -38,6 +38,9 @@
38#include "choose-mode.h" 38#include "choose-mode.h"
39#include "mode_kern.h" 39#include "mode_kern.h"
40#include "mode.h" 40#include "mode.h"
41#ifdef UML_CONFIG_MODE_SKAS
42#include "skas.h"
43#endif
41 44
42#define DEFAULT_COMMAND_LINE "root=98:0" 45#define DEFAULT_COMMAND_LINE "root=98:0"
43 46
@@ -318,6 +321,7 @@ int linux_main(int argc, char **argv)
318 unsigned long avail, diff; 321 unsigned long avail, diff;
319 unsigned long virtmem_size, max_physmem; 322 unsigned long virtmem_size, max_physmem;
320 unsigned int i, add; 323 unsigned int i, add;
324 char * mode;
321 325
322 for (i = 1; i < argc; i++){ 326 for (i = 1; i < argc; i++){
323 if((i == 1) && (argv[i][0] == ' ')) continue; 327 if((i == 1) && (argv[i][0] == ' ')) continue;
@@ -338,6 +342,21 @@ int linux_main(int argc, char **argv)
338 exit(1); 342 exit(1);
339 } 343 }
340#endif 344#endif
345
346#ifndef CONFIG_MODE_SKAS
347 mode = "TT";
348#else
349 /* Show to the user the result of selection */
350 if (mode_tt)
351 mode = "TT";
352 else if (proc_mm && ptrace_faultinfo)
353 mode = "SKAS3";
354 else
355 mode = "SKAS0";
356#endif
357
358 printf("UML running in %s mode\n", mode);
359
341 uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0, 360 uml_start = CHOOSE_MODE_PROC(set_task_sizes_tt, set_task_sizes_skas, 0,
342 &host_task_size, &task_size); 361 &host_task_size, &task_size);
343 362
diff --git a/arch/um/os-Linux/elf_aux.c b/arch/um/os-Linux/elf_aux.c
index f0d6060e3e57..5423b1ca17c4 100644
--- a/arch/um/os-Linux/elf_aux.c
+++ b/arch/um/os-Linux/elf_aux.c
@@ -11,6 +11,7 @@
11#include <stddef.h> 11#include <stddef.h>
12#include "init.h" 12#include "init.h"
13#include "elf_user.h" 13#include "elf_user.h"
14#include <asm/elf.h>
14 15
15#if ELF_CLASS == ELFCLASS32 16#if ELF_CLASS == ELFCLASS32
16typedef Elf32_auxv_t elf_auxv_t; 17typedef Elf32_auxv_t elf_auxv_t;
diff --git a/arch/um/os-Linux/user_syms.c b/arch/um/os-Linux/user_syms.c
index 75d7af9ae1d2..56d3f870926b 100644
--- a/arch/um/os-Linux/user_syms.c
+++ b/arch/um/os-Linux/user_syms.c
@@ -83,6 +83,9 @@ EXPORT_SYMBOL_PROTO(statfs64);
83 83
84EXPORT_SYMBOL_PROTO(getuid); 84EXPORT_SYMBOL_PROTO(getuid);
85 85
86EXPORT_SYMBOL_PROTO(fsync);
87EXPORT_SYMBOL_PROTO(fdatasync);
88
86/* 89/*
87 * Overrides for Emacs so that we follow Linus's tabbing style. 90 * Overrides for Emacs so that we follow Linus's tabbing style.
88 * Emacs will notice this stuff at the end of the file and automatically 91 * Emacs will notice this stuff at the end of the file and automatically
diff --git a/arch/um/sys-i386/stub_segv.c b/arch/um/sys-i386/stub_segv.c
index b251442ad0b1..68aeabe3a654 100644
--- a/arch/um/sys-i386/stub_segv.c
+++ b/arch/um/sys-i386/stub_segv.c
@@ -21,10 +21,10 @@ stub_segv_handler(int sig)
21 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid)); 21 __asm__("movl %0, %%eax ; int $0x80": : "g" (__NR_getpid));
22 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;" 22 __asm__("movl %%eax, %%ebx ; movl %0, %%eax ; movl %1, %%ecx ;"
23 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1)); 23 "int $0x80": : "g" (__NR_kill), "g" (SIGUSR1));
24 /* Pop the frame pointer and return address since we need to leave 24 /* Load pointer to sigcontext into esp, since we need to leave
25 * the stack in its original form when we do the sigreturn here, by 25 * the stack in its original form when we do the sigreturn here, by
26 * hand. 26 * hand.
27 */ 27 */
28 __asm__("popl %%eax ; popl %%eax ; popl %%eax ; movl %0, %%eax ; " 28 __asm__("mov %0,%%esp ; movl %1, %%eax ; "
29 "int $0x80" : : "g" (__NR_sigreturn)); 29 "int $0x80" : : "a" (sc), "g" (__NR_sigreturn));
30} 30}
diff --git a/arch/v850/Makefile b/arch/v850/Makefile
index 6edaed4a310e..bf38ca0ad781 100644
--- a/arch/v850/Makefile
+++ b/arch/v850/Makefile
@@ -1,8 +1,8 @@
1# 1#
2# arch/v850/Makefile 2# arch/v850/Makefile
3# 3#
4# Copyright (C) 2001,02,03 NEC Corporation 4# Copyright (C) 2001,02,03,05 NEC Corporation
5# Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> 5# Copyright (C) 2001,02,03,05 Miles Bader <miles@gnu.org>
6# 6#
7# This file is included by the global makefile so that you can add your own 7# This file is included by the global makefile so that you can add your own
8# architecture-specific flags and dependencies. Remember to do have actions 8# architecture-specific flags and dependencies. Remember to do have actions
@@ -22,6 +22,9 @@ CFLAGS += -ffixed-r16 -mno-prolog-function
22CFLAGS += -fno-builtin 22CFLAGS += -fno-builtin
23CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\" 23CFLAGS += -D__linux__ -DUTS_SYSNAME=\"uClinux\"
24 24
25# By default, build a kernel that runs on the gdb v850 simulator.
26KBUILD_DEFCONFIG := sim_defconfig
27
25# This prevents the linker from consolidating the .gnu.linkonce.this_module 28# This prevents the linker from consolidating the .gnu.linkonce.this_module
26# section into .text (which the v850 default linker script for -r does for 29# section into .text (which the v850 default linker script for -r does for
27# some reason) 30# some reason)
diff --git a/arch/v850/README b/arch/v850/README
index 01b98e290d4a..12f7f7a665e0 100644
--- a/arch/v850/README
+++ b/arch/v850/README
@@ -1,31 +1,43 @@
1This port to the NEC V850E processor supports the following platforms: 1This port to the NEC V850E processor supports the following platforms:
2 2
3 + The gdb v850e simulator (CONFIG_V850E_SIM). 3 "sim"
4 4 The gdb v850e simulator (CONFIG_V850E_SIM).
5 + The Midas labs RTE-V850E/MA1-CB and RTE-V850E/NB85E-CB evaluation boards 5
6 (CONFIG_RTE_CB_MA1 and CONFIG_RTE_CB_NB85E). This support has only been 6 "rte-ma1-cb"
7 tested when running with the Multi-debugger monitor ROM (for the Green 7 The Midas labs RTE-V850E/MA1-CB and RTE-V850E/NB85E-CB evaluation
8 Hills Multi debugger). The optional NEC Solution Gear RTE-MOTHER-A 8 boards (CONFIG_RTE_CB_MA1 and CONFIG_RTE_CB_NB85E). This support
9 motherboard is also supported, which allows PCI boards to be used 9 has only been tested when running with the Multi-debugger monitor
10 (CONFIG_RTE_MB_A_PCI). 10 ROM (for the Green Hills Multi debugger). The optional NEC
11 11 Solution Gear RTE-MOTHER-A motherboard is also supported, which
12 + The Midas labs RTE-V850E/ME2-CB evaluation board (CONFIG_RTE_CB_ME2). 12 allows PCI boards to be used (CONFIG_RTE_MB_A_PCI).
13 This has only been tested using a kernel downloaded via an ICE connection 13
14 using the Multi debugger. Support for the RTE-MOTHER-A is present, but 14 "rte-me2-cb"
15 hasn't been tested (unlike the other Midas labs cpu boards, the 15 The Midas labs RTE-V850E/ME2-CB evaluation board (CONFIG_RTE_CB_ME2).
16 RTE-V850E/ME2-CB includes an ethernet adaptor). 16 This has only been tested using a kernel downloaded via an ICE
17 17 connection using the Multi debugger. Support for the RTE-MOTHER-A is
18 + The NEC AS85EP1 V850E evaluation chip/board (CONFIG_V850E_AS85EP1). 18 present, but hasn't been tested (unlike the other Midas labs cpu
19 19 boards, the RTE-V850E/ME2-CB includes an ethernet adaptor).
20 + The NEC `Anna' (board/chip) implementation of the V850E2 processor 20
21 (CONFIG_V850E2_ANNA). 21 "as85ep1"
22 22 The NEC AS85EP1 V850E evaluation chip/board (CONFIG_V850E_AS85EP1).
23 + The sim85e2c and sim85e2s simulators, which are verilog simulations of 23
24 the V850E2 NA85E2C/NA85E2S cpu cores (CONFIG_V850E2_SIM85E2C and 24 "anna"
25 CONFIG_V850E2_SIM85E2S). 25 The NEC `Anna' (board/chip) implementation of the V850E2 processor
26 26 (CONFIG_V850E2_ANNA).
27 + A FPGA implementation of the V850E2 NA85E2C cpu core 27
28 (CONFIG_V850E2_FPGA85E2C). 28 "sim85e2c", "sim85e2s"
29 The sim85e2c and sim85e2s simulators, which are verilog simulations
30 of the V850E2 NA85E2C/NA85E2S cpu cores (CONFIG_V850E2_SIM85E2C and
31 CONFIG_V850E2_SIM85E2S).
32
33 "fpga85e2c"
34 A FPGA implementation of the V850E2 NA85E2C cpu core
35 (CONFIG_V850E2_FPGA85E2C).
36
37To get a default kernel configuration for a particular platform, you can
38use a <platform>_defconfig make target (e.g., "make rte-me2-cb_defconfig");
39to see which default configurations are possible, look in the directory
40"arch/v850/configs".
29 41
30Porting to anything with a V850E/MA1 or MA2 processor should be simple. 42Porting to anything with a V850E/MA1 or MA2 processor should be simple.
31See the file <asm-v850/machdep.h> and the files it includes for an example of 43See the file <asm-v850/machdep.h> and the files it includes for an example of
diff --git a/arch/v850/configs/rte-ma1-cb_defconfig b/arch/v850/configs/rte-ma1-cb_defconfig
new file mode 100644
index 000000000000..1b5ca3c3a658
--- /dev/null
+++ b/arch/v850/configs/rte-ma1-cb_defconfig
@@ -0,0 +1,605 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-uc0
4# Thu Jul 21 11:08:27 2005
5#
6# CONFIG_MMU is not set
7# CONFIG_UID16 is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11# CONFIG_ISA is not set
12# CONFIG_ISAPNP is not set
13# CONFIG_EISA is not set
14# CONFIG_MCA is not set
15CONFIG_V850=y
16
17#
18# Processor type and features
19#
20# CONFIG_V850E_SIM is not set
21CONFIG_RTE_CB_MA1=y
22# CONFIG_RTE_CB_NB85E is not set
23# CONFIG_RTE_CB_ME2 is not set
24# CONFIG_V850E_AS85EP1 is not set
25# CONFIG_V850E2_SIM85E2C is not set
26# CONFIG_V850E2_SIM85E2S is not set
27# CONFIG_V850E2_FPGA85E2C is not set
28# CONFIG_V850E2_ANNA is not set
29CONFIG_V850E=y
30CONFIG_V850E_MA1=y
31CONFIG_RTE_CB=y
32CONFIG_RTE_CB_MULTI=y
33CONFIG_RTE_CB_MULTI_DBTRAP=y
34# CONFIG_RTE_CB_MA1_KSRAM is not set
35CONFIG_RTE_MB_A_PCI=y
36CONFIG_RTE_GBUS_INT=y
37CONFIG_PCI=y
38CONFIG_V850E_INTC=y
39CONFIG_V850E_TIMER_D=y
40# CONFIG_V850E_CACHE is not set
41# CONFIG_V850E2_CACHE is not set
42CONFIG_NO_CACHE=y
43CONFIG_ZERO_BSS=y
44# CONFIG_V850E_HIGHRES_TIMER is not set
45# CONFIG_RESET_GUARD is not set
46CONFIG_LARGE_ALLOCS=y
47
48#
49# Code maturity level options
50#
51# CONFIG_EXPERIMENTAL is not set
52CONFIG_CLEAN_COMPILE=y
53CONFIG_BROKEN_ON_SMP=y
54CONFIG_INIT_ENV_ARG_LIMIT=32
55
56#
57# General setup
58#
59CONFIG_LOCALVERSION=""
60# CONFIG_BSD_PROCESS_ACCT is not set
61# CONFIG_SYSCTL is not set
62# CONFIG_AUDIT is not set
63# CONFIG_HOTPLUG is not set
64CONFIG_KOBJECT_UEVENT=y
65# CONFIG_IKCONFIG is not set
66CONFIG_EMBEDDED=y
67# CONFIG_KALLSYMS is not set
68CONFIG_PRINTK=y
69CONFIG_BUG=y
70# CONFIG_BASE_FULL is not set
71# CONFIG_FUTEX is not set
72# CONFIG_EPOLL is not set
73CONFIG_CC_OPTIMIZE_FOR_SIZE=y
74CONFIG_CC_ALIGN_FUNCTIONS=0
75CONFIG_CC_ALIGN_LABELS=0
76CONFIG_CC_ALIGN_LOOPS=0
77CONFIG_CC_ALIGN_JUMPS=0
78CONFIG_BASE_SMALL=1
79
80#
81# Loadable module support
82#
83CONFIG_MODULES=y
84CONFIG_MODULE_UNLOAD=y
85CONFIG_OBSOLETE_MODPARM=y
86# CONFIG_MODULE_SRCVERSION_ALL is not set
87CONFIG_KMOD=y
88
89#
90# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
91#
92# CONFIG_PCI_LEGACY_PROC is not set
93# CONFIG_PCI_NAMES is not set
94# CONFIG_PCI_DEBUG is not set
95
96#
97# PCCARD (PCMCIA/CardBus) support
98#
99# CONFIG_PCCARD is not set
100
101#
102# PCI Hotplug Support
103#
104
105#
106# Executable file formats
107#
108CONFIG_BINFMT_FLAT=y
109# CONFIG_BINFMT_ZFLAT is not set
110# CONFIG_BINFMT_SHARED_FLAT is not set
111# CONFIG_BINFMT_MISC is not set
112
113#
114# Generic Driver Options
115#
116CONFIG_STANDALONE=y
117CONFIG_PREVENT_FIRMWARE_BUILD=y
118# CONFIG_FW_LOADER is not set
119# CONFIG_DEBUG_DRIVER is not set
120
121#
122# Memory Technology Devices (MTD)
123#
124CONFIG_MTD=y
125# CONFIG_MTD_DEBUG is not set
126# CONFIG_MTD_CONCAT is not set
127# CONFIG_MTD_PARTITIONS is not set
128
129#
130# User Modules And Translation Layers
131#
132# CONFIG_MTD_CHAR is not set
133CONFIG_MTD_BLOCK=y
134# CONFIG_FTL is not set
135# CONFIG_NFTL is not set
136# CONFIG_INFTL is not set
137
138#
139# RAM/ROM/Flash chip drivers
140#
141# CONFIG_MTD_CFI is not set
142# CONFIG_MTD_JEDECPROBE is not set
143CONFIG_MTD_MAP_BANK_WIDTH_1=y
144CONFIG_MTD_MAP_BANK_WIDTH_2=y
145CONFIG_MTD_MAP_BANK_WIDTH_4=y
146# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
147# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
148# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
149CONFIG_MTD_CFI_I1=y
150CONFIG_MTD_CFI_I2=y
151# CONFIG_MTD_CFI_I4 is not set
152# CONFIG_MTD_CFI_I8 is not set
153# CONFIG_MTD_RAM is not set
154# CONFIG_MTD_ROM is not set
155# CONFIG_MTD_ABSENT is not set
156
157#
158# Mapping drivers for chip access
159#
160# CONFIG_MTD_COMPLEX_MAPPINGS is not set
161
162#
163# Self-contained MTD device drivers
164#
165# CONFIG_MTD_PMC551 is not set
166CONFIG_MTD_SLRAM=y
167# CONFIG_MTD_PHRAM is not set
168# CONFIG_MTD_MTDRAM is not set
169# CONFIG_MTD_BLKMTD is not set
170
171#
172# Disk-On-Chip Device Drivers
173#
174# CONFIG_MTD_DOC2000 is not set
175# CONFIG_MTD_DOC2001 is not set
176# CONFIG_MTD_DOC2001PLUS is not set
177
178#
179# NAND Flash Device Drivers
180#
181# CONFIG_MTD_NAND is not set
182
183#
184# Parallel port support
185#
186# CONFIG_PARPORT is not set
187
188#
189# Block devices
190#
191# CONFIG_BLK_DEV_FD is not set
192# CONFIG_BLK_CPQ_DA is not set
193# CONFIG_BLK_CPQ_CISS_DA is not set
194# CONFIG_BLK_DEV_DAC960 is not set
195# CONFIG_BLK_DEV_COW_COMMON is not set
196# CONFIG_BLK_DEV_LOOP is not set
197# CONFIG_BLK_DEV_NBD is not set
198# CONFIG_BLK_DEV_SX8 is not set
199# CONFIG_BLK_DEV_RAM is not set
200CONFIG_BLK_DEV_RAM_COUNT=16
201CONFIG_INITRAMFS_SOURCE=""
202# CONFIG_CDROM_PKTCDVD is not set
203
204#
205# IO Schedulers
206#
207CONFIG_IOSCHED_NOOP=y
208# CONFIG_IOSCHED_AS is not set
209# CONFIG_IOSCHED_DEADLINE is not set
210# CONFIG_IOSCHED_CFQ is not set
211# CONFIG_ATA_OVER_ETH is not set
212
213#
214# Disk device support
215#
216
217#
218# ATA/ATAPI/MFM/RLL support
219#
220# CONFIG_IDE is not set
221
222#
223# SCSI device support
224#
225# CONFIG_SCSI is not set
226
227#
228# Multi-device support (RAID and LVM)
229#
230# CONFIG_MD is not set
231
232#
233# Fusion MPT device support
234#
235
236#
237# IEEE 1394 (FireWire) support
238#
239# CONFIG_IEEE1394 is not set
240
241#
242# I2O device support
243#
244# CONFIG_I2O is not set
245
246#
247# Networking support
248#
249CONFIG_NET=y
250
251#
252# Networking options
253#
254# CONFIG_PACKET is not set
255# CONFIG_UNIX is not set
256# CONFIG_NET_KEY is not set
257CONFIG_INET=y
258# CONFIG_IP_MULTICAST is not set
259# CONFIG_IP_ADVANCED_ROUTER is not set
260# CONFIG_IP_PNP is not set
261# CONFIG_NET_IPIP is not set
262# CONFIG_NET_IPGRE is not set
263# CONFIG_SYN_COOKIES is not set
264# CONFIG_INET_AH is not set
265# CONFIG_INET_ESP is not set
266# CONFIG_INET_IPCOMP is not set
267# CONFIG_INET_TUNNEL is not set
268# CONFIG_IP_TCPDIAG is not set
269# CONFIG_IP_TCPDIAG_IPV6 is not set
270# CONFIG_IPV6 is not set
271# CONFIG_NETFILTER is not set
272# CONFIG_BRIDGE is not set
273# CONFIG_VLAN_8021Q is not set
274# CONFIG_DECNET is not set
275# CONFIG_LLC2 is not set
276# CONFIG_IPX is not set
277# CONFIG_ATALK is not set
278
279#
280# QoS and/or fair queueing
281#
282# CONFIG_NET_SCHED is not set
283# CONFIG_NET_CLS_ROUTE is not set
284
285#
286# Network testing
287#
288# CONFIG_NET_PKTGEN is not set
289# CONFIG_NETPOLL is not set
290# CONFIG_NET_POLL_CONTROLLER is not set
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294CONFIG_NETDEVICES=y
295# CONFIG_DUMMY is not set
296# CONFIG_BONDING is not set
297# CONFIG_EQUALIZER is not set
298# CONFIG_TUN is not set
299
300#
301# ARCnet devices
302#
303# CONFIG_ARCNET is not set
304
305#
306# Ethernet (10 or 100Mbit)
307#
308CONFIG_NET_ETHERNET=y
309CONFIG_MII=y
310# CONFIG_HAPPYMEAL is not set
311# CONFIG_SUNGEM is not set
312# CONFIG_NET_VENDOR_3COM is not set
313# CONFIG_NET_VENDOR_SMC is not set
314
315#
316# Tulip family network device support
317#
318# CONFIG_NET_TULIP is not set
319# CONFIG_HP100 is not set
320# CONFIG_NE2000 is not set
321CONFIG_NET_PCI=y
322# CONFIG_PCNET32 is not set
323# CONFIG_AMD8111_ETH is not set
324# CONFIG_ADAPTEC_STARFIRE is not set
325# CONFIG_DGRS is not set
326CONFIG_EEPRO100=y
327# CONFIG_E100 is not set
328# CONFIG_FEALNX is not set
329# CONFIG_NATSEMI is not set
330# CONFIG_NE2K_PCI is not set
331# CONFIG_8139TOO is not set
332# CONFIG_SIS900 is not set
333# CONFIG_EPIC100 is not set
334# CONFIG_SUNDANCE is not set
335# CONFIG_TLAN is not set
336# CONFIG_VIA_RHINE is not set
337
338#
339# Ethernet (1000 Mbit)
340#
341# CONFIG_ACENIC is not set
342# CONFIG_DL2K is not set
343# CONFIG_E1000 is not set
344# CONFIG_NS83820 is not set
345# CONFIG_HAMACHI is not set
346# CONFIG_R8169 is not set
347# CONFIG_SK98LIN is not set
348# CONFIG_VIA_VELOCITY is not set
349# CONFIG_TIGON3 is not set
350# CONFIG_BNX2 is not set
351
352#
353# Ethernet (10000 Mbit)
354#
355# CONFIG_IXGB is not set
356# CONFIG_S2IO is not set
357
358#
359# Token Ring devices
360#
361# CONFIG_TR is not set
362
363#
364# Wireless LAN (non-hamradio)
365#
366# CONFIG_NET_RADIO is not set
367
368#
369# Wan interfaces
370#
371# CONFIG_WAN is not set
372# CONFIG_FDDI is not set
373# CONFIG_PPP is not set
374# CONFIG_SLIP is not set
375
376#
377# ISDN subsystem
378#
379# CONFIG_ISDN is not set
380
381#
382# Input device support
383#
384CONFIG_INPUT=y
385
386#
387# Userland interfaces
388#
389# CONFIG_INPUT_MOUSEDEV is not set
390# CONFIG_INPUT_JOYDEV is not set
391# CONFIG_INPUT_TSDEV is not set
392# CONFIG_INPUT_EVDEV is not set
393# CONFIG_INPUT_EVBUG is not set
394
395#
396# Input Device Drivers
397#
398# CONFIG_INPUT_KEYBOARD is not set
399# CONFIG_INPUT_MOUSE is not set
400# CONFIG_INPUT_JOYSTICK is not set
401# CONFIG_INPUT_TOUCHSCREEN is not set
402# CONFIG_INPUT_MISC is not set
403
404#
405# Hardware I/O ports
406#
407# CONFIG_SERIO is not set
408# CONFIG_GAMEPORT is not set
409
410#
411# Character devices
412#
413# CONFIG_VT is not set
414# CONFIG_SERIAL_NONSTANDARD is not set
415
416#
417# Serial drivers
418#
419# CONFIG_SERIAL_8250 is not set
420
421#
422# Non-8250 serial port support
423#
424CONFIG_V850E_UART=y
425CONFIG_V850E_UART_CONSOLE=y
426CONFIG_SERIAL_CORE=y
427CONFIG_SERIAL_CORE_CONSOLE=y
428# CONFIG_SERIAL_JSM is not set
429# CONFIG_UNIX98_PTYS is not set
430# CONFIG_LEGACY_PTYS is not set
431
432#
433# IPMI
434#
435# CONFIG_IPMI_HANDLER is not set
436
437#
438# Watchdog Cards
439#
440# CONFIG_WATCHDOG is not set
441# CONFIG_RTC is not set
442# CONFIG_GEN_RTC is not set
443# CONFIG_DTLK is not set
444# CONFIG_R3964 is not set
445# CONFIG_APPLICOM is not set
446
447#
448# Ftape, the floppy tape device driver
449#
450# CONFIG_DRM is not set
451# CONFIG_RAW_DRIVER is not set
452
453#
454# TPM devices
455#
456
457#
458# Multimedia devices
459#
460# CONFIG_VIDEO_DEV is not set
461
462#
463# Digital Video Broadcasting Devices
464#
465# CONFIG_DVB is not set
466
467#
468# File systems
469#
470# CONFIG_EXT2_FS is not set
471# CONFIG_EXT3_FS is not set
472# CONFIG_JBD is not set
473# CONFIG_REISERFS_FS is not set
474# CONFIG_JFS_FS is not set
475
476#
477# XFS support
478#
479# CONFIG_XFS_FS is not set
480# CONFIG_MINIX_FS is not set
481CONFIG_ROMFS_FS=y
482# CONFIG_QUOTA is not set
483CONFIG_DNOTIFY=y
484# CONFIG_AUTOFS_FS is not set
485# CONFIG_AUTOFS4_FS is not set
486
487#
488# CD-ROM/DVD Filesystems
489#
490# CONFIG_ISO9660_FS is not set
491# CONFIG_UDF_FS is not set
492
493#
494# DOS/FAT/NT Filesystems
495#
496# CONFIG_MSDOS_FS is not set
497# CONFIG_VFAT_FS is not set
498# CONFIG_NTFS_FS is not set
499
500#
501# Pseudo filesystems
502#
503CONFIG_PROC_FS=y
504CONFIG_SYSFS=y
505# CONFIG_TMPFS is not set
506# CONFIG_HUGETLB_PAGE is not set
507CONFIG_RAMFS=y
508
509#
510# Miscellaneous filesystems
511#
512# CONFIG_HFSPLUS_FS is not set
513# CONFIG_JFFS_FS is not set
514# CONFIG_JFFS2_FS is not set
515# CONFIG_CRAMFS is not set
516# CONFIG_VXFS_FS is not set
517# CONFIG_HPFS_FS is not set
518# CONFIG_QNX4FS_FS is not set
519# CONFIG_SYSV_FS is not set
520# CONFIG_UFS_FS is not set
521
522#
523# Network File Systems
524#
525CONFIG_NFS_FS=y
526CONFIG_NFS_V3=y
527# CONFIG_NFSD is not set
528CONFIG_LOCKD=y
529CONFIG_LOCKD_V4=y
530CONFIG_SUNRPC=y
531# CONFIG_SMB_FS is not set
532# CONFIG_CIFS is not set
533# CONFIG_NCP_FS is not set
534# CONFIG_CODA_FS is not set
535
536#
537# Partition Types
538#
539# CONFIG_PARTITION_ADVANCED is not set
540CONFIG_MSDOS_PARTITION=y
541
542#
543# Native Language Support
544#
545# CONFIG_NLS is not set
546
547#
548# Graphics support
549#
550# CONFIG_FB is not set
551
552#
553# Sound
554#
555# CONFIG_SOUND is not set
556
557#
558# USB support
559#
560CONFIG_USB_ARCH_HAS_HCD=y
561CONFIG_USB_ARCH_HAS_OHCI=y
562# CONFIG_USB is not set
563
564#
565# USB Gadget Support
566#
567# CONFIG_USB_GADGET is not set
568
569#
570# Kernel hacking
571#
572# CONFIG_PRINTK_TIME is not set
573CONFIG_DEBUG_KERNEL=y
574# CONFIG_MAGIC_SYSRQ is not set
575CONFIG_LOG_BUF_SHIFT=14
576# CONFIG_SCHEDSTATS is not set
577# CONFIG_DEBUG_SLAB is not set
578# CONFIG_DEBUG_SPINLOCK is not set
579# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
580# CONFIG_DEBUG_KOBJECT is not set
581CONFIG_DEBUG_INFO=y
582# CONFIG_DEBUG_FS is not set
583# CONFIG_NO_KERNEL_MSG is not set
584
585#
586# Security options
587#
588# CONFIG_KEYS is not set
589# CONFIG_SECURITY is not set
590
591#
592# Cryptographic options
593#
594# CONFIG_CRYPTO is not set
595
596#
597# Hardware crypto devices
598#
599
600#
601# Library routines
602#
603# CONFIG_CRC_CCITT is not set
604# CONFIG_CRC32 is not set
605# CONFIG_LIBCRC32C is not set
diff --git a/arch/v850/configs/rte-me2-cb_defconfig b/arch/v850/configs/rte-me2-cb_defconfig
new file mode 100644
index 000000000000..44becc065404
--- /dev/null
+++ b/arch/v850/configs/rte-me2-cb_defconfig
@@ -0,0 +1,453 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-uc0
4# Thu Jul 21 11:30:08 2005
5#
6# CONFIG_MMU is not set
7# CONFIG_UID16 is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11# CONFIG_ISA is not set
12# CONFIG_ISAPNP is not set
13# CONFIG_EISA is not set
14# CONFIG_MCA is not set
15CONFIG_V850=y
16
17#
18# Processor type and features
19#
20# CONFIG_V850E_SIM is not set
21# CONFIG_RTE_CB_MA1 is not set
22# CONFIG_RTE_CB_NB85E is not set
23CONFIG_RTE_CB_ME2=y
24# CONFIG_V850E_AS85EP1 is not set
25# CONFIG_V850E2_SIM85E2C is not set
26# CONFIG_V850E2_SIM85E2S is not set
27# CONFIG_V850E2_FPGA85E2C is not set
28# CONFIG_V850E2_ANNA is not set
29CONFIG_V850E=y
30CONFIG_V850E_ME2=y
31CONFIG_RTE_CB=y
32# CONFIG_RTE_MB_A_PCI is not set
33# CONFIG_PCI is not set
34CONFIG_V850E_INTC=y
35CONFIG_V850E_TIMER_D=y
36CONFIG_V850E_CACHE=y
37# CONFIG_V850E2_CACHE is not set
38# CONFIG_NO_CACHE is not set
39# CONFIG_ROM_KERNEL is not set
40CONFIG_ZERO_BSS=y
41# CONFIG_V850E_HIGHRES_TIMER is not set
42# CONFIG_RESET_GUARD is not set
43CONFIG_LARGE_ALLOCS=y
44
45#
46# Code maturity level options
47#
48# CONFIG_EXPERIMENTAL is not set
49CONFIG_CLEAN_COMPILE=y
50CONFIG_BROKEN_ON_SMP=y
51CONFIG_INIT_ENV_ARG_LIMIT=32
52
53#
54# General setup
55#
56CONFIG_LOCALVERSION=""
57# CONFIG_BSD_PROCESS_ACCT is not set
58# CONFIG_SYSCTL is not set
59# CONFIG_AUDIT is not set
60# CONFIG_HOTPLUG is not set
61# CONFIG_IKCONFIG is not set
62CONFIG_EMBEDDED=y
63# CONFIG_KALLSYMS is not set
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66# CONFIG_BASE_FULL is not set
67# CONFIG_FUTEX is not set
68# CONFIG_EPOLL is not set
69CONFIG_CC_OPTIMIZE_FOR_SIZE=y
70CONFIG_CC_ALIGN_FUNCTIONS=0
71CONFIG_CC_ALIGN_LABELS=0
72CONFIG_CC_ALIGN_LOOPS=0
73CONFIG_CC_ALIGN_JUMPS=0
74CONFIG_BASE_SMALL=1
75
76#
77# Loadable module support
78#
79CONFIG_MODULES=y
80CONFIG_MODULE_UNLOAD=y
81CONFIG_OBSOLETE_MODPARM=y
82# CONFIG_MODULE_SRCVERSION_ALL is not set
83CONFIG_KMOD=y
84
85#
86# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
87#
88
89#
90# PCCARD (PCMCIA/CardBus) support
91#
92# CONFIG_PCCARD is not set
93
94#
95# PCI Hotplug Support
96#
97
98#
99# Executable file formats
100#
101CONFIG_BINFMT_FLAT=y
102# CONFIG_BINFMT_ZFLAT is not set
103# CONFIG_BINFMT_SHARED_FLAT is not set
104# CONFIG_BINFMT_MISC is not set
105
106#
107# Generic Driver Options
108#
109CONFIG_STANDALONE=y
110CONFIG_PREVENT_FIRMWARE_BUILD=y
111# CONFIG_FW_LOADER is not set
112# CONFIG_DEBUG_DRIVER is not set
113
114#
115# Memory Technology Devices (MTD)
116#
117CONFIG_MTD=y
118# CONFIG_MTD_DEBUG is not set
119# CONFIG_MTD_CONCAT is not set
120# CONFIG_MTD_PARTITIONS is not set
121
122#
123# User Modules And Translation Layers
124#
125# CONFIG_MTD_CHAR is not set
126CONFIG_MTD_BLOCK=y
127# CONFIG_FTL is not set
128# CONFIG_NFTL is not set
129# CONFIG_INFTL is not set
130
131#
132# RAM/ROM/Flash chip drivers
133#
134# CONFIG_MTD_CFI is not set
135# CONFIG_MTD_JEDECPROBE is not set
136CONFIG_MTD_MAP_BANK_WIDTH_1=y
137CONFIG_MTD_MAP_BANK_WIDTH_2=y
138CONFIG_MTD_MAP_BANK_WIDTH_4=y
139# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
140# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
141# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
142CONFIG_MTD_CFI_I1=y
143CONFIG_MTD_CFI_I2=y
144# CONFIG_MTD_CFI_I4 is not set
145# CONFIG_MTD_CFI_I8 is not set
146# CONFIG_MTD_RAM is not set
147# CONFIG_MTD_ROM is not set
148# CONFIG_MTD_ABSENT is not set
149
150#
151# Mapping drivers for chip access
152#
153# CONFIG_MTD_COMPLEX_MAPPINGS is not set
154
155#
156# Self-contained MTD device drivers
157#
158CONFIG_MTD_SLRAM=y
159# CONFIG_MTD_PHRAM is not set
160# CONFIG_MTD_MTDRAM is not set
161# CONFIG_MTD_BLKMTD is not set
162
163#
164# Disk-On-Chip Device Drivers
165#
166# CONFIG_MTD_DOC2000 is not set
167# CONFIG_MTD_DOC2001 is not set
168# CONFIG_MTD_DOC2001PLUS is not set
169
170#
171# NAND Flash Device Drivers
172#
173# CONFIG_MTD_NAND is not set
174
175#
176# Parallel port support
177#
178# CONFIG_PARPORT is not set
179
180#
181# Block devices
182#
183# CONFIG_BLK_DEV_FD is not set
184# CONFIG_BLK_DEV_COW_COMMON is not set
185# CONFIG_BLK_DEV_LOOP is not set
186# CONFIG_BLK_DEV_RAM is not set
187CONFIG_BLK_DEV_RAM_COUNT=16
188CONFIG_INITRAMFS_SOURCE=""
189# CONFIG_CDROM_PKTCDVD is not set
190
191#
192# IO Schedulers
193#
194CONFIG_IOSCHED_NOOP=y
195# CONFIG_IOSCHED_AS is not set
196# CONFIG_IOSCHED_DEADLINE is not set
197# CONFIG_IOSCHED_CFQ is not set
198
199#
200# Disk device support
201#
202
203#
204# ATA/ATAPI/MFM/RLL support
205#
206# CONFIG_IDE is not set
207
208#
209# SCSI device support
210#
211# CONFIG_SCSI is not set
212
213#
214# Multi-device support (RAID and LVM)
215#
216# CONFIG_MD is not set
217
218#
219# Fusion MPT device support
220#
221
222#
223# IEEE 1394 (FireWire) support
224#
225
226#
227# I2O device support
228#
229
230#
231# Networking support
232#
233# CONFIG_NET is not set
234# CONFIG_NETPOLL is not set
235# CONFIG_NET_POLL_CONTROLLER is not set
236
237#
238# ISDN subsystem
239#
240
241#
242# Input device support
243#
244CONFIG_INPUT=y
245
246#
247# Userland interfaces
248#
249# CONFIG_INPUT_MOUSEDEV is not set
250# CONFIG_INPUT_JOYDEV is not set
251# CONFIG_INPUT_TSDEV is not set
252# CONFIG_INPUT_EVDEV is not set
253# CONFIG_INPUT_EVBUG is not set
254
255#
256# Input Device Drivers
257#
258# CONFIG_INPUT_KEYBOARD is not set
259# CONFIG_INPUT_MOUSE is not set
260# CONFIG_INPUT_JOYSTICK is not set
261# CONFIG_INPUT_TOUCHSCREEN is not set
262# CONFIG_INPUT_MISC is not set
263
264#
265# Hardware I/O ports
266#
267CONFIG_SERIO=y
268# CONFIG_SERIO_I8042 is not set
269# CONFIG_SERIO_SERPORT is not set
270# CONFIG_SERIO_LIBPS2 is not set
271# CONFIG_SERIO_RAW is not set
272# CONFIG_GAMEPORT is not set
273
274#
275# Character devices
276#
277# CONFIG_VT is not set
278# CONFIG_SERIAL_NONSTANDARD is not set
279
280#
281# Serial drivers
282#
283CONFIG_SERIAL_8250=y
284CONFIG_SERIAL_8250_CONSOLE=y
285CONFIG_SERIAL_8250_NR_UARTS=1
286# CONFIG_SERIAL_8250_EXTENDED is not set
287
288#
289# Non-8250 serial port support
290#
291# CONFIG_V850E_UART is not set
292CONFIG_SERIAL_CORE=y
293CONFIG_SERIAL_CORE_CONSOLE=y
294# CONFIG_UNIX98_PTYS is not set
295# CONFIG_LEGACY_PTYS is not set
296
297#
298# IPMI
299#
300# CONFIG_IPMI_HANDLER is not set
301
302#
303# Watchdog Cards
304#
305# CONFIG_WATCHDOG is not set
306# CONFIG_RTC is not set
307# CONFIG_GEN_RTC is not set
308# CONFIG_DTLK is not set
309# CONFIG_R3964 is not set
310
311#
312# Ftape, the floppy tape device driver
313#
314# CONFIG_DRM is not set
315# CONFIG_RAW_DRIVER is not set
316
317#
318# TPM devices
319#
320
321#
322# Multimedia devices
323#
324# CONFIG_VIDEO_DEV is not set
325
326#
327# Digital Video Broadcasting Devices
328#
329
330#
331# File systems
332#
333# CONFIG_EXT2_FS is not set
334# CONFIG_EXT3_FS is not set
335# CONFIG_JBD is not set
336# CONFIG_REISERFS_FS is not set
337# CONFIG_JFS_FS is not set
338
339#
340# XFS support
341#
342# CONFIG_XFS_FS is not set
343# CONFIG_MINIX_FS is not set
344CONFIG_ROMFS_FS=y
345# CONFIG_QUOTA is not set
346CONFIG_DNOTIFY=y
347# CONFIG_AUTOFS_FS is not set
348# CONFIG_AUTOFS4_FS is not set
349
350#
351# CD-ROM/DVD Filesystems
352#
353# CONFIG_ISO9660_FS is not set
354# CONFIG_UDF_FS is not set
355
356#
357# DOS/FAT/NT Filesystems
358#
359# CONFIG_MSDOS_FS is not set
360# CONFIG_VFAT_FS is not set
361# CONFIG_NTFS_FS is not set
362
363#
364# Pseudo filesystems
365#
366CONFIG_PROC_FS=y
367CONFIG_SYSFS=y
368# CONFIG_TMPFS is not set
369# CONFIG_HUGETLB_PAGE is not set
370CONFIG_RAMFS=y
371
372#
373# Miscellaneous filesystems
374#
375# CONFIG_HFSPLUS_FS is not set
376# CONFIG_JFFS_FS is not set
377# CONFIG_JFFS2_FS is not set
378# CONFIG_CRAMFS is not set
379# CONFIG_VXFS_FS is not set
380# CONFIG_HPFS_FS is not set
381# CONFIG_QNX4FS_FS is not set
382# CONFIG_SYSV_FS is not set
383# CONFIG_UFS_FS is not set
384
385#
386# Partition Types
387#
388# CONFIG_PARTITION_ADVANCED is not set
389CONFIG_MSDOS_PARTITION=y
390
391#
392# Native Language Support
393#
394# CONFIG_NLS is not set
395
396#
397# Graphics support
398#
399# CONFIG_FB is not set
400
401#
402# Sound
403#
404# CONFIG_SOUND is not set
405
406#
407# USB support
408#
409# CONFIG_USB_ARCH_HAS_HCD is not set
410# CONFIG_USB_ARCH_HAS_OHCI is not set
411
412#
413# USB Gadget Support
414#
415# CONFIG_USB_GADGET is not set
416
417#
418# Kernel hacking
419#
420# CONFIG_PRINTK_TIME is not set
421CONFIG_DEBUG_KERNEL=y
422# CONFIG_MAGIC_SYSRQ is not set
423CONFIG_LOG_BUF_SHIFT=14
424# CONFIG_SCHEDSTATS is not set
425# CONFIG_DEBUG_SLAB is not set
426# CONFIG_DEBUG_SPINLOCK is not set
427# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
428# CONFIG_DEBUG_KOBJECT is not set
429CONFIG_DEBUG_INFO=y
430# CONFIG_DEBUG_FS is not set
431# CONFIG_NO_KERNEL_MSG is not set
432
433#
434# Security options
435#
436# CONFIG_KEYS is not set
437# CONFIG_SECURITY is not set
438
439#
440# Cryptographic options
441#
442# CONFIG_CRYPTO is not set
443
444#
445# Hardware crypto devices
446#
447
448#
449# Library routines
450#
451# CONFIG_CRC_CCITT is not set
452# CONFIG_CRC32 is not set
453# CONFIG_LIBCRC32C is not set
diff --git a/arch/v850/configs/sim_defconfig b/arch/v850/configs/sim_defconfig
new file mode 100644
index 000000000000..d73f5f9d8383
--- /dev/null
+++ b/arch/v850/configs/sim_defconfig
@@ -0,0 +1,442 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-uc0
4# Thu Jul 21 11:29:27 2005
5#
6# CONFIG_MMU is not set
7# CONFIG_UID16 is not set
8CONFIG_RWSEM_GENERIC_SPINLOCK=y
9# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
10CONFIG_GENERIC_CALIBRATE_DELAY=y
11# CONFIG_ISA is not set
12# CONFIG_ISAPNP is not set
13# CONFIG_EISA is not set
14# CONFIG_MCA is not set
15CONFIG_V850=y
16
17#
18# Processor type and features
19#
20CONFIG_V850E_SIM=y
21# CONFIG_RTE_CB_MA1 is not set
22# CONFIG_RTE_CB_NB85E is not set
23# CONFIG_RTE_CB_ME2 is not set
24# CONFIG_V850E_AS85EP1 is not set
25# CONFIG_V850E2_SIM85E2C is not set
26# CONFIG_V850E2_SIM85E2S is not set
27# CONFIG_V850E2_FPGA85E2C is not set
28# CONFIG_V850E2_ANNA is not set
29CONFIG_V850E=y
30# CONFIG_PCI is not set
31# CONFIG_V850E_INTC is not set
32# CONFIG_V850E_TIMER_D is not set
33# CONFIG_V850E_CACHE is not set
34# CONFIG_V850E2_CACHE is not set
35CONFIG_NO_CACHE=y
36CONFIG_ZERO_BSS=y
37# CONFIG_RESET_GUARD is not set
38CONFIG_LARGE_ALLOCS=y
39
40#
41# Code maturity level options
42#
43# CONFIG_EXPERIMENTAL is not set
44CONFIG_CLEAN_COMPILE=y
45CONFIG_BROKEN_ON_SMP=y
46CONFIG_INIT_ENV_ARG_LIMIT=32
47
48#
49# General setup
50#
51CONFIG_LOCALVERSION=""
52# CONFIG_BSD_PROCESS_ACCT is not set
53# CONFIG_SYSCTL is not set
54# CONFIG_AUDIT is not set
55# CONFIG_HOTPLUG is not set
56# CONFIG_IKCONFIG is not set
57CONFIG_EMBEDDED=y
58# CONFIG_KALLSYMS is not set
59CONFIG_PRINTK=y
60CONFIG_BUG=y
61# CONFIG_BASE_FULL is not set
62# CONFIG_FUTEX is not set
63# CONFIG_EPOLL is not set
64CONFIG_CC_OPTIMIZE_FOR_SIZE=y
65CONFIG_CC_ALIGN_FUNCTIONS=0
66CONFIG_CC_ALIGN_LABELS=0
67CONFIG_CC_ALIGN_LOOPS=0
68CONFIG_CC_ALIGN_JUMPS=0
69CONFIG_BASE_SMALL=1
70
71#
72# Loadable module support
73#
74CONFIG_MODULES=y
75CONFIG_MODULE_UNLOAD=y
76CONFIG_OBSOLETE_MODPARM=y
77# CONFIG_MODULE_SRCVERSION_ALL is not set
78CONFIG_KMOD=y
79
80#
81# Bus options (PCI, PCMCIA, EISA, MCA, ISA)
82#
83
84#
85# PCCARD (PCMCIA/CardBus) support
86#
87# CONFIG_PCCARD is not set
88
89#
90# PCI Hotplug Support
91#
92
93#
94# Executable file formats
95#
96CONFIG_BINFMT_FLAT=y
97# CONFIG_BINFMT_ZFLAT is not set
98# CONFIG_BINFMT_SHARED_FLAT is not set
99# CONFIG_BINFMT_MISC is not set
100
101#
102# Generic Driver Options
103#
104CONFIG_STANDALONE=y
105CONFIG_PREVENT_FIRMWARE_BUILD=y
106# CONFIG_FW_LOADER is not set
107# CONFIG_DEBUG_DRIVER is not set
108
109#
110# Memory Technology Devices (MTD)
111#
112CONFIG_MTD=y
113# CONFIG_MTD_DEBUG is not set
114# CONFIG_MTD_CONCAT is not set
115# CONFIG_MTD_PARTITIONS is not set
116
117#
118# User Modules And Translation Layers
119#
120# CONFIG_MTD_CHAR is not set
121CONFIG_MTD_BLOCK=y
122# CONFIG_FTL is not set
123# CONFIG_NFTL is not set
124# CONFIG_INFTL is not set
125
126#
127# RAM/ROM/Flash chip drivers
128#
129# CONFIG_MTD_CFI is not set
130# CONFIG_MTD_JEDECPROBE is not set
131CONFIG_MTD_MAP_BANK_WIDTH_1=y
132CONFIG_MTD_MAP_BANK_WIDTH_2=y
133CONFIG_MTD_MAP_BANK_WIDTH_4=y
134# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
135# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
136# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
137CONFIG_MTD_CFI_I1=y
138CONFIG_MTD_CFI_I2=y
139# CONFIG_MTD_CFI_I4 is not set
140# CONFIG_MTD_CFI_I8 is not set
141# CONFIG_MTD_RAM is not set
142# CONFIG_MTD_ROM is not set
143# CONFIG_MTD_ABSENT is not set
144
145#
146# Mapping drivers for chip access
147#
148# CONFIG_MTD_COMPLEX_MAPPINGS is not set
149
150#
151# Self-contained MTD device drivers
152#
153CONFIG_MTD_SLRAM=y
154# CONFIG_MTD_PHRAM is not set
155# CONFIG_MTD_MTDRAM is not set
156# CONFIG_MTD_BLKMTD is not set
157
158#
159# Disk-On-Chip Device Drivers
160#
161# CONFIG_MTD_DOC2000 is not set
162# CONFIG_MTD_DOC2001 is not set
163# CONFIG_MTD_DOC2001PLUS is not set
164
165#
166# NAND Flash Device Drivers
167#
168# CONFIG_MTD_NAND is not set
169
170#
171# Parallel port support
172#
173# CONFIG_PARPORT is not set
174
175#
176# Block devices
177#
178# CONFIG_BLK_DEV_FD is not set
179# CONFIG_BLK_DEV_COW_COMMON is not set
180# CONFIG_BLK_DEV_LOOP is not set
181# CONFIG_BLK_DEV_RAM is not set
182CONFIG_BLK_DEV_RAM_COUNT=16
183CONFIG_INITRAMFS_SOURCE=""
184# CONFIG_CDROM_PKTCDVD is not set
185
186#
187# IO Schedulers
188#
189CONFIG_IOSCHED_NOOP=y
190# CONFIG_IOSCHED_AS is not set
191# CONFIG_IOSCHED_DEADLINE is not set
192# CONFIG_IOSCHED_CFQ is not set
193
194#
195# Disk device support
196#
197
198#
199# ATA/ATAPI/MFM/RLL support
200#
201# CONFIG_IDE is not set
202
203#
204# SCSI device support
205#
206# CONFIG_SCSI is not set
207
208#
209# Multi-device support (RAID and LVM)
210#
211# CONFIG_MD is not set
212
213#
214# Fusion MPT device support
215#
216
217#
218# IEEE 1394 (FireWire) support
219#
220
221#
222# I2O device support
223#
224
225#
226# Networking support
227#
228# CONFIG_NET is not set
229# CONFIG_NETPOLL is not set
230# CONFIG_NET_POLL_CONTROLLER is not set
231
232#
233# ISDN subsystem
234#
235
236#
237# Input device support
238#
239CONFIG_INPUT=y
240
241#
242# Userland interfaces
243#
244# CONFIG_INPUT_MOUSEDEV is not set
245# CONFIG_INPUT_JOYDEV is not set
246# CONFIG_INPUT_TSDEV is not set
247# CONFIG_INPUT_EVDEV is not set
248# CONFIG_INPUT_EVBUG is not set
249
250#
251# Input Device Drivers
252#
253# CONFIG_INPUT_KEYBOARD is not set
254# CONFIG_INPUT_MOUSE is not set
255# CONFIG_INPUT_JOYSTICK is not set
256# CONFIG_INPUT_TOUCHSCREEN is not set
257# CONFIG_INPUT_MISC is not set
258
259#
260# Hardware I/O ports
261#
262CONFIG_SERIO=y
263# CONFIG_SERIO_I8042 is not set
264# CONFIG_SERIO_SERPORT is not set
265# CONFIG_SERIO_LIBPS2 is not set
266# CONFIG_SERIO_RAW is not set
267# CONFIG_GAMEPORT is not set
268
269#
270# Character devices
271#
272# CONFIG_VT is not set
273# CONFIG_SERIAL_NONSTANDARD is not set
274
275#
276# Serial drivers
277#
278# CONFIG_SERIAL_8250 is not set
279
280#
281# Non-8250 serial port support
282#
283# CONFIG_UNIX98_PTYS is not set
284# CONFIG_LEGACY_PTYS is not set
285
286#
287# IPMI
288#
289# CONFIG_IPMI_HANDLER is not set
290
291#
292# Watchdog Cards
293#
294# CONFIG_WATCHDOG is not set
295# CONFIG_RTC is not set
296# CONFIG_GEN_RTC is not set
297# CONFIG_DTLK is not set
298# CONFIG_R3964 is not set
299
300#
301# Ftape, the floppy tape device driver
302#
303# CONFIG_DRM is not set
304# CONFIG_RAW_DRIVER is not set
305
306#
307# TPM devices
308#
309
310#
311# Multimedia devices
312#
313# CONFIG_VIDEO_DEV is not set
314
315#
316# Digital Video Broadcasting Devices
317#
318
319#
320# File systems
321#
322# CONFIG_EXT2_FS is not set
323# CONFIG_EXT3_FS is not set
324# CONFIG_JBD is not set
325# CONFIG_REISERFS_FS is not set
326# CONFIG_JFS_FS is not set
327
328#
329# XFS support
330#
331# CONFIG_XFS_FS is not set
332# CONFIG_MINIX_FS is not set
333CONFIG_ROMFS_FS=y
334# CONFIG_QUOTA is not set
335CONFIG_DNOTIFY=y
336# CONFIG_AUTOFS_FS is not set
337# CONFIG_AUTOFS4_FS is not set
338
339#
340# CD-ROM/DVD Filesystems
341#
342# CONFIG_ISO9660_FS is not set
343# CONFIG_UDF_FS is not set
344
345#
346# DOS/FAT/NT Filesystems
347#
348# CONFIG_MSDOS_FS is not set
349# CONFIG_VFAT_FS is not set
350# CONFIG_NTFS_FS is not set
351
352#
353# Pseudo filesystems
354#
355CONFIG_PROC_FS=y
356CONFIG_SYSFS=y
357# CONFIG_TMPFS is not set
358# CONFIG_HUGETLB_PAGE is not set
359CONFIG_RAMFS=y
360
361#
362# Miscellaneous filesystems
363#
364# CONFIG_HFSPLUS_FS is not set
365# CONFIG_JFFS_FS is not set
366# CONFIG_JFFS2_FS is not set
367# CONFIG_CRAMFS is not set
368# CONFIG_VXFS_FS is not set
369# CONFIG_HPFS_FS is not set
370# CONFIG_QNX4FS_FS is not set
371# CONFIG_SYSV_FS is not set
372# CONFIG_UFS_FS is not set
373
374#
375# Partition Types
376#
377# CONFIG_PARTITION_ADVANCED is not set
378CONFIG_MSDOS_PARTITION=y
379
380#
381# Native Language Support
382#
383# CONFIG_NLS is not set
384
385#
386# Graphics support
387#
388# CONFIG_FB is not set
389
390#
391# Sound
392#
393# CONFIG_SOUND is not set
394
395#
396# USB support
397#
398# CONFIG_USB_ARCH_HAS_HCD is not set
399# CONFIG_USB_ARCH_HAS_OHCI is not set
400
401#
402# USB Gadget Support
403#
404# CONFIG_USB_GADGET is not set
405
406#
407# Kernel hacking
408#
409# CONFIG_PRINTK_TIME is not set
410CONFIG_DEBUG_KERNEL=y
411# CONFIG_MAGIC_SYSRQ is not set
412CONFIG_LOG_BUF_SHIFT=14
413# CONFIG_SCHEDSTATS is not set
414# CONFIG_DEBUG_SLAB is not set
415# CONFIG_DEBUG_SPINLOCK is not set
416# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
417# CONFIG_DEBUG_KOBJECT is not set
418CONFIG_DEBUG_INFO=y
419# CONFIG_DEBUG_FS is not set
420# CONFIG_NO_KERNEL_MSG is not set
421
422#
423# Security options
424#
425# CONFIG_KEYS is not set
426# CONFIG_SECURITY is not set
427
428#
429# Cryptographic options
430#
431# CONFIG_CRYPTO is not set
432
433#
434# Hardware crypto devices
435#
436
437#
438# Library routines
439#
440# CONFIG_CRC_CCITT is not set
441# CONFIG_CRC32 is not set
442# CONFIG_LIBCRC32C is not set
diff --git a/arch/v850/kernel/anna.c b/arch/v850/kernel/anna.c
index 6aaeab5e8a40..d0502e142437 100644
--- a/arch/v850/kernel/anna.c
+++ b/arch/v850/kernel/anna.c
@@ -132,8 +132,6 @@ void machine_restart (char *__unused)
132 asm ("jmp r0"); /* Jump to the reset vector. */ 132 asm ("jmp r0"); /* Jump to the reset vector. */
133} 133}
134 134
135EXPORT_SYMBOL(machine_restart);
136
137void machine_halt (void) 135void machine_halt (void)
138{ 136{
139#ifdef CONFIG_RESET_GUARD 137#ifdef CONFIG_RESET_GUARD
@@ -145,15 +143,11 @@ void machine_halt (void)
145 asm ("halt; nop; nop; nop; nop; nop"); 143 asm ("halt; nop; nop; nop; nop; nop");
146} 144}
147 145
148EXPORT_SYMBOL(machine_halt);
149
150void machine_power_off (void) 146void machine_power_off (void)
151{ 147{
152 machine_halt (); 148 machine_halt ();
153} 149}
154 150
155EXPORT_SYMBOL(machine_power_off);
156
157/* Called before configuring an on-chip UART. */ 151/* Called before configuring an on-chip UART. */
158void anna_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud) 152void anna_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
159{ 153{
diff --git a/arch/v850/kernel/as85ep1.c b/arch/v850/kernel/as85ep1.c
index 4059b1df11b5..d78c5e4ea9bc 100644
--- a/arch/v850/kernel/as85ep1.c
+++ b/arch/v850/kernel/as85ep1.c
@@ -160,8 +160,6 @@ void machine_restart (char *__unused)
160 asm ("jmp r0"); /* Jump to the reset vector. */ 160 asm ("jmp r0"); /* Jump to the reset vector. */
161} 161}
162 162
163EXPORT_SYMBOL(machine_restart);
164
165void machine_halt (void) 163void machine_halt (void)
166{ 164{
167#ifdef CONFIG_RESET_GUARD 165#ifdef CONFIG_RESET_GUARD
@@ -173,15 +171,11 @@ void machine_halt (void)
173 asm ("halt; nop; nop; nop; nop; nop"); 171 asm ("halt; nop; nop; nop; nop; nop");
174} 172}
175 173
176EXPORT_SYMBOL(machine_halt);
177
178void machine_power_off (void) 174void machine_power_off (void)
179{ 175{
180 machine_halt (); 176 machine_halt ();
181} 177}
182 178
183EXPORT_SYMBOL(machine_power_off);
184
185/* Called before configuring an on-chip UART. */ 179/* Called before configuring an on-chip UART. */
186void as85ep1_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud) 180void as85ep1_uart_pre_configure (unsigned chan, unsigned cflags, unsigned baud)
187{ 181{
diff --git a/arch/v850/kernel/fpga85e2c.c b/arch/v850/kernel/fpga85e2c.c
index 4bac5149b3c2..d8094519ad85 100644
--- a/arch/v850/kernel/fpga85e2c.c
+++ b/arch/v850/kernel/fpga85e2c.c
@@ -121,22 +121,16 @@ void machine_halt (void)
121 } 121 }
122} 122}
123 123
124EXPORT_SYMBOL(machine_halt);
125
126void machine_restart (char *__unused) 124void machine_restart (char *__unused)
127{ 125{
128 machine_halt (); 126 machine_halt ();
129} 127}
130 128
131EXPORT_SYMBOL(machine_restart);
132
133void machine_power_off (void) 129void machine_power_off (void)
134{ 130{
135 machine_halt (); 131 machine_halt ();
136} 132}
137 133
138EXPORT_SYMBOL(machine_power_off);
139
140 134
141/* Interrupts */ 135/* Interrupts */
142 136
diff --git a/arch/v850/kernel/rte_cb.c b/arch/v850/kernel/rte_cb.c
index 7ba397f77aca..0c794b9e0f9b 100644
--- a/arch/v850/kernel/rte_cb.c
+++ b/arch/v850/kernel/rte_cb.c
@@ -67,8 +67,6 @@ void machine_restart (char *__unused)
67 asm ("jmp r0"); /* Jump to the reset vector. */ 67 asm ("jmp r0"); /* Jump to the reset vector. */
68} 68}
69 69
70EXPORT_SYMBOL(machine_restart);
71
72/* This says `HALt.' in LEDese. */ 70/* This says `HALt.' in LEDese. */
73static unsigned char halt_leds_msg[] = { 0x76, 0x77, 0x38, 0xF8 }; 71static unsigned char halt_leds_msg[] = { 0x76, 0x77, 0x38, 0xF8 };
74 72
@@ -89,15 +87,11 @@ void machine_halt (void)
89 asm ("halt; nop; nop; nop; nop; nop"); 87 asm ("halt; nop; nop; nop; nop; nop");
90} 88}
91 89
92EXPORT_SYMBOL(machine_halt);
93
94void machine_power_off (void) 90void machine_power_off (void)
95{ 91{
96 machine_halt (); 92 machine_halt ();
97} 93}
98 94
99EXPORT_SYMBOL(machine_power_off);
100
101 95
102/* Animated LED display for timer tick. */ 96/* Animated LED display for timer tick. */
103 97
diff --git a/arch/v850/kernel/rte_mb_a_pci.c b/arch/v850/kernel/rte_mb_a_pci.c
index 074b50abc89d..ffbb6d073bf2 100644
--- a/arch/v850/kernel/rte_mb_a_pci.c
+++ b/arch/v850/kernel/rte_mb_a_pci.c
@@ -1,8 +1,8 @@
1/* 1/*
2 * arch/v850/kernel/mb_a_pci.c -- PCI support for Midas lab RTE-MOTHER-A board 2 * arch/v850/kernel/mb_a_pci.c -- PCI support for Midas lab RTE-MOTHER-A board
3 * 3 *
4 * Copyright (C) 2001,02,03 NEC Electronics Corporation 4 * Copyright (C) 2001,02,03,05 NEC Electronics Corporation
5 * Copyright (C) 2001,02,03 Miles Bader <miles@gnu.org> 5 * Copyright (C) 2001,02,03,05 Miles Bader <miles@gnu.org>
6 * 6 *
7 * This file is subject to the terms and conditions of the GNU General 7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this 8 * Public License. See the file COPYING in the main directory of this
@@ -743,15 +743,17 @@ pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len,int dir)
743 for a scatter-gather list, same rules and usage. */ 743 for a scatter-gather list, same rules and usage. */
744 744
745void 745void
746pci_dma_sync_sg_for_cpu (struct pci_dev *dev, struct scatterlist *sg, int sg_len, 746pci_dma_sync_sg_for_cpu (struct pci_dev *dev,
747 int dir) 747 struct scatterlist *sg, int sg_len,
748 int dir)
748{ 749{
749 BUG (); 750 BUG ();
750} 751}
751 752
752void 753void
753pci_dma_sync_sg_for_device (struct pci_dev *dev, struct scatterlist *sg, int sg_len, 754pci_dma_sync_sg_for_device (struct pci_dev *dev,
754 int dir) 755 struct scatterlist *sg, int sg_len,
756 int dir)
755{ 757{
756 BUG (); 758 BUG ();
757} 759}
@@ -786,6 +788,27 @@ pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
786} 788}
787 789
788 790
791/* iomap/iomap */
792
793void __iomem *pci_iomap (struct pci_dev *dev, int bar, unsigned long max)
794{
795 unsigned long start = pci_resource_start (dev, bar);
796 unsigned long len = pci_resource_len (dev, bar);
797
798 if (!start || len == 0)
799 return 0;
800
801 /* None of the ioremap functions actually do anything, other than
802 re-casting their argument, so don't bother differentiating them. */
803 return ioremap (start, len);
804}
805
806void pci_iounmap (struct pci_dev *dev, void __iomem *addr)
807{
808 /* nothing */
809}
810
811
789/* symbol exports (for modules) */ 812/* symbol exports (for modules) */
790 813
791EXPORT_SYMBOL (pci_map_single); 814EXPORT_SYMBOL (pci_map_single);
@@ -794,3 +817,5 @@ EXPORT_SYMBOL (pci_alloc_consistent);
794EXPORT_SYMBOL (pci_free_consistent); 817EXPORT_SYMBOL (pci_free_consistent);
795EXPORT_SYMBOL (pci_dma_sync_single_for_cpu); 818EXPORT_SYMBOL (pci_dma_sync_single_for_cpu);
796EXPORT_SYMBOL (pci_dma_sync_single_for_device); 819EXPORT_SYMBOL (pci_dma_sync_single_for_device);
820EXPORT_SYMBOL (pci_iomap);
821EXPORT_SYMBOL (pci_iounmap);
diff --git a/arch/v850/kernel/sim.c b/arch/v850/kernel/sim.c
index 4f31da962632..e2cc5580fa2a 100644
--- a/arch/v850/kernel/sim.c
+++ b/arch/v850/kernel/sim.c
@@ -104,24 +104,18 @@ void machine_restart (char *__unused)
104 V850_SIM_SYSCALL (exit, 0); 104 V850_SIM_SYSCALL (exit, 0);
105} 105}
106 106
107EXPORT_SYMBOL(machine_restart);
108
109void machine_halt (void) 107void machine_halt (void)
110{ 108{
111 V850_SIM_SYSCALL (write, 1, "HALT\n", 5); 109 V850_SIM_SYSCALL (write, 1, "HALT\n", 5);
112 V850_SIM_SYSCALL (exit, 0); 110 V850_SIM_SYSCALL (exit, 0);
113} 111}
114 112
115EXPORT_SYMBOL(machine_halt);
116
117void machine_power_off (void) 113void machine_power_off (void)
118{ 114{
119 V850_SIM_SYSCALL (write, 1, "POWER OFF\n", 10); 115 V850_SIM_SYSCALL (write, 1, "POWER OFF\n", 10);
120 V850_SIM_SYSCALL (exit, 0); 116 V850_SIM_SYSCALL (exit, 0);
121} 117}
122 118
123EXPORT_SYMBOL(machine_power_off);
124
125 119
126/* Load data from a file called NAME into ram. The address and length 120/* Load data from a file called NAME into ram. The address and length
127 of the data image are returned in ADDR and LEN. */ 121 of the data image are returned in ADDR and LEN. */
diff --git a/arch/v850/kernel/sim85e2.c b/arch/v850/kernel/sim85e2.c
index 93a722b516bb..9111613fb53a 100644
--- a/arch/v850/kernel/sim85e2.c
+++ b/arch/v850/kernel/sim85e2.c
@@ -184,18 +184,13 @@ void machine_halt (void)
184 for (;;) {} 184 for (;;) {}
185} 185}
186 186
187EXPORT_SYMBOL(machine_halt);
188
189void machine_restart (char *__unused) 187void machine_restart (char *__unused)
190{ 188{
191 machine_halt (); 189 machine_halt ();
192} 190}
193 191
194EXPORT_SYMBOL(machine_restart);
195
196void machine_power_off (void) 192void machine_power_off (void)
197{ 193{
198 machine_halt (); 194 machine_halt ();
199} 195}
200 196
201EXPORT_SYMBOL(machine_power_off);
diff --git a/arch/v850/kernel/vmlinux.lds.S b/arch/v850/kernel/vmlinux.lds.S
index c366a8b326ee..5be05f47109e 100644
--- a/arch/v850/kernel/vmlinux.lds.S
+++ b/arch/v850/kernel/vmlinux.lds.S
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/config.h> 14#include <linux/config.h>
15
15#define VMLINUX_SYMBOL(_sym_) _##_sym_ 16#define VMLINUX_SYMBOL(_sym_) _##_sym_
16#include <asm-generic/vmlinux.lds.h> 17#include <asm-generic/vmlinux.lds.h>
17 18
@@ -42,6 +43,19 @@
42 *(.rodata) *(.rodata.*) \ 43 *(.rodata) *(.rodata.*) \
43 *(__vermagic) /* Kernel version magic */ \ 44 *(__vermagic) /* Kernel version magic */ \
44 *(.rodata1) \ 45 *(.rodata1) \
46 /* PCI quirks */ \
47 ___start_pci_fixups_early = . ; \
48 *(.pci_fixup_early) \
49 ___end_pci_fixups_early = . ; \
50 ___start_pci_fixups_header = . ; \
51 *(.pci_fixup_header) \
52 ___end_pci_fixups_header = . ; \
53 ___start_pci_fixups_final = . ; \
54 *(.pci_fixup_final) \
55 ___end_pci_fixups_final = . ; \
56 ___start_pci_fixups_enable = . ; \
57 *(.pci_fixup_enable) \
58 ___end_pci_fixups_enable = . ; \
45 /* Kernel symbol table: Normal symbols */ \ 59 /* Kernel symbol table: Normal symbols */ \
46 ___start___ksymtab = .; \ 60 ___start___ksymtab = .; \
47 *(__ksymtab) \ 61 *(__ksymtab) \
diff --git a/arch/x86_64/Kconfig b/arch/x86_64/Kconfig
index 4b8326177c52..660a03a89e66 100644
--- a/arch/x86_64/Kconfig
+++ b/arch/x86_64/Kconfig
@@ -329,12 +329,15 @@ config HPET_EMULATE_RTC
329 329
330config GART_IOMMU 330config GART_IOMMU
331 bool "IOMMU support" 331 bool "IOMMU support"
332 default y
332 depends on PCI 333 depends on PCI
333 help 334 help
334 Support the K8 IOMMU. Needed to run systems with more than 4GB of memory 335 Support the IOMMU. Needed to run systems with more than 3GB of memory
335 properly with 32-bit PCI devices that do not support DAC (Double Address 336 properly with 32-bit PCI devices that do not support DAC (Double Address
336 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter. 337 Cycle). The IOMMU can be turned off at runtime with the iommu=off parameter.
337 Normally the kernel will take the right choice by itself. 338 Normally the kernel will take the right choice by itself.
339 This option includes a driver for the AMD Opteron/Athlon64 IOMMU
340 and a software emulation used on some other systems.
338 If unsure, say Y. 341 If unsure, say Y.
339 342
340# need this always enabled with GART_IOMMU for the VIA workaround 343# need this always enabled with GART_IOMMU for the VIA workaround
diff --git a/arch/x86_64/Makefile b/arch/x86_64/Makefile
index 428915697675..4c6ed96d5f7c 100644
--- a/arch/x86_64/Makefile
+++ b/arch/x86_64/Makefile
@@ -21,18 +21,6 @@
21# 21#
22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $ 22# $Id: Makefile,v 1.31 2002/03/22 15:56:07 ak Exp $
23 23
24#
25# early bootup linking needs 32bit. You can either use real 32bit tools
26# here or 64bit tools in 32bit mode.
27#
28IA32_CC := $(CC) $(CPPFLAGS) -m32 -O2 -fomit-frame-pointer
29IA32_LD := $(LD) -m elf_i386
30IA32_AS := $(CC) $(AFLAGS) -m32 -Wa,--32 -traditional -c
31IA32_OBJCOPY := $(CROSS_COMPILE)objcopy
32IA32_CPP := $(CROSS_COMPILE)gcc -m32 -E
33export IA32_CC IA32_LD IA32_AS IA32_OBJCOPY IA32_CPP
34
35
36LDFLAGS := -m elf_x86_64 24LDFLAGS := -m elf_x86_64
37OBJCOPYFLAGS := -O binary -R .note -R .comment -S 25OBJCOPYFLAGS := -O binary -R .note -R .comment -S
38LDFLAGS_vmlinux := 26LDFLAGS_vmlinux :=
diff --git a/arch/x86_64/defconfig b/arch/x86_64/defconfig
index 569595b74c7c..776f3c866b70 100644
--- a/arch/x86_64/defconfig
+++ b/arch/x86_64/defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.12-rc4 3# Linux kernel version: 2.6.13-rc3
4# Fri May 13 06:39:11 2005 4# Fri Jul 22 16:47:31 2005
5# 5#
6CONFIG_X86_64=y 6CONFIG_X86_64=y
7CONFIG_64BIT=y 7CONFIG_64BIT=y
@@ -84,14 +84,27 @@ CONFIG_X86_IO_APIC=y
84CONFIG_X86_LOCAL_APIC=y 84CONFIG_X86_LOCAL_APIC=y
85CONFIG_MTRR=y 85CONFIG_MTRR=y
86CONFIG_SMP=y 86CONFIG_SMP=y
87# CONFIG_PREEMPT is not set
88CONFIG_SCHED_SMT=y 87CONFIG_SCHED_SMT=y
88CONFIG_PREEMPT_NONE=y
89# CONFIG_PREEMPT_VOLUNTARY is not set
90# CONFIG_PREEMPT is not set
91CONFIG_PREEMPT_BKL=y
89CONFIG_K8_NUMA=y 92CONFIG_K8_NUMA=y
90# CONFIG_NUMA_EMU is not set 93# CONFIG_NUMA_EMU is not set
91CONFIG_DISCONTIGMEM=y 94CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
92CONFIG_NUMA=y 95CONFIG_NUMA=y
96CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
97CONFIG_ARCH_SPARSEMEM_ENABLE=y
98CONFIG_SELECT_MEMORY_MODEL=y
99# CONFIG_FLATMEM_MANUAL is not set
100CONFIG_DISCONTIGMEM_MANUAL=y
101# CONFIG_SPARSEMEM_MANUAL is not set
102CONFIG_DISCONTIGMEM=y
103CONFIG_FLAT_NODE_MEM_MAP=y
104CONFIG_NEED_MULTIPLE_NODES=y
105CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
93CONFIG_HAVE_DEC_LOCK=y 106CONFIG_HAVE_DEC_LOCK=y
94CONFIG_NR_CPUS=8 107CONFIG_NR_CPUS=32
95CONFIG_HPET_TIMER=y 108CONFIG_HPET_TIMER=y
96CONFIG_X86_PM_TIMER=y 109CONFIG_X86_PM_TIMER=y
97CONFIG_HPET_EMULATE_RTC=y 110CONFIG_HPET_EMULATE_RTC=y
@@ -99,7 +112,13 @@ CONFIG_GART_IOMMU=y
99CONFIG_SWIOTLB=y 112CONFIG_SWIOTLB=y
100CONFIG_X86_MCE=y 113CONFIG_X86_MCE=y
101CONFIG_X86_MCE_INTEL=y 114CONFIG_X86_MCE_INTEL=y
115CONFIG_PHYSICAL_START=0x100000
116# CONFIG_KEXEC is not set
102CONFIG_SECCOMP=y 117CONFIG_SECCOMP=y
118# CONFIG_HZ_100 is not set
119CONFIG_HZ_250=y
120# CONFIG_HZ_1000 is not set
121CONFIG_HZ=250
103CONFIG_GENERIC_HARDIRQS=y 122CONFIG_GENERIC_HARDIRQS=y
104CONFIG_GENERIC_IRQ_PROBE=y 123CONFIG_GENERIC_IRQ_PROBE=y
105CONFIG_ISA_DMA_API=y 124CONFIG_ISA_DMA_API=y
@@ -118,12 +137,11 @@ CONFIG_PM_STD_PARTITION=""
118CONFIG_ACPI=y 137CONFIG_ACPI=y
119CONFIG_ACPI_BOOT=y 138CONFIG_ACPI_BOOT=y
120CONFIG_ACPI_INTERPRETER=y 139CONFIG_ACPI_INTERPRETER=y
121CONFIG_ACPI_SLEEP=y
122CONFIG_ACPI_SLEEP_PROC_FS=y
123CONFIG_ACPI_AC=y 140CONFIG_ACPI_AC=y
124CONFIG_ACPI_BATTERY=y 141CONFIG_ACPI_BATTERY=y
125CONFIG_ACPI_BUTTON=y 142CONFIG_ACPI_BUTTON=y
126# CONFIG_ACPI_VIDEO is not set 143# CONFIG_ACPI_VIDEO is not set
144CONFIG_ACPI_HOTKEY=m
127CONFIG_ACPI_FAN=y 145CONFIG_ACPI_FAN=y
128CONFIG_ACPI_PROCESSOR=y 146CONFIG_ACPI_PROCESSOR=y
129CONFIG_ACPI_THERMAL=y 147CONFIG_ACPI_THERMAL=y
@@ -154,6 +172,7 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
154# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set 172# CONFIG_CPU_FREQ_GOV_POWERSAVE is not set
155CONFIG_CPU_FREQ_GOV_USERSPACE=y 173CONFIG_CPU_FREQ_GOV_USERSPACE=y
156CONFIG_CPU_FREQ_GOV_ONDEMAND=y 174CONFIG_CPU_FREQ_GOV_ONDEMAND=y
175# CONFIG_CPU_FREQ_GOV_CONSERVATIVE is not set
157 176
158# 177#
159# CPUFreq processor drivers 178# CPUFreq processor drivers
@@ -204,6 +223,76 @@ CONFIG_SYSVIPC_COMPAT=y
204CONFIG_UID16=y 223CONFIG_UID16=y
205 224
206# 225#
226# Networking
227#
228CONFIG_NET=y
229
230#
231# Networking options
232#
233CONFIG_PACKET=y
234# CONFIG_PACKET_MMAP is not set
235CONFIG_UNIX=y
236# CONFIG_NET_KEY is not set
237CONFIG_INET=y
238CONFIG_IP_MULTICAST=y
239# CONFIG_IP_ADVANCED_ROUTER is not set
240CONFIG_IP_FIB_HASH=y
241# CONFIG_IP_PNP is not set
242# CONFIG_NET_IPIP is not set
243# CONFIG_NET_IPGRE is not set
244# CONFIG_IP_MROUTE is not set
245# CONFIG_ARPD is not set
246# CONFIG_SYN_COOKIES is not set
247# CONFIG_INET_AH is not set
248# CONFIG_INET_ESP is not set
249# CONFIG_INET_IPCOMP is not set
250# CONFIG_INET_TUNNEL is not set
251CONFIG_IP_TCPDIAG=y
252CONFIG_IP_TCPDIAG_IPV6=y
253# CONFIG_TCP_CONG_ADVANCED is not set
254CONFIG_TCP_CONG_BIC=y
255CONFIG_IPV6=y
256# CONFIG_IPV6_PRIVACY is not set
257# CONFIG_INET6_AH is not set
258# CONFIG_INET6_ESP is not set
259# CONFIG_INET6_IPCOMP is not set
260# CONFIG_INET6_TUNNEL is not set
261# CONFIG_IPV6_TUNNEL is not set
262# CONFIG_NETFILTER is not set
263
264#
265# SCTP Configuration (EXPERIMENTAL)
266#
267# CONFIG_IP_SCTP is not set
268# CONFIG_ATM is not set
269# CONFIG_BRIDGE is not set
270# CONFIG_VLAN_8021Q is not set
271# CONFIG_DECNET is not set
272# CONFIG_LLC2 is not set
273# CONFIG_IPX is not set
274# CONFIG_ATALK is not set
275# CONFIG_X25 is not set
276# CONFIG_LAPB is not set
277# CONFIG_NET_DIVERT is not set
278# CONFIG_ECONET is not set
279# CONFIG_WAN_ROUTER is not set
280# CONFIG_NET_SCHED is not set
281# CONFIG_NET_CLS_ROUTE is not set
282
283#
284# Network testing
285#
286# CONFIG_NET_PKTGEN is not set
287CONFIG_NETPOLL=y
288# CONFIG_NETPOLL_RX is not set
289# CONFIG_NETPOLL_TRAP is not set
290CONFIG_NET_POLL_CONTROLLER=y
291# CONFIG_HAMRADIO is not set
292# CONFIG_IRDA is not set
293# CONFIG_BT is not set
294
295#
207# Device Drivers 296# Device Drivers
208# 297#
209 298
@@ -308,6 +397,7 @@ CONFIG_BLK_DEV_AMD74XX=y
308# CONFIG_BLK_DEV_HPT366 is not set 397# CONFIG_BLK_DEV_HPT366 is not set
309# CONFIG_BLK_DEV_SC1200 is not set 398# CONFIG_BLK_DEV_SC1200 is not set
310CONFIG_BLK_DEV_PIIX=y 399CONFIG_BLK_DEV_PIIX=y
400# CONFIG_BLK_DEV_IT821X is not set
311# CONFIG_BLK_DEV_NS87415 is not set 401# CONFIG_BLK_DEV_NS87415 is not set
312# CONFIG_BLK_DEV_PDC202XX_OLD is not set 402# CONFIG_BLK_DEV_PDC202XX_OLD is not set
313CONFIG_BLK_DEV_PDC202XX_NEW=y 403CONFIG_BLK_DEV_PDC202XX_NEW=y
@@ -338,6 +428,7 @@ CONFIG_BLK_DEV_SD=y
338# CONFIG_CHR_DEV_OSST is not set 428# CONFIG_CHR_DEV_OSST is not set
339# CONFIG_BLK_DEV_SR is not set 429# CONFIG_BLK_DEV_SR is not set
340# CONFIG_CHR_DEV_SG is not set 430# CONFIG_CHR_DEV_SG is not set
431# CONFIG_CHR_DEV_SCH is not set
341 432
342# 433#
343# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 434# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -372,7 +463,6 @@ CONFIG_AIC79XX_DEBUG_MASK=0
372# CONFIG_MEGARAID_NEWGEN is not set 463# CONFIG_MEGARAID_NEWGEN is not set
373# CONFIG_MEGARAID_LEGACY is not set 464# CONFIG_MEGARAID_LEGACY is not set
374CONFIG_SCSI_SATA=y 465CONFIG_SCSI_SATA=y
375# CONFIG_SCSI_SATA_AHCI is not set
376# CONFIG_SCSI_SATA_SVW is not set 466# CONFIG_SCSI_SATA_SVW is not set
377CONFIG_SCSI_ATA_PIIX=y 467CONFIG_SCSI_ATA_PIIX=y
378# CONFIG_SCSI_SATA_NV is not set 468# CONFIG_SCSI_SATA_NV is not set
@@ -410,14 +500,21 @@ CONFIG_SCSI_QLA2XXX=y
410# 500#
411# Multi-device support (RAID and LVM) 501# Multi-device support (RAID and LVM)
412# 502#
413# CONFIG_MD is not set 503CONFIG_MD=y
504# CONFIG_BLK_DEV_MD is not set
505CONFIG_BLK_DEV_DM=y
506# CONFIG_DM_CRYPT is not set
507# CONFIG_DM_SNAPSHOT is not set
508# CONFIG_DM_MIRROR is not set
509# CONFIG_DM_ZERO is not set
510# CONFIG_DM_MULTIPATH is not set
414 511
415# 512#
416# Fusion MPT device support 513# Fusion MPT device support
417# 514#
418CONFIG_FUSION=y 515# CONFIG_FUSION is not set
419CONFIG_FUSION_MAX_SGE=40 516# CONFIG_FUSION_SPI is not set
420# CONFIG_FUSION_CTL is not set 517# CONFIG_FUSION_FC is not set
421 518
422# 519#
423# IEEE 1394 (FireWire) support 520# IEEE 1394 (FireWire) support
@@ -430,75 +527,8 @@ CONFIG_FUSION_MAX_SGE=40
430# CONFIG_I2O is not set 527# CONFIG_I2O is not set
431 528
432# 529#
433# Networking support 530# Network device support
434#
435CONFIG_NET=y
436
437#
438# Networking options
439#
440CONFIG_PACKET=y
441# CONFIG_PACKET_MMAP is not set
442CONFIG_UNIX=y
443# CONFIG_NET_KEY is not set
444CONFIG_INET=y
445CONFIG_IP_MULTICAST=y
446# CONFIG_IP_ADVANCED_ROUTER is not set
447# CONFIG_IP_PNP is not set
448# CONFIG_NET_IPIP is not set
449# CONFIG_NET_IPGRE is not set
450# CONFIG_IP_MROUTE is not set
451# CONFIG_ARPD is not set
452# CONFIG_SYN_COOKIES is not set
453# CONFIG_INET_AH is not set
454# CONFIG_INET_ESP is not set
455# CONFIG_INET_IPCOMP is not set
456# CONFIG_INET_TUNNEL is not set
457CONFIG_IP_TCPDIAG=y
458CONFIG_IP_TCPDIAG_IPV6=y
459CONFIG_IPV6=y
460# CONFIG_IPV6_PRIVACY is not set
461# CONFIG_INET6_AH is not set
462# CONFIG_INET6_ESP is not set
463# CONFIG_INET6_IPCOMP is not set
464# CONFIG_INET6_TUNNEL is not set
465# CONFIG_IPV6_TUNNEL is not set
466# CONFIG_NETFILTER is not set
467
468#
469# SCTP Configuration (EXPERIMENTAL)
470# 531#
471# CONFIG_IP_SCTP is not set
472# CONFIG_ATM is not set
473# CONFIG_BRIDGE is not set
474# CONFIG_VLAN_8021Q is not set
475# CONFIG_DECNET is not set
476# CONFIG_LLC2 is not set
477# CONFIG_IPX is not set
478# CONFIG_ATALK is not set
479# CONFIG_X25 is not set
480# CONFIG_LAPB is not set
481# CONFIG_NET_DIVERT is not set
482# CONFIG_ECONET is not set
483# CONFIG_WAN_ROUTER is not set
484
485#
486# QoS and/or fair queueing
487#
488# CONFIG_NET_SCHED is not set
489# CONFIG_NET_CLS_ROUTE is not set
490
491#
492# Network testing
493#
494# CONFIG_NET_PKTGEN is not set
495CONFIG_NETPOLL=y
496# CONFIG_NETPOLL_RX is not set
497# CONFIG_NETPOLL_TRAP is not set
498CONFIG_NET_POLL_CONTROLLER=y
499# CONFIG_HAMRADIO is not set
500# CONFIG_IRDA is not set
501# CONFIG_BT is not set
502CONFIG_NETDEVICES=y 532CONFIG_NETDEVICES=y
503# CONFIG_DUMMY is not set 533# CONFIG_DUMMY is not set
504# CONFIG_BONDING is not set 534# CONFIG_BONDING is not set
@@ -517,7 +547,9 @@ CONFIG_NET_ETHERNET=y
517CONFIG_MII=y 547CONFIG_MII=y
518# CONFIG_HAPPYMEAL is not set 548# CONFIG_HAPPYMEAL is not set
519# CONFIG_SUNGEM is not set 549# CONFIG_SUNGEM is not set
520# CONFIG_NET_VENDOR_3COM is not set 550CONFIG_NET_VENDOR_3COM=y
551CONFIG_VORTEX=y
552# CONFIG_TYPHOON is not set
521 553
522# 554#
523# Tulip family network device support 555# Tulip family network device support
@@ -532,7 +564,7 @@ CONFIG_NET_PCI=y
532CONFIG_FORCEDETH=y 564CONFIG_FORCEDETH=y
533# CONFIG_DGRS is not set 565# CONFIG_DGRS is not set
534# CONFIG_EEPRO100 is not set 566# CONFIG_EEPRO100 is not set
535# CONFIG_E100 is not set 567CONFIG_E100=y
536# CONFIG_FEALNX is not set 568# CONFIG_FEALNX is not set
537# CONFIG_NATSEMI is not set 569# CONFIG_NATSEMI is not set
538# CONFIG_NE2K_PCI is not set 570# CONFIG_NE2K_PCI is not set
@@ -553,14 +585,15 @@ CONFIG_8139TOO=y
553# CONFIG_ACENIC is not set 585# CONFIG_ACENIC is not set
554# CONFIG_DL2K is not set 586# CONFIG_DL2K is not set
555CONFIG_E1000=y 587CONFIG_E1000=y
556# CONFIG_E1000_NAPI is not set
557# CONFIG_NS83820 is not set 588# CONFIG_NS83820 is not set
558# CONFIG_HAMACHI is not set 589# CONFIG_HAMACHI is not set
559# CONFIG_YELLOWFIN is not set 590# CONFIG_YELLOWFIN is not set
560# CONFIG_R8169 is not set 591# CONFIG_R8169 is not set
592# CONFIG_SKGE is not set
561# CONFIG_SK98LIN is not set 593# CONFIG_SK98LIN is not set
562# CONFIG_VIA_VELOCITY is not set 594# CONFIG_VIA_VELOCITY is not set
563CONFIG_TIGON3=y 595CONFIG_TIGON3=y
596# CONFIG_BNX2 is not set
564 597
565# 598#
566# Ethernet (10000 Mbit) 599# Ethernet (10000 Mbit)
@@ -647,7 +680,6 @@ CONFIG_SERIO_I8042=y
647CONFIG_SERIO_LIBPS2=y 680CONFIG_SERIO_LIBPS2=y
648# CONFIG_SERIO_RAW is not set 681# CONFIG_SERIO_RAW is not set
649# CONFIG_GAMEPORT is not set 682# CONFIG_GAMEPORT is not set
650CONFIG_SOUND_GAMEPORT=y
651 683
652# 684#
653# Character devices 685# Character devices
@@ -716,6 +748,7 @@ CONFIG_MAX_RAW_DEVS=256
716# I2C support 748# I2C support
717# 749#
718# CONFIG_I2C is not set 750# CONFIG_I2C is not set
751# CONFIG_I2C_SENSOR is not set
719 752
720# 753#
721# Dallas's 1-wire bus 754# Dallas's 1-wire bus
@@ -723,6 +756,12 @@ CONFIG_MAX_RAW_DEVS=256
723# CONFIG_W1 is not set 756# CONFIG_W1 is not set
724 757
725# 758#
759# Hardware Monitoring support
760#
761CONFIG_HWMON=y
762# CONFIG_HWMON_DEBUG_CHIP is not set
763
764#
726# Misc devices 765# Misc devices
727# 766#
728# CONFIG_IBM_ASM is not set 767# CONFIG_IBM_ASM is not set
@@ -808,6 +847,7 @@ CONFIG_USB_DEVICEFS=y
808CONFIG_USB_EHCI_HCD=y 847CONFIG_USB_EHCI_HCD=y
809# CONFIG_USB_EHCI_SPLIT_ISO is not set 848# CONFIG_USB_EHCI_SPLIT_ISO is not set
810# CONFIG_USB_EHCI_ROOT_HUB_TT is not set 849# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
850# CONFIG_USB_ISP116X_HCD is not set
811CONFIG_USB_OHCI_HCD=y 851CONFIG_USB_OHCI_HCD=y
812# CONFIG_USB_OHCI_BIG_ENDIAN is not set 852# CONFIG_USB_OHCI_BIG_ENDIAN is not set
813CONFIG_USB_OHCI_LITTLE_ENDIAN=y 853CONFIG_USB_OHCI_LITTLE_ENDIAN=y
@@ -846,12 +886,15 @@ CONFIG_USB_HIDINPUT=y
846# CONFIG_USB_HIDDEV is not set 886# CONFIG_USB_HIDDEV is not set
847# CONFIG_USB_AIPTEK is not set 887# CONFIG_USB_AIPTEK is not set
848# CONFIG_USB_WACOM is not set 888# CONFIG_USB_WACOM is not set
889# CONFIG_USB_ACECAD is not set
849# CONFIG_USB_KBTAB is not set 890# CONFIG_USB_KBTAB is not set
850# CONFIG_USB_POWERMATE is not set 891# CONFIG_USB_POWERMATE is not set
851# CONFIG_USB_MTOUCH is not set 892# CONFIG_USB_MTOUCH is not set
893# CONFIG_USB_ITMTOUCH is not set
852# CONFIG_USB_EGALAX is not set 894# CONFIG_USB_EGALAX is not set
853# CONFIG_USB_XPAD is not set 895# CONFIG_USB_XPAD is not set
854# CONFIG_USB_ATI_REMOTE is not set 896# CONFIG_USB_ATI_REMOTE is not set
897# CONFIG_USB_KEYSPAN_REMOTE is not set
855 898
856# 899#
857# USB Imaging devices 900# USB Imaging devices
@@ -902,10 +945,11 @@ CONFIG_USB_MON=y
902# CONFIG_USB_PHIDGETSERVO is not set 945# CONFIG_USB_PHIDGETSERVO is not set
903# CONFIG_USB_IDMOUSE is not set 946# CONFIG_USB_IDMOUSE is not set
904# CONFIG_USB_SISUSBVGA is not set 947# CONFIG_USB_SISUSBVGA is not set
948# CONFIG_USB_LD is not set
905# CONFIG_USB_TEST is not set 949# CONFIG_USB_TEST is not set
906 950
907# 951#
908# USB ATM/DSL drivers 952# USB DSL modem support
909# 953#
910 954
911# 955#
@@ -924,6 +968,10 @@ CONFIG_USB_MON=y
924# CONFIG_INFINIBAND is not set 968# CONFIG_INFINIBAND is not set
925 969
926# 970#
971# SN Devices
972#
973
974#
927# Firmware Drivers 975# Firmware Drivers
928# 976#
929# CONFIG_EDD is not set 977# CONFIG_EDD is not set
@@ -935,6 +983,7 @@ CONFIG_EXT2_FS=y
935CONFIG_EXT2_FS_XATTR=y 983CONFIG_EXT2_FS_XATTR=y
936CONFIG_EXT2_FS_POSIX_ACL=y 984CONFIG_EXT2_FS_POSIX_ACL=y
937# CONFIG_EXT2_FS_SECURITY is not set 985# CONFIG_EXT2_FS_SECURITY is not set
986# CONFIG_EXT2_FS_XIP is not set
938CONFIG_EXT3_FS=y 987CONFIG_EXT3_FS=y
939CONFIG_EXT3_FS_XATTR=y 988CONFIG_EXT3_FS_XATTR=y
940CONFIG_EXT3_FS_POSIX_ACL=y 989CONFIG_EXT3_FS_POSIX_ACL=y
@@ -957,6 +1006,7 @@ CONFIG_FS_POSIX_ACL=y
957# CONFIG_XFS_FS is not set 1006# CONFIG_XFS_FS is not set
958# CONFIG_MINIX_FS is not set 1007# CONFIG_MINIX_FS is not set
959# CONFIG_ROMFS_FS is not set 1008# CONFIG_ROMFS_FS is not set
1009CONFIG_INOTIFY=y
960# CONFIG_QUOTA is not set 1010# CONFIG_QUOTA is not set
961CONFIG_DNOTIFY=y 1011CONFIG_DNOTIFY=y
962CONFIG_AUTOFS_FS=y 1012CONFIG_AUTOFS_FS=y
@@ -986,7 +1036,6 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
986CONFIG_PROC_FS=y 1036CONFIG_PROC_FS=y
987CONFIG_PROC_KCORE=y 1037CONFIG_PROC_KCORE=y
988CONFIG_SYSFS=y 1038CONFIG_SYSFS=y
989# CONFIG_DEVFS_FS is not set
990# CONFIG_DEVPTS_FS_XATTR is not set 1039# CONFIG_DEVPTS_FS_XATTR is not set
991CONFIG_TMPFS=y 1040CONFIG_TMPFS=y
992# CONFIG_TMPFS_XATTR is not set 1041# CONFIG_TMPFS_XATTR is not set
@@ -1016,15 +1065,18 @@ CONFIG_RAMFS=y
1016# 1065#
1017CONFIG_NFS_FS=y 1066CONFIG_NFS_FS=y
1018CONFIG_NFS_V3=y 1067CONFIG_NFS_V3=y
1068# CONFIG_NFS_V3_ACL is not set
1019# CONFIG_NFS_V4 is not set 1069# CONFIG_NFS_V4 is not set
1020# CONFIG_NFS_DIRECTIO is not set 1070# CONFIG_NFS_DIRECTIO is not set
1021CONFIG_NFSD=y 1071CONFIG_NFSD=y
1022CONFIG_NFSD_V3=y 1072CONFIG_NFSD_V3=y
1073# CONFIG_NFSD_V3_ACL is not set
1023# CONFIG_NFSD_V4 is not set 1074# CONFIG_NFSD_V4 is not set
1024CONFIG_NFSD_TCP=y 1075CONFIG_NFSD_TCP=y
1025CONFIG_LOCKD=y 1076CONFIG_LOCKD=y
1026CONFIG_LOCKD_V4=y 1077CONFIG_LOCKD_V4=y
1027CONFIG_EXPORTFS=y 1078CONFIG_EXPORTFS=y
1079CONFIG_NFS_COMMON=y
1028CONFIG_SUNRPC=y 1080CONFIG_SUNRPC=y
1029# CONFIG_RPCSEC_GSS_KRB5 is not set 1081# CONFIG_RPCSEC_GSS_KRB5 is not set
1030# CONFIG_RPCSEC_GSS_SPKM3 is not set 1082# CONFIG_RPCSEC_GSS_SPKM3 is not set
diff --git a/arch/x86_64/ia32/Makefile b/arch/x86_64/ia32/Makefile
index a12b19da4b59..f76217d8f579 100644
--- a/arch/x86_64/ia32/Makefile
+++ b/arch/x86_64/ia32/Makefile
@@ -4,14 +4,14 @@
4 4
5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \ 5obj-$(CONFIG_IA32_EMULATION) := ia32entry.o sys_ia32.o ia32_ioctl.o \
6 ia32_signal.o tls32.o \ 6 ia32_signal.o tls32.o \
7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o 7 ia32_binfmt.o fpu32.o ptrace32.o syscall32.o syscall32_syscall.o
8 8
9sysv-$(CONFIG_SYSVIPC) := ipc32.o 9sysv-$(CONFIG_SYSVIPC) := ipc32.o
10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y) 10obj-$(CONFIG_IA32_EMULATION) += $(sysv-y)
11 11
12obj-$(CONFIG_IA32_AOUT) += ia32_aout.o 12obj-$(CONFIG_IA32_AOUT) += ia32_aout.o
13 13
14$(obj)/syscall32.o: $(src)/syscall32.c \ 14$(obj)/syscall32_syscall.o: \
15 $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so) 15 $(foreach F,sysenter syscall,$(obj)/vsyscall-$F.so)
16 16
17# Teach kbuild about targets 17# Teach kbuild about targets
diff --git a/arch/x86_64/ia32/ia32_aout.c b/arch/x86_64/ia32/ia32_aout.c
index c12edf5d97f0..3e6780fa0186 100644
--- a/arch/x86_64/ia32/ia32_aout.c
+++ b/arch/x86_64/ia32/ia32_aout.c
@@ -42,7 +42,7 @@ extern int ia32_setup_arg_pages(struct linux_binprm *bprm,
42static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 42static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
43static int load_aout_library(struct file*); 43static int load_aout_library(struct file*);
44 44
45#if CORE_DUMP 45#ifdef CORE_DUMP
46static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 46static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file);
47 47
48/* 48/*
@@ -103,7 +103,7 @@ static struct linux_binfmt aout_format = {
103 .module = THIS_MODULE, 103 .module = THIS_MODULE,
104 .load_binary = load_aout_binary, 104 .load_binary = load_aout_binary,
105 .load_shlib = load_aout_library, 105 .load_shlib = load_aout_library,
106#if CORE_DUMP 106#ifdef CORE_DUMP
107 .core_dump = aout_core_dump, 107 .core_dump = aout_core_dump,
108#endif 108#endif
109 .min_coredump = PAGE_SIZE 109 .min_coredump = PAGE_SIZE
@@ -120,7 +120,7 @@ static void set_brk(unsigned long start, unsigned long end)
120 up_write(&current->mm->mmap_sem); 120 up_write(&current->mm->mmap_sem);
121} 121}
122 122
123#if CORE_DUMP 123#ifdef CORE_DUMP
124/* 124/*
125 * These are the only things you should do on a core-file: use only these 125 * These are the only things you should do on a core-file: use only these
126 * macros to write out all the necessary info. 126 * macros to write out all the necessary info.
diff --git a/arch/x86_64/ia32/ia32entry.S b/arch/x86_64/ia32/ia32entry.S
index cc935427d532..c45d6a05b984 100644
--- a/arch/x86_64/ia32/ia32entry.S
+++ b/arch/x86_64/ia32/ia32entry.S
@@ -591,11 +591,15 @@ ia32_sys_call_table:
591 .quad compat_sys_mq_getsetattr 591 .quad compat_sys_mq_getsetattr
592 .quad compat_sys_kexec_load /* reserved for kexec */ 592 .quad compat_sys_kexec_load /* reserved for kexec */
593 .quad compat_sys_waitid 593 .quad compat_sys_waitid
594 .quad quiet_ni_syscall /* sys_altroot */ 594 .quad quiet_ni_syscall /* 285: sys_altroot */
595 .quad sys_add_key 595 .quad sys_add_key
596 .quad sys_request_key 596 .quad sys_request_key
597 .quad sys_keyctl 597 .quad sys_keyctl
598 /* don't forget to change IA32_NR_syscalls */ 598 .quad sys_ioprio_set
599 .quad sys_ioprio_get /* 290 */
600 .quad sys_inotify_init
601 .quad sys_inotify_add_watch
602 .quad sys_inotify_rm_watch
599ia32_syscall_end: 603ia32_syscall_end:
600 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8 604 .rept IA32_NR_syscalls-(ia32_syscall_end-ia32_sys_call_table)/8
601 .quad ni_syscall 605 .quad ni_syscall
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c
index 68a9ab06ee7c..be996d1b691e 100644
--- a/arch/x86_64/ia32/sys_ia32.c
+++ b/arch/x86_64/ia32/sys_ia32.c
@@ -61,6 +61,7 @@
61#include <linux/ptrace.h> 61#include <linux/ptrace.h>
62#include <linux/highuid.h> 62#include <linux/highuid.h>
63#include <linux/vmalloc.h> 63#include <linux/vmalloc.h>
64#include <linux/fsnotify.h>
64#include <asm/mman.h> 65#include <asm/mman.h>
65#include <asm/types.h> 66#include <asm/types.h>
66#include <asm/uaccess.h> 67#include <asm/uaccess.h>
@@ -984,8 +985,10 @@ asmlinkage long sys32_open(const char __user * filename, int flags, int mode)
984 if (IS_ERR(f)) { 985 if (IS_ERR(f)) {
985 put_unused_fd(fd); 986 put_unused_fd(fd);
986 fd = error; 987 fd = error;
987 } else 988 } else {
989 fsnotify_open(f->f_dentry);
988 fd_install(fd, f); 990 fd_install(fd, f);
991 }
989 } 992 }
990 putname(tmp); 993 putname(tmp);
991 } 994 }
diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c
index 816a3b89f13d..adbc5f8089e9 100644
--- a/arch/x86_64/ia32/syscall32.c
+++ b/arch/x86_64/ia32/syscall32.c
@@ -14,16 +14,6 @@
14#include <asm/tlbflush.h> 14#include <asm/tlbflush.h>
15#include <asm/ia32_unistd.h> 15#include <asm/ia32_unistd.h>
16 16
17/* 32bit VDSOs mapped into user space. */
18asm(".section \".init.data\",\"aw\"\n"
19 "syscall32_syscall:\n"
20 ".incbin \"arch/x86_64/ia32/vsyscall-syscall.so\"\n"
21 "syscall32_syscall_end:\n"
22 "syscall32_sysenter:\n"
23 ".incbin \"arch/x86_64/ia32/vsyscall-sysenter.so\"\n"
24 "syscall32_sysenter_end:\n"
25 ".previous");
26
27extern unsigned char syscall32_syscall[], syscall32_syscall_end[]; 17extern unsigned char syscall32_syscall[], syscall32_syscall_end[];
28extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[]; 18extern unsigned char syscall32_sysenter[], syscall32_sysenter_end[];
29extern int sysctl_vsyscall32; 19extern int sysctl_vsyscall32;
diff --git a/arch/x86_64/ia32/syscall32_syscall.S b/arch/x86_64/ia32/syscall32_syscall.S
new file mode 100644
index 000000000000..8f8271bdf135
--- /dev/null
+++ b/arch/x86_64/ia32/syscall32_syscall.S
@@ -0,0 +1,17 @@
1/* 32bit VDSOs mapped into user space. */
2
3 .section ".init.data","aw"
4
5 .globl syscall32_syscall
6 .globl syscall32_syscall_end
7
8syscall32_syscall:
9 .incbin "arch/x86_64/ia32/vsyscall-syscall.so"
10syscall32_syscall_end:
11
12 .globl syscall32_sysenter
13 .globl syscall32_sysenter_end
14
15syscall32_sysenter:
16 .incbin "arch/x86_64/ia32/vsyscall-sysenter.so"
17syscall32_sysenter_end:
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 28817490fdc6..096d470e280f 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -76,7 +76,7 @@
76 76
77 .macro FAKE_STACK_FRAME child_rip 77 .macro FAKE_STACK_FRAME child_rip
78 /* push in order ss, rsp, eflags, cs, rip */ 78 /* push in order ss, rsp, eflags, cs, rip */
79 xorq %rax, %rax 79 xorl %eax, %eax
80 pushq %rax /* ss */ 80 pushq %rax /* ss */
81 CFI_ADJUST_CFA_OFFSET 8 81 CFI_ADJUST_CFA_OFFSET 8
82 pushq %rax /* rsp */ 82 pushq %rax /* rsp */
@@ -423,7 +423,7 @@ ENTRY(stub_rt_sigreturn)
423 testl $3,CS(%rdi) 423 testl $3,CS(%rdi)
424 je 1f 424 je 1f
425 swapgs 425 swapgs
4261: addl $1,%gs:pda_irqcount # RED-PEN should check preempt count 4261: incl %gs:pda_irqcount # RED-PEN should check preempt count
427 movq %gs:pda_irqstackptr,%rax 427 movq %gs:pda_irqstackptr,%rax
428 cmoveq %rax,%rsp 428 cmoveq %rax,%rsp
429 pushq %rdi # save old stack 429 pushq %rdi # save old stack
@@ -436,7 +436,7 @@ ENTRY(common_interrupt)
436ret_from_intr: 436ret_from_intr:
437 popq %rdi 437 popq %rdi
438 cli 438 cli
439 subl $1,%gs:pda_irqcount 439 decl %gs:pda_irqcount
440#ifdef CONFIG_DEBUG_INFO 440#ifdef CONFIG_DEBUG_INFO
441 movq RBP(%rdi),%rbp 441 movq RBP(%rdi),%rbp
442#endif 442#endif
@@ -494,7 +494,7 @@ retint_signal:
494 sti 494 sti
495 SAVE_REST 495 SAVE_REST
496 movq $-1,ORIG_RAX(%rsp) 496 movq $-1,ORIG_RAX(%rsp)
497 xorq %rsi,%rsi # oldset 497 xorl %esi,%esi # oldset
498 movq %rsp,%rdi # &pt_regs 498 movq %rsp,%rdi # &pt_regs
499 call do_notify_resume 499 call do_notify_resume
500 RESTORE_REST 500 RESTORE_REST
@@ -752,7 +752,7 @@ child_rip:
752 movq %rsi, %rdi 752 movq %rsi, %rdi
753 call *%rax 753 call *%rax
754 # exit 754 # exit
755 xorq %rdi, %rdi 755 xorl %edi, %edi
756 call do_exit 756 call do_exit
757 757
758/* 758/*
@@ -918,3 +918,15 @@ ENTRY(machine_check)
918ENTRY(call_debug) 918ENTRY(call_debug)
919 zeroentry do_call_debug 919 zeroentry do_call_debug
920 920
921ENTRY(call_softirq)
922 movq %gs:pda_irqstackptr,%rax
923 pushq %r15
924 movq %rsp,%r15
925 incl %gs:pda_irqcount
926 cmove %rax,%rsp
927 call __do_softirq
928 movq %r15,%rsp
929 decl %gs:pda_irqcount
930 popq %r15
931 ret
932
diff --git a/arch/x86_64/kernel/genapic.c b/arch/x86_64/kernel/genapic.c
index 69b9c25a8fc4..30c843a5efdd 100644
--- a/arch/x86_64/kernel/genapic.c
+++ b/arch/x86_64/kernel/genapic.c
@@ -31,6 +31,7 @@ u8 x86_cpu_to_log_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
31 31
32extern struct genapic apic_cluster; 32extern struct genapic apic_cluster;
33extern struct genapic apic_flat; 33extern struct genapic apic_flat;
34extern struct genapic apic_physflat;
34 35
35struct genapic *genapic = &apic_flat; 36struct genapic *genapic = &apic_flat;
36 37
@@ -44,12 +45,7 @@ void __init clustered_apic_check(void)
44 u8 clusters, max_cluster; 45 u8 clusters, max_cluster;
45 u8 id; 46 u8 id;
46 u8 cluster_cnt[NUM_APIC_CLUSTERS]; 47 u8 cluster_cnt[NUM_APIC_CLUSTERS];
47 48 int num_cpus = 0;
48 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
49 /* AMD always uses flat mode right now */
50 genapic = &apic_flat;
51 goto print;
52 }
53 49
54#if defined(CONFIG_ACPI_BUS) 50#if defined(CONFIG_ACPI_BUS)
55 /* 51 /*
@@ -64,15 +60,34 @@ void __init clustered_apic_check(void)
64#endif 60#endif
65 61
66 memset(cluster_cnt, 0, sizeof(cluster_cnt)); 62 memset(cluster_cnt, 0, sizeof(cluster_cnt));
67
68 for (i = 0; i < NR_CPUS; i++) { 63 for (i = 0; i < NR_CPUS; i++) {
69 id = bios_cpu_apicid[i]; 64 id = bios_cpu_apicid[i];
70 if (id != BAD_APICID) 65 if (id == BAD_APICID)
71 cluster_cnt[APIC_CLUSTERID(id)]++; 66 continue;
67 num_cpus++;
68 cluster_cnt[APIC_CLUSTERID(id)]++;
72 } 69 }
73 70
71 /* Don't use clustered mode on AMD platforms. */
72 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
73 genapic = &apic_physflat;
74#ifndef CONFIG_CPU_HOTPLUG
75 /* In the CPU hotplug case we cannot use broadcast mode
76 because that opens a race when a CPU is removed.
77 Stay at physflat mode in this case.
78 It is bad to do this unconditionally though. Once
79 we have ACPI platform support for CPU hotplug
80 we should detect hotplug capablity from ACPI tables and
81 only do this when really needed. -AK */
82 if (num_cpus <= 8)
83 genapic = &apic_flat;
84#endif
85 goto print;
86 }
87
74 clusters = 0; 88 clusters = 0;
75 max_cluster = 0; 89 max_cluster = 0;
90
76 for (i = 0; i < NUM_APIC_CLUSTERS; i++) { 91 for (i = 0; i < NUM_APIC_CLUSTERS; i++) {
77 if (cluster_cnt[i] > 0) { 92 if (cluster_cnt[i] > 0) {
78 ++clusters; 93 ++clusters;
diff --git a/arch/x86_64/kernel/genapic_flat.c b/arch/x86_64/kernel/genapic_flat.c
index 282846965080..adc96282a9e2 100644
--- a/arch/x86_64/kernel/genapic_flat.c
+++ b/arch/x86_64/kernel/genapic_flat.c
@@ -2,13 +2,11 @@
2 * Copyright 2004 James Cleverdon, IBM. 2 * Copyright 2004 James Cleverdon, IBM.
3 * Subject to the GNU Public License, v.2 3 * Subject to the GNU Public License, v.2
4 * 4 *
5 * Flat APIC subarch code. Maximum 8 CPUs, logical delivery. 5 * Flat APIC subarch code.
6 * 6 *
7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by 7 * Hacked for x86-64 by James Cleverdon from i386 architecture code by
8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and 8 * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
9 * James Cleverdon. 9 * James Cleverdon.
10 * Ashok Raj <ashok.raj@intel.com>
11 * Removed IPI broadcast shortcut to support CPU hotplug
12 */ 10 */
13#include <linux/config.h> 11#include <linux/config.h>
14#include <linux/threads.h> 12#include <linux/threads.h>
@@ -20,47 +18,6 @@
20#include <asm/smp.h> 18#include <asm/smp.h>
21#include <asm/ipi.h> 19#include <asm/ipi.h>
22 20
23/*
24 * The following permit choosing broadcast IPI shortcut v.s sending IPI only
25 * to online cpus via the send_IPI_mask varient.
26 * The mask version is my preferred option, since it eliminates a lot of
27 * other extra code that would need to be written to cleanup intrs sent
28 * to a CPU while offline.
29 *
30 * Sending broadcast introduces lots of trouble in CPU hotplug situations.
31 * These IPI's are delivered to cpu's irrespective of their offline status
32 * and could pickup stale intr data when these CPUS are turned online.
33 *
34 * Not using broadcast is a cleaner approach IMO, but Andi Kleen disagrees with
35 * the idea of not using broadcast IPI's anymore. Hence the run time check
36 * is introduced, on his request so we can choose an alternate mechanism.
37 *
38 * Initial wacky performance tests that collect cycle counts show
39 * no increase in using mask v.s broadcast version. In fact they seem
40 * identical in terms of cycle counts.
41 *
42 * if we need to use broadcast, we need to do the following.
43 *
44 * cli;
45 * hold call_lock;
46 * clear any pending IPI, just ack and clear all pending intr
47 * set cpu_online_map;
48 * release call_lock;
49 * sti;
50 *
51 * The complicated dummy irq processing shown above is not required if
52 * we didnt sent IPI's to wrong CPU's in the first place.
53 *
54 * - Ashok Raj <ashok.raj@intel.com>
55 */
56#ifdef CONFIG_HOTPLUG_CPU
57#define DEFAULT_SEND_IPI (1)
58#else
59#define DEFAULT_SEND_IPI (0)
60#endif
61
62static int no_broadcast=DEFAULT_SEND_IPI;
63
64static cpumask_t flat_target_cpus(void) 21static cpumask_t flat_target_cpus(void)
65{ 22{
66 return cpu_online_map; 23 return cpu_online_map;
@@ -119,37 +76,15 @@ static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
119 local_irq_restore(flags); 76 local_irq_restore(flags);
120} 77}
121 78
122static inline void __local_flat_send_IPI_allbutself(int vector)
123{
124 if (no_broadcast) {
125 cpumask_t mask = cpu_online_map;
126 int this_cpu = get_cpu();
127
128 cpu_clear(this_cpu, mask);
129 flat_send_IPI_mask(mask, vector);
130 put_cpu();
131 }
132 else
133 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
134}
135
136static inline void __local_flat_send_IPI_all(int vector)
137{
138 if (no_broadcast)
139 flat_send_IPI_mask(cpu_online_map, vector);
140 else
141 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
142}
143
144static void flat_send_IPI_allbutself(int vector) 79static void flat_send_IPI_allbutself(int vector)
145{ 80{
146 if (((num_online_cpus()) - 1) >= 1) 81 if (((num_online_cpus()) - 1) >= 1)
147 __local_flat_send_IPI_allbutself(vector); 82 __send_IPI_shortcut(APIC_DEST_ALLBUT, vector,APIC_DEST_LOGICAL);
148} 83}
149 84
150static void flat_send_IPI_all(int vector) 85static void flat_send_IPI_all(int vector)
151{ 86{
152 __local_flat_send_IPI_all(vector); 87 __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
153} 88}
154 89
155static int flat_apic_id_registered(void) 90static int flat_apic_id_registered(void)
@@ -170,16 +105,6 @@ static unsigned int phys_pkg_id(int index_msb)
170 return ((ebx >> 24) & 0xFF) >> index_msb; 105 return ((ebx >> 24) & 0xFF) >> index_msb;
171} 106}
172 107
173static __init int no_ipi_broadcast(char *str)
174{
175 get_option(&str, &no_broadcast);
176 printk ("Using %s mode\n", no_broadcast ? "No IPI Broadcast" :
177 "IPI Broadcast");
178 return 1;
179}
180
181__setup("no_ipi_broadcast", no_ipi_broadcast);
182
183struct genapic apic_flat = { 108struct genapic apic_flat = {
184 .name = "flat", 109 .name = "flat",
185 .int_delivery_mode = dest_LowestPrio, 110 .int_delivery_mode = dest_LowestPrio,
@@ -195,11 +120,62 @@ struct genapic apic_flat = {
195 .phys_pkg_id = phys_pkg_id, 120 .phys_pkg_id = phys_pkg_id,
196}; 121};
197 122
198static int __init print_ipi_mode(void) 123/*
124 * Physflat mode is used when there are more than 8 CPUs on a AMD system.
125 * We cannot use logical delivery in this case because the mask
126 * overflows, so use physical mode.
127 */
128
129static cpumask_t physflat_target_cpus(void)
130{
131 return cpumask_of_cpu(0);
132}
133
134static void physflat_send_IPI_mask(cpumask_t cpumask, int vector)
135{
136 send_IPI_mask_sequence(cpumask, vector);
137}
138
139static void physflat_send_IPI_allbutself(int vector)
140{
141 cpumask_t allbutme = cpu_online_map;
142 int me = get_cpu();
143 cpu_clear(me, allbutme);
144 physflat_send_IPI_mask(allbutme, vector);
145 put_cpu();
146}
147
148static void physflat_send_IPI_all(int vector)
199{ 149{
200 printk ("Using IPI %s mode\n", no_broadcast ? "No-Shortcut" : 150 physflat_send_IPI_mask(cpu_online_map, vector);
201 "Shortcut");
202 return 0;
203} 151}
204 152
205late_initcall(print_ipi_mode); 153static unsigned int physflat_cpu_mask_to_apicid(cpumask_t cpumask)
154{
155 int cpu;
156
157 /*
158 * We're using fixed IRQ delivery, can only return one phys APIC ID.
159 * May as well be the first.
160 */
161 cpu = first_cpu(cpumask);
162 if ((unsigned)cpu < NR_CPUS)
163 return x86_cpu_to_apicid[cpu];
164 else
165 return BAD_APICID;
166}
167
168struct genapic apic_physflat = {
169 .name = "physical flat",
170 .int_delivery_mode = dest_LowestPrio,
171 .int_dest_mode = (APIC_DEST_PHYSICAL != 0),
172 .int_delivery_dest = APIC_DEST_PHYSICAL | APIC_DM_LOWEST,
173 .target_cpus = physflat_target_cpus,
174 .apic_id_registered = flat_apic_id_registered,
175 .init_apic_ldr = flat_init_apic_ldr,/*not needed, but shouldn't hurt*/
176 .send_IPI_all = physflat_send_IPI_all,
177 .send_IPI_allbutself = physflat_send_IPI_allbutself,
178 .send_IPI_mask = physflat_send_IPI_mask,
179 .cpu_mask_to_apicid = physflat_cpu_mask_to_apicid,
180 .phys_pkg_id = phys_pkg_id,
181};
diff --git a/arch/x86_64/kernel/head.S b/arch/x86_64/kernel/head.S
index 8d765aa77a26..98ff5eb32b9a 100644
--- a/arch/x86_64/kernel/head.S
+++ b/arch/x86_64/kernel/head.S
@@ -137,14 +137,14 @@ startup_64:
137 wrmsr 137 wrmsr
138 138
139 /* Setup cr0 */ 139 /* Setup cr0 */
140 xorq %rax, %rax 140#define CR0_PM 1 /* protected mode */
141 btsq $31, %rax /* Enable paging */ 141#define CR0_MP (1<<1)
142 btsq $0, %rax /* Enable protected mode */ 142#define CR0_ET (1<<4)
143 btsq $1, %rax /* Enable MP */ 143#define CR0_NE (1<<5)
144 btsq $4, %rax /* Enable ET */ 144#define CR0_WP (1<<16)
145 btsq $5, %rax /* Enable NE */ 145#define CR0_AM (1<<18)
146 btsq $16, %rax /* Enable WP */ 146#define CR0_PAGING (1<<31)
147 btsq $18, %rax /* Enable AM */ 147 movl $CR0_PM|CR0_MP|CR0_ET|CR0_NE|CR0_WP|CR0_AM|CR0_PAGING,%eax
148 /* Make changes effective */ 148 /* Make changes effective */
149 movq %rax, %cr0 149 movq %rax, %cr0
150 150
diff --git a/arch/x86_64/kernel/irq.c b/arch/x86_64/kernel/irq.c
index cc3fb85f5145..849a20aec7ca 100644
--- a/arch/x86_64/kernel/irq.c
+++ b/arch/x86_64/kernel/irq.c
@@ -135,3 +135,22 @@ void fixup_irqs(cpumask_t map)
135 local_irq_disable(); 135 local_irq_disable();
136} 136}
137#endif 137#endif
138
139extern void call_softirq(void);
140
141asmlinkage void do_softirq(void)
142{
143 __u32 pending;
144 unsigned long flags;
145
146 if (in_interrupt())
147 return;
148
149 local_irq_save(flags);
150 pending = local_softirq_pending();
151 /* Switch to interrupt stack */
152 if (pending)
153 call_softirq();
154 local_irq_restore(flags);
155}
156EXPORT_SYMBOL(do_softirq);
diff --git a/arch/x86_64/kernel/mce.c b/arch/x86_64/kernel/mce.c
index 21e70625a495..3b267c91bb0c 100644
--- a/arch/x86_64/kernel/mce.c
+++ b/arch/x86_64/kernel/mce.c
@@ -15,6 +15,8 @@
15#include <linux/sysdev.h> 15#include <linux/sysdev.h>
16#include <linux/miscdevice.h> 16#include <linux/miscdevice.h>
17#include <linux/fs.h> 17#include <linux/fs.h>
18#include <linux/cpu.h>
19#include <linux/percpu.h>
18#include <asm/processor.h> 20#include <asm/processor.h>
19#include <asm/msr.h> 21#include <asm/msr.h>
20#include <asm/mce.h> 22#include <asm/mce.h>
@@ -514,10 +516,7 @@ static struct sysdev_class mce_sysclass = {
514 set_kset_name("machinecheck"), 516 set_kset_name("machinecheck"),
515}; 517};
516 518
517static struct sys_device device_mce = { 519static DEFINE_PER_CPU(struct sys_device, device_mce);
518 .id = 0,
519 .cls = &mce_sysclass,
520};
521 520
522/* Why are there no generic functions for this? */ 521/* Why are there no generic functions for this? */
523#define ACCESSOR(name, var, start) \ 522#define ACCESSOR(name, var, start) \
@@ -542,27 +541,83 @@ ACCESSOR(bank4ctl,bank[4],mce_restart())
542ACCESSOR(tolerant,tolerant,) 541ACCESSOR(tolerant,tolerant,)
543ACCESSOR(check_interval,check_interval,mce_restart()) 542ACCESSOR(check_interval,check_interval,mce_restart())
544 543
545static __cpuinit int mce_init_device(void) 544/* Per cpu sysdev init. All of the cpus still share the same ctl bank */
545static __cpuinit int mce_create_device(unsigned int cpu)
546{ 546{
547 int err; 547 int err;
548 if (!mce_available(&cpu_data[cpu]))
549 return -EIO;
550
551 per_cpu(device_mce,cpu).id = cpu;
552 per_cpu(device_mce,cpu).cls = &mce_sysclass;
553
554 err = sysdev_register(&per_cpu(device_mce,cpu));
555
556 if (!err) {
557 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
558 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
559 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
560 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
561 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
562 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_tolerant);
563 sysdev_create_file(&per_cpu(device_mce,cpu), &attr_check_interval);
564 }
565 return err;
566}
567
568#ifdef CONFIG_HOTPLUG_CPU
569static __cpuinit void mce_remove_device(unsigned int cpu)
570{
571 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank0ctl);
572 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank1ctl);
573 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank2ctl);
574 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank3ctl);
575 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_bank4ctl);
576 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_tolerant);
577 sysdev_remove_file(&per_cpu(device_mce,cpu), &attr_check_interval);
578 sysdev_unregister(&per_cpu(device_mce,cpu));
579}
580#endif
581
582/* Get notified when a cpu comes on/off. Be hotplug friendly. */
583static __cpuinit int
584mce_cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu)
585{
586 unsigned int cpu = (unsigned long)hcpu;
587
588 switch (action) {
589 case CPU_ONLINE:
590 mce_create_device(cpu);
591 break;
592#ifdef CONFIG_HOTPLUG_CPU
593 case CPU_DEAD:
594 mce_remove_device(cpu);
595 break;
596#endif
597 }
598 return NOTIFY_OK;
599}
600
601static struct notifier_block mce_cpu_notifier = {
602 .notifier_call = mce_cpu_callback,
603};
604
605static __init int mce_init_device(void)
606{
607 int err;
608 int i = 0;
609
548 if (!mce_available(&boot_cpu_data)) 610 if (!mce_available(&boot_cpu_data))
549 return -EIO; 611 return -EIO;
550 err = sysdev_class_register(&mce_sysclass); 612 err = sysdev_class_register(&mce_sysclass);
551 if (!err) 613
552 err = sysdev_register(&device_mce); 614 for_each_online_cpu(i) {
553 if (!err) { 615 mce_create_device(i);
554 /* could create per CPU objects, but it is not worth it. */ 616 }
555 sysdev_create_file(&device_mce, &attr_bank0ctl); 617
556 sysdev_create_file(&device_mce, &attr_bank1ctl); 618 register_cpu_notifier(&mce_cpu_notifier);
557 sysdev_create_file(&device_mce, &attr_bank2ctl);
558 sysdev_create_file(&device_mce, &attr_bank3ctl);
559 sysdev_create_file(&device_mce, &attr_bank4ctl);
560 sysdev_create_file(&device_mce, &attr_tolerant);
561 sysdev_create_file(&device_mce, &attr_check_interval);
562 }
563
564 misc_register(&mce_log_device); 619 misc_register(&mce_log_device);
565 return err; 620 return err;
566
567} 621}
622
568device_initcall(mce_init_device); 623device_initcall(mce_init_device);
diff --git a/arch/x86_64/kernel/mpparse.c b/arch/x86_64/kernel/mpparse.c
index 9c5aa2a790c7..08abf9f5b159 100644
--- a/arch/x86_64/kernel/mpparse.c
+++ b/arch/x86_64/kernel/mpparse.c
@@ -109,7 +109,7 @@ static int __init mpf_checksum(unsigned char *mp, int len)
109 109
110static void __init MP_processor_info (struct mpc_config_processor *m) 110static void __init MP_processor_info (struct mpc_config_processor *m)
111{ 111{
112 int ver; 112 int ver, cpu;
113 static int found_bsp=0; 113 static int found_bsp=0;
114 114
115 if (!(m->mpc_cpuflag & CPU_ENABLED)) 115 if (!(m->mpc_cpuflag & CPU_ENABLED))
@@ -131,7 +131,7 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
131 return; 131 return;
132 } 132 }
133 133
134 num_processors++; 134 cpu = num_processors++;
135 135
136 if (m->mpc_apicid > MAX_APICS) { 136 if (m->mpc_apicid > MAX_APICS) {
137 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n", 137 printk(KERN_ERR "Processor #%d INVALID. (Max ID: %d).\n",
@@ -155,13 +155,18 @@ static void __init MP_processor_info (struct mpc_config_processor *m)
155 * in same order as logical cpu numbers. Hence the first 155 * in same order as logical cpu numbers. Hence the first
156 * entry is BSP, and so on. 156 * entry is BSP, and so on.
157 */ 157 */
158 cpu = 0;
159
158 bios_cpu_apicid[0] = m->mpc_apicid; 160 bios_cpu_apicid[0] = m->mpc_apicid;
159 x86_cpu_to_apicid[0] = m->mpc_apicid; 161 x86_cpu_to_apicid[0] = m->mpc_apicid;
160 found_bsp = 1; 162 found_bsp = 1;
161 } else { 163 } else
162 bios_cpu_apicid[num_processors - found_bsp] = m->mpc_apicid; 164 cpu = num_processors - found_bsp;
163 x86_cpu_to_apicid[num_processors - found_bsp] = m->mpc_apicid; 165 bios_cpu_apicid[cpu] = m->mpc_apicid;
164 } 166 x86_cpu_to_apicid[cpu] = m->mpc_apicid;
167
168 cpu_set(cpu, cpu_possible_map);
169 cpu_set(cpu, cpu_present_map);
165} 170}
166 171
167static void __init MP_bus_info (struct mpc_config_bus *m) 172static void __init MP_bus_info (struct mpc_config_bus *m)
diff --git a/arch/x86_64/kernel/reboot.c b/arch/x86_64/kernel/reboot.c
index 57e71dbdfd69..47f95687905f 100644
--- a/arch/x86_64/kernel/reboot.c
+++ b/arch/x86_64/kernel/reboot.c
@@ -109,23 +109,10 @@ void machine_shutdown(void)
109 local_irq_enable(); 109 local_irq_enable();
110} 110}
111 111
112void machine_restart(char * __unused) 112void machine_emergency_restart(void)
113{ 113{
114 int i; 114 int i;
115 115
116 printk("machine restart\n");
117
118 machine_shutdown();
119
120 if (!reboot_force) {
121 local_irq_disable();
122#ifndef CONFIG_SMP
123 disable_local_APIC();
124#endif
125 disable_IO_APIC();
126 local_irq_enable();
127 }
128
129 /* Tell the BIOS if we want cold or warm reboot */ 116 /* Tell the BIOS if we want cold or warm reboot */
130 *((unsigned short *)__va(0x472)) = reboot_mode; 117 *((unsigned short *)__va(0x472)) = reboot_mode;
131 118
@@ -150,18 +137,26 @@ void machine_restart(char * __unused)
150 } 137 }
151} 138}
152 139
153EXPORT_SYMBOL(machine_restart); 140void machine_restart(char * __unused)
141{
142 printk("machine restart\n");
143
144 if (!reboot_force) {
145 machine_shutdown();
146 }
147 machine_emergency_restart();
148}
154 149
155void machine_halt(void) 150void machine_halt(void)
156{ 151{
157} 152}
158 153
159EXPORT_SYMBOL(machine_halt);
160
161void machine_power_off(void) 154void machine_power_off(void)
162{ 155{
156 if (!reboot_force) {
157 machine_shutdown();
158 }
163 if (pm_power_off) 159 if (pm_power_off)
164 pm_power_off(); 160 pm_power_off();
165} 161}
166 162
167EXPORT_SYMBOL(machine_power_off);
diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c
index 5fd03225058a..0aa526298e92 100644
--- a/arch/x86_64/kernel/setup.c
+++ b/arch/x86_64/kernel/setup.c
@@ -765,8 +765,6 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
765 int cpu = smp_processor_id(); 765 int cpu = smp_processor_id();
766 int node = 0; 766 int node = 0;
767 unsigned bits; 767 unsigned bits;
768 if (c->x86_num_cores == 1)
769 return;
770 768
771 bits = 0; 769 bits = 0;
772 while ((1 << bits) < c->x86_num_cores) 770 while ((1 << bits) < c->x86_num_cores)
@@ -1081,8 +1079,7 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
1081 else 1079 else
1082 mtrr_ap_init(); 1080 mtrr_ap_init();
1083#ifdef CONFIG_NUMA 1081#ifdef CONFIG_NUMA
1084 if (c != &boot_cpu_data) 1082 numa_add_cpu(smp_processor_id());
1085 numa_add_cpu(c - cpu_data);
1086#endif 1083#endif
1087} 1084}
1088 1085
diff --git a/arch/x86_64/kernel/setup64.c b/arch/x86_64/kernel/setup64.c
index f2b9c6bc999a..34082c1cc41e 100644
--- a/arch/x86_64/kernel/setup64.c
+++ b/arch/x86_64/kernel/setup64.c
@@ -12,6 +12,7 @@
12#include <linux/string.h> 12#include <linux/string.h>
13#include <linux/bootmem.h> 13#include <linux/bootmem.h>
14#include <linux/bitops.h> 14#include <linux/bitops.h>
15#include <linux/module.h>
15#include <asm/bootsetup.h> 16#include <asm/bootsetup.h>
16#include <asm/pda.h> 17#include <asm/pda.h>
17#include <asm/pgtable.h> 18#include <asm/pgtable.h>
@@ -22,10 +23,8 @@
22#include <asm/smp.h> 23#include <asm/smp.h>
23#include <asm/i387.h> 24#include <asm/i387.h>
24#include <asm/percpu.h> 25#include <asm/percpu.h>
25#include <asm/mtrr.h>
26#include <asm/proto.h> 26#include <asm/proto.h>
27#include <asm/mman.h> 27#include <asm/sections.h>
28#include <asm/numa.h>
29 28
30char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,}; 29char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
31 30
@@ -33,11 +32,6 @@ cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
33 32
34struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned; 33struct x8664_pda cpu_pda[NR_CPUS] __cacheline_aligned;
35 34
36extern struct task_struct init_task;
37
38extern unsigned char __per_cpu_start[], __per_cpu_end[];
39
40extern struct desc_ptr cpu_gdt_descr[];
41struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table }; 35struct desc_ptr idt_descr = { 256 * 16, (unsigned long) idt_table };
42 36
43char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned"))); 37char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
@@ -101,7 +95,7 @@ void __init setup_per_cpu_areas(void)
101#endif 95#endif
102 96
103 for (i = 0; i < NR_CPUS; i++) { 97 for (i = 0; i < NR_CPUS; i++) {
104 unsigned char *ptr; 98 char *ptr;
105 99
106 if (!NODE_DATA(cpu_to_node(i))) { 100 if (!NODE_DATA(cpu_to_node(i))) {
107 printk("cpu with no node %d, num_online_nodes %d\n", 101 printk("cpu with no node %d, num_online_nodes %d\n",
@@ -190,11 +184,7 @@ void __cpuinit check_efer(void)
190 */ 184 */
191void __cpuinit cpu_init (void) 185void __cpuinit cpu_init (void)
192{ 186{
193#ifdef CONFIG_SMP
194 int cpu = stack_smp_processor_id(); 187 int cpu = stack_smp_processor_id();
195#else
196 int cpu = smp_processor_id();
197#endif
198 struct tss_struct *t = &per_cpu(init_tss, cpu); 188 struct tss_struct *t = &per_cpu(init_tss, cpu);
199 unsigned long v; 189 unsigned long v;
200 char *estacks = NULL; 190 char *estacks = NULL;
@@ -214,7 +204,7 @@ void __cpuinit cpu_init (void)
214 204
215 printk("Initializing CPU#%d\n", cpu); 205 printk("Initializing CPU#%d\n", cpu);
216 206
217 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE); 207 clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
218 208
219 /* 209 /*
220 * Initialize the per-CPU GDT with the boot GDT, 210 * Initialize the per-CPU GDT with the boot GDT,
diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c
index ccae392886af..6ee74db52303 100644
--- a/arch/x86_64/kernel/smp.c
+++ b/arch/x86_64/kernel/smp.c
@@ -129,10 +129,9 @@ asmlinkage void smp_invalidate_interrupt (void)
129 } else 129 } else
130 leave_mm(cpu); 130 leave_mm(cpu);
131 } 131 }
132out:
132 ack_APIC_irq(); 133 ack_APIC_irq();
133 cpu_clear(cpu, flush_cpumask); 134 cpu_clear(cpu, flush_cpumask);
134
135out:
136 put_cpu_no_resched(); 135 put_cpu_no_resched();
137} 136}
138 137
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
index b969ee128728..6d23354443c0 100644
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -113,24 +113,6 @@ struct task_struct *idle_thread_array[NR_CPUS] __cpuinitdata ;
113#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p)) 113#define set_idle_for_cpu(x,p) (idle_thread_array[(x)] = (p))
114 114
115/* 115/*
116 * cpu_possible_map should be static, it cannot change as cpu's
117 * are onlined, or offlined. The reason is per-cpu data-structures
118 * are allocated by some modules at init time, and dont expect to
119 * do this dynamically on cpu arrival/departure.
120 * cpu_present_map on the other hand can change dynamically.
121 * In case when cpu_hotplug is not compiled, then we resort to current
122 * behaviour, which is cpu_possible == cpu_present.
123 * If cpu-hotplug is supported, then we need to preallocate for all
124 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
125 * - Ashok Raj
126 */
127#ifdef CONFIG_HOTPLUG_CPU
128#define fixup_cpu_possible_map(x) cpu_set((x), cpu_possible_map)
129#else
130#define fixup_cpu_possible_map(x)
131#endif
132
133/*
134 * Currently trivial. Write the real->protected mode 116 * Currently trivial. Write the real->protected mode
135 * bootstrap into the page concerned. The caller 117 * bootstrap into the page concerned. The caller
136 * has made sure it's suitably aligned. 118 * has made sure it's suitably aligned.
@@ -229,7 +211,7 @@ static __cpuinit void sync_master(void *arg)
229{ 211{
230 unsigned long flags, i; 212 unsigned long flags, i;
231 213
232 if (smp_processor_id() != boot_cpu_id) 214 if (smp_processor_id() != 0)
233 return; 215 return;
234 216
235 go[MASTER] = 0; 217 go[MASTER] = 0;
@@ -285,7 +267,7 @@ static __cpuinit void sync_tsc(void)
285 int i, done = 0; 267 int i, done = 0;
286 long delta, adj, adjust_latency = 0; 268 long delta, adj, adjust_latency = 0;
287 unsigned long flags, rt, master_time_stamp, bound; 269 unsigned long flags, rt, master_time_stamp, bound;
288#if DEBUG_TSC_SYNC 270#ifdef DEBUG_TSC_SYNC
289 static struct syncdebug { 271 static struct syncdebug {
290 long rt; /* roundtrip time */ 272 long rt; /* roundtrip time */
291 long master; /* master's timestamp */ 273 long master; /* master's timestamp */
@@ -321,7 +303,7 @@ static __cpuinit void sync_tsc(void)
321 rdtscll(t); 303 rdtscll(t);
322 wrmsrl(MSR_IA32_TSC, t + adj); 304 wrmsrl(MSR_IA32_TSC, t + adj);
323 } 305 }
324#if DEBUG_TSC_SYNC 306#ifdef DEBUG_TSC_SYNC
325 t[i].rt = rt; 307 t[i].rt = rt;
326 t[i].master = master_time_stamp; 308 t[i].master = master_time_stamp;
327 t[i].diff = delta; 309 t[i].diff = delta;
@@ -331,7 +313,7 @@ static __cpuinit void sync_tsc(void)
331 } 313 }
332 spin_unlock_irqrestore(&tsc_sync_lock, flags); 314 spin_unlock_irqrestore(&tsc_sync_lock, flags);
333 315
334#if DEBUG_TSC_SYNC 316#ifdef DEBUG_TSC_SYNC
335 for (i = 0; i < NUM_ROUNDS; ++i) 317 for (i = 0; i < NUM_ROUNDS; ++i)
336 printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n", 318 printk("rt=%5ld master=%5ld diff=%5ld adjlat=%5ld\n",
337 t[i].rt, t[i].master, t[i].diff, t[i].lat); 319 t[i].rt, t[i].master, t[i].diff, t[i].lat);
@@ -537,7 +519,7 @@ void __cpuinit start_secondary(void)
537extern volatile unsigned long init_rsp; 519extern volatile unsigned long init_rsp;
538extern void (*initial_code)(void); 520extern void (*initial_code)(void);
539 521
540#if APIC_DEBUG 522#ifdef APIC_DEBUG
541static void inquire_remote_apic(int apicid) 523static void inquire_remote_apic(int apicid)
542{ 524{
543 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 }; 525 unsigned i, regs[] = { APIC_ID >> 4, APIC_LVR >> 4, APIC_SPIV >> 4 };
@@ -773,8 +755,9 @@ do_rest:
773 initial_code = start_secondary; 755 initial_code = start_secondary;
774 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK); 756 clear_ti_thread_flag(c_idle.idle->thread_info, TIF_FORK);
775 757
776 printk(KERN_INFO "Booting processor %d/%d rip %lx rsp %lx\n", cpu, apicid, 758 printk(KERN_INFO "Booting processor %d/%d APIC 0x%x\n", cpu,
777 start_rip, init_rsp); 759 cpus_weight(cpu_present_map),
760 apicid);
778 761
779 /* 762 /*
780 * This grunge runs the startup process for 763 * This grunge runs the startup process for
@@ -841,7 +824,7 @@ do_rest:
841 else 824 else
842 /* trampoline code not run */ 825 /* trampoline code not run */
843 printk("Not responding.\n"); 826 printk("Not responding.\n");
844#if APIC_DEBUG 827#ifdef APIC_DEBUG
845 inquire_remote_apic(apicid); 828 inquire_remote_apic(apicid);
846#endif 829#endif
847 } 830 }
@@ -924,6 +907,27 @@ static __init void enforce_max_cpus(unsigned max_cpus)
924 } 907 }
925} 908}
926 909
910#ifdef CONFIG_HOTPLUG_CPU
911/*
912 * cpu_possible_map should be static, it cannot change as cpu's
913 * are onlined, or offlined. The reason is per-cpu data-structures
914 * are allocated by some modules at init time, and dont expect to
915 * do this dynamically on cpu arrival/departure.
916 * cpu_present_map on the other hand can change dynamically.
917 * In case when cpu_hotplug is not compiled, then we resort to current
918 * behaviour, which is cpu_possible == cpu_present.
919 * If cpu-hotplug is supported, then we need to preallocate for all
920 * those NR_CPUS, hence cpu_possible_map represents entire NR_CPUS range.
921 * - Ashok Raj
922 */
923static void prefill_possible_map(void)
924{
925 int i;
926 for (i = 0; i < NR_CPUS; i++)
927 cpu_set(i, cpu_possible_map);
928}
929#endif
930
927/* 931/*
928 * Various sanity checks. 932 * Various sanity checks.
929 */ 933 */
@@ -987,25 +991,15 @@ static int __init smp_sanity_check(unsigned max_cpus)
987 */ 991 */
988void __init smp_prepare_cpus(unsigned int max_cpus) 992void __init smp_prepare_cpus(unsigned int max_cpus)
989{ 993{
990 int i;
991
992 nmi_watchdog_default(); 994 nmi_watchdog_default();
993 current_cpu_data = boot_cpu_data; 995 current_cpu_data = boot_cpu_data;
994 current_thread_info()->cpu = 0; /* needed? */ 996 current_thread_info()->cpu = 0; /* needed? */
995 997
996 enforce_max_cpus(max_cpus); 998 enforce_max_cpus(max_cpus);
997 999
998 /* 1000#ifdef CONFIG_HOTPLUG_CPU
999 * Fill in cpu_present_mask 1001 prefill_possible_map();
1000 */ 1002#endif
1001 for (i = 0; i < NR_CPUS; i++) {
1002 int apicid = cpu_present_to_apicid(i);
1003 if (physid_isset(apicid, phys_cpu_present_map)) {
1004 cpu_set(i, cpu_present_map);
1005 cpu_set(i, cpu_possible_map);
1006 }
1007 fixup_cpu_possible_map(i);
1008 }
1009 1003
1010 if (smp_sanity_check(max_cpus) < 0) { 1004 if (smp_sanity_check(max_cpus) < 0) {
1011 printk(KERN_INFO "SMP disabled\n"); 1005 printk(KERN_INFO "SMP disabled\n");
@@ -1189,8 +1183,7 @@ void __cpu_die(unsigned int cpu)
1189 printk ("CPU %d is now offline\n", cpu); 1183 printk ("CPU %d is now offline\n", cpu);
1190 return; 1184 return;
1191 } 1185 }
1192 current->state = TASK_UNINTERRUPTIBLE; 1186 msleep(100);
1193 schedule_timeout(HZ/10);
1194 } 1187 }
1195 printk(KERN_ERR "CPU %u didn't die...\n", cpu); 1188 printk(KERN_ERR "CPU %u didn't die...\n", cpu);
1196} 1189}
diff --git a/arch/x86_64/kernel/traps.c b/arch/x86_64/kernel/traps.c
index 102736630002..6ead433a3885 100644
--- a/arch/x86_64/kernel/traps.c
+++ b/arch/x86_64/kernel/traps.c
@@ -594,9 +594,6 @@ asmlinkage void default_do_nmi(struct pt_regs *regs)
594 if (!cpu) 594 if (!cpu)
595 reason = get_nmi_reason(); 595 reason = get_nmi_reason();
596 596
597 if (!cpu_online(cpu))
598 return;
599
600 if (!(reason & 0xc0)) { 597 if (!(reason & 0xc0)) {
601 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT) 598 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 0, SIGINT)
602 == NOTIFY_STOP) 599 == NOTIFY_STOP)
diff --git a/arch/x86_64/lib/delay.c b/arch/x86_64/lib/delay.c
index 33a873a3c223..841bd738a189 100644
--- a/arch/x86_64/lib/delay.c
+++ b/arch/x86_64/lib/delay.c
@@ -18,8 +18,6 @@
18#include <asm/smp.h> 18#include <asm/smp.h>
19#endif 19#endif
20 20
21int x86_udelay_tsc = 0; /* Delay via TSC */
22
23int read_current_timer(unsigned long *timer_value) 21int read_current_timer(unsigned long *timer_value)
24{ 22{
25 rdtscll(*timer_value); 23 rdtscll(*timer_value);
diff --git a/arch/x86_64/mm/fault.c b/arch/x86_64/mm/fault.c
index 2f187986f940..13792721037e 100644
--- a/arch/x86_64/mm/fault.c
+++ b/arch/x86_64/mm/fault.c
@@ -23,7 +23,6 @@
23#include <linux/vt_kern.h> /* For unblank_screen() */ 23#include <linux/vt_kern.h> /* For unblank_screen() */
24#include <linux/compiler.h> 24#include <linux/compiler.h>
25#include <linux/module.h> 25#include <linux/module.h>
26#include <linux/kprobes.h>
27 26
28#include <asm/system.h> 27#include <asm/system.h>
29#include <asm/uaccess.h> 28#include <asm/uaccess.h>
diff --git a/arch/x86_64/mm/numa.c b/arch/x86_64/mm/numa.c
index ac61c186eb02..70cb2904a90f 100644
--- a/arch/x86_64/mm/numa.c
+++ b/arch/x86_64/mm/numa.c
@@ -36,34 +36,36 @@ int numa_off __initdata;
36int __init compute_hash_shift(struct node *nodes, int numnodes) 36int __init compute_hash_shift(struct node *nodes, int numnodes)
37{ 37{
38 int i; 38 int i;
39 int shift = 24; 39 int shift = 20;
40 u64 addr; 40 unsigned long addr,maxend=0;
41 41
42 /* When in doubt use brute force. */ 42 for (i = 0; i < numnodes; i++)
43 while (shift < 48) { 43 if ((nodes[i].start != nodes[i].end) && (nodes[i].end > maxend))
44 memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE); 44 maxend = nodes[i].end;
45 for (i = 0; i < numnodes; i++) { 45
46 if (nodes[i].start == nodes[i].end) 46 while ((1UL << shift) < (maxend / NODEMAPSIZE))
47 continue; 47 shift++;
48 for (addr = nodes[i].start; 48
49 addr < nodes[i].end; 49 printk (KERN_DEBUG"Using %d for the hash shift. Max adder is %lx \n",
50 addr += (1UL << shift)) { 50 shift,maxend);
51 if (memnodemap[addr >> shift] != 0xff && 51 memset(memnodemap,0xff,sizeof(*memnodemap) * NODEMAPSIZE);
52 memnodemap[addr >> shift] != i) { 52 for (i = 0; i < numnodes; i++) {
53 printk(KERN_INFO 53 if (nodes[i].start == nodes[i].end)
54 "node %d shift %d addr %Lx conflict %d\n", 54 continue;
55 i, shift, addr, memnodemap[addr>>shift]); 55 for (addr = nodes[i].start;
56 goto next; 56 addr < nodes[i].end;
57 } 57 addr += (1UL << shift)) {
58 memnodemap[addr >> shift] = i; 58 if (memnodemap[addr >> shift] != 0xff) {
59 printk(KERN_INFO
60 "Your memory is not aligned you need to rebuild your kernel "
61 "with a bigger NODEMAPSIZE shift=%d adder=%lu\n",
62 shift,addr);
63 return -1;
59 } 64 }
65 memnodemap[addr >> shift] = i;
60 } 66 }
61 return shift;
62 next:
63 shift++;
64 } 67 }
65 memset(memnodemap,0,sizeof(*memnodemap) * NODEMAPSIZE); 68 return shift;
66 return -1;
67} 69}
68 70
69#ifdef CONFIG_SPARSEMEM 71#ifdef CONFIG_SPARSEMEM
diff --git a/arch/x86_64/mm/srat.c b/arch/x86_64/mm/srat.c
index 5d01b31472e1..8e3d097a9ddd 100644
--- a/arch/x86_64/mm/srat.c
+++ b/arch/x86_64/mm/srat.c
@@ -20,6 +20,9 @@
20 20
21static struct acpi_table_slit *acpi_slit; 21static struct acpi_table_slit *acpi_slit;
22 22
23/* Internal processor count */
24static unsigned int __initdata num_processors = 0;
25
23static nodemask_t nodes_parsed __initdata; 26static nodemask_t nodes_parsed __initdata;
24static nodemask_t nodes_found __initdata; 27static nodemask_t nodes_found __initdata;
25static struct node nodes[MAX_NUMNODES] __initdata; 28static struct node nodes[MAX_NUMNODES] __initdata;
@@ -101,16 +104,18 @@ acpi_numa_processor_affinity_init(struct acpi_table_processor_affinity *pa)
101 bad_srat(); 104 bad_srat();
102 return; 105 return;
103 } 106 }
104 if (pa->apic_id >= NR_CPUS) { 107 if (num_processors >= NR_CPUS) {
105 printk(KERN_ERR "SRAT: lapic %u too large.\n", 108 printk(KERN_ERR "SRAT: Processor #%d (lapic %u) INVALID. (Max ID: %d).\n",
106 pa->apic_id); 109 num_processors, pa->apic_id, NR_CPUS);
107 bad_srat(); 110 bad_srat();
108 return; 111 return;
109 } 112 }
110 cpu_to_node[pa->apic_id] = node; 113 cpu_to_node[num_processors] = node;
111 acpi_numa = 1; 114 acpi_numa = 1;
112 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> Node %u\n", 115 printk(KERN_INFO "SRAT: PXM %u -> APIC %u -> CPU %u -> Node %u\n",
113 pxm, pa->apic_id, node); 116 pxm, pa->apic_id, num_processors, node);
117
118 num_processors++;
114} 119}
115 120
116/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */ 121/* Callback for parsing of the Proximity Domain <-> Memory Area mappings */
@@ -124,7 +129,6 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
124 129
125 if (srat_disabled() || ma->flags.enabled == 0) 130 if (srat_disabled() || ma->flags.enabled == 0)
126 return; 131 return;
127 /* hotplug bit is ignored for now */
128 pxm = ma->proximity_domain; 132 pxm = ma->proximity_domain;
129 node = setup_node(pxm); 133 node = setup_node(pxm);
130 if (node < 0) { 134 if (node < 0) {
@@ -134,6 +138,10 @@ acpi_numa_memory_affinity_init(struct acpi_table_memory_affinity *ma)
134 } 138 }
135 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32); 139 start = ma->base_addr_lo | ((u64)ma->base_addr_hi << 32);
136 end = start + (ma->length_lo | ((u64)ma->length_hi << 32)); 140 end = start + (ma->length_lo | ((u64)ma->length_hi << 32));
141 /* It is fine to add this area to the nodes data it will be used later*/
142 if (ma->flags.hot_pluggable == 1)
143 printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n",
144 start, end);
137 i = conflicting_nodes(start, end); 145 i = conflicting_nodes(start, end);
138 if (i >= 0) { 146 if (i >= 0) {
139 printk(KERN_ERR 147 printk(KERN_ERR
diff --git a/arch/x86_64/pci/k8-bus.c b/arch/x86_64/pci/k8-bus.c
index 7e7d0c2a0025..c2c38b579939 100644
--- a/arch/x86_64/pci/k8-bus.c
+++ b/arch/x86_64/pci/k8-bus.c
@@ -29,7 +29,7 @@ __init static int
29fill_mp_bus_to_cpumask(void) 29fill_mp_bus_to_cpumask(void)
30{ 30{
31 struct pci_dev *nb_dev = NULL; 31 struct pci_dev *nb_dev = NULL;
32 int i, j, printed; 32 int i, j;
33 u32 ldtbus, nid; 33 u32 ldtbus, nid;
34 static int lbnr[3] = { 34 static int lbnr[3] = {
35 LDT_BUS_NUMBER_REGISTER_0, 35 LDT_BUS_NUMBER_REGISTER_0,