aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/boot/Makefile2
-rw-r--r--arch/alpha/boot/main.c2
-rw-r--r--arch/alpha/boot/tools/mkbb.c5
-rw-r--r--arch/alpha/boot/tools/objstrip.c2
-rw-r--r--arch/alpha/mm/init.c3
-rw-r--r--arch/arm/Kconfig2
-rw-r--r--arch/arm/kernel/entry-common.S2
-rw-r--r--arch/arm/nwfpe/Makefile1
-rw-r--r--arch/arm/nwfpe/entry26.S112
-rw-r--r--arch/arm26/ACKNOWLEDGEMENTS29
-rw-r--r--arch/arm26/Kconfig253
-rw-r--r--arch/arm26/Kconfig.debug50
-rw-r--r--arch/arm26/Makefile107
-rw-r--r--arch/arm26/boot/Makefile83
-rw-r--r--arch/arm26/boot/compressed/Makefile50
-rw-r--r--arch/arm26/boot/compressed/head.S516
-rw-r--r--arch/arm26/boot/compressed/ll_char_wr.S162
-rw-r--r--arch/arm26/boot/compressed/misc.c316
-rw-r--r--arch/arm26/boot/compressed/uncompress.h110
-rw-r--r--arch/arm26/boot/compressed/vmlinux.lds.in60
-rw-r--r--arch/arm26/boot/install.sh62
-rw-r--r--arch/arm26/defconfig361
-rw-r--r--arch/arm26/kernel/Makefile17
-rw-r--r--arch/arm26/kernel/armksyms.c204
-rw-r--r--arch/arm26/kernel/asm-offsets.c55
-rw-r--r--arch/arm26/kernel/calls.S265
-rw-r--r--arch/arm26/kernel/compat.c173
-rw-r--r--arch/arm26/kernel/dma.c273
-rw-r--r--arch/arm26/kernel/ecard.c847
-rw-r--r--arch/arm26/kernel/entry.S951
-rw-r--r--arch/arm26/kernel/fiq.c201
-rw-r--r--arch/arm26/kernel/head.S112
-rw-r--r--arch/arm26/kernel/init_task.c49
-rw-r--r--arch/arm26/kernel/irq.c722
-rw-r--r--arch/arm26/kernel/process.c392
-rw-r--r--arch/arm26/kernel/ptrace.c670
-rw-r--r--arch/arm26/kernel/ptrace.h13
-rw-r--r--arch/arm26/kernel/semaphore.c222
-rw-r--r--arch/arm26/kernel/setup.c572
-rw-r--r--arch/arm26/kernel/signal.c538
-rw-r--r--arch/arm26/kernel/sys_arm.c323
-rw-r--r--arch/arm26/kernel/time.c210
-rw-r--r--arch/arm26/kernel/traps.c548
-rw-r--r--arch/arm26/kernel/vmlinux-arm26-xip.lds.in136
-rw-r--r--arch/arm26/kernel/vmlinux-arm26.lds.in129
-rw-r--r--arch/arm26/kernel/vmlinux.lds.S11
-rw-r--r--arch/arm26/lib/Makefile26
-rw-r--r--arch/arm26/lib/ashldi3.c61
-rw-r--r--arch/arm26/lib/ashrdi3.c61
-rw-r--r--arch/arm26/lib/backtrace.S144
-rw-r--r--arch/arm26/lib/changebit.S28
-rw-r--r--arch/arm26/lib/clearbit.S31
-rw-r--r--arch/arm26/lib/copy_page.S62
-rw-r--r--arch/arm26/lib/csumipv6.S32
-rw-r--r--arch/arm26/lib/csumpartial.S130
-rw-r--r--arch/arm26/lib/csumpartialcopy.S52
-rw-r--r--arch/arm26/lib/csumpartialcopygeneric.S352
-rw-r--r--arch/arm26/lib/csumpartialcopyuser.S114
-rw-r--r--arch/arm26/lib/delay.S57
-rw-r--r--arch/arm26/lib/ecard.S40
-rw-r--r--arch/arm26/lib/findbit.S67
-rw-r--r--arch/arm26/lib/floppydma.S32
-rw-r--r--arch/arm26/lib/gcclib.h21
-rw-r--r--arch/arm26/lib/getuser.S112
-rw-r--r--arch/arm26/lib/io-acorn.S70
-rw-r--r--arch/arm26/lib/io-readsb.S116
-rw-r--r--arch/arm26/lib/io-readsl.S78
-rw-r--r--arch/arm26/lib/io-readsw.S107
-rw-r--r--arch/arm26/lib/io-writesb.S122
-rw-r--r--arch/arm26/lib/io-writesl.S56
-rw-r--r--arch/arm26/lib/io-writesw.S127
-rw-r--r--arch/arm26/lib/kbd.c278
-rw-r--r--arch/arm26/lib/lib1funcs.S313
-rw-r--r--arch/arm26/lib/longlong.h184
-rw-r--r--arch/arm26/lib/lshrdi3.c61
-rw-r--r--arch/arm26/lib/memchr.S25
-rw-r--r--arch/arm26/lib/memcpy.S318
-rw-r--r--arch/arm26/lib/memset.S80
-rw-r--r--arch/arm26/lib/memzero.S80
-rw-r--r--arch/arm26/lib/muldi3.c77
-rw-r--r--arch/arm26/lib/putuser.S109
-rw-r--r--arch/arm26/lib/setbit.S29
-rw-r--r--arch/arm26/lib/strchr.S25
-rw-r--r--arch/arm26/lib/strrchr.S25
-rw-r--r--arch/arm26/lib/testchangebit.S29
-rw-r--r--arch/arm26/lib/testclearbit.S29
-rw-r--r--arch/arm26/lib/testsetbit.S29
-rw-r--r--arch/arm26/lib/uaccess-kernel.S173
-rw-r--r--arch/arm26/lib/uaccess-user.S718
-rw-r--r--arch/arm26/lib/ucmpdi2.c51
-rw-r--r--arch/arm26/lib/udivdi3.c242
-rw-r--r--arch/arm26/machine/Makefile8
-rw-r--r--arch/arm26/machine/dma.c214
-rw-r--r--arch/arm26/machine/irq.c164
-rw-r--r--arch/arm26/machine/latches.c72
-rw-r--r--arch/arm26/mm/Makefile6
-rw-r--r--arch/arm26/mm/extable.c24
-rw-r--r--arch/arm26/mm/fault.c312
-rw-r--r--arch/arm26/mm/fault.h5
-rw-r--r--arch/arm26/mm/init.c403
-rw-r--r--arch/arm26/mm/memc.c184
-rw-r--r--arch/arm26/mm/proc-funcs.S359
-rw-r--r--arch/arm26/mm/small_page.c192
-rw-r--r--arch/arm26/nwfpe/ARM-gcc.h120
-rw-r--r--arch/arm26/nwfpe/ChangeLog83
-rw-r--r--arch/arm26/nwfpe/Makefile15
-rw-r--r--arch/arm26/nwfpe/double_cpdo.c288
-rw-r--r--arch/arm26/nwfpe/entry.S114
-rw-r--r--arch/arm26/nwfpe/extended_cpdo.c273
-rw-r--r--arch/arm26/nwfpe/fpa11.c221
-rw-r--r--arch/arm26/nwfpe/fpa11.h87
-rw-r--r--arch/arm26/nwfpe/fpa11.inl51
-rw-r--r--arch/arm26/nwfpe/fpa11_cpdo.c117
-rw-r--r--arch/arm26/nwfpe/fpa11_cpdt.c368
-rw-r--r--arch/arm26/nwfpe/fpa11_cprt.c289
-rw-r--r--arch/arm26/nwfpe/fpmodule.c180
-rw-r--r--arch/arm26/nwfpe/fpmodule.h46
-rw-r--r--arch/arm26/nwfpe/fpmodule.inl84
-rw-r--r--arch/arm26/nwfpe/fpopcode.c148
-rw-r--r--arch/arm26/nwfpe/fpopcode.h390
-rw-r--r--arch/arm26/nwfpe/fpsr.h108
-rw-r--r--arch/arm26/nwfpe/milieu.h48
-rw-r--r--arch/arm26/nwfpe/single_cpdo.c255
-rw-r--r--arch/arm26/nwfpe/softfloat-macros740
-rw-r--r--arch/arm26/nwfpe/softfloat-specialize366
-rw-r--r--arch/arm26/nwfpe/softfloat.c3439
-rw-r--r--arch/arm26/nwfpe/softfloat.h232
-rw-r--r--arch/frv/mb93090-mb00/pci-vdk.c3
-rw-r--r--arch/i386/Kconfig3
-rw-r--r--arch/i386/boot/code16gcc.h2
-rw-r--r--arch/i386/boot/edd.c5
-rw-r--r--arch/i386/boot/header.S4
-rw-r--r--arch/i386/boot/install.sh9
-rw-r--r--arch/i386/boot/pm.c2
-rw-r--r--arch/i386/boot/video-bios.c2
-rw-r--r--arch/i386/kernel/Makefile1
-rw-r--r--arch/i386/kernel/apm.c2
-rw-r--r--arch/i386/kernel/cpu/bugs.c1
-rw-r--r--arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c4
-rw-r--r--arch/i386/kernel/legacy_serial.c67
-rw-r--r--arch/ia64/kernel/perfmon.c4
-rw-r--r--arch/m68knommu/platform/5206e/config.c1
-rw-r--r--arch/mips/Kconfig245
-rw-r--r--arch/mips/Makefile65
-rw-r--r--arch/mips/arc/file.c22
-rw-r--r--arch/mips/au1000/common/Makefile2
-rw-r--r--arch/mips/boot/Makefile4
-rw-r--r--arch/mips/cobalt/Makefile2
-rw-r--r--arch/mips/cobalt/serial.c4
-rw-r--r--arch/mips/configs/atlas_defconfig3
-rw-r--r--arch/mips/configs/bigsur_defconfig3
-rw-r--r--arch/mips/configs/capcella_defconfig3
-rw-r--r--arch/mips/configs/cobalt_defconfig2
-rw-r--r--arch/mips/configs/db1000_defconfig3
-rw-r--r--arch/mips/configs/db1100_defconfig3
-rw-r--r--arch/mips/configs/db1200_defconfig3
-rw-r--r--arch/mips/configs/db1500_defconfig3
-rw-r--r--arch/mips/configs/db1550_defconfig3
-rw-r--r--arch/mips/configs/ddb5477_defconfig990
-rw-r--r--arch/mips/configs/decstation_defconfig3
-rw-r--r--arch/mips/configs/e55_defconfig3
-rw-r--r--arch/mips/configs/emma2rh_defconfig3
-rw-r--r--arch/mips/configs/excite_defconfig3
-rw-r--r--arch/mips/configs/fulong_defconfig2
-rw-r--r--arch/mips/configs/ip22_defconfig3
-rw-r--r--arch/mips/configs/ip27_defconfig3
-rw-r--r--arch/mips/configs/ip32_defconfig3
-rw-r--r--arch/mips/configs/jazz_defconfig3
-rw-r--r--arch/mips/configs/jmr3927_defconfig3
-rw-r--r--arch/mips/configs/malta_defconfig3
-rw-r--r--arch/mips/configs/mipssim_defconfig3
-rw-r--r--arch/mips/configs/mpc30x_defconfig3
-rw-r--r--arch/mips/configs/msp71xx_defconfig3
-rw-r--r--arch/mips/configs/ocelot_defconfig919
-rw-r--r--arch/mips/configs/pb1100_defconfig3
-rw-r--r--arch/mips/configs/pb1500_defconfig3
-rw-r--r--arch/mips/configs/pb1550_defconfig3
-rw-r--r--arch/mips/configs/pnx8550-jbs_defconfig3
-rw-r--r--arch/mips/configs/pnx8550-stb810_defconfig3
-rw-r--r--arch/mips/configs/qemu_defconfig3
-rw-r--r--arch/mips/configs/rbhma4200_defconfig2
-rw-r--r--arch/mips/configs/rbhma4500_defconfig2
-rw-r--r--arch/mips/configs/rm200_defconfig3
-rw-r--r--arch/mips/configs/sb1250-swarm_defconfig3
-rw-r--r--arch/mips/configs/sead_defconfig3
-rw-r--r--arch/mips/configs/tb0219_defconfig3
-rw-r--r--arch/mips/configs/tb0226_defconfig3
-rw-r--r--arch/mips/configs/tb0287_defconfig3
-rw-r--r--arch/mips/configs/workpad_defconfig3
-rw-r--r--arch/mips/configs/wrppmc_defconfig3
-rw-r--r--arch/mips/configs/yosemite_defconfig3
-rw-r--r--arch/mips/ddb5xxx/Kconfig4
-rw-r--r--arch/mips/ddb5xxx/common/Makefile5
-rw-r--r--arch/mips/ddb5xxx/common/nile4.c130
-rw-r--r--arch/mips/ddb5xxx/common/prom.c132
-rw-r--r--arch/mips/ddb5xxx/common/rtc_ds1386.c170
-rw-r--r--arch/mips/ddb5xxx/ddb5477/Makefile9
-rw-r--r--arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c49
-rw-r--r--arch/mips/ddb5xxx/ddb5477/debug.c160
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq.c209
-rw-r--r--arch/mips/ddb5xxx/ddb5477/irq_5477.c154
-rw-r--r--arch/mips/ddb5xxx/ddb5477/kgdb_io.c136
-rw-r--r--arch/mips/ddb5xxx/ddb5477/lcd44780.c96
-rw-r--r--arch/mips/ddb5xxx/ddb5477/lcd44780.h15
-rw-r--r--arch/mips/ddb5xxx/ddb5477/setup.c399
-rw-r--r--arch/mips/dec/Makefile2
-rw-r--r--arch/mips/defconfig3
-rw-r--r--arch/mips/gt64120/common/Makefile5
-rw-r--r--arch/mips/gt64120/common/time.c101
-rw-r--r--arch/mips/gt64120/momenco_ocelot/Makefile7
-rw-r--r--arch/mips/gt64120/momenco_ocelot/dbg_io.c121
-rw-r--r--arch/mips/gt64120/momenco_ocelot/irq.c95
-rw-r--r--arch/mips/gt64120/momenco_ocelot/ocelot-platform.c46
-rw-r--r--arch/mips/gt64120/momenco_ocelot/ocelot_pld.h30
-rw-r--r--arch/mips/gt64120/momenco_ocelot/prom.c71
-rw-r--r--arch/mips/gt64120/momenco_ocelot/reset.c47
-rw-r--r--arch/mips/gt64120/momenco_ocelot/setup.c365
-rw-r--r--arch/mips/gt64120/wrppmc/Makefile2
-rw-r--r--arch/mips/jazz/Makefile2
-rw-r--r--arch/mips/jmr3927/common/Makefile2
-rw-r--r--arch/mips/jmr3927/rbhma3100/Makefile2
-rw-r--r--arch/mips/kernel/Makefile2
-rw-r--r--arch/mips/kernel/asm-offsets.c1
-rw-r--r--arch/mips/kernel/head.S1
-rw-r--r--arch/mips/kernel/kspd.c19
-rw-r--r--arch/mips/kernel/linux32.c7
-rw-r--r--arch/mips/kernel/machine_kexec.c13
-rw-r--r--arch/mips/kernel/mips-mt-fpaff.c9
-rw-r--r--arch/mips/kernel/mips-mt.c22
-rw-r--r--arch/mips/kernel/process.c2
-rw-r--r--arch/mips/kernel/ptrace.c14
-rw-r--r--arch/mips/kernel/relocate_kernel.S78
-rw-r--r--arch/mips/kernel/rtlx.c24
-rw-r--r--arch/mips/kernel/scall32-o32.S1
-rw-r--r--arch/mips/kernel/scall64-64.S1
-rw-r--r--arch/mips/kernel/scall64-n32.S1
-rw-r--r--arch/mips/kernel/scall64-o32.S1
-rw-r--r--arch/mips/kernel/signal32.c1
-rw-r--r--arch/mips/kernel/smp.c55
-rw-r--r--arch/mips/kernel/smtc.c36
-rw-r--r--arch/mips/kernel/syscall.c18
-rw-r--r--arch/mips/kernel/traps.c2
-rw-r--r--arch/mips/kernel/unaligned.c53
-rw-r--r--arch/mips/kernel/vpe.c359
-rw-r--r--arch/mips/lemote/lm2e/Makefile3
-rw-r--r--arch/mips/lemote/lm2e/irq.c1
-rw-r--r--arch/mips/lemote/lm2e/prom.c10
-rw-r--r--arch/mips/lemote/lm2e/setup.c14
-rw-r--r--arch/mips/math-emu/Makefile2
-rw-r--r--arch/mips/mips-boards/atlas/Makefile2
-rw-r--r--arch/mips/mips-boards/atlas/atlas_int.c1
-rw-r--r--arch/mips/mips-boards/generic/Makefile2
-rw-r--r--arch/mips/mips-boards/generic/init.c1
-rw-r--r--arch/mips/mips-boards/generic/time.c4
-rw-r--r--arch/mips/mips-boards/malta/Makefile2
-rw-r--r--arch/mips/mips-boards/malta/malta_int.c12
-rw-r--r--arch/mips/mips-boards/malta/malta_smtc.c2
-rw-r--r--arch/mips/mips-boards/sead/Makefile2
-rw-r--r--arch/mips/mipssim/Makefile2
-rw-r--r--arch/mips/mipssim/sim_setup.c1
-rw-r--r--arch/mips/mm/Makefile2
-rw-r--r--arch/mips/mm/c-r4k.c4
-rw-r--r--arch/mips/oprofile/op_model_rm9000.c1
-rw-r--r--arch/mips/pci/Makefile2
-rw-r--r--arch/mips/pci/fixup-ddb5477.c78
-rw-r--r--arch/mips/pci/fixup-ocelot.c75
-rw-r--r--arch/mips/pci/fixup-rbtx4927.c2
-rw-r--r--arch/mips/pci/fixup-tx4938.c2
-rw-r--r--arch/mips/pci/ops-ddb5477.c278
-rw-r--r--arch/mips/pci/ops-emma2rh.c2
-rw-r--r--arch/mips/pci/ops-pnx8550.c12
-rw-r--r--arch/mips/pci/pci-ddb5477.c207
-rw-r--r--arch/mips/pci/pci-ocelot.c107
-rw-r--r--arch/mips/philips/pnx8550/common/Makefile2
-rw-r--r--arch/mips/pmc-sierra/yosemite/Makefile4
-rw-r--r--arch/mips/pmc-sierra/yosemite/i2c-yosemite.c188
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/prom.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/setup.c4
-rw-r--r--arch/mips/pmc-sierra/yosemite/smp.c19
-rw-r--r--arch/mips/qemu/Makefile2
-rw-r--r--arch/mips/sgi-ip27/Makefile2
-rw-r--r--arch/mips/sgi-ip27/ip27-klnuma.c16
-rw-r--r--arch/mips/sgi-ip27/ip27-smp.c2
-rw-r--r--arch/mips/sgi-ip32/Makefile2
-rw-r--r--arch/mips/sgi-ip32/ip32-reset.c3
-rw-r--r--arch/mips/sibyte/bcm1480/Makefile2
-rw-r--r--arch/mips/sibyte/bcm1480/setup.c1
-rw-r--r--arch/mips/sibyte/common/Makefile1
-rw-r--r--arch/mips/sibyte/sb1250/Makefile2
-rw-r--r--arch/mips/sni/Makefile2
-rw-r--r--arch/mips/tx4927/common/tx4927_irq.c3
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c4
-rw-r--r--arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c58
-rw-r--r--arch/mips/tx4938/toshiba_rbtx4938/setup.c4
-rw-r--r--arch/mips/vr41xx/common/Makefile2
-rw-r--r--arch/powerpc/boot/dts/prpmc2800.dts6
-rw-r--r--arch/powerpc/kernel/entry_64.S1
-rw-r--r--arch/powerpc/sysdev/mv64x60_dev.c64
-rw-r--r--arch/ppc/syslib/mv64x60.c29
-rw-r--r--arch/sh/Kconfig33
-rw-r--r--arch/sh/Makefile2
-rw-r--r--arch/sh/boards/se/7300/Makefile5
-rw-r--r--arch/sh/boards/se/7300/io.c268
-rw-r--r--arch/sh/boards/se/7300/irq.c40
-rw-r--r--arch/sh/boards/se/7300/setup.c74
-rw-r--r--arch/sh/boards/se/73180/Makefile5
-rw-r--r--arch/sh/boards/se/73180/io.c268
-rw-r--r--arch/sh/boards/se/73180/irq.c136
-rw-r--r--arch/sh/boards/se/73180/setup.c75
-rw-r--r--arch/sh/boot/Makefile7
-rw-r--r--arch/sh/boot/compressed/Makefile7
-rw-r--r--arch/sh/configs/se7300_defconfig696
-rw-r--r--arch/sh/configs/se73180_defconfig648
-rw-r--r--arch/sh/drivers/dma/dma-api.c7
-rw-r--r--arch/sh/kernel/cpu/irq/Makefile1
-rw-r--r--arch/sh/kernel/cpu/irq/ipr.c2
-rw-r--r--arch/sh/kernel/cpu/irq/pint.c220
-rw-r--r--arch/sh/kernel/cpu/sh3/Makefile4
-rw-r--r--arch/sh/kernel/cpu/sh3/clock-sh7710.c (renamed from arch/sh/kernel/cpu/sh3/clock-sh7300.c)26
-rw-r--r--arch/sh/kernel/cpu/sh3/setup-sh7300.c43
-rw-r--r--arch/sh/kernel/cpu/sh4/probe.c6
-rw-r--r--arch/sh/kernel/cpu/sh4/sq.c18
-rw-r--r--arch/sh/kernel/cpu/sh4a/Makefile2
-rw-r--r--arch/sh/kernel/cpu/sh4a/clock-sh73180.c81
-rw-r--r--arch/sh/kernel/cpu/sh4a/setup-sh73180.c43
-rw-r--r--arch/sh/kernel/init_task.c2
-rw-r--r--arch/sh/kernel/process.c7
-rw-r--r--arch/sh/kernel/setup.c3
-rw-r--r--arch/sh/kernel/sys_sh.c1
-rw-r--r--arch/sh/kernel/timers/timer-tmu.c3
-rw-r--r--arch/sh/kernel/vsyscall/vsyscall.c1
-rw-r--r--arch/sh/mm/Kconfig14
-rw-r--r--arch/sh/mm/cache-sh4.c14
-rw-r--r--arch/sh/mm/pg-sh4.c76
-rw-r--r--arch/sh/tools/mach-types2
-rw-r--r--arch/sh64/Kconfig3
-rw-r--r--arch/sh64/kernel/init_task.c2
-rw-r--r--arch/sh64/kernel/irq_intc.c1
-rw-r--r--arch/sh64/kernel/pci-dma.c4
-rw-r--r--arch/sh64/kernel/process.c1
-rw-r--r--arch/sh64/kernel/sys_sh64.c1
-rw-r--r--arch/sh64/lib/dbg.c1
-rw-r--r--arch/sparc/mm/sun4c.c3
-rw-r--r--arch/um/drivers/chan_kern.c9
-rw-r--r--arch/x86_64/kernel/Makefile2
-rw-r--r--arch/x86_64/kernel/bugs.c1
-rw-r--r--arch/x86_64/kernel/entry.S6
-rw-r--r--arch/x86_64/kernel/tce.c2
349 files changed, 964 insertions, 33845 deletions
diff --git a/arch/alpha/boot/Makefile b/arch/alpha/boot/Makefile
index e1ae14cd2b4e..cd143887380a 100644
--- a/arch/alpha/boot/Makefile
+++ b/arch/alpha/boot/Makefile
@@ -104,7 +104,7 @@ OBJ_bootlx := $(obj)/head.o $(obj)/main.o
104OBJ_bootph := $(obj)/head.o $(obj)/bootp.o 104OBJ_bootph := $(obj)/head.o $(obj)/bootp.o
105OBJ_bootpzh := $(obj)/head.o $(obj)/bootpz.o $(obj)/misc.o 105OBJ_bootpzh := $(obj)/head.o $(obj)/bootpz.o $(obj)/misc.o
106 106
107$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) FORCE 107$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
108 $(call if_changed,ld) 108 $(call if_changed,ld)
109 109
110$(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE 110$(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
diff --git a/arch/alpha/boot/main.c b/arch/alpha/boot/main.c
index 90ed55b662a8..89f3be071ae5 100644
--- a/arch/alpha/boot/main.c
+++ b/arch/alpha/boot/main.c
@@ -132,7 +132,7 @@ static inline long load(long dev, unsigned long addr, unsigned long count)
132 if (result) 132 if (result)
133 srm_printk("Boot file specification (%s) not implemented\n", 133 srm_printk("Boot file specification (%s) not implemented\n",
134 bootfile); 134 bootfile);
135 return callback_read(dev, count, addr, boot_size/512 + 1); 135 return callback_read(dev, count, (void *)addr, boot_size/512 + 1);
136} 136}
137 137
138/* 138/*
diff --git a/arch/alpha/boot/tools/mkbb.c b/arch/alpha/boot/tools/mkbb.c
index 632a7fd6d7dc..1185778e6a1e 100644
--- a/arch/alpha/boot/tools/mkbb.c
+++ b/arch/alpha/boot/tools/mkbb.c
@@ -11,6 +11,7 @@
11 11
12#include <fcntl.h> 12#include <fcntl.h>
13#include <unistd.h> 13#include <unistd.h>
14#include <stdlib.h>
14#include <stdio.h> 15#include <stdio.h>
15 16
16/* Minimal definition of disklabel, so we don't have to include 17/* Minimal definition of disklabel, so we don't have to include
@@ -114,7 +115,7 @@ int main(int argc, char ** argv)
114 nread = read(fd, &bootloader_image, sizeof(bootblock)); 115 nread = read(fd, &bootloader_image, sizeof(bootblock));
115 if(nread != sizeof(bootblock)) { 116 if(nread != sizeof(bootblock)) {
116 perror("lxboot read"); 117 perror("lxboot read");
117 fprintf(stderr, "expected %d, got %d\n", sizeof(bootblock), nread); 118 fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread);
118 exit(0); 119 exit(0);
119 } 120 }
120 121
@@ -122,7 +123,7 @@ int main(int argc, char ** argv)
122 nread = read(dev, &bootblock_from_disk, sizeof(bootblock)); 123 nread = read(dev, &bootblock_from_disk, sizeof(bootblock));
123 if(nread != sizeof(bootblock)) { 124 if(nread != sizeof(bootblock)) {
124 perror("bootblock read"); 125 perror("bootblock read");
125 fprintf(stderr, "expected %d, got %d\n", sizeof(bootblock), nread); 126 fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread);
126 exit(0); 127 exit(0);
127 } 128 }
128 129
diff --git a/arch/alpha/boot/tools/objstrip.c b/arch/alpha/boot/tools/objstrip.c
index 96154e768a20..ef1838230291 100644
--- a/arch/alpha/boot/tools/objstrip.c
+++ b/arch/alpha/boot/tools/objstrip.c
@@ -144,7 +144,7 @@ main (int argc, char *argv[])
144#ifdef __ELF__ 144#ifdef __ELF__
145 elf = (struct elfhdr *) buf; 145 elf = (struct elfhdr *) buf;
146 146
147 if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) { 147 if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) {
148 if (elf->e_type != ET_EXEC) { 148 if (elf->e_type != ET_EXEC) {
149 fprintf(stderr, "%s: %s is not an ELF executable\n", 149 fprintf(stderr, "%s: %s is not an ELF executable\n",
150 prog_name, inname); 150 prog_name, inname);
diff --git a/arch/alpha/mm/init.c b/arch/alpha/mm/init.c
index 550f4907d613..5e6da47779a4 100644
--- a/arch/alpha/mm/init.c
+++ b/arch/alpha/mm/init.c
@@ -267,8 +267,7 @@ callback_init(void * kernel_end)
267/* 267/*
268 * paging_init() sets up the memory map. 268 * paging_init() sets up the memory map.
269 */ 269 */
270void 270void __init paging_init(void)
271paging_init(void)
272{ 271{
273 unsigned long zones_size[MAX_NR_ZONES] = {0, }; 272 unsigned long zones_size[MAX_NR_ZONES] = {0, };
274 unsigned long dma_pfn, high_pfn; 273 unsigned long dma_pfn, high_pfn;
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index c8569e862c6b..d6145298a325 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -991,8 +991,6 @@ source "drivers/pnp/Kconfig"
991 991
992source "drivers/block/Kconfig" 992source "drivers/block/Kconfig"
993 993
994source "drivers/acorn/block/Kconfig"
995
996if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \ 994if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \
997 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \ 995 || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \
998 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \ 996 || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \
diff --git a/arch/arm/kernel/entry-common.S b/arch/arm/kernel/entry-common.S
index c589dc3ecd1a..33e6cc2ffd3b 100644
--- a/arch/arm/kernel/entry-common.S
+++ b/arch/arm/kernel/entry-common.S
@@ -46,7 +46,7 @@ fast_work_pending:
46work_pending: 46work_pending:
47 tst r1, #_TIF_NEED_RESCHED 47 tst r1, #_TIF_NEED_RESCHED
48 bne work_resched 48 bne work_resched
49 tst r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING 49 tst r1, #_TIF_SIGPENDING
50 beq no_work_pending 50 beq no_work_pending
51 mov r0, sp @ 'regs' 51 mov r0, sp @ 'regs'
52 mov r2, why @ 'syscall' 52 mov r2, why @ 'syscall'
diff --git a/arch/arm/nwfpe/Makefile b/arch/arm/nwfpe/Makefile
index ed7b26bf73f5..b29178c0414e 100644
--- a/arch/arm/nwfpe/Makefile
+++ b/arch/arm/nwfpe/Makefile
@@ -9,5 +9,4 @@ nwfpe-y += fpa11.o fpa11_cpdo.o fpa11_cpdt.o \
9 softfloat.o single_cpdo.o double_cpdo.o 9 softfloat.o single_cpdo.o double_cpdo.o
10 10
11nwfpe-$(CONFIG_FPE_NWFPE_XP) += extended_cpdo.o 11nwfpe-$(CONFIG_FPE_NWFPE_XP) += extended_cpdo.o
12nwfpe-$(CONFIG_CPU_26) += entry26.o
13nwfpe-$(CONFIG_CPU_32) += entry.o 12nwfpe-$(CONFIG_CPU_32) += entry.o
diff --git a/arch/arm/nwfpe/entry26.S b/arch/arm/nwfpe/entry26.S
deleted file mode 100644
index 3e6fb5d21d64..000000000000
--- a/arch/arm/nwfpe/entry26.S
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998
4 (c) Philip Blundell 1998-1999
5
6 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
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 as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#include <asm/asm-offsets.h>
24
25/* This is the kernel's entry point into the floating point emulator.
26It is called from the kernel with code similar to this:
27
28 mov fp, #0
29 teqp pc, #PSR_I_BIT | SVC_MODE
30 ldr r4, .LC2
31 ldr pc, [r4] @ Call FP module USR entry point
32
33The kernel expects the emulator to return via one of two possible
34points of return it passes to the emulator. The emulator, if
35successful in its emulation, jumps to ret_from_exception and the
36kernel takes care of returning control from the trap to the user code.
37If the emulator is unable to emulate the instruction, it returns to
38fpundefinstr and the kernel halts the user program with a core dump.
39
40This routine does four things:
41
421) It saves SP into a variable called userRegisters. The kernel has
43created a struct pt_regs on the stack and saved the user registers
44into it. See /usr/include/asm/proc/ptrace.h for details. The
45emulator code uses userRegisters as the base of an array of words from
46which the contents of the registers can be extracted.
47
482) It locates the FP emulator work area within the TSS structure and
49points `fpa11' to it.
50
513) It calls EmulateAll to emulate a floating point instruction.
52EmulateAll returns 1 if the emulation was successful, or 0 if not.
53
544) If an instruction has been emulated successfully, it looks ahead at
55the next instruction. If it is a floating point instruction, it
56executes the instruction, without returning to user space. In this
57way it repeatedly looks ahead and executes floating point instructions
58until it encounters a non floating point instruction, at which time it
59returns via _fpreturn.
60
61This is done to reduce the effect of the trap overhead on each
62floating point instructions. GCC attempts to group floating point
63instructions to allow the emulator to spread the cost of the trap over
64several floating point instructions. */
65
66 .globl nwfpe_enter
67nwfpe_enter:
68 mov sl, sp
69 ldr r5, [sp, #60] @ get contents of PC
70 bic r5, r5, #0xfc000003
71 ldr r0, [r5, #-4] @ get actual instruction into r0
72 bl EmulateAll @ emulate the instruction
731: cmp r0, #0 @ was emulation successful
74 beq fpundefinstr @ no, return failure
75
76next:
77.Lx1: ldrt r6, [r5], #4 @ get the next instruction and
78 @ increment PC
79
80 and r2, r6, #0x0F000000 @ test for FP insns
81 teq r2, #0x0C000000
82 teqne r2, #0x0D000000
83 teqne r2, #0x0E000000
84 bne ret_from_exception @ return ok if not a fp insn
85
86 ldr r9, [sp, #60] @ get new condition codes
87 and r9, r9, #0xfc000003
88 orr r7, r5, r9
89 str r7, [sp, #60] @ update PC copy in regs
90
91 mov r0, r6 @ save a copy
92 mov r1, r9 @ fetch the condition codes
93 bl checkCondition @ check the condition
94 cmp r0, #0 @ r0 = 0 ==> condition failed
95
96 @ if condition code failed to match, next insn
97 beq next @ get the next instruction;
98
99 mov r0, r6 @ prepare for EmulateAll()
100 adr lr, 1b
101 orr lr, lr, #3
102 b EmulateAll @ if r0 != 0, goto EmulateAll
103
104.Lret: b ret_from_exception @ let the user eat segfaults
105
106 @ We need to be prepared for the instruction at .Lx1 to fault.
107 @ Emit the appropriate exception gunk to fix things up.
108 .section __ex_table,"a"
109 .align 3
110 .long .Lx1
111 ldr lr, [lr, $(.Lret - .Lx1)/4]
112 .previous
diff --git a/arch/arm26/ACKNOWLEDGEMENTS b/arch/arm26/ACKNOWLEDGEMENTS
deleted file mode 100644
index 0a17a45110e7..000000000000
--- a/arch/arm26/ACKNOWLEDGEMENTS
+++ /dev/null
@@ -1,29 +0,0 @@
1The work in this architecture (ARM26) is that of a great many people.
2
3This is what has happened:
4
5I [Ian Molton] have been trying to repair the ARM26 architecture support, but it has become an impossible task whilst it is still merged with the ARM32 (arch/arm) code. The ARM26 code is too different to be sensible to keep with the ARM32 code now, and Russell King really doesnt have the time to maintain the ARM26 code. Add to that that most ARM32 developers dont know about or care about ARM26 when writing patches, and you have a reall mess.
6
7As a result, I've split it off into a new architecture of its own. I've named it arm26 since these CPUs have only a 26 bit address space, unlike the other ARMs.
8
9The upheaval in moving around so many source files and chopping out vasty ammounts of cruft was enormous, and the copyright of many files is sometimes unclear. Because of this, I am writing this, in order that no-one is left out / misaccredited / blamed for any of the code.
10
11People I KNOW have made major contributions to the code:
12
13David Alan Gilbert (former maintainer of ARM26 bits)
14Philip Blundell
15Russell King
16Keith Owens
17
18also thanks to Nicholas Pitre for hints, and for the basis or our XIP support.
19
20Currently maintaing the code are
21
22Ian Molton (Maintainer / Archimedes)
23John Appleby (kernel / A5K)
24
25If anyone has a problem with attributions in header files / source files, please do contact me to straighten things out.
26
27Ian Molton (aka spyro) - ARM26 maintainer
28spyro@f2s.com
29
diff --git a/arch/arm26/Kconfig b/arch/arm26/Kconfig
deleted file mode 100644
index 9044f33299f7..000000000000
--- a/arch/arm26/Kconfig
+++ /dev/null
@@ -1,253 +0,0 @@
1#
2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/kconfig-language.txt.
4#
5
6mainmenu "Linux Kernel Configuration"
7
8config ARM
9 bool
10 default y
11
12config ARM26
13 bool
14 default y
15
16config MMU
17 bool
18 default y
19
20config NO_DMA
21 def_bool y
22
23config ARCH_ACORN
24 bool
25 default y
26
27config CPU_26
28 bool
29 default y
30
31config FIQ
32 bool
33 default y
34
35# 9 = 512 pages 8 = 256 pages 7 = 128 pages
36config FORCE_MAX_ZONEORDER
37 int
38 default 9
39
40config RWSEM_GENERIC_SPINLOCK
41 bool
42 default y
43
44config RWSEM_XCHGADD_ALGORITHM
45 bool
46
47config ARCH_HAS_ILOG2_U32
48 bool
49 default n
50
51config ARCH_HAS_ILOG2_U64
52 bool
53 default n
54
55config GENERIC_HWEIGHT
56 bool
57 default y
58
59config GENERIC_CALIBRATE_DELAY
60 bool
61 default y
62
63config ZONE_DMA
64 bool
65 default y
66
67config GENERIC_ISA_DMA
68 bool
69
70config ARCH_MAY_HAVE_PC_FDC
71 bool
72
73source "init/Kconfig"
74
75
76menu "System Type"
77
78choice
79 prompt "Archimedes/A5000 Implementations"
80
81config ARCH_ARC
82 bool "Archimedes"
83 help
84 Say Y to support the Acorn Archimedes.
85
86 The Acorn Archimedes was an personal computer based on an 8MHz ARM2
87 processor, released in 1987. It supported up to 16MB of RAM in
88 later models and floppy, harddisc, ethernet etc.
89
90config ARCH_A5K
91 bool "A5000"
92 select ARCH_MAY_HAVE_PC_FDC
93 help
94 Say Y here to support the Acorn A5000.
95
96 Linux can support the
97 internal IDE disk and CD-ROM interface, serial and parallel port,
98 and the floppy drive. Note that on some A5000s the floppy is
99 plugged into the wrong socket on the motherboard.
100
101config PAGESIZE_16
102 bool "2MB physical memory (broken)"
103 help
104 Say Y here if your Archimedes or A5000 system has only 2MB of
105 memory, otherwise say N. The resulting kernel will not run on a
106 machine with 4MB of memory.
107endchoice
108endmenu
109
110config ISA_DMA_API
111 bool
112 default y
113
114menu "General setup"
115
116# Compressed boot loader in ROM. Yes, we really want to ask about
117# TEXT and BSS so we preserve their values in the config files.
118config ZBOOT_ROM
119 bool "Compressed boot loader in ROM/flash"
120 help
121 Say Y here if you intend to execute your compressed kernel image (zImage)
122 directly from ROM or flash. If unsure, say N.
123
124config ZBOOT_ROM_TEXT
125 depends on ZBOOT_ROM
126 hex "Compressed ROM boot loader base address"
127 default "0"
128 help
129 The base address for zImage. Unless you have special requirements, you
130 should not change this value.
131
132config ZBOOT_ROM_BSS
133 depends on ZBOOT_ROM
134 hex "Compressed ROM boot loader BSS address"
135 default "0"
136 help
137 The base address of 64KiB of read/write memory, which must be available
138 while the decompressor is running. Unless you have special requirements,
139 you should not change this value.
140
141config XIP_KERNEL
142 bool "Execute In Place (XIP) kernel image"
143 help
144 Select this option to create a kernel that can be programmed into
145 the OS ROMs.
146
147comment "At least one math emulation must be selected"
148
149config FPE_NWFPE
150 tristate "NWFPE math emulation"
151 ---help---
152 Say Y to include the NWFPE floating point emulator in the kernel.
153 This is necessary to run most binaries. Linux does not currently
154 support floating point hardware so you need to say Y here even if
155 your machine has an FPA or floating point co-processor module.
156
157 It is also possible to say M to build the emulator as a module
158 (nwfpe) or indeed to leave it out altogether. However, unless you
159 know what you are doing this can easily render your machine
160 unbootable. Saying Y is the safe option.
161
162 You may say N here if you are going to load the Acorn FPEmulator
163 early in the bootup.
164
165source "fs/Kconfig.binfmt"
166
167config PREEMPT
168 bool "Preemptible Kernel (EXPERIMENTAL)"
169 depends on CPU_32 && EXPERIMENTAL
170 help
171 This option reduces the latency of the kernel when reacting to
172 real-time or interactive events by allowing a low priority process to
173 be preempted even if it is in kernel mode executing a system call.
174 This allows applications to run more reliably even when the system is
175 under load.
176
177 Say Y here if you are building a kernel for a desktop, embedded
178 or real-time system. Say N if you are unsure.
179
180config ARTHUR
181 tristate "RISC OS personality"
182 depends on CPU_32
183 help
184 Say Y here to include the kernel code necessary if you want to run
185 Acorn RISC OS/Arthur binaries under Linux. This code is still very
186 experimental; if this sounds frightening, say N and sleep in peace.
187 You can also say M here to compile this support as a module (which
188 will be called arthur).
189
190config CMDLINE
191 string "Default kernel command string"
192 default ""
193 help
194 On some architectures (EBSA110 and CATS), there is currently no way
195 for the boot loader to pass arguments to the kernel. For these
196 architectures, you should supply some command-line options at build
197 time by entering them here. As a minimum, you should specify the
198 memory size and the root device (e.g., mem=64M root=/dev/nfs).
199
200source "mm/Kconfig"
201
202endmenu
203
204source "net/Kconfig"
205
206source "drivers/base/Kconfig"
207
208source "drivers/parport/Kconfig"
209
210source "drivers/pnp/Kconfig"
211
212source "drivers/block/Kconfig"
213
214source "drivers/md/Kconfig"
215
216source "drivers/net/Kconfig"
217
218source "drivers/ide/Kconfig"
219
220source "drivers/scsi/Kconfig"
221
222source "drivers/isdn/Kconfig"
223
224#
225# input before char - char/joystick depends on it. As does USB.
226#
227source "drivers/input/Kconfig"
228
229source "drivers/char/Kconfig"
230
231source "drivers/media/Kconfig"
232
233source "fs/Kconfig"
234
235source "drivers/video/Kconfig"
236
237if ARCH_ACORN
238
239source "sound/Kconfig"
240
241endif
242
243source "drivers/misc/Kconfig"
244
245source "drivers/usb/Kconfig"
246
247source "arch/arm26/Kconfig.debug"
248
249source "security/Kconfig"
250
251source "crypto/Kconfig"
252
253source "lib/Kconfig"
diff --git a/arch/arm26/Kconfig.debug b/arch/arm26/Kconfig.debug
deleted file mode 100644
index 611fc86503fc..000000000000
--- a/arch/arm26/Kconfig.debug
+++ /dev/null
@@ -1,50 +0,0 @@
1menu "Kernel hacking"
2
3source "lib/Kconfig.debug"
4
5# RMK wants arm kernels compiled with frame pointers so hardwire this to y.
6# If you know what you are doing and are willing to live without stack
7# traces, you can get a slightly smaller kernel by setting this option to
8# n, but then RMK will have to kill you ;).
9config FRAME_POINTER
10 bool
11 default y
12 help
13 If you say N here, the resulting kernel will be slightly smaller and
14 faster. However, when a problem occurs with the kernel, the
15 information that is reported is severely limited. Most people
16 should say Y here.
17
18config DEBUG_USER
19 bool "Verbose user fault messages"
20 help
21 When a user program crashes due to an exception, the kernel can
22 print a brief message explaining what the problem was. This is
23 sometimes helpful for debugging but serves no purpose on a
24 production system. Most people should say N here.
25
26config DEBUG_WAITQ
27 bool "Wait queue debugging"
28 depends on DEBUG_KERNEL
29
30config DEBUG_ERRORS
31 bool "Verbose kernel error messages"
32 depends on DEBUG_KERNEL
33 help
34 This option controls verbose debugging information which can be
35 printed when the kernel detects an internal error. This debugging
36 information is useful to kernel hackers when tracking down problems,
37 but mostly meaningless to other people. It's safe to say Y unless
38 you are concerned with the code size or don't want to see these
39 messages.
40
41# These options are only for real kernel hackers who want to get their hands dirty.
42config DEBUG_LL
43 bool "Kernel low-level debugging functions"
44 depends on DEBUG_KERNEL
45 help
46 Say Y here to include definitions of printascii, printchar, printhex
47 in the kernel. This is helpful if you are debugging code that
48 executes before the console is initialized.
49
50endmenu
diff --git a/arch/arm26/Makefile b/arch/arm26/Makefile
deleted file mode 100644
index fe91eda98a94..000000000000
--- a/arch/arm26/Makefile
+++ /dev/null
@@ -1,107 +0,0 @@
1#
2# arch/arm26/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies.
6#
7# This file is subject to the terms and conditions of the GNU General Public
8# License. See the file "COPYING" in the main directory of this archive
9# for more details.
10#
11# Copyright (C) 1995-2001 by Russell King
12# Copyright (c) 2004 Ian Molton
13
14LDFLAGS_vmlinux :=-p -X
15CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR)
16OBJCOPYFLAGS :=-O binary -R .note -R .comment -S
17GZFLAGS :=-9
18
19ifeq ($(CONFIG_FRAME_POINTER),y)
20CFLAGS +=-fno-omit-frame-pointer -mno-sched-prolog
21endif
22
23CFLAGS_BOOT :=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm
24CFLAGS +=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm
25AFLAGS +=-mapcs-26 -mcpu=arm3 -msoft-float
26
27ifeq ($(CONFIG_XIP_KERNEL),y)
28 TEXTADDR := 0x03880000
29 DATAADDR := 0x02080000
30else
31 TEXTADDR := 0x02080000
32 DATAADDR := .
33endif
34
35head-y := arch/arm26/kernel/head.o arch/arm26/kernel/init_task.o
36
37ifeq ($(incdir-y),)
38incdir-y :=
39endif
40INCDIR :=
41
42export MACHINE TEXTADDR GZFLAGS CFLAGS_BOOT
43
44# If we have a machine-specific directory, then include it in the build.
45core-y += arch/arm26/kernel/ arch/arm26/mm/ arch/arm26/machine/
46core-$(CONFIG_FPE_NWFPE) += arch/arm26/nwfpe/
47
48libs-y += arch/arm26/lib/
49
50# Default target when executing plain make
51all: zImage
52
53boot := arch/arm26/boot
54
55PHONY += maketools FORCE
56maketools: FORCE
57
58
59# Convert bzImage to zImage
60bzImage: vmlinux
61 $(Q)$(MAKE) $(build)=$(boot) $(boot)/zImage
62
63zImage Image bootpImage xipImage: vmlinux
64 $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
65
66zinstall install: vmlinux
67 $(Q)$(MAKE) $(build)=$(boot) $@
68
69# We use MRPROPER_FILES and CLEAN_FILES now
70archclean:
71 $(Q)$(MAKE) $(clean)=$(boot)
72
73# My testing targets (that short circuit a few dependencies)
74zImg:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/zImage
75Img:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/Image
76bp:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage
77i:; $(Q)$(MAKE) $(build)=$(boot) install
78zi:; $(Q)$(MAKE) $(build)=$(boot) zinstall
79
80#
81# Configuration targets. Use these to select a
82# configuration for your architecture
83%_config:
84 @( \
85 CFG=$(@:_config=); \
86 if [ -f arch/arm26/def-configs/$$CFG ]; then \
87 [ -f .config ] && mv -f .config .config.old; \
88 cp arch/arm26/def-configs/$$CFG .config; \
89 echo "*** Default configuration for $$CFG installed"; \
90 echo "*** Next, you may run 'make oldconfig'"; \
91 else \
92 echo "$$CFG does not exist"; \
93 fi; \
94 )
95
96define archhelp
97 echo '* zImage - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
98 echo ' Image - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
99 echo ' bootpImage - Combined zImage and initial RAM disk'
100 echo ' xipImage - eXecute In Place capable image for ROM use (arch/$(ARCH)/boot/xipImage)'
101 echo ' initrd - Create an initial image'
102 echo ' install - Install uncompressed kernel'
103 echo ' zinstall - Install compressed kernel'
104 echo ' Install using (your) ~/bin/installkernel or'
105 echo ' (distribution) /sbin/installkernel or'
106 echo ' install to $$(INSTALL_PATH) and run lilo'
107endef
diff --git a/arch/arm26/boot/Makefile b/arch/arm26/boot/Makefile
deleted file mode 100644
index 68acb7b0d47f..000000000000
--- a/arch/arm26/boot/Makefile
+++ /dev/null
@@ -1,83 +0,0 @@
1#
2# arch/arm26/boot/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies.
6#
7# This file is subject to the terms and conditions of the GNU General Public
8# License. See the file "COPYING" in the main directory of this archive
9# for more details.
10#
11# Copyright (C) 1995-2002 Russell King
12#
13
14# Note: the following conditions must always be true:
15# ZRELADDR == virt_to_phys(TEXTADDR)
16# PARAMS_PHYS must be with 4MB of ZRELADDR
17# INITRD_PHYS must be in RAM
18
19 zreladdr-y := 0x02080000
20params_phys-y := 0x0207c000
21initrd_phys-y := 0x02180000
22
23ZRELADDR := 0x02080000
24ZTEXTADDR := 0x0207c000
25PARAMS_PHYS := $(params_phys-y)
26INITRD_PHYS := 0x02180000
27
28# We now have a PIC decompressor implementation. Decompressors running
29# from RAM should not define ZTEXTADDR. Decompressors running directly
30# from ROM or Flash must define ZTEXTADDR (preferably via the config)
31# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
32ifeq ($(CONFIG_ZBOOT_ROM),y)
33ZTEXTADDR := $(CONFIG_ZBOOT_ROM_TEXT)
34ZBSSADDR := $(CONFIG_ZBOOT_ROM_BSS)
35else
36ZTEXTADDR := 0
37ZBSSADDR := ALIGN(4)
38endif
39
40export ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
41
42targets := Image zImage bootpImage xipImage
43
44$(obj)/Image: vmlinux FORCE
45 $(call if_changed,objcopy)
46 @echo ' Kernel: $@ is ready'
47
48$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
49 $(call if_changed,objcopy)
50 @echo ' Kernel: $@ is ready'
51
52$(obj)/compressed/vmlinux: vmlinux FORCE
53 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
54
55ifeq ($(CONFIG_XIP_KERNEL),y)
56$(obj)/xipImage: vmlinux FORCE
57# $(OBJCOPY) -S -O binary -R .data -R .comment vmlinux vmlinux-text.bin
58# FIXME - where has .pci_fixup crept in from?
59 $(OBJCOPY) -S -O binary -R .data -R .pci_fixup -R .comment vmlinux vmlinux-text.bin
60 $(OBJCOPY) -S -O binary -R .init -R .text -R __ex_table -R .pci_fixup -R __ksymtab -R __ksymtab_gpl -R __kcrctab -R __kcrctab_gpl -R __param -R .comment vmlinux vmlinux-data.bin
61 cat vmlinux-text.bin vmlinux-data.bin > $@
62 $(RM) -f vmlinux-text.bin vmlinux-data.bin
63 @echo ' Kernel: $@ is ready'
64endif
65
66PHONY += initrd
67initrd:
68 @test "$(INITRD_PHYS)" != "" || \
69 (echo This machine does not support INITRD; exit -1)
70 @test "$(INITRD)" != "" || \
71 (echo You must specify INITRD; exit -1)
72
73install: $(obj)/Image
74 $(CONFIG_SHELL) $(obj)/install.sh \
75 $(KERNELRELEASE) \
76 $(obj)/Image System.map "$(INSTALL_PATH)"
77
78zinstall: $(obj)/zImage
79 $(CONFIG_SHELL) $(obj)/install.sh \
80 $(KERNELRELEASE) \
81 $(obj)/zImage System.map "$(INSTALL_PATH)"
82
83subdir- := compressed
diff --git a/arch/arm26/boot/compressed/Makefile b/arch/arm26/boot/compressed/Makefile
deleted file mode 100644
index b1d9ddebbe74..000000000000
--- a/arch/arm26/boot/compressed/Makefile
+++ /dev/null
@@ -1,50 +0,0 @@
1#
2# linux/arch/arm26/boot/compressed/Makefile
3#
4# create a compressed vmlinuz image from the original vmlinux
5#
6# Note! ZTEXTADDR, ZBSSADDR and ZRELADDR are now exported
7# from arch/arm26/boot/Makefile
8#
9
10HEAD = head.o
11OBJS = misc.o
12FONTC = drivers/video/console/font_acorn_8x8.c
13
14OBJS += ll_char_wr.o font.o
15CFLAGS_misc.o := -DPARAMS_PHYS=$(PARAMS_PHYS)
16
17targets := vmlinux vmlinux.lds piggy piggy.gz piggy.o font.o head.o $(OBJS)
18
19SEDFLAGS = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
20
21EXTRA_CFLAGS := $(CFLAGS_BOOT) -fpic
22EXTRA_AFLAGS := -traditional
23
24LDFLAGS_vmlinux := -p -X \
25 $(shell $(CC) $(CFLAGS)) -T
26
27$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
28 $(addprefix $(obj)/, $(OBJS)) FORCE
29 $(call if_changed,ld)
30 @:
31
32
33$(obj)/piggy: vmlinux FORCE
34 $(call if_changed,objcopy)
35
36$(obj)/piggy.gz: $(obj)/piggy FORCE
37 $(call if_changed,gzip)
38
39LDFLAGS_piggy.o := -r -b binary
40$(obj)/piggy.o: $(obj)/piggy.gz FORCE
41 $(call if_changed,ld)
42
43$(obj)/font.o: $(FONTC)
44 $(CC) $(CFLAGS) -Dstatic= -c $(FONTC) -o $(obj)/font.o
45
46$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm26/boot/Makefile .config
47 @sed "$(SEDFLAGS)" < $< > $@
48
49$(obj)/misc.o: $(obj)/misc.c $(obj)/uncompress.h lib/inflate.c
50
diff --git a/arch/arm26/boot/compressed/head.S b/arch/arm26/boot/compressed/head.S
deleted file mode 100644
index 2a2cda36d83b..000000000000
--- a/arch/arm26/boot/compressed/head.S
+++ /dev/null
@@ -1,516 +0,0 @@
1/*
2 * linux/arch/arm26/boot/compressed/head.S
3 *
4 * Copyright (C) 1996-2002 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11
12/*
13 * Debugging stuff
14 *
15 * Note that these macros must not contain any code which is not
16 * 100% relocatable. Any attempt to do so will result in a crash.
17 * Please select one of the following when turning on debugging.
18 */
19
20 .macro kputc,val
21 mov r0, \val
22 bl putc
23 .endm
24
25 .macro kphex,val,len
26 mov r0, \val
27 mov r1, #\len
28 bl phex
29 .endm
30
31 .macro debug_reloc_start
32 .endm
33
34 .macro debug_reloc_end
35 .endm
36
37 .section ".start", #alloc, #execinstr
38/*
39 * sort out different calling conventions
40 */
41 .align
42start:
43 .type start,#function
44 .rept 8
45 mov r0, r0
46 .endr
47
48 b 1f
49 .word 0x016f2818 @ Magic numbers to help the loader
50 .word start @ absolute load/run zImage address
51 .word _edata @ zImage end address
521: mov r7, r1 @ save architecture ID
53 mov r8, #0 @ save r0
54 teqp pc, #0x0c000003 @ turn off interrupts
55
56 .text
57 adr r0, LC0
58 ldmia r0, {r1, r2, r3, r4, r5, r6, ip, sp}
59 subs r0, r0, r1 @ calculate the delta offset
60
61 teq r0, #0 @ if delta is zero, we're
62 beq not_relocated @ running at the address we
63 @ were linked at.
64
65 add r2, r2, r0 @ different address, so we
66 add r3, r3, r0 @ need to fix up various
67 add r5, r5, r0 @ pointers.
68 add r6, r6, r0
69 add ip, ip, r0
70 add sp, sp, r0
71
721: ldr r1, [r6, #0] @ relocate entries in the GOT
73 add r1, r1, r0 @ table. This fixes up the
74 str r1, [r6], #4 @ C references.
75 cmp r6, ip
76 blo 1b
77
78not_relocated: mov r0, #0
791: str r0, [r2], #4 @ clear bss
80 str r0, [r2], #4
81 str r0, [r2], #4
82 str r0, [r2], #4
83 cmp r2, r3
84 blo 1b
85
86 bl cache_on
87
88 mov r1, sp @ malloc space above stack
89 add r2, sp, #0x10000 @ 64k max
90
91/*
92 * Check to see if we will overwrite ourselves.
93 * r4 = final kernel address
94 * r5 = start of this image
95 * r2 = end of malloc space (and therefore this image)
96 * We basically want:
97 * r4 >= r2 -> OK
98 * r4 + image length <= r5 -> OK
99 */
100 cmp r4, r2
101 bhs wont_overwrite
102 add r0, r4, #4096*1024 @ 4MB largest kernel size
103 cmp r0, r5
104 bls wont_overwrite
105
106 mov r5, r2 @ decompress after malloc space
107 mov r0, r5
108 mov r3, r7
109 bl decompress_kernel
110
111 add r0, r0, #127
112 bic r0, r0, #127 @ align the kernel length
113/*
114 * r0 = decompressed kernel length
115 * r1-r3 = unused
116 * r4 = kernel execution address
117 * r5 = decompressed kernel start
118 * r6 = processor ID
119 * r7 = architecture ID
120 * r8-r14 = unused
121 */
122 add r1, r5, r0 @ end of decompressed kernel
123 adr r2, reloc_start
124 ldr r3, LC1
125 add r3, r2, r3
1261: ldmia r2!, {r8 - r13} @ copy relocation code
127 stmia r1!, {r8 - r13}
128 ldmia r2!, {r8 - r13}
129 stmia r1!, {r8 - r13}
130 cmp r2, r3
131 blo 1b
132
133 bl cache_clean_flush
134 add pc, r5, r0 @ call relocation code
135
136/*
137 * We're not in danger of overwriting ourselves. Do this the simple way.
138 *
139 * r4 = kernel execution address
140 * r7 = architecture ID
141 */
142wont_overwrite: mov r0, r4
143 mov r3, r7
144 bl decompress_kernel
145 b call_kernel
146
147 .type LC0, #object
148LC0: .word LC0 @ r1
149 .word __bss_start @ r2
150 .word _end @ r3
151 .word _load_addr @ r4
152 .word _start @ r5
153 .word _got_start @ r6
154 .word _got_end @ ip
155 .word user_stack+4096 @ sp
156LC1: .word reloc_end - reloc_start
157 .size LC0, . - LC0
158
159/*
160 * Turn on the cache. We need to setup some page tables so that we
161 * can have both the I and D caches on.
162 *
163 * We place the page tables 16k down from the kernel execution address,
164 * and we hope that nothing else is using it. If we're using it, we
165 * will go pop!
166 *
167 * On entry,
168 * r4 = kernel execution address
169 * r6 = processor ID
170 * r7 = architecture number
171 * r8 = run-time address of "start"
172 * On exit,
173 * r1, r2, r3, r8, r9, r12 corrupted
174 * This routine must preserve:
175 * r4, r5, r6, r7
176 */
177 .align 5
178cache_on: mov r3, #8 @ cache_on function
179 b call_cache_fn
180
181__setup_mmu: sub r3, r4, #16384 @ Page directory size
182 bic r3, r3, #0xff @ Align the pointer
183 bic r3, r3, #0x3f00
184/*
185 * Initialise the page tables, turning on the cacheable and bufferable
186 * bits for the RAM area only.
187 */
188 mov r0, r3
189 mov r8, r0, lsr #18
190 mov r8, r8, lsl #18 @ start of RAM
191 add r9, r8, #0x10000000 @ a reasonable RAM size
192 mov r1, #0x12
193 orr r1, r1, #3 << 10
194 add r2, r3, #16384
1951: cmp r1, r8 @ if virt > start of RAM
196 orrhs r1, r1, #0x0c @ set cacheable, bufferable
197 cmp r1, r9 @ if virt > end of RAM
198 bichs r1, r1, #0x0c @ clear cacheable, bufferable
199 str r1, [r0], #4 @ 1:1 mapping
200 add r1, r1, #1048576
201 teq r0, r2
202 bne 1b
203/*
204 * If ever we are running from Flash, then we surely want the cache
205 * to be enabled also for our execution instance... We map 2MB of it
206 * so there is no map overlap problem for up to 1 MB compressed kernel.
207 * If the execution is in RAM then we would only be duplicating the above.
208 */
209 mov r1, #0x1e
210 orr r1, r1, #3 << 10
211 mov r2, pc, lsr #20
212 orr r1, r1, r2, lsl #20
213 add r0, r3, r2, lsl #2
214 str r1, [r0], #4
215 add r1, r1, #1048576
216 str r1, [r0]
217 mov pc, lr
218
219__armv4_cache_on:
220 mov r12, lr
221 bl __setup_mmu
222 mov r0, #0
223 mcr p15, 0, r0, c7, c10, 4 @ drain write buffer
224 mcr p15, 0, r0, c8, c7, 0 @ flush I,D TLBs
225 mrc p15, 0, r0, c1, c0, 0 @ read control reg
226 orr r0, r0, #0x1000 @ I-cache enable
227 orr r0, r0, #0x0030
228 b __common_cache_on
229
230__arm6_cache_on:
231 mov r12, lr
232 bl __setup_mmu
233 mov r0, #0
234 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
235 mcr p15, 0, r0, c5, c0, 0 @ invalidate whole TLB v3
236 mov r0, #0x30
237__common_cache_on:
238#ifndef DEBUG
239 orr r0, r0, #0x000d @ Write buffer, mmu
240#endif
241 mov r1, #-1
242 mcr p15, 0, r3, c2, c0, 0 @ load page table pointer
243 mcr p15, 0, r1, c3, c0, 0 @ load domain access control
244 mcr p15, 0, r0, c1, c0, 0 @ load control register
245 mov pc, r12
246
247/*
248 * All code following this line is relocatable. It is relocated by
249 * the above code to the end of the decompressed kernel image and
250 * executed there. During this time, we have no stacks.
251 *
252 * r0 = decompressed kernel length
253 * r1-r3 = unused
254 * r4 = kernel execution address
255 * r5 = decompressed kernel start
256 * r6 = processor ID
257 * r7 = architecture ID
258 * r8-r14 = unused
259 */
260 .align 5
261reloc_start: add r8, r5, r0
262 debug_reloc_start
263 mov r1, r4
2641:
265 .rept 4
266 ldmia r5!, {r0, r2, r3, r9 - r13} @ relocate kernel
267 stmia r1!, {r0, r2, r3, r9 - r13}
268 .endr
269
270 cmp r5, r8
271 blo 1b
272 debug_reloc_end
273
274call_kernel: bl cache_clean_flush
275 bl cache_off
276 mov r0, #0
277 mov r1, r7 @ restore architecture number
278 mov pc, r4 @ call kernel
279
280/*
281 * Here follow the relocatable cache support functions for the
282 * various processors. This is a generic hook for locating an
283 * entry and jumping to an instruction at the specified offset
284 * from the start of the block. Please note this is all position
285 * independent code.
286 *
287 * r1 = corrupted
288 * r2 = corrupted
289 * r3 = block offset
290 * r6 = corrupted
291 * r12 = corrupted
292 */
293
294call_cache_fn: adr r12, proc_types
295 mrc p15, 0, r6, c0, c0 @ get processor ID
2961: ldr r1, [r12, #0] @ get value
297 ldr r2, [r12, #4] @ get mask
298 eor r1, r1, r6 @ (real ^ match)
299 tst r1, r2 @ & mask
300 addeq pc, r12, r3 @ call cache function
301 add r12, r12, #4*5
302 b 1b
303
304/*
305 * Table for cache operations. This is basically:
306 * - CPU ID match
307 * - CPU ID mask
308 * - 'cache on' method instruction
309 * - 'cache off' method instruction
310 * - 'cache flush' method instruction
311 *
312 * We match an entry using: ((real_id ^ match) & mask) == 0
313 *
314 * Writethrough caches generally only need 'on' and 'off'
315 * methods. Writeback caches _must_ have the flush method
316 * defined.
317 */
318 .type proc_types,#object
319proc_types:
320 .word 0x41560600 @ ARM6/610
321 .word 0xffffffe0
322 b __arm6_cache_off @ works, but slow
323 b __arm6_cache_off
324 mov pc, lr
325@ b __arm6_cache_on @ untested
326@ b __arm6_cache_off
327@ b __armv3_cache_flush
328
329 .word 0x41007000 @ ARM7/710
330 .word 0xfff8fe00
331 b __arm7_cache_off
332 b __arm7_cache_off
333 mov pc, lr
334
335 .word 0x41807200 @ ARM720T (writethrough)
336 .word 0xffffff00
337 b __armv4_cache_on
338 b __armv4_cache_off
339 mov pc, lr
340
341 .word 0x41129200 @ ARM920T
342 .word 0xff00fff0
343 b __armv4_cache_on
344 b __armv4_cache_off
345 b __armv4_cache_flush
346
347 .word 0x4401a100 @ sa110 / sa1100
348 .word 0xffffffe0
349 b __armv4_cache_on
350 b __armv4_cache_off
351 b __armv4_cache_flush
352
353 .word 0x6901b110 @ sa1110
354 .word 0xfffffff0
355 b __armv4_cache_on
356 b __armv4_cache_off
357 b __armv4_cache_flush
358
359 .word 0x69050000 @ xscale
360 .word 0xffff0000
361 b __armv4_cache_on
362 b __armv4_cache_off
363 b __armv4_cache_flush
364
365 .word 0 @ unrecognised type
366 .word 0
367 mov pc, lr
368 mov pc, lr
369 mov pc, lr
370
371 .size proc_types, . - proc_types
372
373/*
374 * Turn off the Cache and MMU. ARMv3 does not support
375 * reading the control register, but ARMv4 does.
376 *
377 * On entry, r6 = processor ID
378 * On exit, r0, r1, r2, r3, r12 corrupted
379 * This routine must preserve: r4, r6, r7
380 */
381 .align 5
382cache_off: mov r3, #12 @ cache_off function
383 b call_cache_fn
384
385__armv4_cache_off:
386 mrc p15, 0, r0, c1, c0
387 bic r0, r0, #0x000d
388 mcr p15, 0, r0, c1, c0 @ turn MMU and cache off
389 mov r0, #0
390 mcr p15, 0, r0, c7, c7 @ invalidate whole cache v4
391 mcr p15, 0, r0, c8, c7 @ invalidate whole TLB v4
392 mov pc, lr
393
394__arm6_cache_off:
395 mov r0, #0x00000030 @ ARM6 control reg.
396 b __armv3_cache_off
397
398__arm7_cache_off:
399 mov r0, #0x00000070 @ ARM7 control reg.
400 b __armv3_cache_off
401
402__armv3_cache_off:
403 mcr p15, 0, r0, c1, c0, 0 @ turn MMU and cache off
404 mov r0, #0
405 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
406 mcr p15, 0, r0, c5, c0, 0 @ invalidate whole TLB v3
407 mov pc, lr
408
409/*
410 * Clean and flush the cache to maintain consistency.
411 *
412 * On entry,
413 * r6 = processor ID
414 * On exit,
415 * r1, r2, r3, r12 corrupted
416 * This routine must preserve:
417 * r0, r4, r5, r6, r7
418 */
419 .align 5
420cache_clean_flush:
421 mov r3, #16
422 b call_cache_fn
423
424__armv4_cache_flush:
425 bic r1, pc, #31
426 add r2, r1, #65536 @ 2x the largest dcache size
4271: ldr r12, [r1], #32 @ s/w flush D cache
428 teq r1, r2
429 bne 1b
430
431 mcr p15, 0, r1, c7, c7, 0 @ flush I cache
432 mcr p15, 0, r1, c7, c10, 4 @ drain WB
433 mov pc, lr
434
435__armv3_cache_flush:
436 mov r1, #0
437 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
438 mov pc, lr
439
440/*
441 * Various debugging routines for printing hex characters and
442 * memory, which again must be relocatable.
443 */
444#ifdef DEBUG
445 .type phexbuf,#object
446phexbuf: .space 12
447 .size phexbuf, . - phexbuf
448
449phex: adr r3, phexbuf
450 mov r2, #0
451 strb r2, [r3, r1]
4521: subs r1, r1, #1
453 movmi r0, r3
454 bmi puts
455 and r2, r0, #15
456 mov r0, r0, lsr #4
457 cmp r2, #10
458 addge r2, r2, #7
459 add r2, r2, #'0'
460 strb r2, [r3, r1]
461 b 1b
462
463puts: loadsp r3
4641: ldrb r2, [r0], #1
465 teq r2, #0
466 moveq pc, lr
4672: writeb r2
468 mov r1, #0x00020000
4693: subs r1, r1, #1
470 bne 3b
471 teq r2, #'\n'
472 moveq r2, #'\r'
473 beq 2b
474 teq r0, #0
475 bne 1b
476 mov pc, lr
477putc:
478 mov r2, r0
479 mov r0, #0
480 loadsp r3
481 b 2b
482
483memdump: mov r12, r0
484 mov r10, lr
485 mov r11, #0
4862: mov r0, r11, lsl #2
487 add r0, r0, r12
488 mov r1, #8
489 bl phex
490 mov r0, #':'
491 bl putc
4921: mov r0, #' '
493 bl putc
494 ldr r0, [r12, r11, lsl #2]
495 mov r1, #8
496 bl phex
497 and r0, r11, #7
498 teq r0, #3
499 moveq r0, #' '
500 bleq putc
501 and r0, r11, #7
502 add r11, r11, #1
503 teq r0, #7
504 bne 1b
505 mov r0, #'\n'
506 bl putc
507 cmp r11, #64
508 blt 2b
509 mov pc, r10
510#endif
511
512reloc_end:
513
514 .align
515 .section ".stack", "aw"
516user_stack: .space 4096
diff --git a/arch/arm26/boot/compressed/ll_char_wr.S b/arch/arm26/boot/compressed/ll_char_wr.S
deleted file mode 100644
index f024c3ebdfa5..000000000000
--- a/arch/arm26/boot/compressed/ll_char_wr.S
+++ /dev/null
@@ -1,162 +0,0 @@
1/*
2 * linux/arch/arm26/lib/ll_char_wr.S
3 *
4 * Copyright (C) 1995, 1996 Russell King.
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Speedups & 1bpp code (C) 1996 Philip Blundell & Russell King.
11 *
12 * 10-04-96 RMK Various cleanups & reduced register usage.
13 * 08-04-98 RMK Shifts re-ordered
14 */
15
16@ Regs: [] = corruptible
17@ {} = used
18@ () = do not use
19
20#include <linux/linkage.h>
21#include <asm/assembler.h>
22 .text
23
24#define BOLD 0x01
25#define ITALIC 0x02
26#define UNDERLINE 0x04
27#define FLASH 0x08
28#define INVERSE 0x10
29
30LC0: .word bytes_per_char_h
31 .word video_size_row
32 .word acorndata_8x8
33 .word con_charconvtable
34
35ENTRY(ll_write_char)
36 stmfd sp!, {r4 - r7, lr}
37@
38@ Smashable regs: {r0 - r3}, [r4 - r7], (r8 - fp), [ip], (sp), [lr], (pc)
39@
40 eor ip, r1, #UNDERLINE << 9
41/*
42 * calculate colours
43 */
44 tst r1, #INVERSE << 9
45 moveq r2, r1, lsr #16
46 moveq r3, r1, lsr #24
47 movne r2, r1, lsr #24
48 movne r3, r1, lsr #16
49 and r3, r3, #255
50 and r2, r2, #255
51/*
52 * calculate offset into character table
53 */
54 mov r1, r1, lsl #23
55 mov r1, r1, lsr #20
56/*
57 * calculate offset required for each row [maybe I should make this an argument to this fn.
58 * Have to see what the register usage is like in the calling routines.
59 */
60 adr r4, LC0
61 ldmia r4, {r4, r5, r6, lr}
62 ldr r4, [r4]
63 ldr r5, [r5]
64/*
65 * Go to resolution-dependent routine...
66 */
67 cmp r4, #4
68 blt Lrow1bpp
69 eor r2, r3, r2 @ Create eor mask to change colour from bg
70 orr r3, r3, r3, lsl #8 @ to fg.
71 orr r3, r3, r3, lsl #16
72 add r0, r0, r5, lsl #3 @ Move to bottom of character
73 add r1, r1, #7
74 ldrb r7, [r6, r1]
75 tst ip, #UNDERLINE << 9
76 eoreq r7, r7, #255
77 teq r4, #8
78 beq Lrow8bpplp
79@
80@ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
81@
82 orr r3, r3, r3, lsl #4
83Lrow4bpplp: ldr r7, [lr, r7, lsl #2]
84 mul r7, r2, r7
85 tst r1, #7 @ avoid using r7 directly after
86 eor ip, r3, r7
87 str ip, [r0, -r5]!
88 LOADREGS(eqfd, sp!, {r4 - r7, pc})
89 sub r1, r1, #1
90 ldrb r7, [r6, r1]
91 ldr r7, [lr, r7, lsl #2]
92 mul r7, r2, r7
93 tst r1, #7 @ avoid using r7 directly after
94 eor ip, r3, r7
95 str ip, [r0, -r5]!
96 subne r1, r1, #1
97 ldrneb r7, [r6, r1]
98 bne Lrow4bpplp
99 LOADREGS(fd, sp!, {r4 - r7, pc})
100
101@
102@ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
103@
104Lrow8bpplp: mov ip, r7, lsr #4
105 ldr ip, [lr, ip, lsl #2]
106 mul r4, r2, ip
107 and ip, r7, #15 @ avoid r4
108 ldr ip, [lr, ip, lsl #2] @ avoid r4
109 mul ip, r2, ip @ avoid r4
110 eor r4, r3, r4 @ avoid ip
111 tst r1, #7 @ avoid ip
112 sub r0, r0, r5 @ avoid ip
113 eor ip, r3, ip
114 stmia r0, {r4, ip}
115 LOADREGS(eqfd, sp!, {r4 - r7, pc})
116 sub r1, r1, #1
117 ldrb r7, [r6, r1]
118 mov ip, r7, lsr #4
119 ldr ip, [lr, ip, lsl #2]
120 mul r4, r2, ip
121 and ip, r7, #15 @ avoid r4
122 ldr ip, [lr, ip, lsl #2] @ avoid r4
123 mul ip, r2, ip @ avoid r4
124 eor r4, r3, r4 @ avoid ip
125 tst r1, #7 @ avoid ip
126 sub r0, r0, r5 @ avoid ip
127 eor ip, r3, ip
128 stmia r0, {r4, ip}
129 subne r1, r1, #1
130 ldrneb r7, [r6, r1]
131 bne Lrow8bpplp
132 LOADREGS(fd, sp!, {r4 - r7, pc})
133
134@
135@ Smashable regs: {r0 - r3}, [r4], {r5, r6}, [r7], (r8 - fp), [ip], (sp), [lr], (pc)
136@
137Lrow1bpp: add r6, r6, r1
138 ldmia r6, {r4, r7}
139 tst ip, #INVERSE << 9
140 mvnne r4, r4
141 mvnne r7, r7
142 strb r4, [r0], r5
143 mov r4, r4, lsr #8
144 strb r4, [r0], r5
145 mov r4, r4, lsr #8
146 strb r4, [r0], r5
147 mov r4, r4, lsr #8
148 strb r4, [r0], r5
149 strb r7, [r0], r5
150 mov r7, r7, lsr #8
151 strb r7, [r0], r5
152 mov r7, r7, lsr #8
153 strb r7, [r0], r5
154 mov r7, r7, lsr #8
155 tst ip, #UNDERLINE << 9
156 mvneq r7, r7
157 strb r7, [r0], r5
158 LOADREGS(fd, sp!, {r4 - r7, pc})
159
160 .bss
161ENTRY(con_charconvtable)
162 .space 1024
diff --git a/arch/arm26/boot/compressed/misc.c b/arch/arm26/boot/compressed/misc.c
deleted file mode 100644
index 0714d19c5776..000000000000
--- a/arch/arm26/boot/compressed/misc.c
+++ /dev/null
@@ -1,316 +0,0 @@
1/*
2 * misc.c
3 *
4 * This is a collection of several routines from gzip-1.0.3
5 * adapted for Linux.
6 *
7 * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
8 *
9 * Modified for ARM Linux by Russell King
10 *
11 * Nicolas Pitre <nico@visuaide.com> 1999/04/14 :
12 * For this code to run directly from Flash, all constant variables must
13 * be marked with 'const' and all other variables initialized at run-time
14 * only. This way all non constant variables will end up in the bss segment,
15 * which should point to addresses in RAM and cleared to 0 on start.
16 * This allows for a much quicker boot time.
17 */
18
19unsigned int __machine_arch_type;
20
21#include <linux/kernel.h>
22
23#include <asm/uaccess.h>
24#include "uncompress.h"
25
26#ifdef STANDALONE_DEBUG
27#define puts printf
28#endif
29
30#define __ptr_t void *
31
32/*
33 * Optimised C version of memzero for the ARM.
34 */
35void __memzero (__ptr_t s, size_t n)
36{
37 union { void *vp; unsigned long *ulp; unsigned char *ucp; } u;
38 int i;
39
40 u.vp = s;
41
42 for (i = n >> 5; i > 0; i--) {
43 *u.ulp++ = 0;
44 *u.ulp++ = 0;
45 *u.ulp++ = 0;
46 *u.ulp++ = 0;
47 *u.ulp++ = 0;
48 *u.ulp++ = 0;
49 *u.ulp++ = 0;
50 *u.ulp++ = 0;
51 }
52
53 if (n & 1 << 4) {
54 *u.ulp++ = 0;
55 *u.ulp++ = 0;
56 *u.ulp++ = 0;
57 *u.ulp++ = 0;
58 }
59
60 if (n & 1 << 3) {
61 *u.ulp++ = 0;
62 *u.ulp++ = 0;
63 }
64
65 if (n & 1 << 2)
66 *u.ulp++ = 0;
67
68 if (n & 1 << 1) {
69 *u.ucp++ = 0;
70 *u.ucp++ = 0;
71 }
72
73 if (n & 1)
74 *u.ucp++ = 0;
75}
76
77static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src,
78 size_t __n)
79{
80 int i = 0;
81 unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src;
82
83 for (i = __n >> 3; i > 0; i--) {
84 *d++ = *s++;
85 *d++ = *s++;
86 *d++ = *s++;
87 *d++ = *s++;
88 *d++ = *s++;
89 *d++ = *s++;
90 *d++ = *s++;
91 *d++ = *s++;
92 }
93
94 if (__n & 1 << 2) {
95 *d++ = *s++;
96 *d++ = *s++;
97 *d++ = *s++;
98 *d++ = *s++;
99 }
100
101 if (__n & 1 << 1) {
102 *d++ = *s++;
103 *d++ = *s++;
104 }
105
106 if (__n & 1)
107 *d++ = *s++;
108
109 return __dest;
110}
111
112/*
113 * gzip delarations
114 */
115#define OF(args) args
116#define STATIC static
117
118typedef unsigned char uch;
119typedef unsigned short ush;
120typedef unsigned long ulg;
121
122#define WSIZE 0x8000 /* Window size must be at least 32k, */
123 /* and a power of two */
124
125static uch *inbuf; /* input buffer */
126static uch window[WSIZE]; /* Sliding window buffer */
127
128static unsigned insize; /* valid bytes in inbuf */
129static unsigned inptr; /* index of next byte to be processed in inbuf */
130static unsigned outcnt; /* bytes in output buffer */
131
132/* gzip flag byte */
133#define ASCII_FLAG 0x01 /* bit 0 set: file probably ascii text */
134#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
135#define EXTRA_FIELD 0x04 /* bit 2 set: extra field present */
136#define ORIG_NAME 0x08 /* bit 3 set: original file name present */
137#define COMMENT 0x10 /* bit 4 set: file comment present */
138#define ENCRYPTED 0x20 /* bit 5 set: file is encrypted */
139#define RESERVED 0xC0 /* bit 6,7: reserved */
140
141#define get_byte() (inptr < insize ? inbuf[inptr++] : fill_inbuf())
142
143/* Diagnostic functions */
144#ifdef DEBUG
145# define Assert(cond,msg) {if(!(cond)) error(msg);}
146# define Trace(x) fprintf x
147# define Tracev(x) {if (verbose) fprintf x ;}
148# define Tracevv(x) {if (verbose>1) fprintf x ;}
149# define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
150# define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
151#else
152# define Assert(cond,msg)
153# define Trace(x)
154# define Tracev(x)
155# define Tracevv(x)
156# define Tracec(c,x)
157# define Tracecv(c,x)
158#endif
159
160static int fill_inbuf(void);
161static void flush_window(void);
162static void error(char *m);
163static void gzip_mark(void **);
164static void gzip_release(void **);
165
166extern char input_data[];
167extern char input_data_end[];
168
169static uch *output_data;
170static ulg output_ptr;
171static ulg bytes_out;
172
173static void *malloc(int size);
174static void free(void *where);
175static void error(char *m);
176static void gzip_mark(void **);
177static void gzip_release(void **);
178
179static void puts(const char *);
180
181extern int end;
182static ulg free_mem_ptr;
183static ulg free_mem_ptr_end;
184
185#define HEAP_SIZE 0x3000
186
187#include "../../../../lib/inflate.c"
188
189#ifndef STANDALONE_DEBUG
190static void *malloc(int size)
191{
192 void *p;
193
194 if (size <0) error("Malloc error");
195 if (free_mem_ptr <= 0) error("Memory error");
196
197 free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
198
199 p = (void *)free_mem_ptr;
200 free_mem_ptr += size;
201
202 if (free_mem_ptr >= free_mem_ptr_end)
203 error("Out of memory");
204 return p;
205}
206
207static void free(void *where)
208{ /* gzip_mark & gzip_release do the free */
209}
210
211static void gzip_mark(void **ptr)
212{
213 arch_decomp_wdog();
214 *ptr = (void *) free_mem_ptr;
215}
216
217static void gzip_release(void **ptr)
218{
219 arch_decomp_wdog();
220 free_mem_ptr = (long) *ptr;
221}
222#else
223static void gzip_mark(void **ptr)
224{
225}
226
227static void gzip_release(void **ptr)
228{
229}
230#endif
231
232/* ===========================================================================
233 * Fill the input buffer. This is called only when the buffer is empty
234 * and at least one byte is really needed.
235 */
236int fill_inbuf(void)
237{
238 if (insize != 0)
239 error("ran out of input data");
240
241 inbuf = input_data;
242 insize = &input_data_end[0] - &input_data[0];
243
244 inptr = 1;
245 return inbuf[0];
246}
247
248/* ===========================================================================
249 * Write the output window window[0..outcnt-1] and update crc and bytes_out.
250 * (Used for the decompressed data only.)
251 */
252void flush_window(void)
253{
254 ulg c = crc;
255 unsigned n;
256 uch *in, *out, ch;
257
258 in = window;
259 out = &output_data[output_ptr];
260 for (n = 0; n < outcnt; n++) {
261 ch = *out++ = *in++;
262 c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
263 }
264 crc = c;
265 bytes_out += (ulg)outcnt;
266 output_ptr += (ulg)outcnt;
267 outcnt = 0;
268 puts(".");
269}
270
271static void error(char *x)
272{
273 int ptr;
274
275 puts("\n\n");
276 puts(x);
277 puts("\n\n -- System halted");
278
279 while(1); /* Halt */
280}
281
282#ifndef STANDALONE_DEBUG
283
284ulg
285decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p,
286 int arch_id)
287{
288 output_data = (uch *)output_start; /* Points to kernel start */
289 free_mem_ptr = free_mem_ptr_p;
290 free_mem_ptr_end = free_mem_ptr_end_p;
291 __machine_arch_type = arch_id;
292
293 arch_decomp_setup();
294
295 makecrc();
296 puts("Uncompressing Linux...");
297 gunzip();
298 puts(" done, booting the kernel.\n");
299 return output_ptr;
300}
301#else
302
303char output_buffer[1500*1024];
304
305int main()
306{
307 output_data = output_buffer;
308
309 makecrc();
310 puts("Uncompressing Linux...");
311 gunzip();
312 puts("done.\n");
313 return 0;
314}
315#endif
316
diff --git a/arch/arm26/boot/compressed/uncompress.h b/arch/arm26/boot/compressed/uncompress.h
deleted file mode 100644
index 66d9b938a7a4..000000000000
--- a/arch/arm26/boot/compressed/uncompress.h
+++ /dev/null
@@ -1,110 +0,0 @@
1/*
2 *
3 * Copyright (C) 1996 Russell King
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9#define VIDMEM ((char *)0x02000000)
10
11int video_num_columns, video_num_lines, video_size_row;
12int white, bytes_per_char_h;
13extern unsigned long con_charconvtable[256];
14
15struct param_struct {
16 unsigned long page_size;
17 unsigned long nr_pages;
18 unsigned long ramdisk_size;
19 unsigned long mountrootrdonly;
20 unsigned long rootdev;
21 unsigned long video_num_cols;
22 unsigned long video_num_rows;
23 unsigned long video_x;
24 unsigned long video_y;
25 unsigned long memc_control_reg;
26 unsigned char sounddefault;
27 unsigned char adfsdrives;
28 unsigned char bytes_per_char_h;
29 unsigned char bytes_per_char_v;
30 unsigned long unused[256/4-11];
31};
32
33static struct param_struct *params = (struct param_struct *)0x0207c000;
34
35/*
36 * This does not append a newline
37 */
38static void puts(const char *s)
39{
40 extern void ll_write_char(char *, unsigned long);
41 int x,y;
42 unsigned char c;
43 char *ptr;
44
45 x = params->video_x;
46 y = params->video_y;
47
48 while ( ( c = *(unsigned char *)s++ ) != '\0' ) {
49 if ( c == '\n' ) {
50 x = 0;
51 if ( ++y >= video_num_lines ) {
52 y--;
53 }
54 } else {
55 ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
56 ll_write_char(ptr, c|(white<<16));
57 if ( ++x >= video_num_columns ) {
58 x = 0;
59 if ( ++y >= video_num_lines ) {
60 y--;
61 }
62 }
63 }
64 }
65
66 params->video_x = x;
67 params->video_y = y;
68}
69
70static void error(char *x);
71
72/*
73 * Setup for decompression
74 */
75static void arch_decomp_setup(void)
76{
77 int i;
78
79 video_num_lines = params->video_num_rows;
80 video_num_columns = params->video_num_cols;
81 bytes_per_char_h = params->bytes_per_char_h;
82 video_size_row = video_num_columns * bytes_per_char_h;
83 if (bytes_per_char_h == 4)
84 for (i = 0; i < 256; i++)
85 con_charconvtable[i] =
86 (i & 128 ? 1 << 0 : 0) |
87 (i & 64 ? 1 << 4 : 0) |
88 (i & 32 ? 1 << 8 : 0) |
89 (i & 16 ? 1 << 12 : 0) |
90 (i & 8 ? 1 << 16 : 0) |
91 (i & 4 ? 1 << 20 : 0) |
92 (i & 2 ? 1 << 24 : 0) |
93 (i & 1 ? 1 << 28 : 0);
94 else
95 for (i = 0; i < 16; i++)
96 con_charconvtable[i] =
97 (i & 8 ? 1 << 0 : 0) |
98 (i & 4 ? 1 << 8 : 0) |
99 (i & 2 ? 1 << 16 : 0) |
100 (i & 1 ? 1 << 24 : 0);
101
102 white = bytes_per_char_h == 8 ? 0xfc : 7;
103
104 if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
105}
106
107/*
108 * nothing to do
109 */
110#define arch_decomp_wdog()
diff --git a/arch/arm26/boot/compressed/vmlinux.lds.in b/arch/arm26/boot/compressed/vmlinux.lds.in
deleted file mode 100644
index 86d821d5ab70..000000000000
--- a/arch/arm26/boot/compressed/vmlinux.lds.in
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 * linux/arch/arm26/boot/compressed/vmlinux.lds.in
3 *
4 * Copyright (C) 2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10OUTPUT_ARCH(arm)
11ENTRY(_start)
12SECTIONS
13{
14 . = LOAD_ADDR;
15 _load_addr = .;
16
17 . = TEXT_START;
18 _text = .;
19
20 .text : {
21 _start = .;
22 *(.start)
23 *(.text)
24 *(.fixup)
25 *(.gnu.warning)
26 *(.rodata)
27 *(.rodata.*)
28 *(.glue_7)
29 *(.glue_7t)
30 input_data = .;
31 arch/arm26/boot/compressed/piggy.o
32 input_data_end = .;
33 . = ALIGN(4);
34 }
35
36 _etext = .;
37
38 _got_start = .;
39 .got : { *(.got) }
40 _got_end = .;
41 .got.plt : { *(.got.plt) }
42 .data : { *(.data) }
43 _edata = .;
44
45 . = BSS_START;
46 __bss_start = .;
47 .bss : { *(.bss) }
48 _end = .;
49
50 .stack (NOLOAD) : { *(.stack) }
51
52 .stab 0 : { *(.stab) }
53 .stabstr 0 : { *(.stabstr) }
54 .stab.excl 0 : { *(.stab.excl) }
55 .stab.exclstr 0 : { *(.stab.exclstr) }
56 .stab.index 0 : { *(.stab.index) }
57 .stab.indexstr 0 : { *(.stab.indexstr) }
58 .comment 0 : { *(.comment) }
59}
60
diff --git a/arch/arm26/boot/install.sh b/arch/arm26/boot/install.sh
deleted file mode 100644
index 8a8399b26cf7..000000000000
--- a/arch/arm26/boot/install.sh
+++ /dev/null
@@ -1,62 +0,0 @@
1#!/bin/sh
2#
3# arch/arm26/boot/install.sh
4#
5# This file is subject to the terms and conditions of the GNU General Public
6# License. See the file "COPYING" in the main directory of this archive
7# for more details.
8#
9# Copyright (C) 1995 by Linus Torvalds
10#
11# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
12# Adapted from code in arch/i386/boot/install.sh by Russell King
13# Stolen from arm32 by Ian Molton
14#
15# "make install" script for arm architecture
16#
17# Arguments:
18# $1 - kernel version
19# $2 - kernel image file
20# $3 - kernel map file
21# $4 - default install path (blank if root directory)
22#
23
24# User may have a custom install script
25
26if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then
27 exec /sbin/${CROSS_COMPILE}installkernel "$@"
28fi
29
30if [ "$2" = "zImage" ]; then
31# Compressed install
32 echo "Installing compressed kernel"
33 if [ -f $4/vmlinuz-$1 ]; then
34 mv $4/vmlinuz-$1 $4/vmlinuz.old
35 fi
36
37 if [ -f $4/System.map-$1 ]; then
38 mv $4/System.map-$1 $4/System.old
39 fi
40
41 cat $2 > $4/vmlinuz-$1
42 cp $3 $4/System.map-$1
43else
44# Normal install
45 echo "Installing normal kernel"
46 if [ -f $4/vmlinux-$1 ]; then
47 mv $4/vmlinux-$1 $4/vmlinux.old
48 fi
49
50 if [ -f $4/System.map ]; then
51 mv $4/System.map $4/System.old
52 fi
53
54 cat $2 > $4/vmlinux-$1
55 cp $3 $4/System.map
56fi
57
58if [ -x /sbin/loadmap ]; then
59 /sbin/loadmap --rdev /dev/ima
60else
61 echo "You have to install it yourself"
62fi
diff --git a/arch/arm26/defconfig b/arch/arm26/defconfig
deleted file mode 100644
index 2b7d44bf49bf..000000000000
--- a/arch/arm26/defconfig
+++ /dev/null
@@ -1,361 +0,0 @@
1#
2# Automatically generated by make menuconfig: don't edit
3#
4CONFIG_ARM=y
5# CONFIG_EISA is not set
6# CONFIG_SBUS is not set
7# CONFIG_MCA is not set
8CONFIG_UID16=y
9CONFIG_RWSEM_GENERIC_SPINLOCK=y
10# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
11# CONFIG_GENERIC_BUST_SPINLOCK is not set
12# CONFIG_GENERIC_ISA_DMA is not set
13
14#
15# Code maturity level options
16#
17CONFIG_EXPERIMENTAL=y
18
19#
20# General setup
21#
22# CONFIG_NET is not set
23# CONFIG_SYSVIPC is not set
24# CONFIG_BSD_PROCESS_ACCT is not set
25# CONFIG_SYSCTL is not set
26
27#
28# Loadable module support
29#
30# CONFIG_MODULES is not set
31
32#
33# System Type
34#
35CONFIG_ARCH_ARC=y
36# CONFIG_ARCH_A5K is not set
37CONFIG_ARCH_ACORN=y
38# CONFIG_CPU_32 is not set
39CONFIG_CPU_26=y
40# CONFIG_PAGESIZE_16 is not set
41
42#
43# General setup
44#
45CONFIG_FIQ=y
46# CONFIG_ZBOOT_ROM is not set
47CONFIG_ZBOOT_ROM_TEXT=0
48CONFIG_ZBOOT_ROM_BSS=0
49CONFIG_FPE_NWFPE=y
50CONFIG_KCORE_ELF=y
51# CONFIG_KCORE_AOUT is not set
52# CONFIG_BINFMT_AOUT is not set
53# CONFIG_BINFMT_ELF is not set
54# CONFIG_BINFMT_MISC is not set
55CONFIG_CMDLINE=""
56# CONFIG_ALIGNMENT_TRAP is not set
57
58#
59# Parallel port support
60#
61# CONFIG_PARPORT is not set
62
63#
64# Plug and Play configuration
65#
66# CONFIG_PNP is not set
67# CONFIG_ISAPNP is not set
68# CONFIG_PNPBIOS is not set
69
70#
71# Block devices
72#
73# CONFIG_BLK_DEV_FD is not set
74# CONFIG_BLK_DEV_XD is not set
75# CONFIG_PARIDE is not set
76# CONFIG_BLK_CPQ_DA is not set
77# CONFIG_BLK_CPQ_CISS_DA is not set
78# CONFIG_CISS_SCSI_TAPE is not set
79# CONFIG_BLK_DEV_DAC960 is not set
80# CONFIG_BLK_DEV_UMEM is not set
81# CONFIG_BLK_DEV_LOOP is not set
82# CONFIG_BLK_DEV_NBD is not set
83# CONFIG_BLK_DEV_RAM is not set
84# CONFIG_BLK_DEV_INITRD is not set
85
86#
87# Multi-device support (RAID and LVM)
88#
89# CONFIG_MD is not set
90# CONFIG_BLK_DEV_MD is not set
91# CONFIG_MD_LINEAR is not set
92# CONFIG_MD_RAID0 is not set
93# CONFIG_MD_RAID1 is not set
94# CONFIG_MD_RAID5 is not set
95# CONFIG_MD_MULTIPATH is not set
96# CONFIG_BLK_DEV_LVM is not set
97
98#
99# Acorn-specific block devices
100#
101# CONFIG_BLK_DEV_FD1772 is not set
102# CONFIG_BLK_DEV_MFM is not set
103
104#
105# ATA/ATAPI/MFM/RLL support
106#
107# CONFIG_IDE is not set
108# CONFIG_BLK_DEV_HD is not set
109
110#
111# SCSI support
112#
113# CONFIG_SCSI is not set
114
115#
116# ISDN subsystem
117#
118
119#
120# Input device support
121#
122# CONFIG_INPUT is not set
123# CONFIG_INPUT_KEYBDEV is not set
124# CONFIG_INPUT_MOUSEDEV is not set
125# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
126# CONFIG_INPUT_JOYDEV is not set
127# CONFIG_INPUT_TSDEV is not set
128# CONFIG_INPUT_TSLIBDEV is not set
129# CONFIG_INPUT_EVDEV is not set
130# CONFIG_INPUT_EVBUG is not set
131# CONFIG_INPUT_UINPUT is not set
132# CONFIG_GAMEPORT is not set
133CONFIG_SOUND_GAMEPORT=y
134# CONFIG_GAMEPORT_NS558 is not set
135# CONFIG_GAMEPORT_L4 is not set
136# CONFIG_GAMEPORT_EMU10K1 is not set
137# CONFIG_GAMEPORT_VORTEX is not set
138# CONFIG_GAMEPORT_FM801 is not set
139# CONFIG_GAMEPORT_CS461x is not set
140# CONFIG_SERIO is not set
141# CONFIG_SERIO_I8042 is not set
142# CONFIG_SERIO_SERPORT is not set
143# CONFIG_SERIO_CT82C710 is not set
144# CONFIG_SERIO_PARKBD is not set
145# CONFIG_SERIO_ACORN is not set
146
147#
148# Character devices
149#
150# CONFIG_VT is not set
151# CONFIG_SERIAL_NONSTANDARD is not set
152
153#
154# Serial drivers
155#
156# CONFIG_SERIAL_8250 is not set
157# CONFIG_SERIAL_8250_CONSOLE is not set
158# CONFIG_SERIAL_8250_CS is not set
159# CONFIG_SERIAL_8250_EXTENDED is not set
160# CONFIG_SERIAL_8250_MANY_PORTS is not set
161# CONFIG_SERIAL_8250_SHARE_IRQ is not set
162# CONFIG_SERIAL_8250_DETECT_IRQ is not set
163# CONFIG_SERIAL_8250_MULTIPORT is not set
164# CONFIG_SERIAL_8250_RSA is not set
165# CONFIG_ATOMWIDE_SERIAL is not set
166# CONFIG_DUALSP_SERIAL is not set
167# CONFIG_SERIAL_AMBA is not set
168# CONFIG_SERIAL_AMBA_CONSOLE is not set
169# CONFIG_SERIAL_CLPS711X is not set
170# CONFIG_SERIAL_CLPS711X_CONSOLE is not set
171# CONFIG_SERIAL_CLPS711X_OLD_NAME is not set
172# CONFIG_SERIAL_21285 is not set
173# CONFIG_SERIAL_21285_OLD is not set
174# CONFIG_SERIAL_21285_CONSOLE is not set
175# CONFIG_SERIAL_UART00 is not set
176# CONFIG_SERIAL_UART00_CONSOLE is not set
177# CONFIG_SERIAL_SA1100 is not set
178# CONFIG_SERIAL_SA1100_CONSOLE is not set
179# CONFIG_UNIX98_PTYS is not set
180
181#
182# I2C support
183#
184CONFIG_I2C=y
185CONFIG_I2C_ALGOBIT=y
186CONFIG_I2C_ALGOPCF=y
187# CONFIG_I2C_ELEKTOR is not set
188CONFIG_I2C_CHARDEV=y
189# CONFIG_I2C_PROC is not set
190
191#
192# L3 serial bus support
193#
194# CONFIG_L3 is not set
195# CONFIG_L3_ALGOBIT is not set
196# CONFIG_L3_BIT_SA1100_GPIO is not set
197# CONFIG_L3_SA1111 is not set
198# CONFIG_BIT_SA1100_GPIO is not set
199
200#
201# Mice
202#
203# CONFIG_BUSMOUSE is not set
204# CONFIG_PSMOUSE is not set
205# CONFIG_QIC02_TAPE is not set
206
207#
208# Watchdog Cards
209#
210# CONFIG_WATCHDOG is not set
211# CONFIG_NVRAM is not set
212# CONFIG_RTC is not set
213# CONFIG_DTLK is not set
214# CONFIG_R3964 is not set
215# CONFIG_APPLICOM is not set
216
217#
218# Ftape, the floppy tape device driver
219#
220# CONFIG_FTAPE is not set
221# CONFIG_AGP is not set
222# CONFIG_DRM is not set
223# CONFIG_RAW_DRIVER is not set
224
225#
226# Multimedia devices
227#
228# CONFIG_VIDEO_DEV is not set
229
230#
231# File systems
232#
233# CONFIG_QUOTA is not set
234# CONFIG_QFMT_V1 is not set
235# CONFIG_QFMT_V2 is not set
236# CONFIG_AUTOFS_FS is not set
237# CONFIG_AUTOFS4_FS is not set
238# CONFIG_REISERFS_FS is not set
239# CONFIG_REISERFS_CHECK is not set
240# CONFIG_REISERFS_PROC_INFO is not set
241# CONFIG_ADFS_FS is not set
242# CONFIG_ADFS_FS_RW is not set
243# CONFIG_AFFS_FS is not set
244# CONFIG_HFS_FS is not set
245# CONFIG_BFS_FS is not set
246# CONFIG_EXT3_FS is not set
247# CONFIG_JBD is not set
248# CONFIG_JBD_DEBUG is not set
249# CONFIG_FAT_FS is not set
250# CONFIG_MSDOS_FS is not set
251# CONFIG_VFAT_FS is not set
252# CONFIG_EFS_FS is not set
253# CONFIG_JFFS_FS is not set
254# CONFIG_JFFS2_FS is not set
255# CONFIG_CRAMFS is not set
256# CONFIG_TMPFS is not set
257CONFIG_RAMFS=y
258# CONFIG_ISO9660_FS is not set
259# CONFIG_JOLIET is not set
260# CONFIG_ZISOFS is not set
261# CONFIG_JFS_FS is not set
262# CONFIG_JFS_DEBUG is not set
263# CONFIG_JFS_STATISTICS is not set
264# CONFIG_MINIX_FS is not set
265# CONFIG_VXFS_FS is not set
266# CONFIG_NTFS_FS is not set
267# CONFIG_NTFS_DEBUG is not set
268# CONFIG_HPFS_FS is not set
269CONFIG_PROC_FS=y
270# CONFIG_DEVFS_FS is not set
271# CONFIG_DEVFS_MOUNT is not set
272# CONFIG_DEVFS_DEBUG is not set
273# CONFIG_DEVPTS_FS is not set
274# CONFIG_QNX4FS_FS is not set
275# CONFIG_QNX4FS_RW is not set
276# CONFIG_ROMFS_FS is not set
277CONFIG_EXT2_FS=y
278# CONFIG_SYSV_FS is not set
279# CONFIG_UDF_FS is not set
280# CONFIG_UDF_RW is not set
281# CONFIG_UFS_FS is not set
282# CONFIG_UFS_FS_WRITE is not set
283# CONFIG_NCPFS_NLS is not set
284# CONFIG_SMB_FS is not set
285# CONFIG_ZISOFS_FS is not set
286
287#
288# Partition Types
289#
290CONFIG_PARTITION_ADVANCED=y
291CONFIG_ACORN_PARTITION=y
292# CONFIG_ACORN_PARTITION_EESOX is not set
293# CONFIG_ACORN_PARTITION_ICS is not set
294CONFIG_ACORN_PARTITION_ADFS=y
295# CONFIG_ACORN_PARTITION_POWERTEC is not set
296CONFIG_ACORN_PARTITION_RISCIX=y
297# CONFIG_OSF_PARTITION is not set
298# CONFIG_AMIGA_PARTITION is not set
299# CONFIG_ATARI_PARTITION is not set
300# CONFIG_MAC_PARTITION is not set
301# CONFIG_MSDOS_PARTITION is not set
302# CONFIG_LDM_PARTITION is not set
303# CONFIG_SGI_PARTITION is not set
304# CONFIG_ULTRIX_PARTITION is not set
305# CONFIG_SUN_PARTITION is not set
306# CONFIG_EFI_PARTITION is not set
307# CONFIG_SMB_NLS is not set
308# CONFIG_NLS is not set
309
310#
311# Sound
312#
313# CONFIG_SOUND is not set
314
315#
316# Multimedia Capabilities Port drivers
317#
318# CONFIG_MCP is not set
319# CONFIG_MCP_SA1100 is not set
320# CONFIG_MCP_UCB1200 is not set
321# CONFIG_MCP_UCB1200_AUDIO is not set
322# CONFIG_MCP_UCB1200_TS is not set
323
324#
325# Console Switches
326#
327# CONFIG_SWITCHES is not set
328# CONFIG_SWITCHES_SA1100 is not set
329# CONFIG_SWITCHES_UCB1X00 is not set
330
331#
332# USB support
333#
334# CONFIG_USB is not set
335
336#
337# Kernel hacking
338#
339# CONFIG_NO_FRAME_POINTER is not set
340CONFIG_DEBUG_USER=y
341CONFIG_DEBUG_INFO=y
342CONFIG_DEBUG_KERNEL=y
343CONFIG_DEBUG_SLAB=y
344CONFIG_MAGIC_SYSRQ=y
345CONFIG_DEBUG_SPINLOCK=y
346CONFIG_DEBUG_WAITQ=y
347CONFIG_DEBUG_BUGVERBOSE=y
348CONFIG_DEBUG_ERRORS=y
349CONFIG_DEBUG_LL=y
350
351#
352# Security options
353#
354CONFIG_SECURITY_CAPABILITIES=y
355
356#
357# Library routines
358#
359CONFIG_CRC32=y
360# CONFIG_ZLIB_INFLATE is not set
361# CONFIG_ZLIB_DEFLATE is not set
diff --git a/arch/arm26/kernel/Makefile b/arch/arm26/kernel/Makefile
deleted file mode 100644
index ee9fb49fdb78..000000000000
--- a/arch/arm26/kernel/Makefile
+++ /dev/null
@@ -1,17 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7AFLAGS_head.o := -DTEXTADDR=$(TEXTADDR)
8
9obj-y := compat.o dma.o entry.o irq.o process.o ptrace.o \
10 semaphore.o setup.o signal.o sys_arm.o time.o traps.o \
11 ecard.o dma.o ecard.o fiq.o time.o
12
13extra-y := head.o init_task.o vmlinux.lds
14
15obj-$(CONFIG_FIQ) += fiq.o
16obj-$(CONFIG_MODULES) += armksyms.o
17
diff --git a/arch/arm26/kernel/armksyms.c b/arch/arm26/kernel/armksyms.c
deleted file mode 100644
index fe1e3ceed7cb..000000000000
--- a/arch/arm26/kernel/armksyms.c
+++ /dev/null
@@ -1,204 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/armksyms.c
3 *
4 * Copyright (C) 2003 Ian Molton
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/module.h>
11#include <linux/module.h>
12#include <linux/user.h>
13#include <linux/string.h>
14#include <linux/fs.h>
15#include <linux/mm.h>
16#include <linux/mman.h>
17#include <linux/delay.h>
18#include <linux/in6.h>
19#include <linux/interrupt.h>
20#include <linux/pm.h>
21#include <linux/tty.h>
22#include <linux/vt_kern.h>
23#include <linux/syscalls.h>
24
25#include <asm/byteorder.h>
26#include <asm/elf.h>
27#include <asm/io.h>
28#include <asm/irq.h>
29#include <asm/processor.h>
30#include <asm/semaphore.h>
31#include <asm/system.h>
32#include <asm/uaccess.h>
33#include <asm/checksum.h>
34#include <asm/mach-types.h>
35
36extern int dump_fpu(struct pt_regs *, struct user_fp_struct *);
37extern void inswb(unsigned int port, void *to, int len);
38extern void outswb(unsigned int port, const void *to, int len);
39
40extern void __bad_xchg(volatile void *ptr, int size);
41
42/*
43 * libgcc functions - functions that are used internally by the
44 * compiler... (prototypes are not correct though, but that
45 * doesn't really matter since they're not versioned).
46 */
47extern void __ashldi3(void);
48extern void __ashrdi3(void);
49extern void __divsi3(void);
50extern void __lshrdi3(void);
51extern void __modsi3(void);
52extern void __muldi3(void);
53extern void __ucmpdi2(void);
54extern void __udivdi3(void);
55extern void __umoddi3(void);
56extern void __udivmoddi4(void);
57extern void __udivsi3(void);
58extern void __umodsi3(void);
59extern void abort(void);
60
61extern void ret_from_exception(void);
62extern void fpundefinstr(void);
63extern void fp_enter(void);
64
65/*
66 * This has a special calling convention; it doesn't
67 * modify any of the usual registers, except for LR.
68 * FIXME - we used to use our own local version - looks to be in kernel/softirq now
69 */
70//extern void __do_softirq(void);
71
72#define EXPORT_SYMBOL_ALIAS(sym,orig) \
73 const char __kstrtab_##sym[] \
74 __attribute__((section(".kstrtab"))) = \
75 __MODULE_STRING(sym); \
76 const struct module_symbol __ksymtab_##sym \
77 __attribute__((section("__ksymtab"))) = \
78 { (unsigned long)&orig, __kstrtab_##sym };
79
80/*
81 * floating point math emulator support.
82 * These symbols will never change their calling convention...
83 */
84EXPORT_SYMBOL_ALIAS(kern_fp_enter,fp_enter);
85EXPORT_SYMBOL_ALIAS(fp_printk,printk);
86EXPORT_SYMBOL_ALIAS(fp_send_sig,send_sig);
87
88EXPORT_SYMBOL(fpundefinstr);
89EXPORT_SYMBOL(ret_from_exception);
90
91#ifdef CONFIG_VT
92EXPORT_SYMBOL(kd_mksound);
93#endif
94
95//EXPORT_SYMBOL(__do_softirq);
96
97 /* platform dependent support */
98EXPORT_SYMBOL(dump_thread);
99EXPORT_SYMBOL(dump_fpu);
100EXPORT_SYMBOL(udelay);
101EXPORT_SYMBOL(kernel_thread);
102EXPORT_SYMBOL(system_rev);
103EXPORT_SYMBOL(system_serial_low);
104EXPORT_SYMBOL(system_serial_high);
105#ifdef CONFIG_DEBUG_BUGVERBOSE
106EXPORT_SYMBOL(__bug);
107#endif
108EXPORT_SYMBOL(__bad_xchg);
109EXPORT_SYMBOL(__readwrite_bug);
110EXPORT_SYMBOL(set_irq_type);
111EXPORT_SYMBOL(pm_idle);
112EXPORT_SYMBOL(pm_power_off);
113
114 /* processor dependencies */
115EXPORT_SYMBOL(__machine_arch_type);
116
117 /* networking */
118EXPORT_SYMBOL(csum_partial_copy_nocheck);
119EXPORT_SYMBOL(__csum_ipv6_magic);
120
121 /* io */
122#ifndef __raw_readsb
123EXPORT_SYMBOL(__raw_readsb);
124#endif
125#ifndef __raw_readsw
126EXPORT_SYMBOL(__raw_readsw);
127#endif
128#ifndef __raw_readsl
129EXPORT_SYMBOL(__raw_readsl);
130#endif
131#ifndef __raw_writesb
132EXPORT_SYMBOL(__raw_writesb);
133#endif
134#ifndef __raw_writesw
135EXPORT_SYMBOL(__raw_writesw);
136#endif
137#ifndef __raw_writesl
138EXPORT_SYMBOL(__raw_writesl);
139#endif
140
141 /* string / mem functions */
142EXPORT_SYMBOL(strcpy);
143EXPORT_SYMBOL(strncpy);
144EXPORT_SYMBOL(strcat);
145EXPORT_SYMBOL(strncat);
146EXPORT_SYMBOL(strcmp);
147EXPORT_SYMBOL(strncmp);
148EXPORT_SYMBOL(strchr);
149EXPORT_SYMBOL(strlen);
150EXPORT_SYMBOL(strnlen);
151EXPORT_SYMBOL(strrchr);
152EXPORT_SYMBOL(strstr);
153EXPORT_SYMBOL(memset);
154EXPORT_SYMBOL(memcpy);
155EXPORT_SYMBOL(memmove);
156EXPORT_SYMBOL(memcmp);
157EXPORT_SYMBOL(memscan);
158EXPORT_SYMBOL(__memzero);
159
160 /* user mem (segment) */
161EXPORT_SYMBOL(uaccess_kernel);
162EXPORT_SYMBOL(uaccess_user);
163
164EXPORT_SYMBOL(__get_user_1);
165EXPORT_SYMBOL(__get_user_2);
166EXPORT_SYMBOL(__get_user_4);
167EXPORT_SYMBOL(__get_user_8);
168
169EXPORT_SYMBOL(__put_user_1);
170EXPORT_SYMBOL(__put_user_2);
171EXPORT_SYMBOL(__put_user_4);
172EXPORT_SYMBOL(__put_user_8);
173
174 /* gcc lib functions */
175EXPORT_SYMBOL(__ashldi3);
176EXPORT_SYMBOL(__ashrdi3);
177EXPORT_SYMBOL(__divsi3);
178EXPORT_SYMBOL(__lshrdi3);
179EXPORT_SYMBOL(__modsi3);
180EXPORT_SYMBOL(__muldi3);
181EXPORT_SYMBOL(__ucmpdi2);
182EXPORT_SYMBOL(__udivdi3);
183EXPORT_SYMBOL(__umoddi3);
184EXPORT_SYMBOL(__udivmoddi4);
185EXPORT_SYMBOL(__udivsi3);
186EXPORT_SYMBOL(__umodsi3);
187
188 /* bitops */
189EXPORT_SYMBOL(_set_bit_le);
190EXPORT_SYMBOL(_test_and_set_bit_le);
191EXPORT_SYMBOL(_clear_bit_le);
192EXPORT_SYMBOL(_test_and_clear_bit_le);
193EXPORT_SYMBOL(_change_bit_le);
194EXPORT_SYMBOL(_test_and_change_bit_le);
195EXPORT_SYMBOL(_find_first_zero_bit_le);
196EXPORT_SYMBOL(_find_next_zero_bit_le);
197
198 /* elf */
199EXPORT_SYMBOL(elf_platform);
200EXPORT_SYMBOL(elf_hwcap);
201
202#ifdef CONFIG_PREEMPT
203EXPORT_SYMBOL(kernel_flag);
204#endif
diff --git a/arch/arm26/kernel/asm-offsets.c b/arch/arm26/kernel/asm-offsets.c
deleted file mode 100644
index 76d9d7d489a8..000000000000
--- a/arch/arm26/kernel/asm-offsets.c
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Copyright (C) 1995-2001 Russell King
3 * 2001-2002 Keith Owens
4 * 2003 Ian Molton
5 *
6 * Generate definitions needed by assembly language modules.
7 * This code generates raw asm output which is post-processed to extract
8 * and format the required data.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/sched.h>
16#include <linux/mm.h>
17
18#include <asm/pgtable.h>
19#include <asm/uaccess.h>
20
21/*
22 * Make sure that the compiler and target are compatible.
23 */
24#if defined(__APCS_32__) && defined(CONFIG_CPU_26)
25#error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26
26#endif
27
28/* Use marker if you need to separate the values later */
29
30#define DEFINE(sym, val) \
31 asm volatile("\n->" #sym " %0 " #val : : "i" (val))
32
33#define BLANK() asm volatile("\n->" : : )
34
35int main(void)
36{
37 DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
38 BLANK();
39 DEFINE(VMA_VM_MM, offsetof(struct vm_area_struct, vm_mm));
40 DEFINE(VMA_VM_FLAGS, offsetof(struct vm_area_struct, vm_flags));
41 BLANK();
42 DEFINE(VM_EXEC, VM_EXEC);
43 BLANK();
44 BLANK();
45 DEFINE(PAGE_PRESENT, _PAGE_PRESENT);
46 DEFINE(PAGE_READONLY, _PAGE_READONLY);
47 DEFINE(PAGE_NOT_USER, _PAGE_NOT_USER);
48 DEFINE(PAGE_OLD, _PAGE_OLD);
49 DEFINE(PAGE_CLEAN, _PAGE_CLEAN);
50 BLANK();
51 DEFINE(PAGE_SZ, PAGE_SIZE);
52 BLANK();
53 DEFINE(SYS_ERROR0, 0x9f0000);
54 return 0;
55}
diff --git a/arch/arm26/kernel/calls.S b/arch/arm26/kernel/calls.S
deleted file mode 100644
index e3d276827c84..000000000000
--- a/arch/arm26/kernel/calls.S
+++ /dev/null
@@ -1,265 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/calls.S
3 *
4 * Copyright (C) 2003 Ian Molton
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * FIXME
11 * This file is included twice in entry.S which may not be necessary
12 */
13
14//FIXME - clearly NR_syscalls is never defined here
15
16#ifndef NR_syscalls
17#define NR_syscalls 256
18#else
19
20__syscall_start:
21/* 0 */ .long sys_ni_syscall
22 .long sys_exit
23 .long sys_fork_wrapper
24 .long sys_read
25 .long sys_write
26/* 5 */ .long sys_open
27 .long sys_close
28 .long sys_ni_syscall /* was sys_waitpid */
29 .long sys_creat
30 .long sys_link
31/* 10 */ .long sys_unlink
32 .long sys_execve_wrapper
33 .long sys_chdir
34 .long sys_time /* used by libc4 */
35 .long sys_mknod
36/* 15 */ .long sys_chmod
37 .long sys_lchown16
38 .long sys_ni_syscall /* was sys_break */
39 .long sys_ni_syscall /* was sys_stat */
40 .long sys_lseek
41/* 20 */ .long sys_getpid
42 .long sys_mount
43 .long sys_oldumount /* used by libc4 */
44 .long sys_setuid16
45 .long sys_getuid16
46/* 25 */ .long sys_stime
47 .long sys_ptrace
48 .long sys_alarm /* used by libc4 */
49 .long sys_ni_syscall /* was sys_fstat */
50 .long sys_pause
51/* 30 */ .long sys_utime /* used by libc4 */
52 .long sys_ni_syscall /* was sys_stty */
53 .long sys_ni_syscall /* was sys_getty */
54 .long sys_access
55 .long sys_nice
56/* 35 */ .long sys_ni_syscall /* was sys_ftime */
57 .long sys_sync
58 .long sys_kill
59 .long sys_rename
60 .long sys_mkdir
61/* 40 */ .long sys_rmdir
62 .long sys_dup
63 .long sys_pipe
64 .long sys_times
65 .long sys_ni_syscall /* was sys_prof */
66/* 45 */ .long sys_brk
67 .long sys_setgid16
68 .long sys_getgid16
69 .long sys_ni_syscall /* was sys_signal */
70 .long sys_geteuid16
71/* 50 */ .long sys_getegid16
72 .long sys_acct
73 .long sys_umount
74 .long sys_ni_syscall /* was sys_lock */
75 .long sys_ioctl
76/* 55 */ .long sys_fcntl
77 .long sys_ni_syscall /* was sys_mpx */
78 .long sys_setpgid
79 .long sys_ni_syscall /* was sys_ulimit */
80 .long sys_ni_syscall /* was sys_olduname */
81/* 60 */ .long sys_umask
82 .long sys_chroot
83 .long sys_ustat
84 .long sys_dup2
85 .long sys_getppid
86/* 65 */ .long sys_getpgrp
87 .long sys_setsid
88 .long sys_sigaction
89 .long sys_ni_syscall /* was sys_sgetmask */
90 .long sys_ni_syscall /* was sys_ssetmask */
91/* 70 */ .long sys_setreuid16
92 .long sys_setregid16
93 .long sys_sigsuspend_wrapper
94 .long sys_sigpending
95 .long sys_sethostname
96/* 75 */ .long sys_setrlimit
97 .long sys_old_getrlimit /* used by libc4 */
98 .long sys_getrusage
99 .long sys_gettimeofday
100 .long sys_settimeofday
101/* 80 */ .long sys_getgroups16
102 .long sys_setgroups16
103 .long old_select /* used by libc4 */
104 .long sys_symlink
105 .long sys_ni_syscall /* was sys_lstat */
106/* 85 */ .long sys_readlink
107 .long sys_uselib
108 .long sys_swapon
109 .long sys_reboot
110 .long old_readdir /* used by libc4 */
111/* 90 */ .long old_mmap /* used by libc4 */
112 .long sys_munmap
113 .long sys_truncate
114 .long sys_ftruncate
115 .long sys_fchmod
116/* 95 */ .long sys_fchown16
117 .long sys_getpriority
118 .long sys_setpriority
119 .long sys_ni_syscall /* was sys_profil */
120 .long sys_statfs
121/* 100 */ .long sys_fstatfs
122 .long sys_ni_syscall
123 .long sys_socketcall
124 .long sys_syslog
125 .long sys_setitimer
126/* 105 */ .long sys_getitimer
127 .long sys_newstat
128 .long sys_newlstat
129 .long sys_newfstat
130 .long sys_ni_syscall /* was sys_uname */
131/* 110 */ .long sys_ni_syscall /* was sys_iopl */
132 .long sys_vhangup
133 .long sys_ni_syscall
134 .long sys_syscall /* call a syscall */
135 .long sys_wait4
136/* 115 */ .long sys_swapoff
137 .long sys_sysinfo
138 .long sys_ipc
139 .long sys_fsync
140 .long sys_sigreturn_wrapper
141/* 120 */ .long sys_clone_wapper
142 .long sys_setdomainname
143 .long sys_newuname
144 .long sys_ni_syscall
145 .long sys_adjtimex
146/* 125 */ .long sys_mprotect
147 .long sys_sigprocmask
148 .long sys_ni_syscall /* WAS: sys_create_module */
149 .long sys_init_module
150 .long sys_delete_module
151/* 130 */ .long sys_ni_syscall /* WAS: sys_get_kernel_syms */
152 .long sys_quotactl
153 .long sys_getpgid
154 .long sys_fchdir
155 .long sys_bdflush
156/* 135 */ .long sys_sysfs
157 .long sys_personality
158 .long sys_ni_syscall /* .long _sys_afs_syscall */
159 .long sys_setfsuid16
160 .long sys_setfsgid16
161/* 140 */ .long sys_llseek
162 .long sys_getdents
163 .long sys_select
164 .long sys_flock
165 .long sys_msync
166/* 145 */ .long sys_readv
167 .long sys_writev
168 .long sys_getsid
169 .long sys_fdatasync
170 .long sys_sysctl
171/* 150 */ .long sys_mlock
172 .long sys_munlock
173 .long sys_mlockall
174 .long sys_munlockall
175 .long sys_sched_setparam
176/* 155 */ .long sys_sched_getparam
177 .long sys_sched_setscheduler
178 .long sys_sched_getscheduler
179 .long sys_sched_yield
180 .long sys_sched_get_priority_max
181/* 160 */ .long sys_sched_get_priority_min
182 .long sys_sched_rr_get_interval
183 .long sys_nanosleep
184 .long sys_arm_mremap
185 .long sys_setresuid16
186/* 165 */ .long sys_getresuid16
187 .long sys_ni_syscall
188 .long sys_ni_syscall /* WAS: sys_query_module */
189 .long sys_poll
190 .long sys_nfsservctl
191/* 170 */ .long sys_setresgid16
192 .long sys_getresgid16
193 .long sys_prctl
194 .long sys_rt_sigreturn_wrapper
195 .long sys_rt_sigaction
196/* 175 */ .long sys_rt_sigprocmask
197 .long sys_rt_sigpending
198 .long sys_rt_sigtimedwait
199 .long sys_rt_sigqueueinfo
200 .long sys_rt_sigsuspend_wrapper
201/* 180 */ .long sys_pread64
202 .long sys_pwrite64
203 .long sys_chown16
204 .long sys_getcwd
205 .long sys_capget
206/* 185 */ .long sys_capset
207 .long sys_sigaltstack_wrapper
208 .long sys_sendfile
209 .long sys_ni_syscall
210 .long sys_ni_syscall
211/* 190 */ .long sys_vfork_wrapper
212 .long sys_getrlimit
213 .long sys_mmap2
214 .long sys_truncate64
215 .long sys_ftruncate64
216/* 195 */ .long sys_stat64
217 .long sys_lstat64
218 .long sys_fstat64
219 .long sys_lchown
220 .long sys_getuid
221/* 200 */ .long sys_getgid
222 .long sys_geteuid
223 .long sys_getegid
224 .long sys_setreuid
225 .long sys_setregid
226/* 205 */ .long sys_getgroups
227 .long sys_setgroups
228 .long sys_fchown
229 .long sys_setresuid
230 .long sys_getresuid
231/* 210 */ .long sys_setresgid
232 .long sys_getresgid
233 .long sys_chown
234 .long sys_setuid
235 .long sys_setgid
236/* 215 */ .long sys_setfsuid
237 .long sys_setfsgid
238 .long sys_getdents64
239 .long sys_pivot_root
240 .long sys_mincore
241/* 220 */ .long sys_madvise
242 .long sys_fcntl64
243 .long sys_ni_syscall /* TUX */
244 .long sys_ni_syscall /* WAS: sys_security */
245 .long sys_gettid
246/* 225 */ .long sys_readahead
247 .long sys_setxattr
248 .long sys_lsetxattr
249 .long sys_fsetxattr
250 .long sys_getxattr
251/* 230 */ .long sys_lgetxattr
252 .long sys_fgetxattr
253 .long sys_listxattr
254 .long sys_llistxattr
255 .long sys_flistxattr
256/* 235 */ .long sys_removexattr
257 .long sys_lremovexattr
258 .long sys_fremovexattr
259 .long sys_tkill
260__syscall_end:
261
262 .rept NR_syscalls - (__syscall_end - __syscall_start) / 4
263 .long sys_ni_syscall
264 .endr
265#endif
diff --git a/arch/arm26/kernel/compat.c b/arch/arm26/kernel/compat.c
deleted file mode 100644
index 21e966ff0aa7..000000000000
--- a/arch/arm26/kernel/compat.c
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/compat.c
3 *
4 * Copyright (C) 2001 Russell King
5 * 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * We keep the old params compatibility cruft in one place (here)
12 * so we don't end up with lots of mess around other places.
13 *
14 * NOTE:
15 * The old struct param_struct is deprecated, but it will be kept in
16 * the kernel for 5 years from now (2001). This will allow boot loaders
17 * to convert to the new struct tag way.
18 */
19#include <linux/types.h>
20#include <linux/kernel.h>
21#include <linux/string.h>
22#include <linux/init.h>
23
24#include <asm/setup.h>
25#include <asm/mach-types.h>
26#include <asm/page.h>
27
28//#include <asm/arch.h>
29//#include <asm/mach/irq.h>
30
31/*
32 * Usage:
33 * - do not go blindly adding fields, add them at the end
34 * - when adding fields, don't rely on the address until
35 * a patch from me has been released
36 * - unused fields should be zero (for future expansion)
37 * - this structure is relatively short-lived - only
38 * guaranteed to contain useful data in setup_arch()
39 *
40 * This is the old deprecated way to pass parameters to the kernel
41 */
42struct param_struct {
43 union {
44 struct {
45 unsigned long page_size; /* 0 */
46 unsigned long nr_pages; /* 4 */
47 unsigned long ramdisk_size; /* 8 */
48 unsigned long flags; /* 12 */
49#define FLAG_READONLY 1
50#define FLAG_RDLOAD 4
51#define FLAG_RDPROMPT 8
52 unsigned long rootdev; /* 16 */
53 unsigned long video_num_cols; /* 20 */
54 unsigned long video_num_rows; /* 24 */
55 unsigned long video_x; /* 28 */
56 unsigned long video_y; /* 32 */
57 unsigned long memc_control_reg; /* 36 */
58 unsigned char sounddefault; /* 40 */
59 unsigned char adfsdrives; /* 41 */
60 unsigned char bytes_per_char_h; /* 42 */
61 unsigned char bytes_per_char_v; /* 43 */
62 unsigned long pages_in_bank[4]; /* 44 */
63 unsigned long pages_in_vram; /* 60 */
64 unsigned long initrd_start; /* 64 */
65 unsigned long initrd_size; /* 68 */
66 unsigned long rd_start; /* 72 */
67 unsigned long system_rev; /* 76 */
68 unsigned long system_serial_low; /* 80 */
69 unsigned long system_serial_high; /* 84 */
70 unsigned long mem_fclk_21285; /* 88 */
71 } s;
72 char unused[256];
73 } u1;
74 union {
75 char paths[8][128];
76 struct {
77 unsigned long magic;
78 char n[1024 - sizeof(unsigned long)];
79 } s;
80 } u2;
81 char commandline[COMMAND_LINE_SIZE];
82};
83
84static struct tag * __init memtag(struct tag *tag, unsigned long start, unsigned long size)
85{
86 tag = tag_next(tag);
87 tag->hdr.tag = ATAG_MEM;
88 tag->hdr.size = tag_size(tag_mem32);
89 tag->u.mem.size = size;
90 tag->u.mem.start = start;
91
92 return tag;
93}
94
95static void __init build_tag_list(struct param_struct *params, void *taglist)
96{
97 struct tag *tag = taglist;
98
99 if (params->u1.s.page_size != PAGE_SIZE) {
100 printk(KERN_WARNING "Warning: bad configuration page, "
101 "trying to continue\n");
102 return;
103 }
104
105 printk(KERN_DEBUG "Converting old-style param struct to taglist\n");
106
107 tag->hdr.tag = ATAG_CORE;
108 tag->hdr.size = tag_size(tag_core);
109 tag->u.core.flags = params->u1.s.flags & FLAG_READONLY;
110 tag->u.core.pagesize = params->u1.s.page_size;
111 tag->u.core.rootdev = params->u1.s.rootdev;
112
113 tag = tag_next(tag);
114 tag->hdr.tag = ATAG_RAMDISK;
115 tag->hdr.size = tag_size(tag_ramdisk);
116 tag->u.ramdisk.flags = (params->u1.s.flags & FLAG_RDLOAD ? 1 : 0) |
117 (params->u1.s.flags & FLAG_RDPROMPT ? 2 : 0);
118 tag->u.ramdisk.size = params->u1.s.ramdisk_size;
119 tag->u.ramdisk.start = params->u1.s.rd_start;
120
121 tag = tag_next(tag);
122 tag->hdr.tag = ATAG_INITRD;
123 tag->hdr.size = tag_size(tag_initrd);
124 tag->u.initrd.start = params->u1.s.initrd_start;
125 tag->u.initrd.size = params->u1.s.initrd_size;
126
127 tag = tag_next(tag);
128 tag->hdr.tag = ATAG_SERIAL;
129 tag->hdr.size = tag_size(tag_serialnr);
130 tag->u.serialnr.low = params->u1.s.system_serial_low;
131 tag->u.serialnr.high = params->u1.s.system_serial_high;
132
133 tag = tag_next(tag);
134 tag->hdr.tag = ATAG_REVISION;
135 tag->hdr.size = tag_size(tag_revision);
136 tag->u.revision.rev = params->u1.s.system_rev;
137
138 tag = memtag(tag, PHYS_OFFSET, params->u1.s.nr_pages * PAGE_SIZE);
139
140 tag = tag_next(tag);
141 tag->hdr.tag = ATAG_ACORN;
142 tag->hdr.size = tag_size(tag_acorn);
143 tag->u.acorn.memc_control_reg = params->u1.s.memc_control_reg;
144 tag->u.acorn.vram_pages = params->u1.s.pages_in_vram;
145 tag->u.acorn.sounddefault = params->u1.s.sounddefault;
146 tag->u.acorn.adfsdrives = params->u1.s.adfsdrives;
147
148 tag = tag_next(tag);
149 tag->hdr.tag = ATAG_CMDLINE;
150 tag->hdr.size = (strlen(params->commandline) + 3 +
151 sizeof(struct tag_header)) >> 2;
152 strcpy(tag->u.cmdline.cmdline, params->commandline);
153
154 tag = tag_next(tag);
155 tag->hdr.tag = ATAG_NONE;
156 tag->hdr.size = 0;
157
158 memmove(params, taglist, ((int)tag) - ((int)taglist) +
159 sizeof(struct tag_header));
160}
161
162void __init convert_to_tag_list(struct tag *tags)
163{
164 struct param_struct *params = (struct param_struct *)tags;
165 build_tag_list(params, &params->u2);
166}
167
168void __init squash_mem_tags(struct tag *tag)
169{
170 for (; tag->hdr.size; tag = tag_next(tag))
171 if (tag->hdr.tag == ATAG_MEM)
172 tag->hdr.tag = ATAG_NONE;
173}
diff --git a/arch/arm26/kernel/dma.c b/arch/arm26/kernel/dma.c
deleted file mode 100644
index 80b5a774d905..000000000000
--- a/arch/arm26/kernel/dma.c
+++ /dev/null
@@ -1,273 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/dma.c
3 *
4 * Copyright (C) 1995-2000 Russell King
5 * 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Front-end to the DMA handling. This handles the allocation/freeing
12 * of DMA channels, and provides a unified interface to the machines
13 * DMA facilities.
14 */
15#include <linux/module.h>
16#include <linux/slab.h>
17#include <linux/sched.h>
18#include <linux/mman.h>
19#include <linux/init.h>
20#include <linux/spinlock.h>
21#include <linux/errno.h>
22
23#include <asm/dma.h>
24
25DEFINE_SPINLOCK(dma_spin_lock);
26
27static dma_t dma_chan[MAX_DMA_CHANNELS];
28
29/*
30 * Get dma list for /proc/dma
31 */
32int get_dma_list(char *buf)
33{
34 dma_t *dma;
35 char *p = buf;
36 int i;
37
38 for (i = 0, dma = dma_chan; i < MAX_DMA_CHANNELS; i++, dma++)
39 if (dma->lock)
40 p += sprintf(p, "%2d: %14s %s\n", i,
41 dma->d_ops->type, dma->device_id);
42
43 return p - buf;
44}
45
46/*
47 * Request DMA channel
48 *
49 * On certain platforms, we have to allocate an interrupt as well...
50 */
51int request_dma(dmach_t channel, const char *device_id)
52{
53 dma_t *dma = dma_chan + channel;
54 int ret;
55
56 if (channel >= MAX_DMA_CHANNELS || !dma->d_ops)
57 goto bad_dma;
58
59 if (xchg(&dma->lock, 1) != 0)
60 goto busy;
61
62 dma->device_id = device_id;
63 dma->active = 0;
64 dma->invalid = 1;
65
66 ret = 0;
67 if (dma->d_ops->request)
68 ret = dma->d_ops->request(channel, dma);
69
70 if (ret)
71 xchg(&dma->lock, 0);
72
73 return ret;
74
75bad_dma:
76 printk(KERN_ERR "dma: trying to allocate DMA%d\n", channel);
77 return -EINVAL;
78
79busy:
80 return -EBUSY;
81}
82
83/*
84 * Free DMA channel
85 *
86 * On certain platforms, we have to free interrupt as well...
87 */
88void free_dma(dmach_t channel)
89{
90 dma_t *dma = dma_chan + channel;
91
92 if (channel >= MAX_DMA_CHANNELS || !dma->d_ops)
93 goto bad_dma;
94
95 if (dma->active) {
96 printk(KERN_ERR "dma%d: freeing active DMA\n", channel);
97 dma->d_ops->disable(channel, dma);
98 dma->active = 0;
99 }
100
101 if (xchg(&dma->lock, 0) != 0) {
102 if (dma->d_ops->free)
103 dma->d_ops->free(channel, dma);
104 return;
105 }
106
107 printk(KERN_ERR "dma%d: trying to free free DMA\n", channel);
108 return;
109
110bad_dma:
111 printk(KERN_ERR "dma: trying to free DMA%d\n", channel);
112}
113
114/* Set DMA Scatter-Gather list
115 */
116void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg)
117{
118 dma_t *dma = dma_chan + channel;
119
120 if (dma->active)
121 printk(KERN_ERR "dma%d: altering DMA SG while "
122 "DMA active\n", channel);
123
124 dma->sg = sg;
125 dma->sgcount = nr_sg;
126 dma->using_sg = 1;
127 dma->invalid = 1;
128}
129
130/* Set DMA address
131 *
132 * Copy address to the structure, and set the invalid bit
133 */
134void set_dma_addr (dmach_t channel, unsigned long physaddr)
135{
136 dma_t *dma = dma_chan + channel;
137
138 if (dma->active)
139 printk(KERN_ERR "dma%d: altering DMA address while "
140 "DMA active\n", channel);
141
142 dma->sg = &dma->buf;
143 dma->sgcount = 1;
144 dma->buf.__address = (char *)physaddr;//FIXME - not pretty
145 dma->using_sg = 0;
146 dma->invalid = 1;
147}
148
149/* Set DMA byte count
150 *
151 * Copy address to the structure, and set the invalid bit
152 */
153void set_dma_count (dmach_t channel, unsigned long count)
154{
155 dma_t *dma = dma_chan + channel;
156
157 if (dma->active)
158 printk(KERN_ERR "dma%d: altering DMA count while "
159 "DMA active\n", channel);
160
161 dma->sg = &dma->buf;
162 dma->sgcount = 1;
163 dma->buf.length = count;
164 dma->using_sg = 0;
165 dma->invalid = 1;
166}
167
168/* Set DMA direction mode
169 */
170void set_dma_mode (dmach_t channel, dmamode_t mode)
171{
172 dma_t *dma = dma_chan + channel;
173
174 if (dma->active)
175 printk(KERN_ERR "dma%d: altering DMA mode while "
176 "DMA active\n", channel);
177
178 dma->dma_mode = mode;
179 dma->invalid = 1;
180}
181
182/* Enable DMA channel
183 */
184void enable_dma (dmach_t channel)
185{
186 dma_t *dma = dma_chan + channel;
187
188 if (!dma->lock)
189 goto free_dma;
190
191 if (dma->active == 0) {
192 dma->active = 1;
193 dma->d_ops->enable(channel, dma);
194 }
195 return;
196
197free_dma:
198 printk(KERN_ERR "dma%d: trying to enable free DMA\n", channel);
199 BUG();
200}
201
202/* Disable DMA channel
203 */
204void disable_dma (dmach_t channel)
205{
206 dma_t *dma = dma_chan + channel;
207
208 if (!dma->lock)
209 goto free_dma;
210
211 if (dma->active == 1) {
212 dma->active = 0;
213 dma->d_ops->disable(channel, dma);
214 }
215 return;
216
217free_dma:
218 printk(KERN_ERR "dma%d: trying to disable free DMA\n", channel);
219 BUG();
220}
221
222/*
223 * Is the specified DMA channel active?
224 */
225int dma_channel_active(dmach_t channel)
226{
227 return dma_chan[channel].active;
228}
229
230void set_dma_page(dmach_t channel, char pagenr)
231{
232 printk(KERN_ERR "dma%d: trying to set_dma_page\n", channel);
233}
234
235void set_dma_speed(dmach_t channel, int cycle_ns)
236{
237 dma_t *dma = dma_chan + channel;
238 int ret = 0;
239
240 if (dma->d_ops->setspeed)
241 ret = dma->d_ops->setspeed(channel, dma, cycle_ns);
242 dma->speed = ret;
243}
244
245int get_dma_residue(dmach_t channel)
246{
247 dma_t *dma = dma_chan + channel;
248 int ret = 0;
249
250 if (dma->d_ops->residue)
251 ret = dma->d_ops->residue(channel, dma);
252
253 return ret;
254}
255
256void __init init_dma(void)
257{
258 arch_dma_init(dma_chan);
259}
260
261EXPORT_SYMBOL(request_dma);
262EXPORT_SYMBOL(free_dma);
263EXPORT_SYMBOL(enable_dma);
264EXPORT_SYMBOL(disable_dma);
265EXPORT_SYMBOL(set_dma_addr);
266EXPORT_SYMBOL(set_dma_count);
267EXPORT_SYMBOL(set_dma_mode);
268EXPORT_SYMBOL(set_dma_page);
269EXPORT_SYMBOL(get_dma_residue);
270EXPORT_SYMBOL(set_dma_sg);
271EXPORT_SYMBOL(set_dma_speed);
272
273EXPORT_SYMBOL(dma_spin_lock);
diff --git a/arch/arm26/kernel/ecard.c b/arch/arm26/kernel/ecard.c
deleted file mode 100644
index e2bcefc91cc3..000000000000
--- a/arch/arm26/kernel/ecard.c
+++ /dev/null
@@ -1,847 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/ecard.c
3 *
4 * Copyright 1995-2001 Russell King
5 * Copyright 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Find all installed expansion cards, and handle interrupts from them.
12 *
13 * Created from information from Acorns RiscOS3 PRMs
14 * 15-Jun-2003 IM Modified from ARM32 (RiscPC capable) version
15 * 10-Jan-1999 RMK Run loaders in a simulated RISC OS environment.
16 * 06-May-1997 RMK Added blacklist for cards whose loader doesn't work.
17 * 12-Sep-1997 RMK Created new handling of interrupt enables/disables
18 * - cards can now register their own routine to control
19 * interrupts (recommended).
20 * 29-Sep-1997 RMK Expansion card interrupt hardware not being re-enabled
21 * on reset from Linux. (Caused cards not to respond
22 * under RiscOS without hard reset).
23 *
24 */
25#define ECARD_C
26
27#include <linux/module.h>
28#include <linux/kernel.h>
29#include <linux/types.h>
30#include <linux/sched.h>
31#include <linux/interrupt.h>
32#include <linux/reboot.h>
33#include <linux/mm.h>
34#include <linux/slab.h>
35#include <linux/proc_fs.h>
36#include <linux/device.h>
37#include <linux/init.h>
38
39#include <asm/dma.h>
40#include <asm/ecard.h>
41#include <asm/hardware.h>
42#include <asm/io.h>
43#include <asm/irq.h>
44#include <asm/mmu_context.h>
45#include <asm/irqchip.h>
46#include <asm/tlbflush.h>
47
48enum req {
49 req_readbytes,
50 req_reset
51};
52
53struct ecard_request {
54 enum req req;
55 ecard_t *ec;
56 unsigned int address;
57 unsigned int length;
58 unsigned int use_loader;
59 void *buffer;
60};
61
62struct expcard_blacklist {
63 unsigned short manufacturer;
64 unsigned short product;
65 const char *type;
66};
67
68static ecard_t *cards;
69static ecard_t *slot_to_expcard[MAX_ECARDS];
70static unsigned int ectcr;
71
72/* List of descriptions of cards which don't have an extended
73 * identification, or chunk directories containing a description.
74 */
75static struct expcard_blacklist __initdata blacklist[] = {
76 { MANU_ACORN, PROD_ACORN_ETHER1, "Acorn Ether1" }
77};
78
79asmlinkage extern int
80ecard_loader_reset(volatile unsigned char *pa, loader_t loader);
81asmlinkage extern int
82ecard_loader_read(int off, volatile unsigned char *pa, loader_t loader);
83
84static const struct ecard_id *
85ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec);
86
87static inline unsigned short
88ecard_getu16(unsigned char *v)
89{
90 return v[0] | v[1] << 8;
91}
92
93static inline signed long
94ecard_gets24(unsigned char *v)
95{
96 return v[0] | v[1] << 8 | v[2] << 16 | ((v[2] & 0x80) ? 0xff000000 : 0);
97}
98
99static inline ecard_t *
100slot_to_ecard(unsigned int slot)
101{
102 return slot < MAX_ECARDS ? slot_to_expcard[slot] : NULL;
103}
104
105/* ===================== Expansion card daemon ======================== */
106/*
107 * Since the loader programs on the expansion cards need to be run
108 * in a specific environment, create a separate task with this
109 * environment up, and pass requests to this task as and when we
110 * need to.
111 *
112 * This should allow 99% of loaders to be called from Linux.
113 *
114 * From a security standpoint, we trust the card vendors. This
115 * may be a misplaced trust.
116 */
117#define BUS_ADDR(x) ((((unsigned long)(x)) << 2) + IO_BASE)
118#define POD_INT_ADDR(x) ((volatile unsigned char *)\
119 ((BUS_ADDR((x)) - IO_BASE) + IO_START))
120
121static inline void ecard_task_reset(struct ecard_request *req)
122{
123 struct expansion_card *ec = req->ec;
124 if (ec->loader)
125 ecard_loader_reset(POD_INT_ADDR(ec->podaddr), ec->loader);
126}
127
128static void
129ecard_task_readbytes(struct ecard_request *req)
130{
131 unsigned char *buf = (unsigned char *)req->buffer;
132 volatile unsigned char *base_addr =
133 (volatile unsigned char *)POD_INT_ADDR(req->ec->podaddr);
134 unsigned int len = req->length;
135 unsigned int off = req->address;
136
137 if (!req->use_loader || !req->ec->loader) {
138 off *= 4;
139 while (len--) {
140 *buf++ = base_addr[off];
141 off += 4;
142 }
143 } else {
144 while(len--) {
145 /*
146 * The following is required by some
147 * expansion card loader programs.
148 */
149 *(unsigned long *)0x108 = 0;
150 *buf++ = ecard_loader_read(off++, base_addr,
151 req->ec->loader);
152 }
153 }
154}
155
156static void ecard_do_request(struct ecard_request *req)
157{
158 switch (req->req) {
159 case req_readbytes:
160 ecard_task_readbytes(req);
161 break;
162
163 case req_reset:
164 ecard_task_reset(req);
165 break;
166 }
167}
168
169/*
170 * On 26-bit processors, we don't need the kcardd thread to access the
171 * expansion card loaders. We do it directly.
172 */
173#define ecard_call(req) ecard_do_request(req)
174
175/* ======================= Mid-level card control ===================== */
176
177static void
178ecard_readbytes(void *addr, ecard_t *ec, int off, int len, int useld)
179{
180 struct ecard_request req;
181
182 req.req = req_readbytes;
183 req.ec = ec;
184 req.address = off;
185 req.length = len;
186 req.use_loader = useld;
187 req.buffer = addr;
188
189 ecard_call(&req);
190}
191
192int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
193{
194 struct ex_chunk_dir excd;
195 int index = 16;
196 int useld = 0;
197
198 if (!ec->cid.cd)
199 return 0;
200
201 while(1) {
202 ecard_readbytes(&excd, ec, index, 8, useld);
203 index += 8;
204 if (c_id(&excd) == 0) {
205 if (!useld && ec->loader) {
206 useld = 1;
207 index = 0;
208 continue;
209 }
210 return 0;
211 }
212 if (c_id(&excd) == 0xf0) { /* link */
213 index = c_start(&excd);
214 continue;
215 }
216 if (c_id(&excd) == 0x80) { /* loader */
217 if (!ec->loader) {
218 ec->loader = kmalloc(c_len(&excd),
219 GFP_KERNEL);
220 if (ec->loader)
221 ecard_readbytes(ec->loader, ec,
222 (int)c_start(&excd),
223 c_len(&excd), useld);
224 else
225 return 0;
226 }
227 continue;
228 }
229 if (c_id(&excd) == id && num-- == 0)
230 break;
231 }
232
233 if (c_id(&excd) & 0x80) {
234 switch (c_id(&excd) & 0x70) {
235 case 0x70:
236 ecard_readbytes((unsigned char *)excd.d.string, ec,
237 (int)c_start(&excd), c_len(&excd),
238 useld);
239 break;
240 case 0x00:
241 break;
242 }
243 }
244 cd->start_offset = c_start(&excd);
245 memcpy(cd->d.string, excd.d.string, 256);
246 return 1;
247}
248
249/* ======================= Interrupt control ============================ */
250
251static void ecard_def_irq_enable(ecard_t *ec, int irqnr)
252{
253}
254
255static void ecard_def_irq_disable(ecard_t *ec, int irqnr)
256{
257}
258
259static int ecard_def_irq_pending(ecard_t *ec)
260{
261 return !ec->irqmask || ec->irqaddr[0] & ec->irqmask;
262}
263
264static void ecard_def_fiq_enable(ecard_t *ec, int fiqnr)
265{
266 panic("ecard_def_fiq_enable called - impossible");
267}
268
269static void ecard_def_fiq_disable(ecard_t *ec, int fiqnr)
270{
271 panic("ecard_def_fiq_disable called - impossible");
272}
273
274static int ecard_def_fiq_pending(ecard_t *ec)
275{
276 return !ec->fiqmask || ec->fiqaddr[0] & ec->fiqmask;
277}
278
279static expansioncard_ops_t ecard_default_ops = {
280 ecard_def_irq_enable,
281 ecard_def_irq_disable,
282 ecard_def_irq_pending,
283 ecard_def_fiq_enable,
284 ecard_def_fiq_disable,
285 ecard_def_fiq_pending
286};
287
288/*
289 * Enable and disable interrupts from expansion cards.
290 * (interrupts are disabled for these functions).
291 *
292 * They are not meant to be called directly, but via enable/disable_irq.
293 */
294static void ecard_irq_unmask(unsigned int irqnr)
295{
296 ecard_t *ec = slot_to_ecard(irqnr - 32);
297
298 if (ec) {
299 if (!ec->ops)
300 ec->ops = &ecard_default_ops;
301
302 if (ec->claimed && ec->ops->irqenable)
303 ec->ops->irqenable(ec, irqnr);
304 else
305 printk(KERN_ERR "ecard: rejecting request to "
306 "enable IRQs for %d\n", irqnr);
307 }
308}
309
310static void ecard_irq_mask(unsigned int irqnr)
311{
312 ecard_t *ec = slot_to_ecard(irqnr - 32);
313
314 if (ec) {
315 if (!ec->ops)
316 ec->ops = &ecard_default_ops;
317
318 if (ec->ops && ec->ops->irqdisable)
319 ec->ops->irqdisable(ec, irqnr);
320 }
321}
322
323static struct irqchip ecard_chip = {
324 .ack = ecard_irq_mask,
325 .mask = ecard_irq_mask,
326 .unmask = ecard_irq_unmask,
327};
328
329void ecard_enablefiq(unsigned int fiqnr)
330{
331 ecard_t *ec = slot_to_ecard(fiqnr);
332
333 if (ec) {
334 if (!ec->ops)
335 ec->ops = &ecard_default_ops;
336
337 if (ec->claimed && ec->ops->fiqenable)
338 ec->ops->fiqenable(ec, fiqnr);
339 else
340 printk(KERN_ERR "ecard: rejecting request to "
341 "enable FIQs for %d\n", fiqnr);
342 }
343}
344
345void ecard_disablefiq(unsigned int fiqnr)
346{
347 ecard_t *ec = slot_to_ecard(fiqnr);
348
349 if (ec) {
350 if (!ec->ops)
351 ec->ops = &ecard_default_ops;
352
353 if (ec->ops->fiqdisable)
354 ec->ops->fiqdisable(ec, fiqnr);
355 }
356}
357
358static void
359ecard_dump_irq_state(ecard_t *ec)
360{
361 printk(" %d: %sclaimed, ",
362 ec->slot_no,
363 ec->claimed ? "" : "not ");
364
365 if (ec->ops && ec->ops->irqpending &&
366 ec->ops != &ecard_default_ops)
367 printk("irq %spending\n",
368 ec->ops->irqpending(ec) ? "" : "not ");
369 else
370 printk("irqaddr %p, mask = %02X, status = %02X\n",
371 ec->irqaddr, ec->irqmask, *ec->irqaddr);
372}
373
374static void ecard_check_lockup(struct irqdesc *desc)
375{
376 static int last, lockup;
377 ecard_t *ec;
378
379 /*
380 * If the timer interrupt has not run since the last million
381 * unrecognised expansion card interrupts, then there is
382 * something seriously wrong. Disable the expansion card
383 * interrupts so at least we can continue.
384 *
385 * Maybe we ought to start a timer to re-enable them some time
386 * later?
387 */
388 if (last == jiffies) {
389 lockup += 1;
390 if (lockup > 1000000) {
391 printk(KERN_ERR "\nInterrupt lockup detected - "
392 "disabling all expansion card interrupts\n");
393
394 desc->chip->mask(IRQ_EXPANSIONCARD);
395
396 printk("Expansion card IRQ state:\n");
397
398 for (ec = cards; ec; ec = ec->next)
399 ecard_dump_irq_state(ec);
400 }
401 } else
402 lockup = 0;
403
404 /*
405 * If we did not recognise the source of this interrupt,
406 * warn the user, but don't flood the user with these messages.
407 */
408 if (!last || time_after(jiffies, (unsigned long)(last + 5*HZ))) {
409 last = jiffies;
410 printk(KERN_WARNING "Unrecognised interrupt from backplane\n");
411 }
412}
413
414static void
415ecard_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
416{
417 ecard_t *ec;
418 int called = 0;
419
420 desc->chip->mask(irq);
421 for (ec = cards; ec; ec = ec->next) {
422 int pending;
423
424 if (!ec->claimed || ec->irq == NO_IRQ)
425 continue;
426
427 if (ec->ops && ec->ops->irqpending)
428 pending = ec->ops->irqpending(ec);
429 else
430 pending = ecard_default_ops.irqpending(ec);
431
432 if (pending) {
433 struct irqdesc *d = irq_desc + ec->irq;
434 d->handle(ec->irq, d, regs);
435 called ++;
436 }
437 }
438 desc->chip->unmask(irq);
439
440 if (called == 0)
441 ecard_check_lockup(desc);
442}
443
444#define ecard_irqexp_handler NULL
445#define ecard_probeirqhw() (0)
446
447unsigned int ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
448{
449 unsigned long address = 0;
450 int slot = ec->slot_no;
451
452 ectcr &= ~(1 << slot);
453
454 switch (type) {
455 case ECARD_MEMC:
456 address = IO_EC_MEMC_BASE + (slot << 12);
457 break;
458
459 case ECARD_IOC:
460 address = IO_EC_IOC_BASE + (slot << 12) + (speed << 17);
461 break;
462
463 default:
464 break;
465 }
466
467 return address;
468}
469
470static int ecard_prints(char *buffer, ecard_t *ec)
471{
472 char *start = buffer;
473
474 buffer += sprintf(buffer, " %d: ", ec->slot_no);
475
476 if (ec->cid.id == 0) {
477 struct in_chunk_dir incd;
478
479 buffer += sprintf(buffer, "[%04X:%04X] ",
480 ec->cid.manufacturer, ec->cid.product);
481
482 if (!ec->card_desc && ec->cid.cd &&
483 ecard_readchunk(&incd, ec, 0xf5, 0)) {
484 ec->card_desc = kmalloc(strlen(incd.d.string)+1, GFP_KERNEL);
485
486 if (ec->card_desc)
487 strcpy((char *)ec->card_desc, incd.d.string);
488 }
489
490 buffer += sprintf(buffer, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*");
491 } else
492 buffer += sprintf(buffer, "Simple card %d\n", ec->cid.id);
493
494 return buffer - start;
495}
496
497static int get_ecard_dev_info(char *buf, char **start, off_t pos, int count)
498{
499 ecard_t *ec = cards;
500 off_t at = 0;
501 int len, cnt;
502
503 cnt = 0;
504 while (ec && count > cnt) {
505 len = ecard_prints(buf, ec);
506 at += len;
507 if (at >= pos) {
508 if (!*start) {
509 *start = buf + (pos - (at - len));
510 cnt = at - pos;
511 } else
512 cnt += len;
513 buf += len;
514 }
515 ec = ec->next;
516 }
517 return (count > cnt) ? cnt : count;
518}
519
520static struct proc_dir_entry *proc_bus_ecard_dir = NULL;
521
522static void ecard_proc_init(void)
523{
524 proc_bus_ecard_dir = proc_mkdir("ecard", proc_bus);
525 create_proc_info_entry("devices", 0, proc_bus_ecard_dir,
526 get_ecard_dev_info);
527}
528
529#define ec_set_resource(ec,nr,st,sz,flg) \
530 do { \
531 (ec)->resource[nr].name = ec->dev.bus_id; \
532 (ec)->resource[nr].start = st; \
533 (ec)->resource[nr].end = (st) + (sz) - 1; \
534 (ec)->resource[nr].flags = flg; \
535 } while (0)
536
537static void __init ecard_init_resources(struct expansion_card *ec)
538{
539 unsigned long base = PODSLOT_IOC0_BASE;
540 unsigned int slot = ec->slot_no;
541 int i;
542
543 ec_set_resource(ec, ECARD_RES_MEMC,
544 PODSLOT_MEMC_BASE + (slot << 14),
545 PODSLOT_MEMC_SIZE, IORESOURCE_MEM);
546
547 for (i = 0; i < ECARD_RES_IOCSYNC - ECARD_RES_IOCSLOW; i++) {
548 ec_set_resource(ec, i + ECARD_RES_IOCSLOW,
549 base + (slot << 14) + (i << 19),
550 PODSLOT_IOC_SIZE, IORESOURCE_MEM);
551 }
552
553 for (i = 0; i < ECARD_NUM_RESOURCES; i++) {
554 if (ec->resource[i].start &&
555 request_resource(&iomem_resource, &ec->resource[i])) {
556 printk(KERN_ERR "%s: resource(s) not available\n",
557 ec->dev.bus_id);
558 ec->resource[i].end -= ec->resource[i].start;
559 ec->resource[i].start = 0;
560 }
561 }
562}
563
564static ssize_t ecard_show_irq(struct device *dev, struct device_attribute *attr, char *buf)
565{
566 struct expansion_card *ec = ECARD_DEV(dev);
567 return sprintf(buf, "%u\n", ec->irq);
568}
569
570static ssize_t ecard_show_vendor(struct device *dev, struct device_attribute *attr, char *buf)
571{
572 struct expansion_card *ec = ECARD_DEV(dev);
573 return sprintf(buf, "%u\n", ec->cid.manufacturer);
574}
575
576static ssize_t ecard_show_device(struct device *dev, struct device_attribute *attr, char *buf)
577{
578 struct expansion_card *ec = ECARD_DEV(dev);
579 return sprintf(buf, "%u\n", ec->cid.product);
580}
581
582static ssize_t ecard_show_dma(struct device *dev, struct device_attribute *attr, char *buf)
583{
584 struct expansion_card *ec = ECARD_DEV(dev);
585 return sprintf(buf, "%u\n", ec->dma);
586}
587
588static ssize_t ecard_show_resources(struct device *dev, struct device_attribute *attr, char *buf)
589{
590 struct expansion_card *ec = ECARD_DEV(dev);
591 char *str = buf;
592 int i;
593
594 for (i = 0; i < ECARD_NUM_RESOURCES; i++)
595 str += sprintf(str, "%08lx %08lx %08lx\n",
596 ec->resource[i].start,
597 ec->resource[i].end,
598 ec->resource[i].flags);
599
600 return str - buf;
601}
602
603static DEVICE_ATTR(irq, S_IRUGO, ecard_show_irq, NULL);
604static DEVICE_ATTR(vendor, S_IRUGO, ecard_show_vendor, NULL);
605static DEVICE_ATTR(device, S_IRUGO, ecard_show_device, NULL);
606static DEVICE_ATTR(dma, S_IRUGO, ecard_show_dma, NULL);
607static DEVICE_ATTR(resource, S_IRUGO, ecard_show_resources, NULL);
608
609/*
610 * Probe for an expansion card.
611 *
612 * If bit 1 of the first byte of the card is set, then the
613 * card does not exist.
614 */
615static int __init
616ecard_probe(int slot, card_type_t type)
617{
618 ecard_t **ecp;
619 ecard_t *ec;
620 struct ex_ecid cid;
621 int i, rc = -ENOMEM;
622
623 ec = kzalloc(sizeof(ecard_t), GFP_KERNEL);
624 if (!ec)
625 goto nomem;
626
627 ec->slot_no = slot;
628 ec->type = type;
629 ec->irq = NO_IRQ;
630 ec->fiq = NO_IRQ;
631 ec->dma = NO_DMA;
632 ec->card_desc = NULL;
633 ec->ops = &ecard_default_ops;
634
635 rc = -ENODEV;
636 if ((ec->podaddr = ecard_address(ec, type, ECARD_SYNC)) == 0)
637 goto nodev;
638
639 cid.r_zero = 1;
640 ecard_readbytes(&cid, ec, 0, 16, 0);
641 if (cid.r_zero)
642 goto nodev;
643
644 ec->cid.id = cid.r_id;
645 ec->cid.cd = cid.r_cd;
646 ec->cid.is = cid.r_is;
647 ec->cid.w = cid.r_w;
648 ec->cid.manufacturer = ecard_getu16(cid.r_manu);
649 ec->cid.product = ecard_getu16(cid.r_prod);
650 ec->cid.country = cid.r_country;
651 ec->cid.irqmask = cid.r_irqmask;
652 ec->cid.irqoff = ecard_gets24(cid.r_irqoff);
653 ec->cid.fiqmask = cid.r_fiqmask;
654 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff);
655 ec->fiqaddr =
656 ec->irqaddr = (unsigned char *)ioaddr(ec->podaddr);
657
658 if (ec->cid.is) {
659 ec->irqmask = ec->cid.irqmask;
660 ec->irqaddr += ec->cid.irqoff;
661 ec->fiqmask = ec->cid.fiqmask;
662 ec->fiqaddr += ec->cid.fiqoff;
663 } else {
664 ec->irqmask = 1;
665 ec->fiqmask = 4;
666 }
667
668 for (i = 0; i < ARRAY_SIZE(blacklist); i++)
669 if (blacklist[i].manufacturer == ec->cid.manufacturer &&
670 blacklist[i].product == ec->cid.product) {
671 ec->card_desc = blacklist[i].type;
672 break;
673 }
674
675 snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot);
676 ec->dev.parent = NULL;
677 ec->dev.bus = &ecard_bus_type;
678 ec->dev.dma_mask = &ec->dma_mask;
679 ec->dma_mask = (u64)0xffffffff;
680
681 ecard_init_resources(ec);
682
683 /*
684 * hook the interrupt handlers
685 */
686 ec->irq = 32 + slot;
687 set_irq_chip(ec->irq, &ecard_chip);
688 set_irq_handler(ec->irq, do_level_IRQ);
689 set_irq_flags(ec->irq, IRQF_VALID);
690
691 for (ecp = &cards; *ecp; ecp = &(*ecp)->next);
692
693 *ecp = ec;
694 slot_to_expcard[slot] = ec;
695
696 device_register(&ec->dev);
697 device_create_file(&ec->dev, &dev_attr_dma);
698 device_create_file(&ec->dev, &dev_attr_irq);
699 device_create_file(&ec->dev, &dev_attr_resource);
700 device_create_file(&ec->dev, &dev_attr_vendor);
701 device_create_file(&ec->dev, &dev_attr_device);
702
703 return 0;
704
705nodev:
706 kfree(ec);
707nomem:
708 return rc;
709}
710
711/*
712 * Initialise the expansion card system.
713 * Locate all hardware - interrupt management and
714 * actual cards.
715 */
716static int __init ecard_init(void)
717{
718 int slot, irqhw;
719
720 printk("Probing expansion cards\n");
721
722 for (slot = 0; slot < MAX_ECARDS; slot ++) {
723 ecard_probe(slot, ECARD_IOC);
724 }
725
726 irqhw = ecard_probeirqhw();
727
728 set_irq_chained_handler(IRQ_EXPANSIONCARD,
729 irqhw ? ecard_irqexp_handler : ecard_irq_handler);
730
731 ecard_proc_init();
732
733 return 0;
734}
735
736subsys_initcall(ecard_init);
737
738/*
739 * ECARD "bus"
740 */
741static const struct ecard_id *
742ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec)
743{
744 int i;
745
746 for (i = 0; ids[i].manufacturer != 65535; i++)
747 if (ec->cid.manufacturer == ids[i].manufacturer &&
748 ec->cid.product == ids[i].product)
749 return ids + i;
750
751 return NULL;
752}
753
754static int ecard_drv_probe(struct device *dev)
755{
756 struct expansion_card *ec = ECARD_DEV(dev);
757 struct ecard_driver *drv = ECARD_DRV(dev->driver);
758 const struct ecard_id *id;
759 int ret;
760
761 id = ecard_match_device(drv->id_table, ec);
762
763 ecard_claim(ec);
764 ret = drv->probe(ec, id);
765 if (ret)
766 ecard_release(ec);
767 return ret;
768}
769
770static int ecard_drv_remove(struct device *dev)
771{
772 struct expansion_card *ec = ECARD_DEV(dev);
773 struct ecard_driver *drv = ECARD_DRV(dev->driver);
774
775 drv->remove(ec);
776 ecard_release(ec);
777
778 return 0;
779}
780
781/*
782 * Before rebooting, we must make sure that the expansion card is in a
783 * sensible state, so it can be re-detected. This means that the first
784 * page of the ROM must be visible. We call the expansion cards reset
785 * handler, if any.
786 */
787static void ecard_drv_shutdown(struct device *dev)
788{
789 struct expansion_card *ec = ECARD_DEV(dev);
790 struct ecard_driver *drv = ECARD_DRV(dev->driver);
791 struct ecard_request req;
792
793 if (drv->shutdown)
794 drv->shutdown(ec);
795 ecard_release(ec);
796 req.req = req_reset;
797 req.ec = ec;
798 ecard_call(&req);
799}
800
801int ecard_register_driver(struct ecard_driver *drv)
802{
803 drv->drv.bus = &ecard_bus_type;
804 drv->drv.probe = ecard_drv_probe;
805 drv->drv.remove = ecard_drv_remove;
806 drv->drv.shutdown = ecard_drv_shutdown;
807
808 return driver_register(&drv->drv);
809}
810
811void ecard_remove_driver(struct ecard_driver *drv)
812{
813 driver_unregister(&drv->drv);
814}
815
816static int ecard_match(struct device *_dev, struct device_driver *_drv)
817{
818 struct expansion_card *ec = ECARD_DEV(_dev);
819 struct ecard_driver *drv = ECARD_DRV(_drv);
820 int ret;
821
822 if (drv->id_table) {
823 ret = ecard_match_device(drv->id_table, ec) != NULL;
824 } else {
825 ret = ec->cid.id == drv->id;
826 }
827
828 return ret;
829}
830
831struct bus_type ecard_bus_type = {
832 .name = "ecard",
833 .match = ecard_match,
834};
835
836static int ecard_bus_init(void)
837{
838 return bus_register(&ecard_bus_type);
839}
840
841postcore_initcall(ecard_bus_init);
842
843EXPORT_SYMBOL(ecard_readchunk);
844EXPORT_SYMBOL(ecard_address);
845EXPORT_SYMBOL(ecard_register_driver);
846EXPORT_SYMBOL(ecard_remove_driver);
847EXPORT_SYMBOL(ecard_bus_type);
diff --git a/arch/arm26/kernel/entry.S b/arch/arm26/kernel/entry.S
deleted file mode 100644
index 91496cc687b1..000000000000
--- a/arch/arm26/kernel/entry.S
+++ /dev/null
@@ -1,951 +0,0 @@
1/* arch/arm26/kernel/entry.S
2 *
3 * Assembled from chunks of code in arch/arm
4 *
5 * Copyright (C) 2003 Ian Molton
6 * Based on the work of RMK.
7 *
8 */
9
10#include <linux/linkage.h>
11
12#include <asm/assembler.h>
13#include <asm/asm-offsets.h>
14#include <asm/errno.h>
15#include <asm/hardware.h>
16#include <asm/sysirq.h>
17#include <asm/thread_info.h>
18#include <asm/page.h>
19#include <asm/ptrace.h>
20
21 .macro zero_fp
22#ifndef CONFIG_NO_FRAME_POINTER
23 mov fp, #0
24#endif
25 .endm
26
27 .text
28
29@ Bad Abort numbers
30@ -----------------
31@
32#define BAD_PREFETCH 0
33#define BAD_DATA 1
34#define BAD_ADDREXCPTN 2
35#define BAD_IRQ 3
36#define BAD_UNDEFINSTR 4
37
38@ OS version number used in SWIs
39@ RISC OS is 0
40@ RISC iX is 8
41@
42#define OS_NUMBER 9
43#define ARMSWI_OFFSET 0x000f0000
44
45@
46@ Stack format (ensured by USER_* and SVC_*)
47@ PSR and PC are comined on arm26
48@
49
50#define S_OFF 8
51
52#define S_OLD_R0 64
53#define S_PC 60
54#define S_LR 56
55#define S_SP 52
56#define S_IP 48
57#define S_FP 44
58#define S_R10 40
59#define S_R9 36
60#define S_R8 32
61#define S_R7 28
62#define S_R6 24
63#define S_R5 20
64#define S_R4 16
65#define S_R3 12
66#define S_R2 8
67#define S_R1 4
68#define S_R0 0
69
70 .macro save_user_regs
71 str r0, [sp, #-4]! @ Store SVC r0
72 str lr, [sp, #-4]! @ Store user mode PC
73 sub sp, sp, #15*4
74 stmia sp, {r0 - lr}^ @ Store the other user-mode regs
75 mov r0, r0
76 .endm
77
78 .macro slow_restore_user_regs
79 ldmia sp, {r0 - lr}^ @ restore the user regs not including PC
80 mov r0, r0
81 ldr lr, [sp, #15*4] @ get user PC
82 add sp, sp, #15*4+8 @ free stack
83 movs pc, lr @ return
84 .endm
85
86 .macro fast_restore_user_regs
87 add sp, sp, #S_OFF
88 ldmib sp, {r1 - lr}^
89 mov r0, r0
90 ldr lr, [sp, #15*4]
91 add sp, sp, #15*4+8
92 movs pc, lr
93 .endm
94
95 .macro save_svc_regs
96 str sp, [sp, #-16]!
97 str lr, [sp, #8]
98 str lr, [sp, #4]
99 stmfd sp!, {r0 - r12}
100 mov r0, #-1
101 str r0, [sp, #S_OLD_R0]
102 zero_fp
103 .endm
104
105 .macro save_svc_regs_irq
106 str sp, [sp, #-16]!
107 str lr, [sp, #4]
108 ldr lr, .LCirq
109 ldr lr, [lr]
110 str lr, [sp, #8]
111 stmfd sp!, {r0 - r12}
112 mov r0, #-1
113 str r0, [sp, #S_OLD_R0]
114 zero_fp
115 .endm
116
117 .macro restore_svc_regs
118 ldmfd sp, {r0 - pc}^
119 .endm
120
121 .macro mask_pc, rd, rm
122 bic \rd, \rm, #PCMASK
123 .endm
124
125 .macro disable_irqs, temp
126 mov \temp, pc
127 orr \temp, \temp, #PSR_I_BIT
128 teqp \temp, #0
129 .endm
130
131 .macro enable_irqs, temp
132 mov \temp, pc
133 and \temp, \temp, #~PSR_I_BIT
134 teqp \temp, #0
135 .endm
136
137 .macro initialise_traps_extra
138 .endm
139
140 .macro get_thread_info, rd
141 mov \rd, sp, lsr #13
142 mov \rd, \rd, lsl #13
143 .endm
144
145/*
146 * These are the registers used in the syscall handler, and allow us to
147 * have in theory up to 7 arguments to a function - r0 to r6.
148 *
149 * Note that tbl == why is intentional.
150 *
151 * We must set at least "tsk" and "why" when calling ret_with_reschedule.
152 */
153scno .req r7 @ syscall number
154tbl .req r8 @ syscall table pointer
155why .req r8 @ Linux syscall (!= 0)
156tsk .req r9 @ current thread_info
157
158/*
159 * Get the system call number.
160 */
161 .macro get_scno
162 mask_pc lr, lr
163 ldr scno, [lr, #-4] @ get SWI instruction
164 .endm
165/*
166 * -----------------------------------------------------------------------
167 */
168
169/*
170 * We rely on the fact that R0 is at the bottom of the stack (due to
171 * slow/fast restore user regs).
172 */
173#if S_R0 != 0
174#error "Please fix"
175#endif
176
177/*
178 * This is the fast syscall return path. We do as little as
179 * possible here, and this includes saving r0 back into the SVC
180 * stack.
181 */
182ret_fast_syscall:
183 disable_irqs r1 @ disable interrupts
184 ldr r1, [tsk, #TI_FLAGS]
185 tst r1, #_TIF_WORK_MASK
186 bne fast_work_pending
187 fast_restore_user_regs
188
189/*
190 * Ok, we need to do extra processing, enter the slow path.
191 */
192fast_work_pending:
193 str r0, [sp, #S_R0+S_OFF]! @ returned r0
194work_pending:
195 tst r1, #_TIF_NEED_RESCHED
196 bne work_resched
197 tst r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING
198 beq no_work_pending
199 mov r0, sp @ 'regs'
200 mov r2, why @ 'syscall'
201 bl do_notify_resume
202 disable_irqs r1 @ disable interrupts
203 b no_work_pending
204
205work_resched:
206 bl schedule
207/*
208 * "slow" syscall return path. "why" tells us if this was a real syscall.
209 */
210ENTRY(ret_to_user)
211ret_slow_syscall:
212 disable_irqs r1 @ disable interrupts
213 ldr r1, [tsk, #TI_FLAGS]
214 tst r1, #_TIF_WORK_MASK
215 bne work_pending
216no_work_pending:
217 slow_restore_user_regs
218
219/*
220 * This is how we return from a fork.
221 */
222ENTRY(ret_from_fork)
223 bl schedule_tail
224 get_thread_info tsk
225 ldr r1, [tsk, #TI_FLAGS] @ check for syscall tracing
226 mov why, #1
227 tst r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
228 beq ret_slow_syscall
229 mov r1, sp
230 mov r0, #1 @ trace exit [IP = 1]
231 bl syscall_trace
232 b ret_slow_syscall
233
234// FIXME - is this strictly necessary?
235#include "calls.S"
236
237/*=============================================================================
238 * SWI handler
239 *-----------------------------------------------------------------------------
240 */
241
242 .align 5
243ENTRY(vector_swi)
244 save_user_regs
245 zero_fp
246 get_scno
247
248 enable_irqs ip
249
250 str r4, [sp, #-S_OFF]! @ push fifth arg
251
252 get_thread_info tsk
253 ldr ip, [tsk, #TI_FLAGS] @ check for syscall tracing
254 bic scno, scno, #0xff000000 @ mask off SWI op-code
255 eor scno, scno, #OS_NUMBER << 20 @ check OS number
256 adr tbl, sys_call_table @ load syscall table pointer
257 tst ip, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
258 bne __sys_trace
259
260 adral lr, ret_fast_syscall @ set return address
261 orral lr, lr, #PSR_I_BIT | MODE_SVC26 @ Force SVC mode on return
262 cmp scno, #NR_syscalls @ check upper syscall limit
263 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
264
265 add r1, sp, #S_OFF
2662: mov why, #0 @ no longer a real syscall
267 cmp scno, #ARMSWI_OFFSET
268 eor r0, scno, #OS_NUMBER << 20 @ put OS number back
269 bcs arm_syscall
270 b sys_ni_syscall @ not private func
271
272 /*
273 * This is the really slow path. We're going to be doing
274 * context switches, and waiting for our parent to respond.
275 */
276__sys_trace:
277 add r1, sp, #S_OFF
278 mov r0, #0 @ trace entry [IP = 0]
279 bl syscall_trace
280
281 adral lr, __sys_trace_return @ set return address
282 orral lr, lr, #PSR_I_BIT | MODE_SVC26 @ Force SVC mode on return
283 add r1, sp, #S_R0 + S_OFF @ pointer to regs
284 cmp scno, #NR_syscalls @ check upper syscall limit
285 ldmccia r1, {r0 - r3} @ have to reload r0 - r3
286 ldrcc pc, [tbl, scno, lsl #2] @ call sys_* routine
287 b 2b
288
289__sys_trace_return:
290 str r0, [sp, #S_R0 + S_OFF]! @ save returned r0
291 mov r1, sp
292 mov r0, #1 @ trace exit [IP = 1]
293 bl syscall_trace
294 b ret_slow_syscall
295
296 .align 5
297
298 .type sys_call_table, #object
299ENTRY(sys_call_table)
300#include "calls.S"
301
302/*============================================================================
303 * Special system call wrappers
304 */
305@ r0 = syscall number
306@ r5 = syscall table
307 .type sys_syscall, #function
308sys_syscall:
309 eor scno, r0, #OS_NUMBER << 20
310 cmp scno, #NR_syscalls @ check range
311 stmleia sp, {r5, r6} @ shuffle args
312 movle r0, r1
313 movle r1, r2
314 movle r2, r3
315 movle r3, r4
316 ldrle pc, [tbl, scno, lsl #2]
317 b sys_ni_syscall
318
319sys_fork_wrapper:
320 add r0, sp, #S_OFF
321 b sys_fork
322
323sys_vfork_wrapper:
324 add r0, sp, #S_OFF
325 b sys_vfork
326
327sys_execve_wrapper:
328 add r3, sp, #S_OFF
329 b sys_execve
330
331sys_clone_wapper:
332 add r2, sp, #S_OFF
333 b sys_clone
334
335sys_sigsuspend_wrapper:
336 add r3, sp, #S_OFF
337 b sys_sigsuspend
338
339sys_rt_sigsuspend_wrapper:
340 add r2, sp, #S_OFF
341 b sys_rt_sigsuspend
342
343sys_sigreturn_wrapper:
344 add r0, sp, #S_OFF
345 b sys_sigreturn
346
347sys_rt_sigreturn_wrapper:
348 add r0, sp, #S_OFF
349 b sys_rt_sigreturn
350
351sys_sigaltstack_wrapper:
352 ldr r2, [sp, #S_OFF + S_SP]
353 b do_sigaltstack
354
355/*
356 * Note: off_4k (r5) is always units of 4K. If we can't do the requested
357 * offset, we return EINVAL. FIXME - this lost some stuff from arm32 to
358 * ifdefs. check it out.
359 */
360sys_mmap2:
361 tst r5, #((1 << (PAGE_SHIFT - 12)) - 1)
362 moveq r5, r5, lsr #PAGE_SHIFT - 12
363 streq r5, [sp, #4]
364 beq do_mmap2
365 mov r0, #-EINVAL
366 RETINSTR(mov,pc, lr)
367
368/*
369 * Design issues:
370 * - We have several modes that each vector can be called from,
371 * each with its own set of registers. On entry to any vector,
372 * we *must* save the registers used in *that* mode.
373 *
374 * - This code must be as fast as possible.
375 *
376 * There are a few restrictions on the vectors:
377 * - the SWI vector cannot be called from *any* non-user mode
378 *
379 * - the FP emulator is *never* called from *any* non-user mode undefined
380 * instruction.
381 *
382 */
383
384 .text
385
386 .macro handle_irq
3871: mov r4, #IOC_BASE
388 ldrb r6, [r4, #0x24] @ get high priority first
389 adr r5, irq_prio_h
390 teq r6, #0
391 ldreqb r6, [r4, #0x14] @ get low priority
392 adreq r5, irq_prio_l
393
394 teq r6, #0 @ If an IRQ happened...
395 ldrneb r0, [r5, r6] @ get IRQ number
396 movne r1, sp @ get struct pt_regs
397 adrne lr, 1b @ Set return address to 1b
398 orrne lr, lr, #PSR_I_BIT | MODE_SVC26 @ (and force SVC mode)
399 bne asm_do_IRQ @ process IRQ (if asserted)
400 .endm
401
402
403/*
404 * Interrupt table (incorporates priority)
405 */
406 .macro irq_prio_table
407irq_prio_l: .byte 0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
408 .byte 4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
409 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
410 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
411 .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
412 .byte 6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
413 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
414 .byte 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
415 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
416 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
417 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
418 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
419 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
420 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
421 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
422 .byte 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
423irq_prio_h: .byte 0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
424 .byte 12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
425 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
426 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
427 .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
428 .byte 14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
429 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
430 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
431 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
432 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
433 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
434 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
435 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
436 .byte 15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
437 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
438 .byte 13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
439 .endm
440
441#if 1
442/*
443 * Uncomment these if you wish to get more debugging into about data aborts.
444 * FIXME - I bet we can find a way to encode these and keep performance.
445 */
446#define FAULT_CODE_LDRSTRPOST 0x80
447#define FAULT_CODE_LDRSTRPRE 0x40
448#define FAULT_CODE_LDRSTRREG 0x20
449#define FAULT_CODE_LDMSTM 0x10
450#define FAULT_CODE_LDCSTC 0x08
451#endif
452#define FAULT_CODE_PREFETCH 0x04
453#define FAULT_CODE_WRITE 0x02
454#define FAULT_CODE_FORCECOW 0x01
455
456/*=============================================================================
457 * Undefined FIQs
458 *-----------------------------------------------------------------------------
459 */
460_unexp_fiq: ldr sp, .LCfiq
461 mov r12, #IOC_BASE
462 strb r12, [r12, #0x38] @ Disable FIQ register
463 teqp pc, #PSR_I_BIT | PSR_F_BIT | MODE_SVC26
464 mov r0, r0
465 stmfd sp!, {r0 - r3, ip, lr}
466 adr r0, Lfiqmsg
467 bl printk
468 ldmfd sp!, {r0 - r3, ip, lr}
469 teqp pc, #PSR_I_BIT | PSR_F_BIT | MODE_FIQ26
470 mov r0, r0
471 movs pc, lr
472
473Lfiqmsg: .ascii "*** Unexpected FIQ\n\0"
474 .align
475
476.LCfiq: .word __temp_fiq
477.LCirq: .word __temp_irq
478
479/*=============================================================================
480 * Undefined instruction handler
481 *-----------------------------------------------------------------------------
482 * Handles floating point instructions
483 */
484vector_undefinstr:
485 tst lr, #MODE_SVC26 @ did we come from a non-user mode?
486 bne __und_svc @ yes - deal with it.
487/* Otherwise, fall through for the user-space (common) case. */
488 save_user_regs
489 zero_fp @ zero frame pointer
490 teqp pc, #PSR_I_BIT | MODE_SVC26 @ disable IRQs
491.Lbug_undef:
492 ldr r4, .LC2
493 ldr pc, [r4] @ Call FP module entry point
494/* FIXME - should we trap for a null pointer here? */
495
496/* The SVC mode case */
497__und_svc: save_svc_regs @ Non-user mode
498 mask_pc r0, lr
499 and r2, lr, #3
500 sub r0, r0, #4
501 mov r1, sp
502 bl do_undefinstr
503 restore_svc_regs
504
505/* We get here if the FP emulator doesnt handle the undef instr.
506 * If the insn WAS handled, the emulator jumps to ret_from_exception by itself/
507 */
508 .globl fpundefinstr
509fpundefinstr:
510 mov r0, lr
511 mov r1, sp
512 teqp pc, #MODE_SVC26
513 bl do_undefinstr
514 b ret_from_exception @ Normal FP exit
515
516#if defined CONFIG_FPE_NWFPE || defined CONFIG_FPE_FASTFPE
517 /* The FPE is always present */
518 .equ fpe_not_present, 0
519#else
520/* We get here if an undefined instruction happens and the floating
521 * point emulator is not present. If the offending instruction was
522 * a WFS, we just perform a normal return as if we had emulated the
523 * operation. This is a hack to allow some basic userland binaries
524 * to run so that the emulator module proper can be loaded. --philb
525 * FIXME - probably a broken useless hack...
526 */
527fpe_not_present:
528 adr r10, wfs_mask_data
529 ldmia r10, {r4, r5, r6, r7, r8}
530 ldr r10, [sp, #S_PC] @ Load PC
531 sub r10, r10, #4
532 mask_pc r10, r10
533 ldrt r10, [r10] @ get instruction
534 and r5, r10, r5
535 teq r5, r4 @ Is it WFS?
536 beq ret_from_exception
537 and r5, r10, r8
538 teq r5, r6 @ Is it LDF/STF on sp or fp?
539 teqne r5, r7
540 bne fpundefinstr
541 tst r10, #0x00200000 @ Does it have WB
542 beq ret_from_exception
543 and r4, r10, #255 @ get offset
544 and r6, r10, #0x000f0000
545 tst r10, #0x00800000 @ +/-
546 ldr r5, [sp, r6, lsr #14] @ Load reg
547 rsbeq r4, r4, #0
548 add r5, r5, r4, lsl #2
549 str r5, [sp, r6, lsr #14] @ Save reg
550 b ret_from_exception
551
552wfs_mask_data: .word 0x0e200110 @ WFS/RFS
553 .word 0x0fef0fff
554 .word 0x0d0d0100 @ LDF [sp]/STF [sp]
555 .word 0x0d0b0100 @ LDF [fp]/STF [fp]
556 .word 0x0f0f0f00
557#endif
558
559.LC2: .word fp_enter
560
561/*=============================================================================
562 * Prefetch abort handler
563 *-----------------------------------------------------------------------------
564 */
565#define DEBUG_UNDEF
566/* remember: lr = USR pc */
567vector_prefetch:
568 sub lr, lr, #4
569 tst lr, #MODE_SVC26
570 bne __pabt_invalid
571 save_user_regs
572 teqp pc, #MODE_SVC26 @ Enable IRQs...
573 mask_pc r0, lr @ Address of abort
574 mov r1, sp @ Tasks registers
575 bl do_PrefetchAbort
576 teq r0, #0 @ If non-zero, we believe this abort..
577 bne ret_from_exception
578#ifdef DEBUG_UNDEF
579 adr r0, t
580 bl printk
581#endif
582 ldr lr, [sp,#S_PC] @ FIXME program to test this on. I think its
583 b .Lbug_undef @ broken at the moment though!)
584
585__pabt_invalid: save_svc_regs
586 mov r0, sp @ Prefetch aborts are definitely *not*
587 mov r1, #BAD_PREFETCH @ allowed in non-user modes. We cant
588 and r2, lr, #3 @ recover from this problem.
589 b bad_mode
590
591#ifdef DEBUG_UNDEF
592t: .ascii "*** undef ***\r\n\0"
593 .align
594#endif
595
596/*=============================================================================
597 * Address exception handler
598 *-----------------------------------------------------------------------------
599 * These aren't too critical.
600 * (they're not supposed to happen).
601 * In order to debug the reason for address exceptions in non-user modes,
602 * we have to obtain all the registers so that we can see what's going on.
603 */
604
605vector_addrexcptn:
606 sub lr, lr, #8
607 tst lr, #3
608 bne Laddrexcptn_not_user
609 save_user_regs
610 teq pc, #MODE_SVC26
611 mask_pc r0, lr @ Point to instruction
612 mov r1, sp @ Point to registers
613 mov r2, #0x400
614 mov lr, pc
615 bl do_excpt
616 b ret_from_exception
617
618Laddrexcptn_not_user:
619 save_svc_regs
620 and r2, lr, #3
621 teq r2, #3
622 bne Laddrexcptn_illegal_mode
623 teqp pc, #MODE_SVC26
624 mask_pc r0, lr
625 mov r1, sp
626 orr r2, r2, #0x400
627 bl do_excpt
628 ldmia sp, {r0 - lr} @ I cant remember the reason I changed this...
629 add sp, sp, #15*4
630 movs pc, lr
631
632Laddrexcptn_illegal_mode:
633 mov r0, sp
634 str lr, [sp, #-4]!
635 orr r1, r2, #PSR_I_BIT | PSR_F_BIT
636 teqp r1, #0 @ change into mode (wont be user mode)
637 mov r0, r0
638 mov r1, r8 @ Any register from r8 - r14 can be banked
639 mov r2, r9
640 mov r3, r10
641 mov r4, r11
642 mov r5, r12
643 mov r6, r13
644 mov r7, r14
645 teqp pc, #PSR_F_BIT | MODE_SVC26 @ back to svc
646 mov r0, r0
647 stmfd sp!, {r1-r7}
648 ldmia r0, {r0-r7}
649 stmfd sp!, {r0-r7}
650 mov r0, sp
651 mov r1, #BAD_ADDREXCPTN
652 b bad_mode
653
654/*=============================================================================
655 * Interrupt (IRQ) handler
656 *-----------------------------------------------------------------------------
657 * Note: if the IRQ was taken whilst in user mode, then *no* kernel routine
658 * is running, so do not have to save svc lr.
659 *
660 * Entered in IRQ mode.
661 */
662
663vector_IRQ: ldr sp, .LCirq @ Setup some temporary stack
664 sub lr, lr, #4
665 str lr, [sp] @ push return address
666
667 tst lr, #3
668 bne __irq_non_usr
669
670__irq_usr: teqp pc, #PSR_I_BIT | MODE_SVC26 @ Enter SVC mode
671 mov r0, r0
672
673 ldr lr, .LCirq
674 ldr lr, [lr] @ Restore lr for jump back to USR
675
676 save_user_regs
677
678 handle_irq
679
680 mov why, #0
681 get_thread_info tsk
682 b ret_to_user
683
684@ Place the IRQ priority table here so that the handle_irq macros above
685@ and below here can access it.
686
687 irq_prio_table
688
689__irq_non_usr: teqp pc, #PSR_I_BIT | MODE_SVC26 @ Enter SVC mode
690 mov r0, r0
691
692 save_svc_regs_irq
693
694 and r2, lr, #3
695 teq r2, #3
696 bne __irq_invalid @ IRQ not from SVC mode
697
698 handle_irq
699
700 restore_svc_regs
701
702__irq_invalid: mov r0, sp
703 mov r1, #BAD_IRQ
704 b bad_mode
705
706/*=============================================================================
707 * Data abort handler code
708 *-----------------------------------------------------------------------------
709 *
710 * This handles both exceptions from user and SVC modes, computes the address
711 * range of the problem, and does any correction that is required. It then
712 * calls the kernel data abort routine.
713 *
714 * This is where I wish that the ARM would tell you which address aborted.
715 */
716
717vector_data: sub lr, lr, #8 @ Correct lr
718 tst lr, #3
719 bne Ldata_not_user
720 save_user_regs
721 teqp pc, #MODE_SVC26
722 mask_pc r0, lr
723 bl Ldata_do
724 b ret_from_exception
725
726Ldata_not_user:
727 save_svc_regs
728 and r2, lr, #3
729 teq r2, #3
730 bne Ldata_illegal_mode
731 tst lr, #PSR_I_BIT
732 teqeqp pc, #MODE_SVC26
733 mask_pc r0, lr
734 bl Ldata_do
735 restore_svc_regs
736
737Ldata_illegal_mode:
738 mov r0, sp
739 mov r1, #BAD_DATA
740 b bad_mode
741
742Ldata_do: mov r3, sp
743 ldr r4, [r0] @ Get instruction
744 mov r2, #0
745 tst r4, #1 << 20 @ Check to see if it is a write instruction
746 orreq r2, r2, #FAULT_CODE_WRITE @ Indicate write instruction
747 mov r1, r4, lsr #22 @ Now branch to the relevent processing routine
748 and r1, r1, #15 << 2
749 add pc, pc, r1
750 movs pc, lr
751 b Ldata_unknown
752 b Ldata_unknown
753 b Ldata_unknown
754 b Ldata_unknown
755 b Ldata_ldrstr_post @ ldr rd, [rn], #m
756 b Ldata_ldrstr_numindex @ ldr rd, [rn, #m] @ RegVal
757 b Ldata_ldrstr_post @ ldr rd, [rn], rm
758 b Ldata_ldrstr_regindex @ ldr rd, [rn, rm]
759 b Ldata_ldmstm @ ldm*a rn, <rlist>
760 b Ldata_ldmstm @ ldm*b rn, <rlist>
761 b Ldata_unknown
762 b Ldata_unknown
763 b Ldata_ldrstr_post @ ldc rd, [rn], #m @ Same as ldr rd, [rn], #m
764 b Ldata_ldcstc_pre @ ldc rd, [rn, #m]
765 b Ldata_unknown
766Ldata_unknown: @ Part of jumptable
767 mov r0, r1
768 mov r1, r4
769 mov r2, r3
770 b baddataabort
771
772Ldata_ldrstr_post:
773 mov r0, r4, lsr #14 @ Get Rn
774 and r0, r0, #15 << 2 @ Mask out reg.
775 teq r0, #15 << 2
776 ldr r0, [r3, r0] @ Get register
777 biceq r0, r0, #PCMASK
778 mov r1, r0
779#ifdef FAULT_CODE_LDRSTRPOST
780 orr r2, r2, #FAULT_CODE_LDRSTRPOST
781#endif
782 b do_DataAbort
783
784Ldata_ldrstr_numindex:
785 mov r0, r4, lsr #14 @ Get Rn
786 and r0, r0, #15 << 2 @ Mask out reg.
787 teq r0, #15 << 2
788 ldr r0, [r3, r0] @ Get register
789 mov r1, r4, lsl #20
790 biceq r0, r0, #PCMASK
791 tst r4, #1 << 23
792 addne r0, r0, r1, lsr #20
793 subeq r0, r0, r1, lsr #20
794 mov r1, r0
795#ifdef FAULT_CODE_LDRSTRPRE
796 orr r2, r2, #FAULT_CODE_LDRSTRPRE
797#endif
798 b do_DataAbort
799
800Ldata_ldrstr_regindex:
801 mov r0, r4, lsr #14 @ Get Rn
802 and r0, r0, #15 << 2 @ Mask out reg.
803 teq r0, #15 << 2
804 ldr r0, [r3, r0] @ Get register
805 and r7, r4, #15
806 biceq r0, r0, #PCMASK
807 teq r7, #15 @ Check for PC
808 ldr r7, [r3, r7, lsl #2] @ Get Rm
809 and r8, r4, #0x60 @ Get shift types
810 biceq r7, r7, #PCMASK
811 mov r9, r4, lsr #7 @ Get shift amount
812 and r9, r9, #31
813 teq r8, #0
814 moveq r7, r7, lsl r9
815 teq r8, #0x20 @ LSR shift
816 moveq r7, r7, lsr r9
817 teq r8, #0x40 @ ASR shift
818 moveq r7, r7, asr r9
819 teq r8, #0x60 @ ROR shift
820 moveq r7, r7, ror r9
821 tst r4, #1 << 23
822 addne r0, r0, r7
823 subeq r0, r0, r7 @ Apply correction
824 mov r1, r0
825#ifdef FAULT_CODE_LDRSTRREG
826 orr r2, r2, #FAULT_CODE_LDRSTRREG
827#endif
828 b do_DataAbort
829
830Ldata_ldmstm:
831 mov r7, #0x11
832 orr r7, r7, r7, lsl #8
833 and r0, r4, r7
834 and r1, r4, r7, lsl #1
835 add r0, r0, r1, lsr #1
836 and r1, r4, r7, lsl #2
837 add r0, r0, r1, lsr #2
838 and r1, r4, r7, lsl #3
839 add r0, r0, r1, lsr #3
840 add r0, r0, r0, lsr #8
841 add r0, r0, r0, lsr #4
842 and r7, r0, #15 @ r7 = no. of registers to transfer.
843 mov r5, r4, lsr #14 @ Get Rn
844 and r5, r5, #15 << 2
845 ldr r0, [r3, r5] @ Get reg
846 eor r6, r4, r4, lsl #2
847 tst r6, #1 << 23 @ Check inc/dec ^ writeback
848 rsbeq r7, r7, #0
849 add r7, r0, r7, lsl #2 @ Do correction (signed)
850 subne r1, r7, #1
851 subeq r1, r0, #1
852 moveq r0, r7
853 tst r4, #1 << 21 @ Check writeback
854 strne r7, [r3, r5]
855 eor r6, r4, r4, lsl #1
856 tst r6, #1 << 24 @ Check Pre/Post ^ inc/dec
857 addeq r0, r0, #4
858 addeq r1, r1, #4
859 teq r5, #15*4 @ CHECK FOR PC
860 biceq r1, r1, #PCMASK
861 biceq r0, r0, #PCMASK
862#ifdef FAULT_CODE_LDMSTM
863 orr r2, r2, #FAULT_CODE_LDMSTM
864#endif
865 b do_DataAbort
866
867Ldata_ldcstc_pre:
868 mov r0, r4, lsr #14 @ Get Rn
869 and r0, r0, #15 << 2 @ Mask out reg.
870 teq r0, #15 << 2
871 ldr r0, [r3, r0] @ Get register
872 mov r1, r4, lsl #24 @ Get offset
873 biceq r0, r0, #PCMASK
874 tst r4, #1 << 23
875 addne r0, r0, r1, lsr #24
876 subeq r0, r0, r1, lsr #24
877 mov r1, r0
878#ifdef FAULT_CODE_LDCSTC
879 orr r2, r2, #FAULT_CODE_LDCSTC
880#endif
881 b do_DataAbort
882
883
884/*
885 * This is the return code to user mode for abort handlers
886 */
887ENTRY(ret_from_exception)
888 get_thread_info tsk
889 mov why, #0
890 b ret_to_user
891
892 .data
893ENTRY(fp_enter)
894 .word fpe_not_present
895 .text
896/*
897 * Register switch for older 26-bit only ARMs
898 */
899ENTRY(__switch_to)
900 add r0, r0, #TI_CPU_SAVE
901 stmia r0, {r4 - sl, fp, sp, lr}
902 add r1, r1, #TI_CPU_SAVE
903 ldmia r1, {r4 - sl, fp, sp, pc}^
904
905/*
906 *=============================================================================
907 * Low-level interface code
908 *-----------------------------------------------------------------------------
909 * Trap initialisation
910 *-----------------------------------------------------------------------------
911 *
912 * Note - FIQ code has changed. The default is a couple of words in 0x1c, 0x20
913 * that call _unexp_fiq. Nowever, we now copy the FIQ routine to 0x1c (removes
914 * some excess cycles).
915 *
916 * What we need to put into 0-0x1c are branches to branch to the kernel.
917 */
918
919 .section ".init.text",#alloc,#execinstr
920
921.Ljump_addresses:
922 swi SYS_ERROR0
923 .word vector_undefinstr - 12
924 .word vector_swi - 16
925 .word vector_prefetch - 20
926 .word vector_data - 24
927 .word vector_addrexcptn - 28
928 .word vector_IRQ - 32
929 .word _unexp_fiq - 36
930 b . + 8
931/*
932 * initialise the trap system
933 */
934ENTRY(__trap_init)
935 stmfd sp!, {r4 - r7, lr}
936 adr r1, .Ljump_addresses
937 ldmia r1, {r1 - r7, ip, lr}
938 orr r2, lr, r2, lsr #2
939 orr r3, lr, r3, lsr #2
940 orr r4, lr, r4, lsr #2
941 orr r5, lr, r5, lsr #2
942 orr r6, lr, r6, lsr #2
943 orr r7, lr, r7, lsr #2
944 orr ip, lr, ip, lsr #2
945 mov r0, #0
946 stmia r0, {r1 - r7, ip}
947 ldmfd sp!, {r4 - r7, pc}^
948
949 .bss
950__temp_irq: .space 4 @ saved lr_irq
951__temp_fiq: .space 128
diff --git a/arch/arm26/kernel/fiq.c b/arch/arm26/kernel/fiq.c
deleted file mode 100644
index c4776c96be6b..000000000000
--- a/arch/arm26/kernel/fiq.c
+++ /dev/null
@@ -1,201 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/fiq.c
3 *
4 * Copyright (C) 1998 Russell King
5 * Copyright (C) 1998, 1999 Phil Blundell
6 * Copyright (C) 2003 Ian Molton
7 *
8 * FIQ support written by Philip Blundell <philb@gnu.org>, 1998.
9 *
10 * FIQ support re-written by Russell King to be more generic
11 *
12 * We now properly support a method by which the FIQ handlers can
13 * be stacked onto the vector. We still do not support sharing
14 * the FIQ vector itself.
15 *
16 * Operation is as follows:
17 * 1. Owner A claims FIQ:
18 * - default_fiq relinquishes control.
19 * 2. Owner A:
20 * - inserts code.
21 * - sets any registers,
22 * - enables FIQ.
23 * 3. Owner B claims FIQ:
24 * - if owner A has a relinquish function.
25 * - disable FIQs.
26 * - saves any registers.
27 * - returns zero.
28 * 4. Owner B:
29 * - inserts code.
30 * - sets any registers,
31 * - enables FIQ.
32 * 5. Owner B releases FIQ:
33 * - Owner A is asked to reacquire FIQ:
34 * - inserts code.
35 * - restores saved registers.
36 * - enables FIQ.
37 * 6. Goto 3
38 */
39#include <linux/module.h>
40#include <linux/mm.h>
41#include <linux/mman.h>
42#include <linux/init.h>
43#include <linux/seq_file.h>
44
45#include <asm/fiq.h>
46#include <asm/io.h>
47#include <asm/irq.h>
48#include <asm/pgalloc.h>
49#include <asm/system.h>
50#include <asm/uaccess.h>
51
52#define FIQ_VECTOR (vectors_base() + 0x1c)
53
54static unsigned long no_fiq_insn;
55
56#define unprotect_page_0()
57#define protect_page_0()
58
59/* Default reacquire function
60 * - we always relinquish FIQ control
61 * - we always reacquire FIQ control
62 */
63static int fiq_def_op(void *ref, int relinquish)
64{
65 if (!relinquish) {
66 unprotect_page_0();
67 *(unsigned long *)FIQ_VECTOR = no_fiq_insn;
68 protect_page_0();
69 }
70
71 return 0;
72}
73
74static struct fiq_handler default_owner = {
75 .name = "default",
76 .fiq_op = fiq_def_op,
77};
78
79static struct fiq_handler *current_fiq = &default_owner;
80
81int show_fiq_list(struct seq_file *p, void *v)
82{
83 if (current_fiq != &default_owner)
84 seq_printf(p, "FIQ: %s\n", current_fiq->name);
85
86 return 0;
87}
88
89void set_fiq_handler(void *start, unsigned int length)
90{
91 unprotect_page_0();
92
93 memcpy((void *)FIQ_VECTOR, start, length);
94
95 protect_page_0();
96}
97
98/*
99 * Taking an interrupt in FIQ mode is death, so both these functions
100 * disable irqs for the duration.
101 */
102void set_fiq_regs(struct pt_regs *regs)
103{
104 register unsigned long tmp, tmp2;
105 __asm__ volatile (
106 "mov %0, pc \n"
107 "bic %1, %0, #0x3 \n"
108 "orr %1, %1, %3 \n"
109 "teqp %1, #0 @ select FIQ mode \n"
110 "mov r0, r0 \n"
111 "ldmia %2, {r8 - r14} \n"
112 "teqp %0, #0 @ return to SVC mode \n"
113 "mov r0, r0 "
114 : "=&r" (tmp), "=&r" (tmp2)
115 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | MODE_FIQ26)
116 /* These registers aren't modified by the above code in a way
117 visible to the compiler, but we mark them as clobbers anyway
118 so that GCC won't put any of the input or output operands in
119 them. */
120 : "r8", "r9", "r10", "r11", "r12", "r13", "r14");
121}
122
123void get_fiq_regs(struct pt_regs *regs)
124{
125 register unsigned long tmp, tmp2;
126 __asm__ volatile (
127 "mov %0, pc \n"
128 "bic %1, %0, #0x3 \n"
129 "orr %1, %1, %3 \n"
130 "teqp %1, #0 @ select FIQ mode \n"
131 "mov r0, r0 \n"
132 "stmia %2, {r8 - r14} \n"
133 "teqp %0, #0 @ return to SVC mode \n"
134 "mov r0, r0 "
135 : "=&r" (tmp), "=&r" (tmp2)
136 : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | MODE_FIQ26)
137 /* These registers aren't modified by the above code in a way
138 visible to the compiler, but we mark them as clobbers anyway
139 so that GCC won't put any of the input or output operands in
140 them. */
141 : "r8", "r9", "r10", "r11", "r12", "r13", "r14");
142}
143
144int claim_fiq(struct fiq_handler *f)
145{
146 int ret = 0;
147
148 if (current_fiq) {
149 ret = -EBUSY;
150
151 if (current_fiq->fiq_op != NULL)
152 ret = current_fiq->fiq_op(current_fiq->dev_id, 1);
153 }
154
155 if (!ret) {
156 f->next = current_fiq;
157 current_fiq = f;
158 }
159
160 return ret;
161}
162
163void release_fiq(struct fiq_handler *f)
164{
165 if (current_fiq != f) {
166 printk(KERN_ERR "%s FIQ trying to release %s FIQ\n",
167 f->name, current_fiq->name);
168#ifdef CONFIG_DEBUG_ERRORS
169 __backtrace();
170#endif
171 return;
172 }
173
174 do
175 current_fiq = current_fiq->next;
176 while (current_fiq->fiq_op(current_fiq->dev_id, 0));
177}
178
179void enable_fiq(int fiq)
180{
181 enable_irq(fiq + FIQ_START);
182}
183
184void disable_fiq(int fiq)
185{
186 disable_irq(fiq + FIQ_START);
187}
188
189EXPORT_SYMBOL(set_fiq_handler);
190EXPORT_SYMBOL(set_fiq_regs);
191EXPORT_SYMBOL(get_fiq_regs);
192EXPORT_SYMBOL(claim_fiq);
193EXPORT_SYMBOL(release_fiq);
194EXPORT_SYMBOL(enable_fiq);
195EXPORT_SYMBOL(disable_fiq);
196
197void __init init_FIQ(void)
198{
199 no_fiq_insn = *(unsigned long *)FIQ_VECTOR;
200 set_fs(get_fs());
201}
diff --git a/arch/arm26/kernel/head.S b/arch/arm26/kernel/head.S
deleted file mode 100644
index 93575e0e58fe..000000000000
--- a/arch/arm26/kernel/head.S
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/head.S
3 *
4 * Copyright (C) 1994-2000 Russell King
5 * Copyright (C) 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * 26-bit kernel startup code
12 */
13#include <linux/linkage.h>
14#include <asm/mach-types.h>
15
16 .globl swapper_pg_dir
17 .equ swapper_pg_dir, 0x0207d000
18
19/*
20 * Entry point.
21 */
22 .section ".init.text",#alloc,#execinstr
23ENTRY(stext)
24
25__entry:
26 cmp pc, #0x02000000
27 ldrlt pc, LC0 @ if 0x01800000, call at 0x02080000
28 teq r0, #0 @ Check for old calling method
29 blne oldparams @ Move page if old
30
31 adr r0, LC0
32 ldmib r0, {r2-r5, sp} @ Setup stack (and fetch other values)
33
34 mov r0, #0 @ Clear BSS
351: cmp r2, r3
36 strcc r0, [r2], #4
37 bcc 1b
38
39 bl detect_proc_type
40 str r0, [r4]
41 bl detect_arch_type
42 str r0, [r5]
43
44#ifdef CONFIG_XIP_KERNEL
45 ldr r3, ETEXT @ data section copy
46 ldr r4, SDATA
47 ldr r5, EDATA
481:
49 ldr r6, [r3], #4
50 str r6, [r4], #4
51 cmp r4, r5
52 blt 1b
53#endif
54 mov fp, #0
55 b start_kernel
56
57LC0: .word _stext
58 .word __bss_start @ r2
59 .word _end @ r3
60 .word processor_id @ r4
61 .word __machine_arch_type @ r5
62 .word init_thread_union+8192 @ sp
63#ifdef CONFIG_XIP_KERNEL
64ETEXT: .word _endtext
65SDATA: .word _sdata
66EDATA: .word __bss_start
67#endif
68
69arm2_id: .long 0x41560200 @ ARM2 and 250 dont have a CPUID
70arm250_id: .long 0x41560250 @ So we create some after probing for them
71 .align
72
73oldparams: mov r4, #0x02000000
74 add r3, r4, #0x00080000
75 add r4, r4, #0x0007c000
761: ldmia r0!, {r5 - r12}
77 stmia r4!, {r5 - r12}
78 cmp r4, r3
79 blt 1b
80 mov pc, lr
81
82/*
83 * We need some way to automatically detect the difference between
84 * these two machines. Unfortunately, it is not possible to detect
85 * the presence of the SuperIO chip, because that will hang the old
86 * Archimedes machines solid.
87 */
88/* DAG: Outdated, these have been combined !!!!!!! */
89detect_arch_type:
90#if defined(CONFIG_ARCH_ARC)
91 mov r0, #MACH_TYPE_ARCHIMEDES
92#elif defined(CONFIG_ARCH_A5K)
93 mov r0, #MACH_TYPE_A5K
94#endif
95 mov pc, lr
96
97detect_proc_type:
98 mov ip, lr
99 mov r2, #0xea000000 @ Point undef instr to continuation
100 adr r0, continue - 12
101 orr r0, r2, r0, lsr #2
102 mov r1, #0
103 str r0, [r1, #4]
104 ldr r0, arm2_id
105 swp r2, r2, [r1] @ check for swp (ARM2 cant)
106 ldr r0, arm250_id
107 mrc 15, 0, r3, c0, c0 @ check for CP#15 (ARM250 cant)
108 mov r0, r3
109continue: mov r2, #0xeb000000 @ Make undef vector loop
110 sub r2, r2, #2
111 str r2, [r1, #4]
112 mov pc, ip
diff --git a/arch/arm26/kernel/init_task.c b/arch/arm26/kernel/init_task.c
deleted file mode 100644
index 4191565b889b..000000000000
--- a/arch/arm26/kernel/init_task.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/init_task.c
3 *
4 * Copyright (C) 2003 Ian Molton
5 *
6 */
7#include <linux/mm.h>
8#include <linux/module.h>
9#include <linux/fs.h>
10#include <linux/sched.h>
11#include <linux/init.h>
12#include <linux/init_task.h>
13#include <linux/mqueue.h>
14
15#include <asm/uaccess.h>
16#include <asm/pgtable.h>
17
18static struct fs_struct init_fs = INIT_FS;
19static struct files_struct init_files = INIT_FILES;
20static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
21static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
22struct mm_struct init_mm = INIT_MM(init_mm);
23
24EXPORT_SYMBOL(init_mm);
25
26/*
27 * Initial thread structure.
28 *
29 * We need to make sure that this is 8192-byte aligned due to the
30 * way process stacks are handled. This is done by making sure
31 * the linker maps this in the .text segment right after head.S,
32 * and making the linker scripts ensure the proper alignment.
33 *
34 * FIXME - should this be 32K alignment on arm26?
35 *
36 * The things we do for performance...
37 */
38union thread_union init_thread_union
39 __attribute__((__section__(".init.task"))) =
40 { INIT_THREAD_INFO(init_task) };
41
42/*
43 * Initial task structure.
44 *
45 * All other task structs will be allocated on slabs in fork.c
46 */
47struct task_struct init_task = INIT_TASK(init_task);
48
49EXPORT_SYMBOL(init_task);
diff --git a/arch/arm26/kernel/irq.c b/arch/arm26/kernel/irq.c
deleted file mode 100644
index 2ffe695b062e..000000000000
--- a/arch/arm26/kernel/irq.c
+++ /dev/null
@@ -1,722 +0,0 @@
1/*
2 * linux/arch/arm/kernel/irq.c
3 *
4 * Copyright (C) 1992 Linus Torvalds
5 * Modifications for ARM processor Copyright (C) 1995-2000 Russell King.
6 * 'Borrowed' for ARM26 and (C) 2003 Ian Molton.
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 * This file contains the code used by various IRQ handling routines:
13 * asking for different IRQ's should be done through these routines
14 * instead of just grabbing them. Thus setups with different IRQ numbers
15 * shouldn't result in any weird surprises, and installing new handlers
16 * should be easier.
17 *
18 * IRQ's are in fact implemented a bit like signal handlers for the kernel.
19 * Naturally it's not a 1:1 relation, but there are similarities.
20 */
21#include <linux/module.h>
22#include <linux/ptrace.h>
23#include <linux/kernel_stat.h>
24#include <linux/signal.h>
25#include <linux/sched.h>
26#include <linux/ioport.h>
27#include <linux/interrupt.h>
28#include <linux/slab.h>
29#include <linux/random.h>
30#include <linux/smp.h>
31#include <linux/init.h>
32#include <linux/seq_file.h>
33#include <linux/errno.h>
34
35#include <asm/irq.h>
36#include <asm/system.h>
37#include <asm/irqchip.h>
38
39//FIXME - this ought to be in a header IMO
40void __init arc_init_irq(void);
41
42/*
43 * Maximum IRQ count. Currently, this is arbitary. However, it should
44 * not be set too low to prevent false triggering. Conversely, if it
45 * is set too high, then you could miss a stuck IRQ.
46 *
47 * FIXME Maybe we ought to set a timer and re-enable the IRQ at a later time?
48 */
49#define MAX_IRQ_CNT 100000
50
51static volatile unsigned long irq_err_count;
52static DEFINE_SPINLOCK(irq_controller_lock);
53
54struct irqdesc irq_desc[NR_IRQS];
55
56/*
57 * Dummy mask/unmask handler
58 */
59void dummy_mask_unmask_irq(unsigned int irq)
60{
61}
62
63void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
64{
65 irq_err_count += 1;
66 printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
67}
68
69static struct irqchip bad_chip = {
70 .ack = dummy_mask_unmask_irq,
71 .mask = dummy_mask_unmask_irq,
72 .unmask = dummy_mask_unmask_irq,
73};
74
75static struct irqdesc bad_irq_desc = {
76 .chip = &bad_chip,
77 .handle = do_bad_IRQ,
78 .depth = 1,
79};
80
81/**
82 * disable_irq - disable an irq and wait for completion
83 * @irq: Interrupt to disable
84 *
85 * Disable the selected interrupt line. We do this lazily.
86 *
87 * This function may be called from IRQ context.
88 */
89void disable_irq(unsigned int irq)
90{
91 struct irqdesc *desc = irq_desc + irq;
92 unsigned long flags;
93 spin_lock_irqsave(&irq_controller_lock, flags);
94 if (!desc->depth++)
95 desc->enabled = 0;
96 spin_unlock_irqrestore(&irq_controller_lock, flags);
97}
98EXPORT_SYMBOL(disable_irq);
99
100void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
101
102EXPORT_SYMBOL(disable_irq_nosync);
103
104/**
105 * enable_irq - enable interrupt handling on an irq
106 * @irq: Interrupt to enable
107 *
108 * Re-enables the processing of interrupts on this IRQ line.
109 * Note that this may call the interrupt handler, so you may
110 * get unexpected results if you hold IRQs disabled.
111 *
112 * This function may be called from IRQ context.
113 */
114void enable_irq(unsigned int irq)
115{
116 struct irqdesc *desc = irq_desc + irq;
117 unsigned long flags;
118 int pending = 0;
119
120 spin_lock_irqsave(&irq_controller_lock, flags);
121 if (unlikely(!desc->depth)) {
122 printk("enable_irq(%u) unbalanced from %p\n", irq,
123 __builtin_return_address(0)); //FIXME bum addresses reported - why?
124 } else if (!--desc->depth) {
125 desc->probing = 0;
126 desc->enabled = 1;
127 desc->chip->unmask(irq);
128 pending = desc->pending;
129 desc->pending = 0;
130 /*
131 * If the interrupt was waiting to be processed,
132 * retrigger it.
133 */
134 if (pending)
135 desc->chip->rerun(irq);
136 }
137 spin_unlock_irqrestore(&irq_controller_lock, flags);
138}
139EXPORT_SYMBOL(enable_irq);
140
141int show_interrupts(struct seq_file *p, void *v)
142{
143 int i = *(loff_t *) v;
144 struct irqaction * action;
145
146 if (i < NR_IRQS) {
147 action = irq_desc[i].action;
148 if (!action)
149 goto out;
150 seq_printf(p, "%3d: %10u ", i, kstat_irqs(i));
151 seq_printf(p, " %s", action->name);
152 for (action = action->next; action; action = action->next) {
153 seq_printf(p, ", %s", action->name);
154 }
155 seq_putc(p, '\n');
156 } else if (i == NR_IRQS) {
157 show_fiq_list(p, v);
158 seq_printf(p, "Err: %10lu\n", irq_err_count);
159 }
160out:
161 return 0;
162}
163
164/*
165 * IRQ lock detection.
166 *
167 * Hopefully, this should get us out of a few locked situations.
168 * However, it may take a while for this to happen, since we need
169 * a large number if IRQs to appear in the same jiffie with the
170 * same instruction pointer (or within 2 instructions).
171 */
172static int check_irq_lock(struct irqdesc *desc, int irq, struct pt_regs *regs)
173{
174 unsigned long instr_ptr = instruction_pointer(regs);
175
176 if (desc->lck_jif == jiffies &&
177 desc->lck_pc >= instr_ptr && desc->lck_pc < instr_ptr + 8) {
178 desc->lck_cnt += 1;
179
180 if (desc->lck_cnt > MAX_IRQ_CNT) {
181 printk(KERN_ERR "IRQ LOCK: IRQ%d is locking the system, disabled\n", irq);
182 return 1;
183 }
184 } else {
185 desc->lck_cnt = 0;
186 desc->lck_pc = instruction_pointer(regs);
187 desc->lck_jif = jiffies;
188 }
189 return 0;
190}
191
192static void
193__do_irq(unsigned int irq, struct irqaction *action, struct pt_regs *regs)
194{
195 unsigned int status;
196 int ret;
197
198 spin_unlock(&irq_controller_lock);
199 if (!(action->flags & IRQF_DISABLED))
200 local_irq_enable();
201
202 status = 0;
203 do {
204 ret = action->handler(irq, action->dev_id, regs);
205 if (ret == IRQ_HANDLED)
206 status |= action->flags;
207 action = action->next;
208 } while (action);
209
210 if (status & IRQF_SAMPLE_RANDOM)
211 add_interrupt_randomness(irq);
212
213 spin_lock_irq(&irq_controller_lock);
214}
215
216/*
217 * This is for software-decoded IRQs. The caller is expected to
218 * handle the ack, clear, mask and unmask issues.
219 */
220void
221do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
222{
223 struct irqaction *action;
224 const int cpu = smp_processor_id();
225
226 desc->triggered = 1;
227
228 kstat_cpu(cpu).irqs[irq]++;
229
230 action = desc->action;
231 if (action)
232 __do_irq(irq, desc->action, regs);
233}
234
235/*
236 * Most edge-triggered IRQ implementations seem to take a broken
237 * approach to this. Hence the complexity.
238 */
239void
240do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
241{
242 const int cpu = smp_processor_id();
243
244 desc->triggered = 1;
245
246 /*
247 * If we're currently running this IRQ, or its disabled,
248 * we shouldn't process the IRQ. Instead, turn on the
249 * hardware masks.
250 */
251 if (unlikely(desc->running || !desc->enabled))
252 goto running;
253
254 /*
255 * Acknowledge and clear the IRQ, but don't mask it.
256 */
257 desc->chip->ack(irq);
258
259 /*
260 * Mark the IRQ currently in progress.
261 */
262 desc->running = 1;
263
264 kstat_cpu(cpu).irqs[irq]++;
265
266 do {
267 struct irqaction *action;
268
269 action = desc->action;
270 if (!action)
271 break;
272
273 if (desc->pending && desc->enabled) {
274 desc->pending = 0;
275 desc->chip->unmask(irq);
276 }
277
278 __do_irq(irq, action, regs);
279 } while (desc->pending);
280
281 desc->running = 0;
282
283 /*
284 * If we were disabled or freed, shut down the handler.
285 */
286 if (likely(desc->action && !check_irq_lock(desc, irq, regs)))
287 return;
288
289 running:
290 /*
291 * We got another IRQ while this one was masked or
292 * currently running. Delay it.
293 */
294 desc->pending = 1;
295 desc->chip->mask(irq);
296 desc->chip->ack(irq);
297}
298
299/*
300 * Level-based IRQ handler. Nice and simple.
301 */
302void
303do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
304{
305 struct irqaction *action;
306 const int cpu = smp_processor_id();
307
308 desc->triggered = 1;
309
310 /*
311 * Acknowledge, clear _AND_ disable the interrupt.
312 */
313 desc->chip->ack(irq);
314
315 if (likely(desc->enabled)) {
316 kstat_cpu(cpu).irqs[irq]++;
317
318 /*
319 * Return with this interrupt masked if no action
320 */
321 action = desc->action;
322 if (action) {
323 __do_irq(irq, desc->action, regs);
324
325 if (likely(desc->enabled &&
326 !check_irq_lock(desc, irq, regs)))
327 desc->chip->unmask(irq);
328 }
329 }
330}
331
332/*
333 * do_IRQ handles all hardware IRQ's. Decoded IRQs should not
334 * come via this function. Instead, they should provide their
335 * own 'handler'
336 */
337asmlinkage void asm_do_IRQ(int irq, struct pt_regs *regs)
338{
339 struct irqdesc *desc = irq_desc + irq;
340
341 /*
342 * Some hardware gives randomly wrong interrupts. Rather
343 * than crashing, do something sensible.
344 */
345 if (irq >= NR_IRQS)
346 desc = &bad_irq_desc;
347
348 irq_enter();
349 spin_lock(&irq_controller_lock);
350 desc->handle(irq, desc, regs);
351 spin_unlock(&irq_controller_lock);
352 irq_exit();
353}
354
355void __set_irq_handler(unsigned int irq, irq_handler_t handle, int is_chained)
356{
357 struct irqdesc *desc;
358 unsigned long flags;
359
360 if (irq >= NR_IRQS) {
361 printk(KERN_ERR "Trying to install handler for IRQ%d\n", irq);
362 return;
363 }
364
365 if (handle == NULL)
366 handle = do_bad_IRQ;
367
368 desc = irq_desc + irq;
369
370 if (is_chained && desc->chip == &bad_chip)
371 printk(KERN_WARNING "Trying to install chained handler for IRQ%d\n", irq);
372
373 spin_lock_irqsave(&irq_controller_lock, flags);
374 if (handle == do_bad_IRQ) {
375 desc->chip->mask(irq);
376 desc->chip->ack(irq);
377 desc->depth = 1;
378 desc->enabled = 0;
379 }
380 desc->handle = handle;
381 if (handle != do_bad_IRQ && is_chained) {
382 desc->valid = 0;
383 desc->probe_ok = 0;
384 desc->depth = 0;
385 desc->chip->unmask(irq);
386 }
387 spin_unlock_irqrestore(&irq_controller_lock, flags);
388}
389
390void set_irq_chip(unsigned int irq, struct irqchip *chip)
391{
392 struct irqdesc *desc;
393 unsigned long flags;
394
395 if (irq >= NR_IRQS) {
396 printk(KERN_ERR "Trying to install chip for IRQ%d\n", irq);
397 return;
398 }
399
400 if (chip == NULL)
401 chip = &bad_chip;
402
403 desc = irq_desc + irq;
404 spin_lock_irqsave(&irq_controller_lock, flags);
405 desc->chip = chip;
406 spin_unlock_irqrestore(&irq_controller_lock, flags);
407}
408
409int set_irq_type(unsigned int irq, unsigned int type)
410{
411 struct irqdesc *desc;
412 unsigned long flags;
413 int ret = -ENXIO;
414
415 if (irq >= NR_IRQS) {
416 printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
417 return -ENODEV;
418 }
419
420 desc = irq_desc + irq;
421 if (desc->chip->type) {
422 spin_lock_irqsave(&irq_controller_lock, flags);
423 ret = desc->chip->type(irq, type);
424 spin_unlock_irqrestore(&irq_controller_lock, flags);
425 }
426
427 return ret;
428}
429
430void set_irq_flags(unsigned int irq, unsigned int iflags)
431{
432 struct irqdesc *desc;
433 unsigned long flags;
434
435 if (irq >= NR_IRQS) {
436 printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq);
437 return;
438 }
439
440 desc = irq_desc + irq;
441 spin_lock_irqsave(&irq_controller_lock, flags);
442 desc->valid = (iflags & IRQF_VALID) != 0;
443 desc->probe_ok = (iflags & IRQF_PROBE) != 0;
444 desc->noautoenable = (iflags & IRQF_NOAUTOEN) != 0;
445 spin_unlock_irqrestore(&irq_controller_lock, flags);
446}
447
448int setup_irq(unsigned int irq, struct irqaction *new)
449{
450 int shared = 0;
451 struct irqaction *old, **p;
452 unsigned long flags;
453 struct irqdesc *desc;
454
455 /*
456 * Some drivers like serial.c use request_irq() heavily,
457 * so we have to be careful not to interfere with a
458 * running system.
459 */
460 if (new->flags & IRQF_SAMPLE_RANDOM) {
461 /*
462 * This function might sleep, we want to call it first,
463 * outside of the atomic block.
464 * Yes, this might clear the entropy pool if the wrong
465 * driver is attempted to be loaded, without actually
466 * installing a new handler, but is this really a problem,
467 * only the sysadmin is able to do this.
468 */
469 rand_initialize_irq(irq);
470 }
471
472 /*
473 * The following block of code has to be executed atomically
474 */
475 desc = irq_desc + irq;
476 spin_lock_irqsave(&irq_controller_lock, flags);
477 p = &desc->action;
478 if ((old = *p) != NULL) {
479 /* Can't share interrupts unless both agree to */
480 if (!(old->flags & new->flags & IRQF_SHARED)) {
481 spin_unlock_irqrestore(&irq_controller_lock, flags);
482 return -EBUSY;
483 }
484
485 /* add new interrupt at end of irq queue */
486 do {
487 p = &old->next;
488 old = *p;
489 } while (old);
490 shared = 1;
491 }
492
493 *p = new;
494
495 if (!shared) {
496 desc->probing = 0;
497 desc->running = 0;
498 desc->pending = 0;
499 desc->depth = 1;
500 if (!desc->noautoenable) {
501 desc->depth = 0;
502 desc->enabled = 1;
503 desc->chip->unmask(irq);
504 }
505 }
506
507 spin_unlock_irqrestore(&irq_controller_lock, flags);
508 return 0;
509}
510
511/**
512 * request_irq - allocate an interrupt line
513 * @irq: Interrupt line to allocate
514 * @handler: Function to be called when the IRQ occurs
515 * @irqflags: Interrupt type flags
516 * @devname: An ascii name for the claiming device
517 * @dev_id: A cookie passed back to the handler function
518 *
519 * This call allocates interrupt resources and enables the
520 * interrupt line and IRQ handling. From the point this
521 * call is made your handler function may be invoked. Since
522 * your handler function must clear any interrupt the board
523 * raises, you must take care both to initialise your hardware
524 * and to set up the interrupt handler in the right order.
525 *
526 * Dev_id must be globally unique. Normally the address of the
527 * device data structure is used as the cookie. Since the handler
528 * receives this value it makes sense to use it.
529 *
530 * If your interrupt is shared you must pass a non NULL dev_id
531 * as this is required when freeing the interrupt.
532 *
533 * Flags:
534 *
535 * IRQF_SHARED Interrupt is shared
536 *
537 * IRQF_DISABLED Disable local interrupts while processing
538 *
539 * IRQF_SAMPLE_RANDOM The interrupt can be used for entropy
540 *
541 */
542
543//FIXME - handler used to return void - whats the significance of the change?
544int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
545 unsigned long irq_flags, const char * devname, void *dev_id)
546{
547 unsigned long retval;
548 struct irqaction *action;
549
550 if (irq >= NR_IRQS || !irq_desc[irq].valid || !handler ||
551 (irq_flags & IRQF_SHARED && !dev_id))
552 return -EINVAL;
553
554 action = kmalloc(sizeof(struct irqaction), GFP_KERNEL);
555 if (!action)
556 return -ENOMEM;
557
558 action->handler = handler;
559 action->flags = irq_flags;
560 cpus_clear(action->mask);
561 action->name = devname;
562 action->next = NULL;
563 action->dev_id = dev_id;
564
565 retval = setup_irq(irq, action);
566
567 if (retval)
568 kfree(action);
569 return retval;
570}
571
572EXPORT_SYMBOL(request_irq);
573
574/**
575 * free_irq - free an interrupt
576 * @irq: Interrupt line to free
577 * @dev_id: Device identity to free
578 *
579 * Remove an interrupt handler. The handler is removed and if the
580 * interrupt line is no longer in use by any driver it is disabled.
581 * On a shared IRQ the caller must ensure the interrupt is disabled
582 * on the card it drives before calling this function.
583 *
584 * This function may be called from interrupt context.
585 */
586void free_irq(unsigned int irq, void *dev_id)
587{
588 struct irqaction * action, **p;
589 unsigned long flags;
590
591 if (irq >= NR_IRQS || !irq_desc[irq].valid) {
592 printk(KERN_ERR "Trying to free IRQ%d\n",irq);
593#ifdef CONFIG_DEBUG_ERRORS
594 __backtrace();
595#endif
596 return;
597 }
598
599 spin_lock_irqsave(&irq_controller_lock, flags);
600 for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) {
601 if (action->dev_id != dev_id)
602 continue;
603
604 /* Found it - now free it */
605 *p = action->next;
606 kfree(action);
607 goto out;
608 }
609 printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
610#ifdef CONFIG_DEBUG_ERRORS
611 __backtrace();
612#endif
613out:
614 spin_unlock_irqrestore(&irq_controller_lock, flags);
615}
616
617EXPORT_SYMBOL(free_irq);
618
619/* Start the interrupt probing. Unlike other architectures,
620 * we don't return a mask of interrupts from probe_irq_on,
621 * but return the number of interrupts enabled for the probe.
622 * The interrupts which have been enabled for probing is
623 * instead recorded in the irq_desc structure.
624 */
625unsigned long probe_irq_on(void)
626{
627 unsigned int i, irqs = 0;
628 unsigned long delay;
629
630 /*
631 * first snaffle up any unassigned but
632 * probe-able interrupts
633 */
634 spin_lock_irq(&irq_controller_lock);
635 for (i = 0; i < NR_IRQS; i++) {
636 if (!irq_desc[i].probe_ok || irq_desc[i].action)
637 continue;
638
639 irq_desc[i].probing = 1;
640 irq_desc[i].triggered = 0;
641 if (irq_desc[i].chip->type)
642 irq_desc[i].chip->type(i, IRQT_PROBE);
643 irq_desc[i].chip->unmask(i);
644 irqs += 1;
645 }
646 spin_unlock_irq(&irq_controller_lock);
647
648 /*
649 * wait for spurious interrupts to mask themselves out again
650 */
651 for (delay = jiffies + HZ/10; time_before(jiffies, delay); )
652 /* min 100ms delay */;
653
654 /*
655 * now filter out any obviously spurious interrupts
656 */
657 spin_lock_irq(&irq_controller_lock);
658 for (i = 0; i < NR_IRQS; i++) {
659 if (irq_desc[i].probing && irq_desc[i].triggered) {
660 irq_desc[i].probing = 0;
661 irqs -= 1;
662 }
663 }
664 spin_unlock_irq(&irq_controller_lock);
665
666 return irqs;
667}
668
669EXPORT_SYMBOL(probe_irq_on);
670
671/*
672 * Possible return values:
673 * >= 0 - interrupt number
674 * -1 - no interrupt/many interrupts
675 */
676int probe_irq_off(unsigned long irqs)
677{
678 unsigned int i;
679 int irq_found = NO_IRQ;
680
681 /*
682 * look at the interrupts, and find exactly one
683 * that we were probing has been triggered
684 */
685 spin_lock_irq(&irq_controller_lock);
686 for (i = 0; i < NR_IRQS; i++) {
687 if (irq_desc[i].probing &&
688 irq_desc[i].triggered) {
689 if (irq_found != NO_IRQ) {
690 irq_found = NO_IRQ;
691 goto out;
692 }
693 irq_found = i;
694 }
695 }
696
697 if (irq_found == -1)
698 irq_found = NO_IRQ;
699out:
700 spin_unlock_irq(&irq_controller_lock);
701
702 return irq_found;
703}
704
705EXPORT_SYMBOL(probe_irq_off);
706
707void __init init_irq_proc(void)
708{
709}
710
711void __init init_IRQ(void)
712{
713 struct irqdesc *desc;
714 extern void init_dma(void);
715 int irq;
716
717 for (irq = 0, desc = irq_desc; irq < NR_IRQS; irq++, desc++)
718 *desc = bad_irq_desc;
719
720 arc_init_irq();
721 init_dma();
722}
diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c
deleted file mode 100644
index dcd81e62ff4e..000000000000
--- a/arch/arm26/kernel/process.c
+++ /dev/null
@@ -1,392 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/process.c
3 *
4 * Copyright (C) 2003 Ian Molton - adapted for ARM26
5 * Copyright (C) 1996-2000 Russell King - Converted to ARM.
6 * Origional Copyright (C) 1995 Linus Torvalds
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#include <stdarg.h>
13
14#include <linux/module.h>
15#include <linux/sched.h>
16#include <linux/kernel.h>
17#include <linux/mm.h>
18#include <linux/stddef.h>
19#include <linux/unistd.h>
20#include <linux/ptrace.h>
21#include <linux/slab.h>
22#include <linux/user.h>
23#include <linux/a.out.h>
24#include <linux/delay.h>
25#include <linux/reboot.h>
26#include <linux/interrupt.h>
27#include <linux/init.h>
28
29#include <asm/system.h>
30#include <asm/io.h>
31#include <asm/leds.h>
32#include <asm/processor.h>
33#include <asm/uaccess.h>
34
35extern const char *processor_modes[];
36extern void setup_mm_for_reboot(char mode);
37
38static volatile int hlt_counter;
39
40void disable_hlt(void)
41{
42 hlt_counter++;
43}
44
45EXPORT_SYMBOL(disable_hlt);
46
47void enable_hlt(void)
48{
49 hlt_counter--;
50}
51
52EXPORT_SYMBOL(enable_hlt);
53
54static int __init nohlt_setup(char *__unused)
55{
56 hlt_counter = 1;
57 return 1;
58}
59
60static int __init hlt_setup(char *__unused)
61{
62 hlt_counter = 0;
63 return 1;
64}
65
66__setup("nohlt", nohlt_setup);
67__setup("hlt", hlt_setup);
68
69/*
70 * This is our default idle handler. We need to disable
71 * interrupts here to ensure we don't miss a wakeup call.
72 */
73void cpu_idle(void)
74{
75 /* endless idle loop with no priority at all */
76 while (1) {
77 while (!need_resched())
78 cpu_relax();
79 preempt_enable_no_resched();
80 schedule();
81 preempt_disable();
82 }
83}
84
85static char reboot_mode = 'h';
86
87int __init reboot_setup(char *str)
88{
89 reboot_mode = str[0];
90 return 1;
91}
92
93__setup("reboot=", reboot_setup);
94
95/* ARM26 cant do these but we still need to define them. */
96void machine_halt(void)
97{
98}
99void machine_power_off(void)
100{
101}
102
103void machine_restart(char * __unused)
104{
105 /*
106 * Clean and disable cache, and turn off interrupts
107 */
108 cpu_proc_fin();
109
110 /*
111 * Tell the mm system that we are going to reboot -
112 * we may need it to insert some 1:1 mappings so that
113 * soft boot works.
114 */
115 setup_mm_for_reboot(reboot_mode);
116
117 /*
118 * copy branch instruction to reset location and call it
119 */
120
121 *(unsigned long *)0 = *(unsigned long *)0x03800000;
122 ((void(*)(void))0)();
123
124 /*
125 * Whoops - the architecture was unable to reboot.
126 * Tell the user! Should never happen...
127 */
128 mdelay(1000);
129 printk("Reboot failed -- System halted\n");
130 while (1);
131}
132
133void show_regs(struct pt_regs * regs)
134{
135 unsigned long flags;
136
137 flags = condition_codes(regs);
138
139 printk("pc : [<%08lx>] lr : [<%08lx>] %s\n"
140 "sp : %08lx ip : %08lx fp : %08lx\n",
141 instruction_pointer(regs),
142 regs->ARM_lr, print_tainted(), regs->ARM_sp,
143 regs->ARM_ip, regs->ARM_fp);
144 printk("r10: %08lx r9 : %08lx r8 : %08lx\n",
145 regs->ARM_r10, regs->ARM_r9,
146 regs->ARM_r8);
147 printk("r7 : %08lx r6 : %08lx r5 : %08lx r4 : %08lx\n",
148 regs->ARM_r7, regs->ARM_r6,
149 regs->ARM_r5, regs->ARM_r4);
150 printk("r3 : %08lx r2 : %08lx r1 : %08lx r0 : %08lx\n",
151 regs->ARM_r3, regs->ARM_r2,
152 regs->ARM_r1, regs->ARM_r0);
153 printk("Flags: %c%c%c%c",
154 flags & PSR_N_BIT ? 'N' : 'n',
155 flags & PSR_Z_BIT ? 'Z' : 'z',
156 flags & PSR_C_BIT ? 'C' : 'c',
157 flags & PSR_V_BIT ? 'V' : 'v');
158 printk(" IRQs o%s FIQs o%s Mode %s Segment %s\n",
159 interrupts_enabled(regs) ? "n" : "ff",
160 fast_interrupts_enabled(regs) ? "n" : "ff",
161 processor_modes[processor_mode(regs)],
162 get_fs() == get_ds() ? "kernel" : "user");
163}
164
165void show_fpregs(struct user_fp *regs)
166{
167 int i;
168
169 for (i = 0; i < 8; i++) {
170 unsigned long *p;
171 char type;
172
173 p = (unsigned long *)(regs->fpregs + i);
174
175 switch (regs->ftype[i]) {
176 case 1: type = 'f'; break;
177 case 2: type = 'd'; break;
178 case 3: type = 'e'; break;
179 default: type = '?'; break;
180 }
181 if (regs->init_flag)
182 type = '?';
183
184 printk(" f%d(%c): %08lx %08lx %08lx%c",
185 i, type, p[0], p[1], p[2], i & 1 ? '\n' : ' ');
186 }
187
188
189 printk("FPSR: %08lx FPCR: %08lx\n",
190 (unsigned long)regs->fpsr,
191 (unsigned long)regs->fpcr);
192}
193
194/*
195 * Task structure and kernel stack allocation.
196 */
197static unsigned long *thread_info_head;
198static unsigned int nr_thread_info;
199
200extern unsigned long get_page_8k(int priority);
201extern void free_page_8k(unsigned long page);
202
203// FIXME - is this valid?
204#define EXTRA_TASK_STRUCT 0
205#define ll_alloc_task_struct() ((struct thread_info *)get_page_8k(GFP_KERNEL))
206#define ll_free_task_struct(p) free_page_8k((unsigned long)(p))
207
208//FIXME - do we use *task param below looks like we dont, which is ok?
209//FIXME - if EXTRA_TASK_STRUCT is zero we can optimise the below away permanently. *IF* its supposed to be zero.
210struct thread_info *alloc_thread_info(struct task_struct *task)
211{
212 struct thread_info *thread = NULL;
213
214 if (EXTRA_TASK_STRUCT) {
215 unsigned long *p = thread_info_head;
216
217 if (p) {
218 thread_info_head = (unsigned long *)p[0];
219 nr_thread_info -= 1;
220 }
221 thread = (struct thread_info *)p;
222 }
223
224 if (!thread)
225 thread = ll_alloc_task_struct();
226
227#ifdef CONFIG_MAGIC_SYSRQ
228 /*
229 * The stack must be cleared if you want SYSRQ-T to
230 * give sensible stack usage information
231 */
232 if (thread) {
233 char *p = (char *)thread;
234 memzero(p+KERNEL_STACK_SIZE, KERNEL_STACK_SIZE);
235 }
236#endif
237 return thread;
238}
239
240void free_thread_info(struct thread_info *thread)
241{
242 if (EXTRA_TASK_STRUCT && nr_thread_info < EXTRA_TASK_STRUCT) {
243 unsigned long *p = (unsigned long *)thread;
244 p[0] = (unsigned long)thread_info_head;
245 thread_info_head = p;
246 nr_thread_info += 1;
247 } else
248 ll_free_task_struct(thread);
249}
250
251/*
252 * Free current thread data structures etc..
253 */
254void exit_thread(void)
255{
256}
257
258void flush_thread(void)
259{
260 struct thread_info *thread = current_thread_info();
261 struct task_struct *tsk = current;
262
263 memset(&tsk->thread.debug, 0, sizeof(struct debug_info));
264 memset(&thread->fpstate, 0, sizeof(union fp_state));
265
266 clear_used_math();
267}
268
269void release_thread(struct task_struct *dead_task)
270{
271}
272
273asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
274
275int
276copy_thread(int nr, unsigned long clone_flags, unsigned long stack_start,
277 unsigned long unused, struct task_struct *p, struct pt_regs *regs)
278{
279 struct thread_info *thread = task_thread_info(p);
280 struct pt_regs *childregs = task_pt_regs(p);
281
282 *childregs = *regs;
283 childregs->ARM_r0 = 0;
284 childregs->ARM_sp = stack_start;
285
286 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
287 thread->cpu_context.sp = (unsigned long)childregs;
288 thread->cpu_context.pc = (unsigned long)ret_from_fork | MODE_SVC26 | PSR_I_BIT;
289
290 return 0;
291}
292
293/*
294 * fill in the fpe structure for a core dump...
295 */
296int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
297{
298 struct thread_info *thread = current_thread_info();
299 int used_math = !!used_math();
300
301 if (used_math)
302 memcpy(fp, &thread->fpstate.soft, sizeof (*fp));
303
304 return used_math;
305}
306
307/*
308 * fill in the user structure for a core dump..
309 */
310void dump_thread(struct pt_regs * regs, struct user * dump)
311{
312 struct task_struct *tsk = current;
313
314 dump->magic = CMAGIC;
315 dump->start_code = tsk->mm->start_code;
316 dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
317
318 dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
319 dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
320 dump->u_ssize = 0;
321
322 dump->u_debugreg[0] = tsk->thread.debug.bp[0].address;
323 dump->u_debugreg[1] = tsk->thread.debug.bp[1].address;
324 dump->u_debugreg[2] = tsk->thread.debug.bp[0].insn;
325 dump->u_debugreg[3] = tsk->thread.debug.bp[1].insn;
326 dump->u_debugreg[4] = tsk->thread.debug.nsaved;
327
328 if (dump->start_stack < 0x04000000)
329 dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT;
330
331 dump->regs = *regs;
332 dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
333}
334
335/*
336 * Shuffle the argument into the correct register before calling the
337 * thread function. r1 is the thread argument, r2 is the pointer to
338 * the thread function, and r3 points to the exit function.
339 * FIXME - make sure this is right - the older code used to zero fp
340 * and cause the parent to call sys_exit (do_exit in this version)
341 */
342extern void kernel_thread_helper(void);
343
344asm( ".section .text\n"
345" .align\n"
346" .type kernel_thread_helper, #function\n"
347"kernel_thread_helper:\n"
348" mov r0, r1\n"
349" mov lr, r3\n"
350" mov pc, r2\n"
351" .size kernel_thread_helper, . - kernel_thread_helper\n"
352" .previous");
353
354/*
355 * Create a kernel thread.
356 */
357pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
358{
359 struct pt_regs regs;
360
361 memset(&regs, 0, sizeof(regs));
362
363 regs.ARM_r1 = (unsigned long)arg;
364 regs.ARM_r2 = (unsigned long)fn;
365 regs.ARM_r3 = (unsigned long)do_exit;
366 regs.ARM_pc = (unsigned long)kernel_thread_helper | MODE_SVC26;
367
368 return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
369}
370EXPORT_SYMBOL(kernel_thread);
371
372
373unsigned long get_wchan(struct task_struct *p)
374{
375 unsigned long fp, lr;
376 unsigned long stack_page;
377 int count = 0;
378 if (!p || p == current || p->state == TASK_RUNNING)
379 return 0;
380
381 stack_page = 4096 + (unsigned long)p;
382 fp = thread_saved_fp(p);
383 do {
384 if (fp < stack_page || fp > 4092+stack_page)
385 return 0;
386 lr = pc_pointer (((unsigned long *)fp)[-1]);
387 if (!in_sched_functions(lr))
388 return lr;
389 fp = *(unsigned long *) (fp - 12);
390 } while (count ++ < 16);
391 return 0;
392}
diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c
deleted file mode 100644
index 0fefb86970c6..000000000000
--- a/arch/arm26/kernel/ptrace.c
+++ /dev/null
@@ -1,670 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/ptrace.c
3 *
4 * By Ross Biro 1/23/92
5 * edited by Linus Torvalds
6 * ARM modifications Copyright (C) 2000 Russell King
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#include <linux/kernel.h>
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/smp.h>
16#include <linux/ptrace.h>
17#include <linux/user.h>
18#include <linux/security.h>
19#include <linux/signal.h>
20
21#include <asm/uaccess.h>
22#include <asm/pgtable.h>
23#include <asm/system.h>
24//#include <asm/processor.h>
25
26#include "ptrace.h"
27
28#define REG_PC 15
29#define REG_PSR 15
30/*
31 * does not yet catch signals sent when the child dies.
32 * in exit.c or in signal.c.
33 */
34
35/*
36 * Breakpoint SWI instruction: SWI &9F0001
37 */
38#define BREAKINST_ARM 0xef9f0001
39
40/*
41 * this routine will get a word off of the processes privileged stack.
42 * the offset is how far from the base addr as stored in the THREAD.
43 * this routine assumes that all the privileged stacks are in our
44 * data space.
45 */
46static inline long get_user_reg(struct task_struct *task, int offset)
47{
48 return task_pt_regs(task)->uregs[offset];
49}
50
51/*
52 * this routine will put a word on the processes privileged stack.
53 * the offset is how far from the base addr as stored in the THREAD.
54 * this routine assumes that all the privileged stacks are in our
55 * data space.
56 */
57static inline int
58put_user_reg(struct task_struct *task, int offset, long data)
59{
60 struct pt_regs newregs, *regs = task_pt_regs(task);
61 int ret = -EINVAL;
62
63 newregs = *regs;
64 newregs.uregs[offset] = data;
65
66 if (valid_user_regs(&newregs)) {
67 regs->uregs[offset] = data;
68 ret = 0;
69 }
70
71 return ret;
72}
73
74static inline int
75read_u32(struct task_struct *task, unsigned long addr, u32 *res)
76{
77 int ret;
78
79 ret = access_process_vm(task, addr, res, sizeof(*res), 0);
80
81 return ret == sizeof(*res) ? 0 : -EIO;
82}
83
84static inline int
85read_instr(struct task_struct *task, unsigned long addr, u32 *res)
86{
87 int ret;
88 u32 val;
89 ret = access_process_vm(task, addr & ~3, &val, sizeof(val), 0);
90 ret = ret == sizeof(val) ? 0 : -EIO;
91 *res = val;
92 return ret;
93}
94
95/*
96 * Get value of register `rn' (in the instruction)
97 */
98static unsigned long
99ptrace_getrn(struct task_struct *child, unsigned long insn)
100{
101 unsigned int reg = (insn >> 16) & 15;
102 unsigned long val;
103
104 val = get_user_reg(child, reg);
105 if (reg == 15)
106 val = pc_pointer(val + 8); //FIXME - correct for arm26?
107
108 return val;
109}
110
111/*
112 * Get value of operand 2 (in an ALU instruction)
113 */
114static unsigned long
115ptrace_getaluop2(struct task_struct *child, unsigned long insn)
116{
117 unsigned long val;
118 int shift;
119 int type;
120
121 if (insn & 1 << 25) {
122 val = insn & 255;
123 shift = (insn >> 8) & 15;
124 type = 3;
125 } else {
126 val = get_user_reg (child, insn & 15);
127
128 if (insn & (1 << 4))
129 shift = (int)get_user_reg (child, (insn >> 8) & 15);
130 else
131 shift = (insn >> 7) & 31;
132
133 type = (insn >> 5) & 3;
134 }
135
136 switch (type) {
137 case 0: val <<= shift; break;
138 case 1: val >>= shift; break;
139 case 2:
140 val = (((signed long)val) >> shift);
141 break;
142 case 3:
143 val = (val >> shift) | (val << (32 - shift));
144 break;
145 }
146 return val;
147}
148
149/*
150 * Get value of operand 2 (in a LDR instruction)
151 */
152static unsigned long
153ptrace_getldrop2(struct task_struct *child, unsigned long insn)
154{
155 unsigned long val;
156 int shift;
157 int type;
158
159 val = get_user_reg(child, insn & 15);
160 shift = (insn >> 7) & 31;
161 type = (insn >> 5) & 3;
162
163 switch (type) {
164 case 0: val <<= shift; break;
165 case 1: val >>= shift; break;
166 case 2:
167 val = (((signed long)val) >> shift);
168 break;
169 case 3:
170 val = (val >> shift) | (val << (32 - shift));
171 break;
172 }
173 return val;
174}
175
176#define OP_MASK 0x01e00000
177#define OP_AND 0x00000000
178#define OP_EOR 0x00200000
179#define OP_SUB 0x00400000
180#define OP_RSB 0x00600000
181#define OP_ADD 0x00800000
182#define OP_ADC 0x00a00000
183#define OP_SBC 0x00c00000
184#define OP_RSC 0x00e00000
185#define OP_ORR 0x01800000
186#define OP_MOV 0x01a00000
187#define OP_BIC 0x01c00000
188#define OP_MVN 0x01e00000
189
190static unsigned long
191get_branch_address(struct task_struct *child, unsigned long pc, unsigned long insn)
192{
193 u32 alt = 0;
194
195 switch (insn & 0x0e000000) {
196 case 0x00000000:
197 case 0x02000000: {
198 /*
199 * data processing
200 */
201 long aluop1, aluop2, ccbit;
202
203 if ((insn & 0xf000) != 0xf000)
204 break;
205
206 aluop1 = ptrace_getrn(child, insn);
207 aluop2 = ptrace_getaluop2(child, insn);
208 ccbit = get_user_reg(child, REG_PSR) & PSR_C_BIT ? 1 : 0;
209
210 switch (insn & OP_MASK) {
211 case OP_AND: alt = aluop1 & aluop2; break;
212 case OP_EOR: alt = aluop1 ^ aluop2; break;
213 case OP_SUB: alt = aluop1 - aluop2; break;
214 case OP_RSB: alt = aluop2 - aluop1; break;
215 case OP_ADD: alt = aluop1 + aluop2; break;
216 case OP_ADC: alt = aluop1 + aluop2 + ccbit; break;
217 case OP_SBC: alt = aluop1 - aluop2 + ccbit; break;
218 case OP_RSC: alt = aluop2 - aluop1 + ccbit; break;
219 case OP_ORR: alt = aluop1 | aluop2; break;
220 case OP_MOV: alt = aluop2; break;
221 case OP_BIC: alt = aluop1 & ~aluop2; break;
222 case OP_MVN: alt = ~aluop2; break;
223 }
224 break;
225 }
226
227 case 0x04000000:
228 case 0x06000000:
229 /*
230 * ldr
231 */
232 if ((insn & 0x0010f000) == 0x0010f000) {
233 unsigned long base;
234
235 base = ptrace_getrn(child, insn);
236 if (insn & 1 << 24) {
237 long aluop2;
238
239 if (insn & 0x02000000)
240 aluop2 = ptrace_getldrop2(child, insn);
241 else
242 aluop2 = insn & 0xfff;
243
244 if (insn & 1 << 23)
245 base += aluop2;
246 else
247 base -= aluop2;
248 }
249 if (read_u32(child, base, &alt) == 0)
250 alt = pc_pointer(alt);
251 }
252 break;
253
254 case 0x08000000:
255 /*
256 * ldm
257 */
258 if ((insn & 0x00108000) == 0x00108000) {
259 unsigned long base;
260 unsigned int nr_regs;
261
262 if (insn & (1 << 23)) {
263 nr_regs = hweight16(insn & 65535) << 2;
264
265 if (!(insn & (1 << 24)))
266 nr_regs -= 4;
267 } else {
268 if (insn & (1 << 24))
269 nr_regs = -4;
270 else
271 nr_regs = 0;
272 }
273
274 base = ptrace_getrn(child, insn);
275
276 if (read_u32(child, base + nr_regs, &alt) == 0)
277 alt = pc_pointer(alt);
278 break;
279 }
280 break;
281
282 case 0x0a000000: {
283 /*
284 * bl or b
285 */
286 signed long displ;
287 /* It's a branch/branch link: instead of trying to
288 * figure out whether the branch will be taken or not,
289 * we'll put a breakpoint at both locations. This is
290 * simpler, more reliable, and probably not a whole lot
291 * slower than the alternative approach of emulating the
292 * branch.
293 */
294 displ = (insn & 0x00ffffff) << 8;
295 displ = (displ >> 6) + 8;
296 if (displ != 0 && displ != 4)
297 alt = pc + displ;
298 }
299 break;
300 }
301
302 return alt;
303}
304
305static int
306swap_insn(struct task_struct *task, unsigned long addr,
307 void *old_insn, void *new_insn, int size)
308{
309 int ret;
310
311 ret = access_process_vm(task, addr, old_insn, size, 0);
312 if (ret == size)
313 ret = access_process_vm(task, addr, new_insn, size, 1);
314 return ret;
315}
316
317static void
318add_breakpoint(struct task_struct *task, struct debug_info *dbg, unsigned long addr)
319{
320 int nr = dbg->nsaved;
321
322 if (nr < 2) {
323 u32 new_insn = BREAKINST_ARM;
324 int res;
325
326 res = swap_insn(task, addr, &dbg->bp[nr].insn, &new_insn, 4);
327
328 if (res == 4) {
329 dbg->bp[nr].address = addr;
330 dbg->nsaved += 1;
331 }
332 } else
333 printk(KERN_ERR "ptrace: too many breakpoints\n");
334}
335
336/*
337 * Clear one breakpoint in the user program. We copy what the hardware
338 * does and use bit 0 of the address to indicate whether this is a Thumb
339 * breakpoint or an ARM breakpoint.
340 */
341static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)
342{
343 unsigned long addr = bp->address;
344 u32 old_insn;
345 int ret;
346
347 ret = swap_insn(task, addr & ~3, &old_insn,
348 &bp->insn, 4);
349
350 if (ret != 4 || old_insn != BREAKINST_ARM)
351 printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
352 "0x%08lx (0x%08x)\n", task->comm, task->pid,
353 addr, old_insn);
354}
355
356void ptrace_set_bpt(struct task_struct *child)
357{
358 struct pt_regs *regs;
359 unsigned long pc;
360 u32 insn;
361 int res;
362
363 regs = task_pt_regs(child);
364 pc = instruction_pointer(regs);
365
366 res = read_instr(child, pc, &insn);
367 if (!res) {
368 struct debug_info *dbg = &child->thread.debug;
369 unsigned long alt;
370
371 dbg->nsaved = 0;
372
373 alt = get_branch_address(child, pc, insn);
374 if (alt)
375 add_breakpoint(child, dbg, alt);
376
377 /*
378 * Note that we ignore the result of setting the above
379 * breakpoint since it may fail. When it does, this is
380 * not so much an error, but a forewarning that we may
381 * be receiving a prefetch abort shortly.
382 *
383 * If we don't set this breakpoint here, then we can
384 * lose control of the thread during single stepping.
385 */
386 if (!alt || predicate(insn) != PREDICATE_ALWAYS)
387 add_breakpoint(child, dbg, pc + 4);
388 }
389}
390
391/*
392 * Ensure no single-step breakpoint is pending. Returns non-zero
393 * value if child was being single-stepped.
394 */
395void ptrace_cancel_bpt(struct task_struct *child)
396{
397 int i, nsaved = child->thread.debug.nsaved;
398
399 child->thread.debug.nsaved = 0;
400
401 if (nsaved > 2) {
402 printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
403 nsaved = 2;
404 }
405
406 for (i = 0; i < nsaved; i++)
407 clear_breakpoint(child, &child->thread.debug.bp[i]);
408}
409
410/*
411 * Called by kernel/ptrace.c when detaching..
412 *
413 * Make sure the single step bit is not set.
414 */
415void ptrace_disable(struct task_struct *child)
416{
417 child->ptrace &= ~PT_SINGLESTEP;
418 ptrace_cancel_bpt(child);
419}
420
421/*
422 * Handle hitting a breakpoint.
423 */
424void ptrace_break(struct task_struct *tsk, struct pt_regs *regs)
425{
426 siginfo_t info;
427
428 /*
429 * The PC is always left pointing at the next instruction. Fix this.
430 */
431 regs->ARM_pc -= 4;
432
433 if (tsk->thread.debug.nsaved == 0)
434 printk(KERN_ERR "ptrace: bogus breakpoint trap\n");
435
436 ptrace_cancel_bpt(tsk);
437
438 info.si_signo = SIGTRAP;
439 info.si_errno = 0;
440 info.si_code = TRAP_BRKPT;
441 info.si_addr = (void *)instruction_pointer(regs) - 4;
442
443 force_sig_info(SIGTRAP, &info, tsk);
444}
445
446/*
447 * Read the word at offset "off" into the "struct user". We
448 * actually access the pt_regs stored on the kernel stack.
449 */
450static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
451 unsigned long *ret)
452{
453 unsigned long tmp;
454
455 if (off & 3 || off >= sizeof(struct user))
456 return -EIO;
457
458 tmp = 0;
459 if (off < sizeof(struct pt_regs))
460 tmp = get_user_reg(tsk, off >> 2);
461
462 return put_user(tmp, ret);
463}
464
465/*
466 * Write the word at offset "off" into "struct user". We
467 * actually access the pt_regs stored on the kernel stack.
468 */
469static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
470 unsigned long val)
471{
472 if (off & 3 || off >= sizeof(struct user))
473 return -EIO;
474
475 if (off >= sizeof(struct pt_regs))
476 return 0;
477
478 return put_user_reg(tsk, off >> 2, val);
479}
480
481/*
482 * Get all user integer registers.
483 */
484static int ptrace_getregs(struct task_struct *tsk, void *uregs)
485{
486 struct pt_regs *regs = task_pt_regs(tsk);
487
488 return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
489}
490
491/*
492 * Set all user integer registers.
493 */
494static int ptrace_setregs(struct task_struct *tsk, void *uregs)
495{
496 struct pt_regs newregs;
497 int ret;
498
499 ret = -EFAULT;
500 if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
501 struct pt_regs *regs = task_pt_regs(tsk);
502
503 ret = -EINVAL;
504 if (valid_user_regs(&newregs)) {
505 *regs = newregs;
506 ret = 0;
507 }
508 }
509
510 return ret;
511}
512
513/*
514 * Get the child FPU state.
515 */
516static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
517{
518 return copy_to_user(ufp, &task_thread_info(tsk)->fpstate,
519 sizeof(struct user_fp)) ? -EFAULT : 0;
520}
521
522/*
523 * Set the child FPU state.
524 */
525static int ptrace_setfpregs(struct task_struct *tsk, void *ufp)
526{
527 set_stopped_child_used_math(tsk);
528 return copy_from_user(&task_thread_info(tsk)->fpstate, ufp,
529 sizeof(struct user_fp)) ? -EFAULT : 0;
530}
531
532long arch_ptrace(struct task_struct *child, long request, long addr, long data)
533{
534 int ret;
535
536 switch (request) {
537 /*
538 * read word at location "addr" in the child process.
539 */
540 case PTRACE_PEEKTEXT:
541 case PTRACE_PEEKDATA:
542 ret = generic_ptrace_peekdata(child, addr, data);
543 break;
544
545 case PTRACE_PEEKUSR:
546 ret = ptrace_read_user(child, addr, (unsigned long *)data);
547 break;
548
549 /*
550 * write the word at location addr.
551 */
552 case PTRACE_POKETEXT:
553 case PTRACE_POKEDATA:
554 ret = generic_ptrace_pokedata(child, addr, data);
555 break;
556
557 case PTRACE_POKEUSR:
558 ret = ptrace_write_user(child, addr, data);
559 break;
560
561 /*
562 * continue/restart and stop at next (return from) syscall
563 */
564 case PTRACE_SYSCALL:
565 case PTRACE_CONT:
566 ret = -EIO;
567 if (!valid_signal(data))
568 break;
569 if (request == PTRACE_SYSCALL)
570 set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
571 else
572 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
573 child->exit_code = data;
574 /* make sure single-step breakpoint is gone. */
575 child->ptrace &= ~PT_SINGLESTEP;
576 ptrace_cancel_bpt(child);
577 wake_up_process(child);
578 ret = 0;
579 break;
580
581 /*
582 * make the child exit. Best I can do is send it a sigkill.
583 * perhaps it should be put in the status that it wants to
584 * exit.
585 */
586 case PTRACE_KILL:
587 /* make sure single-step breakpoint is gone. */
588 child->ptrace &= ~PT_SINGLESTEP;
589 ptrace_cancel_bpt(child);
590 if (child->exit_state != EXIT_ZOMBIE) {
591 child->exit_code = SIGKILL;
592 wake_up_process(child);
593 }
594 ret = 0;
595 break;
596
597 /*
598 * execute single instruction.
599 */
600 case PTRACE_SINGLESTEP:
601 ret = -EIO;
602 if (!valid_signal(data))
603 break;
604 child->ptrace |= PT_SINGLESTEP;
605 clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
606 child->exit_code = data;
607 /* give it a chance to run. */
608 wake_up_process(child);
609 ret = 0;
610 break;
611
612 case PTRACE_DETACH:
613 ret = ptrace_detach(child, data);
614 break;
615
616 case PTRACE_GETREGS:
617 ret = ptrace_getregs(child, (void *)data);
618 break;
619
620 case PTRACE_SETREGS:
621 ret = ptrace_setregs(child, (void *)data);
622 break;
623
624 case PTRACE_GETFPREGS:
625 ret = ptrace_getfpregs(child, (void *)data);
626 break;
627
628 case PTRACE_SETFPREGS:
629 ret = ptrace_setfpregs(child, (void *)data);
630 break;
631
632 default:
633 ret = ptrace_request(child, request, addr, data);
634 break;
635 }
636
637 return ret;
638}
639
640asmlinkage void syscall_trace(int why, struct pt_regs *regs)
641{
642 unsigned long ip;
643
644 if (!test_thread_flag(TIF_SYSCALL_TRACE))
645 return;
646 if (!(current->ptrace & PT_PTRACED))
647 return;
648
649 /*
650 * Save IP. IP is used to denote syscall entry/exit:
651 * IP = 0 -> entry, = 1 -> exit
652 */
653 ip = regs->ARM_ip;
654 regs->ARM_ip = why;
655
656 /* the 0x80 provides a way for the tracing parent to distinguish
657 between a syscall stop and SIGTRAP delivery */
658 ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
659 ? 0x80 : 0));
660 /*
661 * this isn't the same as continuing with a signal, but it will do
662 * for normal use. strace only continues with a signal if the
663 * stopping signal is not SIGTRAP. -brl
664 */
665 if (current->exit_code) {
666 send_sig(current->exit_code, current, 1);
667 current->exit_code = 0;
668 }
669 regs->ARM_ip = ip;
670}
diff --git a/arch/arm26/kernel/ptrace.h b/arch/arm26/kernel/ptrace.h
deleted file mode 100644
index 846c9d8d36ed..000000000000
--- a/arch/arm26/kernel/ptrace.h
+++ /dev/null
@@ -1,13 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/ptrace.h
3 *
4 * Copyright (C) 2000-2003 Russell King
5 * Copyright (C) 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11extern void ptrace_cancel_bpt(struct task_struct *);
12extern void ptrace_set_bpt(struct task_struct *);
13extern void ptrace_break(struct task_struct *, struct pt_regs *);
diff --git a/arch/arm26/kernel/semaphore.c b/arch/arm26/kernel/semaphore.c
deleted file mode 100644
index 5447a06db3fa..000000000000
--- a/arch/arm26/kernel/semaphore.c
+++ /dev/null
@@ -1,222 +0,0 @@
1/*
2 * ARM semaphore implementation, taken from
3 *
4 * i386 semaphore implementation.
5 *
6 * (C) Copyright 1999 Linus Torvalds
7 * (C) Copyright 2003 Ian Molton (ARM26 mods)
8 *
9 * Modified for ARM by Russell King
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#include <linux/module.h>
16#include <linux/sched.h>
17#include <linux/errno.h>
18#include <linux/init.h>
19
20#include <asm/semaphore.h>
21
22/*
23 * Semaphores are implemented using a two-way counter:
24 * The "count" variable is decremented for each process
25 * that tries to acquire the semaphore, while the "sleeping"
26 * variable is a count of such acquires.
27 *
28 * Notably, the inline "up()" and "down()" functions can
29 * efficiently test if they need to do any extra work (up
30 * needs to do something only if count was negative before
31 * the increment operation.
32 *
33 * "sleeping" and the contention routine ordering is
34 * protected by the semaphore spinlock.
35 *
36 * Note that these functions are only called when there is
37 * contention on the lock, and as such all this is the
38 * "non-critical" part of the whole semaphore business. The
39 * critical part is the inline stuff in <asm/semaphore.h>
40 * where we want to avoid any extra jumps and calls.
41 */
42
43/*
44 * Logic:
45 * - only on a boundary condition do we need to care. When we go
46 * from a negative count to a non-negative, we wake people up.
47 * - when we go from a non-negative count to a negative do we
48 * (a) synchronize with the "sleeper" count and (b) make sure
49 * that we're on the wakeup list before we synchronize so that
50 * we cannot lose wakeup events.
51 */
52
53void __up(struct semaphore *sem)
54{
55 wake_up(&sem->wait);
56}
57
58static DEFINE_SPINLOCK(semaphore_lock);
59
60void __sched __down(struct semaphore * sem)
61{
62 struct task_struct *tsk = current;
63 DECLARE_WAITQUEUE(wait, tsk);
64 tsk->state = TASK_UNINTERRUPTIBLE;
65 add_wait_queue_exclusive(&sem->wait, &wait);
66
67 spin_lock_irq(&semaphore_lock);
68 sem->sleepers++;
69 for (;;) {
70 int sleepers = sem->sleepers;
71
72 /*
73 * Add "everybody else" into it. They aren't
74 * playing, because we own the spinlock.
75 */
76 if (!atomic_add_negative(sleepers - 1, &sem->count)) {
77 sem->sleepers = 0;
78 break;
79 }
80 sem->sleepers = 1; /* us - see -1 above */
81 spin_unlock_irq(&semaphore_lock);
82
83 schedule();
84 tsk->state = TASK_UNINTERRUPTIBLE;
85 spin_lock_irq(&semaphore_lock);
86 }
87 spin_unlock_irq(&semaphore_lock);
88 remove_wait_queue(&sem->wait, &wait);
89 tsk->state = TASK_RUNNING;
90 wake_up(&sem->wait);
91}
92
93int __sched __down_interruptible(struct semaphore * sem)
94{
95 int retval = 0;
96 struct task_struct *tsk = current;
97 DECLARE_WAITQUEUE(wait, tsk);
98 tsk->state = TASK_INTERRUPTIBLE;
99 add_wait_queue_exclusive(&sem->wait, &wait);
100
101 spin_lock_irq(&semaphore_lock);
102 sem->sleepers ++;
103 for (;;) {
104 int sleepers = sem->sleepers;
105
106 /*
107 * With signals pending, this turns into
108 * the trylock failure case - we won't be
109 * sleeping, and we* can't get the lock as
110 * it has contention. Just correct the count
111 * and exit.
112 */
113 if (signal_pending(current)) {
114 retval = -EINTR;
115 sem->sleepers = 0;
116 atomic_add(sleepers, &sem->count);
117 break;
118 }
119
120 /*
121 * Add "everybody else" into it. They aren't
122 * playing, because we own the spinlock. The
123 * "-1" is because we're still hoping to get
124 * the lock.
125 */
126 if (!atomic_add_negative(sleepers - 1, &sem->count)) {
127 sem->sleepers = 0;
128 break;
129 }
130 sem->sleepers = 1; /* us - see -1 above */
131 spin_unlock_irq(&semaphore_lock);
132
133 schedule();
134 tsk->state = TASK_INTERRUPTIBLE;
135 spin_lock_irq(&semaphore_lock);
136 }
137 spin_unlock_irq(&semaphore_lock);
138 tsk->state = TASK_RUNNING;
139 remove_wait_queue(&sem->wait, &wait);
140 wake_up(&sem->wait);
141 return retval;
142}
143
144/*
145 * Trylock failed - make sure we correct for
146 * having decremented the count.
147 *
148 * We could have done the trylock with a
149 * single "cmpxchg" without failure cases,
150 * but then it wouldn't work on a 386.
151 */
152int __down_trylock(struct semaphore * sem)
153{
154 int sleepers;
155 unsigned long flags;
156
157 spin_lock_irqsave(&semaphore_lock, flags);
158 sleepers = sem->sleepers + 1;
159 sem->sleepers = 0;
160
161 /*
162 * Add "everybody else" and us into it. They aren't
163 * playing, because we own the spinlock.
164 */
165 if (!atomic_add_negative(sleepers, &sem->count))
166 wake_up(&sem->wait);
167
168 spin_unlock_irqrestore(&semaphore_lock, flags);
169 return 1;
170}
171
172/*
173 * The semaphore operations have a special calling sequence that
174 * allow us to do a simpler in-line version of them. These routines
175 * need to convert that sequence back into the C sequence when
176 * there is contention on the semaphore.
177 *
178 * ip contains the semaphore pointer on entry. Save the C-clobbered
179 * registers (r0 to r3 and lr), but not ip, as we use it as a return
180 * value in some cases..
181 */
182asm(" .section .sched.text , #alloc, #execinstr \n\
183 .align 5 \n\
184 .globl __down_failed \n\
185__down_failed: \n\
186 stmfd sp!, {r0 - r3, lr} \n\
187 mov r0, ip \n\
188 bl __down \n\
189 ldmfd sp!, {r0 - r3, pc}^ \n\
190 \n\
191 .align 5 \n\
192 .globl __down_interruptible_failed \n\
193__down_interruptible_failed: \n\
194 stmfd sp!, {r0 - r3, lr} \n\
195 mov r0, ip \n\
196 bl __down_interruptible \n\
197 mov ip, r0 \n\
198 ldmfd sp!, {r0 - r3, pc}^ \n\
199 \n\
200 .align 5 \n\
201 .globl __down_trylock_failed \n\
202__down_trylock_failed: \n\
203 stmfd sp!, {r0 - r3, lr} \n\
204 mov r0, ip \n\
205 bl __down_trylock \n\
206 mov ip, r0 \n\
207 ldmfd sp!, {r0 - r3, pc}^ \n\
208 \n\
209 .align 5 \n\
210 .globl __up_wakeup \n\
211__up_wakeup: \n\
212 stmfd sp!, {r0 - r3, lr} \n\
213 mov r0, ip \n\
214 bl __up \n\
215 ldmfd sp!, {r0 - r3, pc}^ \n\
216 ");
217
218EXPORT_SYMBOL(__down_failed);
219EXPORT_SYMBOL(__down_interruptible_failed);
220EXPORT_SYMBOL(__down_trylock_failed);
221EXPORT_SYMBOL(__up_wakeup);
222
diff --git a/arch/arm26/kernel/setup.c b/arch/arm26/kernel/setup.c
deleted file mode 100644
index 0e006c6cd5a0..000000000000
--- a/arch/arm26/kernel/setup.c
+++ /dev/null
@@ -1,572 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/setup.c
3 *
4 * Copyright (C) 1995-2001 Russell King
5 * Copyright (C) 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/kernel.h>
12#include <linux/stddef.h>
13#include <linux/ioport.h>
14#include <linux/delay.h>
15#include <linux/utsname.h>
16#include <linux/blkdev.h>
17#include <linux/console.h>
18#include <linux/bootmem.h>
19#include <linux/seq_file.h>
20#include <linux/screen_info.h>
21#include <linux/init.h>
22#include <linux/root_dev.h>
23
24#include <asm/elf.h>
25#include <asm/hardware.h>
26#include <asm/io.h>
27#include <asm/procinfo.h>
28#include <asm/setup.h>
29#include <asm/mach-types.h>
30#include <asm/tlbflush.h>
31
32#include <asm/irqchip.h>
33
34#ifndef MEM_SIZE
35#define MEM_SIZE (16*1024*1024)
36#endif
37
38#ifdef CONFIG_PREEMPT
39DEFINE_SPINLOCK(kernel_flag);
40#endif
41
42#if defined(CONFIG_FPE_NWFPE)
43char fpe_type[8];
44
45static int __init fpe_setup(char *line)
46{
47 memcpy(fpe_type, line, 8);
48 return 1;
49}
50
51__setup("fpe=", fpe_setup);
52#endif
53
54extern void paging_init(struct meminfo *);
55extern void convert_to_tag_list(struct tag *tags);
56extern void squash_mem_tags(struct tag *tag);
57extern void bootmem_init(struct meminfo *);
58extern int root_mountflags;
59extern int _stext, _text, _etext, _edata, _end;
60#ifdef CONFIG_XIP_KERNEL
61extern int _endtext, _sdata;
62#endif
63
64
65unsigned int processor_id;
66unsigned int __machine_arch_type;
67unsigned int system_rev;
68unsigned int system_serial_low;
69unsigned int system_serial_high;
70unsigned int elf_hwcap;
71unsigned int memc_ctrl_reg;
72unsigned int number_mfm_drives;
73
74struct processor processor;
75
76char elf_platform[ELF_PLATFORM_SIZE];
77
78unsigned long phys_initrd_start __initdata = 0;
79unsigned long phys_initrd_size __initdata = 0;
80static struct meminfo meminfo __initdata = { 0, };
81static struct proc_info_item proc_info;
82static const char *machine_name;
83static char __initdata command_line[COMMAND_LINE_SIZE];
84
85static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
86
87/*
88 * Standard memory resources
89 */
90static struct resource mem_res[] = {
91 { "Video RAM", 0, 0, IORESOURCE_MEM },
92 { "Kernel code", 0, 0, IORESOURCE_MEM },
93 { "Kernel data", 0, 0, IORESOURCE_MEM }
94};
95
96#define video_ram mem_res[0]
97#define kernel_code mem_res[1]
98#define kernel_data mem_res[2]
99
100static struct resource io_res[] = {
101 { "reserved", 0x3bc, 0x3be, IORESOURCE_IO | IORESOURCE_BUSY },
102 { "reserved", 0x378, 0x37f, IORESOURCE_IO | IORESOURCE_BUSY },
103 { "reserved", 0x278, 0x27f, IORESOURCE_IO | IORESOURCE_BUSY }
104};
105
106#define lp0 io_res[0]
107#define lp1 io_res[1]
108#define lp2 io_res[2]
109
110#define dump_cpu_info() do { } while (0)
111
112static void __init setup_processor(void)
113{
114 extern struct proc_info_list __proc_info_begin, __proc_info_end;
115 struct proc_info_list *list;
116
117 /*
118 * locate processor in the list of supported processor
119 * types. The linker builds this table for us from the
120 * entries in arch/arm26/mm/proc-*.S
121 */
122 for (list = &__proc_info_begin; list < &__proc_info_end ; list++)
123 if ((processor_id & list->cpu_mask) == list->cpu_val)
124 break;
125
126 /*
127 * If processor type is unrecognised, then we
128 * can do nothing...
129 */
130 if (list >= &__proc_info_end) {
131 printk("CPU configuration botched (ID %08x), unable "
132 "to continue.\n", processor_id);
133 while (1);
134 }
135
136 proc_info = *list->info;
137 processor = *list->proc;
138
139
140 printk("CPU: %s %s revision %d\n",
141 proc_info.manufacturer, proc_info.cpu_name,
142 (int)processor_id & 15);
143
144 dump_cpu_info();
145
146 sprintf(init_utsname()->machine, "%s", list->arch_name);
147 sprintf(elf_platform, "%s", list->elf_name);
148 elf_hwcap = list->elf_hwcap;
149
150 cpu_proc_init();
151}
152
153/*
154 * Initial parsing of the command line. We need to pick out the
155 * memory size. We look for mem=size@start, where start and size
156 * are "size[KkMm]"
157 */
158static void __init
159parse_cmdline(struct meminfo *mi, char **cmdline_p, char *from)
160{
161 char c = ' ', *to = command_line;
162 int usermem = 0, len = 0;
163
164 for (;;) {
165 if (c == ' ' && !memcmp(from, "mem=", 4)) {
166 unsigned long size, start;
167
168 if (to != command_line)
169 to -= 1;
170
171 /*
172 * If the user specifies memory size, we
173 * blow away any automatically generated
174 * size.
175 */
176 if (usermem == 0) {
177 usermem = 1;
178 mi->nr_banks = 0;
179 }
180
181 start = PHYS_OFFSET;
182 size = memparse(from + 4, &from);
183 if (*from == '@')
184 start = memparse(from + 1, &from);
185
186 mi->bank[mi->nr_banks].start = start;
187 mi->bank[mi->nr_banks].size = size;
188 mi->bank[mi->nr_banks].node = PHYS_TO_NID(start);
189 mi->nr_banks += 1;
190 }
191 c = *from++;
192 if (!c)
193 break;
194 if (COMMAND_LINE_SIZE <= ++len)
195 break;
196 *to++ = c;
197 }
198 *to = '\0';
199 *cmdline_p = command_line;
200}
201
202static void __init
203setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
204{
205#ifdef CONFIG_BLK_DEV_RAM
206 extern int rd_size, rd_image_start, rd_prompt, rd_doload;
207
208 rd_image_start = image_start;
209 rd_prompt = prompt;
210 rd_doload = doload;
211
212 if (rd_sz)
213 rd_size = rd_sz;
214#endif
215}
216
217static void __init
218request_standard_resources(struct meminfo *mi)
219{
220 struct resource *res;
221 int i;
222
223 kernel_code.start = init_mm.start_code;
224 kernel_code.end = init_mm.end_code - 1;
225#ifdef CONFIG_XIP_KERNEL
226 kernel_data.start = init_mm.start_data;
227#else
228 kernel_data.start = init_mm.end_code;
229#endif
230 kernel_data.end = init_mm.brk - 1;
231
232 for (i = 0; i < mi->nr_banks; i++) {
233 unsigned long virt_start, virt_end;
234
235 if (mi->bank[i].size == 0)
236 continue;
237
238 virt_start = mi->bank[i].start;
239 virt_end = virt_start + mi->bank[i].size - 1;
240
241 res = alloc_bootmem_low(sizeof(*res));
242 res->name = "System RAM";
243 res->start = virt_start;
244 res->end = virt_end;
245 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
246
247 request_resource(&iomem_resource, res);
248
249 if (kernel_code.start >= res->start &&
250 kernel_code.end <= res->end)
251 request_resource(res, &kernel_code);
252 if (kernel_data.start >= res->start &&
253 kernel_data.end <= res->end)
254 request_resource(res, &kernel_data);
255 }
256
257/* FIXME - needed? if (mdesc->video_start) {
258 video_ram.start = mdesc->video_start;
259 video_ram.end = mdesc->video_end;
260 request_resource(&iomem_resource, &video_ram);
261 }*/
262
263 /*
264 * Some machines don't have the possibility of ever
265 * possessing lp1 or lp2
266 */
267 if (0) /* FIXME - need to do this for A5k at least */
268 request_resource(&ioport_resource, &lp0);
269}
270
271/*
272 * Tag parsing.
273 *
274 * This is the new way of passing data to the kernel at boot time. Rather
275 * than passing a fixed inflexible structure to the kernel, we pass a list
276 * of variable-sized tags to the kernel. The first tag must be a ATAG_CORE
277 * tag for the list to be recognised (to distinguish the tagged list from
278 * a param_struct). The list is terminated with a zero-length tag (this tag
279 * is not parsed in any way).
280 */
281static int __init parse_tag_core(const struct tag *tag)
282{
283 if (tag->hdr.size > 2) {
284 if ((tag->u.core.flags & 1) == 0)
285 root_mountflags &= ~MS_RDONLY;
286 ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
287 }
288 return 0;
289}
290
291__tagtable(ATAG_CORE, parse_tag_core);
292
293static int __init parse_tag_mem32(const struct tag *tag)
294{
295 if (meminfo.nr_banks >= NR_BANKS) {
296 printk(KERN_WARNING
297 "Ignoring memory bank 0x%08x size %dKB\n",
298 tag->u.mem.start, tag->u.mem.size / 1024);
299 return -EINVAL;
300 }
301 meminfo.bank[meminfo.nr_banks].start = tag->u.mem.start;
302 meminfo.bank[meminfo.nr_banks].size = tag->u.mem.size;
303 meminfo.bank[meminfo.nr_banks].node = PHYS_TO_NID(tag->u.mem.start);
304 meminfo.nr_banks += 1;
305
306 return 0;
307}
308
309__tagtable(ATAG_MEM, parse_tag_mem32);
310
311#if defined(CONFIG_DUMMY_CONSOLE)
312struct screen_info screen_info = {
313 .orig_video_lines = 30,
314 .orig_video_cols = 80,
315 .orig_video_mode = 0,
316 .orig_video_ega_bx = 0,
317 .orig_video_isVGA = 1,
318 .orig_video_points = 8
319};
320
321static int __init parse_tag_videotext(const struct tag *tag)
322{
323 screen_info.orig_x = tag->u.videotext.x;
324 screen_info.orig_y = tag->u.videotext.y;
325 screen_info.orig_video_page = tag->u.videotext.video_page;
326 screen_info.orig_video_mode = tag->u.videotext.video_mode;
327 screen_info.orig_video_cols = tag->u.videotext.video_cols;
328 screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
329 screen_info.orig_video_lines = tag->u.videotext.video_lines;
330 screen_info.orig_video_isVGA = tag->u.videotext.video_isvga;
331 screen_info.orig_video_points = tag->u.videotext.video_points;
332 return 0;
333}
334
335__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
336#endif
337
338static int __init parse_tag_acorn(const struct tag *tag)
339{
340 memc_ctrl_reg = tag->u.acorn.memc_control_reg;
341 number_mfm_drives = tag->u.acorn.adfsdrives;
342 return 0;
343}
344
345__tagtable(ATAG_ACORN, parse_tag_acorn);
346
347static int __init parse_tag_ramdisk(const struct tag *tag)
348{
349 setup_ramdisk((tag->u.ramdisk.flags & 1) == 0,
350 (tag->u.ramdisk.flags & 2) == 0,
351 tag->u.ramdisk.start, tag->u.ramdisk.size);
352 return 0;
353}
354
355__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
356
357static int __init parse_tag_initrd(const struct tag *tag)
358{
359 printk(KERN_WARNING "ATAG_INITRD is deprecated; please update your bootloader. \n");
360 phys_initrd_start = (unsigned long)tag->u.initrd.start;
361 phys_initrd_size = (unsigned long)tag->u.initrd.size;
362 return 0;
363}
364
365__tagtable(ATAG_INITRD, parse_tag_initrd);
366
367static int __init parse_tag_initrd2(const struct tag *tag)
368{
369 printk(KERN_WARNING "ATAG_INITRD is deprecated; please update your bootloader. \n");
370 phys_initrd_start = (unsigned long)tag->u.initrd.start;
371 phys_initrd_size = (unsigned long)tag->u.initrd.size;
372 return 0;
373}
374
375__tagtable(ATAG_INITRD2, parse_tag_initrd2);
376
377static int __init parse_tag_serialnr(const struct tag *tag)
378{
379 system_serial_low = tag->u.serialnr.low;
380 system_serial_high = tag->u.serialnr.high;
381 return 0;
382}
383
384__tagtable(ATAG_SERIAL, parse_tag_serialnr);
385
386static int __init parse_tag_revision(const struct tag *tag)
387{
388 system_rev = tag->u.revision.rev;
389 return 0;
390}
391
392__tagtable(ATAG_REVISION, parse_tag_revision);
393
394static int __init parse_tag_cmdline(const struct tag *tag)
395{
396 strncpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
397 default_command_line[COMMAND_LINE_SIZE - 1] = '\0';
398 return 0;
399}
400
401__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
402
403/*
404 * Scan the tag table for this tag, and call its parse function.
405 * The tag table is built by the linker from all the __tagtable
406 * declarations.
407 */
408static int __init parse_tag(const struct tag *tag)
409{
410 extern struct tagtable __tagtable_begin, __tagtable_end;
411 struct tagtable *t;
412
413 for (t = &__tagtable_begin; t < &__tagtable_end; t++)
414 if (tag->hdr.tag == t->tag) {
415 t->parse(tag);
416 break;
417 }
418
419 return t < &__tagtable_end;
420}
421
422/*
423 * Parse all tags in the list, checking both the global and architecture
424 * specific tag tables.
425 */
426static void __init parse_tags(const struct tag *t)
427{
428 for (; t->hdr.size; t = tag_next(t))
429 if (!parse_tag(t))
430 printk(KERN_WARNING
431 "Ignoring unrecognised tag 0x%08x\n",
432 t->hdr.tag);
433}
434
435/*
436 * This holds our defaults.
437 */
438static struct init_tags {
439 struct tag_header hdr1;
440 struct tag_core core;
441 struct tag_header hdr2;
442 struct tag_mem32 mem;
443 struct tag_header hdr3;
444} init_tags __initdata = {
445 { tag_size(tag_core), ATAG_CORE },
446 { 1, PAGE_SIZE, 0xff },
447 { tag_size(tag_mem32), ATAG_MEM },
448 { MEM_SIZE, PHYS_OFFSET },
449 { 0, ATAG_NONE }
450};
451
452void __init setup_arch(char **cmdline_p)
453{
454 struct tag *tags = (struct tag *)&init_tags;
455 char *from = default_command_line;
456
457 setup_processor();
458 if(machine_arch_type == MACH_TYPE_A5K)
459 machine_name = "A5000";
460 else if(machine_arch_type == MACH_TYPE_ARCHIMEDES)
461 machine_name = "Archimedes";
462 else
463 machine_name = "UNKNOWN";
464
465 //FIXME - the tag struct is always copied here but this is a block
466 // of RAM that is accidentally reserved along with video RAM. perhaps
467 // it would be a good idea to explicitly reserve this?
468
469 tags = (struct tag *)0x0207c000;
470
471 /*
472 * If we have the old style parameters, convert them to
473 * a tag list.
474 */
475 if (tags->hdr.tag != ATAG_CORE)
476 convert_to_tag_list(tags);
477 if (tags->hdr.tag != ATAG_CORE)
478 tags = (struct tag *)&init_tags;
479 if (tags->hdr.tag == ATAG_CORE) {
480 if (meminfo.nr_banks != 0)
481 squash_mem_tags(tags);
482 parse_tags(tags);
483 }
484
485 init_mm.start_code = (unsigned long) &_text;
486#ifndef CONFIG_XIP_KERNEL
487 init_mm.end_code = (unsigned long) &_etext;
488#else
489 init_mm.end_code = (unsigned long) &_endtext;
490 init_mm.start_data = (unsigned long) &_sdata;
491#endif
492 init_mm.end_data = (unsigned long) &_edata;
493 init_mm.brk = (unsigned long) &_end;
494
495 memcpy(boot_command_line, from, COMMAND_LINE_SIZE);
496 boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
497 parse_cmdline(&meminfo, cmdline_p, from);
498 bootmem_init(&meminfo);
499 paging_init(&meminfo);
500 request_standard_resources(&meminfo);
501
502#ifdef CONFIG_VT
503#if defined(CONFIG_DUMMY_CONSOLE)
504 conswitchp = &dummy_con;
505#endif
506#endif
507}
508
509static const char *hwcap_str[] = {
510 "swp",
511 "half",
512 "thumb",
513 "26bit",
514 "fastmult",
515 "fpa",
516 "vfp",
517 "edsp",
518 NULL
519};
520
521static int c_show(struct seq_file *m, void *v)
522{
523 int i;
524
525 seq_printf(m, "Processor\t: %s %s rev %d (%s)\n",
526 proc_info.manufacturer, proc_info.cpu_name,
527 (int)processor_id & 15, elf_platform);
528
529 seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
530 loops_per_jiffy / (500000/HZ),
531 (loops_per_jiffy / (5000/HZ)) % 100);
532
533 /* dump out the processor features */
534 seq_puts(m, "Features\t: ");
535
536 for (i = 0; hwcap_str[i]; i++)
537 if (elf_hwcap & (1 << i))
538 seq_printf(m, "%s ", hwcap_str[i]);
539
540 seq_puts(m, "\n");
541
542 seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4);
543 seq_printf(m, "CPU revision\t: %d\n\n", processor_id & 15);
544 seq_printf(m, "Hardware\t: %s\n", machine_name);
545 seq_printf(m, "Revision\t: %04x\n", system_rev);
546 seq_printf(m, "Serial\t\t: %08x%08x\n",
547 system_serial_high, system_serial_low);
548
549 return 0;
550}
551
552static void *c_start(struct seq_file *m, loff_t *pos)
553{
554 return *pos < 1 ? (void *)1 : NULL;
555}
556
557static void *c_next(struct seq_file *m, void *v, loff_t *pos)
558{
559 ++*pos;
560 return NULL;
561}
562
563static void c_stop(struct seq_file *m, void *v)
564{
565}
566
567struct seq_operations cpuinfo_op = {
568 .start = c_start,
569 .next = c_next,
570 .stop = c_stop,
571 .show = c_show
572};
diff --git a/arch/arm26/kernel/signal.c b/arch/arm26/kernel/signal.c
deleted file mode 100644
index 379b82dc645f..000000000000
--- a/arch/arm26/kernel/signal.c
+++ /dev/null
@@ -1,538 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/signal.c
3 *
4 * Copyright (C) 1995-2002 Russell King
5 * Copyright (C) 2003 Ian Molton (ARM26)
6 *
7 * FIXME!!! This is probably very broken (13/05/2003)
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 version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/sched.h>
14#include <linux/mm.h>
15#include <linux/smp.h>
16#include <linux/kernel.h>
17#include <linux/errno.h>
18#include <linux/signal.h>
19#include <linux/wait.h>
20#include <linux/ptrace.h>
21#include <linux/personality.h>
22#include <linux/tty.h>
23#include <linux/binfmts.h>
24#include <linux/elf.h>
25
26#include <asm/pgalloc.h>
27#include <asm/ucontext.h>
28#include <asm/uaccess.h>
29#include <asm/unistd.h>
30
31#include "ptrace.h"
32
33#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
34
35/*
36 * For ARM syscalls, we encode the syscall number into the instruction.
37 */
38#define SWI_SYS_SIGRETURN (0xef000000|(__NR_sigreturn))
39#define SWI_SYS_RT_SIGRETURN (0xef000000|(__NR_rt_sigreturn))
40
41static int do_signal(sigset_t *oldset, struct pt_regs * regs, int syscall);
42
43/*
44 * atomically swap in the new signal mask, and wait for a signal.
45 */
46asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask, struct pt_regs *regs)
47{
48 sigset_t saveset;
49
50 mask &= _BLOCKABLE;
51 spin_lock_irq(&current->sighand->siglock);
52 saveset = current->blocked;
53 siginitset(&current->blocked, mask);
54 recalc_sigpending();
55 spin_unlock_irq(&current->sighand->siglock);
56 regs->ARM_r0 = -EINTR;
57
58 while (1) {
59 current->state = TASK_INTERRUPTIBLE;
60 schedule();
61 if (do_signal(&saveset, regs, 0))
62 return regs->ARM_r0;
63 }
64}
65
66asmlinkage int
67sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
68{
69 sigset_t saveset, newset;
70
71 /* XXX: Don't preclude handling different sized sigset_t's. */
72 if (sigsetsize != sizeof(sigset_t))
73 return -EINVAL;
74
75 if (copy_from_user(&newset, unewset, sizeof(newset)))
76 return -EFAULT;
77 sigdelsetmask(&newset, ~_BLOCKABLE);
78
79 spin_lock_irq(&current->sighand->siglock);
80 saveset = current->blocked;
81 current->blocked = newset;
82 recalc_sigpending();
83 spin_unlock_irq(&current->sighand->siglock);
84 regs->ARM_r0 = -EINTR;
85
86 while (1) {
87 current->state = TASK_INTERRUPTIBLE;
88 schedule();
89 if (do_signal(&saveset, regs, 0))
90 return regs->ARM_r0;
91 }
92}
93
94asmlinkage int
95sys_sigaction(int sig, const struct old_sigaction *act,
96 struct old_sigaction *oact)
97{
98 struct k_sigaction new_ka, old_ka;
99 int ret;
100
101 if (act) {
102 old_sigset_t mask;
103 if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
104 __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
105 __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
106 return -EFAULT;
107 __get_user(new_ka.sa.sa_flags, &act->sa_flags);
108 __get_user(mask, &act->sa_mask);
109 siginitset(&new_ka.sa.sa_mask, mask);
110 }
111
112 ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
113
114 if (!ret && oact) {
115 if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
116 __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
117 __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
118 return -EFAULT;
119 __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
120 __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
121 }
122
123 return ret;
124}
125
126/*
127 * Do a signal return; undo the signal stack.
128 */
129struct sigframe
130{
131 struct sigcontext sc;
132 unsigned long extramask[_NSIG_WORDS-1];
133 unsigned long retcode;
134};
135
136struct rt_sigframe
137{
138 struct siginfo *pinfo;
139 void *puc;
140 struct siginfo info;
141 struct ucontext uc;
142 unsigned long retcode;
143};
144
145static int
146restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
147{
148 int err = 0;
149
150 __get_user_error(regs->ARM_r0, &sc->arm_r0, err);
151 __get_user_error(regs->ARM_r1, &sc->arm_r1, err);
152 __get_user_error(regs->ARM_r2, &sc->arm_r2, err);
153 __get_user_error(regs->ARM_r3, &sc->arm_r3, err);
154 __get_user_error(regs->ARM_r4, &sc->arm_r4, err);
155 __get_user_error(regs->ARM_r5, &sc->arm_r5, err);
156 __get_user_error(regs->ARM_r6, &sc->arm_r6, err);
157 __get_user_error(regs->ARM_r7, &sc->arm_r7, err);
158 __get_user_error(regs->ARM_r8, &sc->arm_r8, err);
159 __get_user_error(regs->ARM_r9, &sc->arm_r9, err);
160 __get_user_error(regs->ARM_r10, &sc->arm_r10, err);
161 __get_user_error(regs->ARM_fp, &sc->arm_fp, err);
162 __get_user_error(regs->ARM_ip, &sc->arm_ip, err);
163 __get_user_error(regs->ARM_sp, &sc->arm_sp, err);
164 __get_user_error(regs->ARM_lr, &sc->arm_lr, err);
165 __get_user_error(regs->ARM_pc, &sc->arm_pc, err);
166
167 err |= !valid_user_regs(regs);
168
169 return err;
170}
171
172asmlinkage int sys_sigreturn(struct pt_regs *regs)
173{
174 struct sigframe *frame;
175 sigset_t set;
176
177 /*
178 * Since we stacked the signal on a 64-bit boundary,
179 * then 'sp' should be word aligned here. If it's
180 * not, then the user is trying to mess with us.
181 */
182 if (regs->ARM_sp & 7)
183 goto badframe;
184
185 frame = (struct sigframe *)regs->ARM_sp;
186
187 if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
188 goto badframe;
189 if (__get_user(set.sig[0], &frame->sc.oldmask)
190 || (_NSIG_WORDS > 1
191 && __copy_from_user(&set.sig[1], &frame->extramask,
192 sizeof(frame->extramask))))
193 goto badframe;
194
195 sigdelsetmask(&set, ~_BLOCKABLE);
196 spin_lock_irq(&current->sighand->siglock);
197 current->blocked = set;
198 recalc_sigpending();
199 spin_unlock_irq(&current->sighand->siglock);
200
201 if (restore_sigcontext(regs, &frame->sc))
202 goto badframe;
203
204 /* Send SIGTRAP if we're single-stepping */
205 if (current->ptrace & PT_SINGLESTEP) {
206 ptrace_cancel_bpt(current);
207 send_sig(SIGTRAP, current, 1);
208 }
209
210 return regs->ARM_r0;
211
212badframe:
213 force_sig(SIGSEGV, current);
214 return 0;
215}
216
217asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
218{
219 struct rt_sigframe *frame;
220 sigset_t set;
221
222 /*
223 * Since we stacked the signal on a 64-bit boundary,
224 * then 'sp' should be word aligned here. If it's
225 * not, then the user is trying to mess with us.
226 */
227 if (regs->ARM_sp & 7)
228 goto badframe;
229
230 frame = (struct rt_sigframe *)regs->ARM_sp;
231
232 if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
233 goto badframe;
234 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
235 goto badframe;
236
237 sigdelsetmask(&set, ~_BLOCKABLE);
238 spin_lock_irq(&current->sighand->siglock);
239 current->blocked = set;
240 recalc_sigpending();
241 spin_unlock_irq(&current->sighand->siglock);
242
243 if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
244 goto badframe;
245
246 /* Send SIGTRAP if we're single-stepping */
247 if (current->ptrace & PT_SINGLESTEP) {
248 ptrace_cancel_bpt(current);
249 send_sig(SIGTRAP, current, 1);
250 }
251
252 return regs->ARM_r0;
253
254badframe:
255 force_sig(SIGSEGV, current);
256 return 0;
257}
258
259static int
260setup_sigcontext(struct sigcontext *sc, /*struct _fpstate *fpstate,*/
261 struct pt_regs *regs, unsigned long mask)
262{
263 int err = 0;
264
265 __put_user_error(regs->ARM_r0, &sc->arm_r0, err);
266 __put_user_error(regs->ARM_r1, &sc->arm_r1, err);
267 __put_user_error(regs->ARM_r2, &sc->arm_r2, err);
268 __put_user_error(regs->ARM_r3, &sc->arm_r3, err);
269 __put_user_error(regs->ARM_r4, &sc->arm_r4, err);
270 __put_user_error(regs->ARM_r5, &sc->arm_r5, err);
271 __put_user_error(regs->ARM_r6, &sc->arm_r6, err);
272 __put_user_error(regs->ARM_r7, &sc->arm_r7, err);
273 __put_user_error(regs->ARM_r8, &sc->arm_r8, err);
274 __put_user_error(regs->ARM_r9, &sc->arm_r9, err);
275 __put_user_error(regs->ARM_r10, &sc->arm_r10, err);
276 __put_user_error(regs->ARM_fp, &sc->arm_fp, err);
277 __put_user_error(regs->ARM_ip, &sc->arm_ip, err);
278 __put_user_error(regs->ARM_sp, &sc->arm_sp, err);
279 __put_user_error(regs->ARM_lr, &sc->arm_lr, err);
280 __put_user_error(regs->ARM_pc, &sc->arm_pc, err);
281
282 __put_user_error(current->thread.trap_no, &sc->trap_no, err);
283 __put_user_error(current->thread.error_code, &sc->error_code, err);
284 __put_user_error(current->thread.address, &sc->fault_address, err);
285 __put_user_error(mask, &sc->oldmask, err);
286
287 return err;
288}
289
290static inline void *
291get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
292{
293 unsigned long sp = regs->ARM_sp;
294
295 /*
296 * This is the X/Open sanctioned signal stack switching.
297 */
298 if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
299 sp = current->sas_ss_sp + current->sas_ss_size;
300
301 /*
302 * ATPCS B01 mandates 8-byte alignment
303 */
304 return (void *)((sp - framesize) & ~7);
305}
306
307static int
308setup_return(struct pt_regs *regs, struct k_sigaction *ka,
309 unsigned long *rc, void *frame, int usig)
310{
311 unsigned long handler = (unsigned long)ka->sa.sa_handler;
312 unsigned long retcode;
313
314 if (ka->sa.sa_flags & SA_RESTORER) {
315 retcode = (unsigned long)ka->sa.sa_restorer;
316 } else {
317
318 if (__put_user((ka->sa.sa_flags & SA_SIGINFO)?SWI_SYS_RT_SIGRETURN:SWI_SYS_SIGRETURN, rc))
319 return 1;
320
321 retcode = ((unsigned long)rc);
322 }
323
324 regs->ARM_r0 = usig;
325 regs->ARM_sp = (unsigned long)frame;
326 regs->ARM_lr = retcode;
327 regs->ARM_pc = handler & ~3;
328
329 return 0;
330}
331
332static int
333setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *regs)
334{
335 struct sigframe *frame = get_sigframe(ka, regs, sizeof(*frame));
336 int err = 0;
337
338 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
339 return 1;
340
341 err |= setup_sigcontext(&frame->sc, /*&frame->fpstate,*/ regs, set->sig[0]);
342
343 if (_NSIG_WORDS > 1) {
344 err |= __copy_to_user(frame->extramask, &set->sig[1],
345 sizeof(frame->extramask));
346 }
347
348 if (err == 0)
349 err = setup_return(regs, ka, &frame->retcode, frame, usig);
350
351 return err;
352}
353
354static int
355setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
356 sigset_t *set, struct pt_regs *regs)
357{
358 struct rt_sigframe *frame = get_sigframe(ka, regs, sizeof(*frame));
359 int err = 0;
360
361 if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
362 return 1;
363
364 __put_user_error(&frame->info, &frame->pinfo, err);
365 __put_user_error(&frame->uc, &frame->puc, err);
366 err |= copy_siginfo_to_user(&frame->info, info);
367
368 /* Clear all the bits of the ucontext we don't use. */
369 err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
370
371 err |= setup_sigcontext(&frame->uc.uc_mcontext, /*&frame->fpstate,*/
372 regs, set->sig[0]);
373 err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
374
375 if (err == 0)
376 err = setup_return(regs, ka, &frame->retcode, frame, usig);
377
378 if (err == 0) {
379 /*
380 * For realtime signals we must also set the second and third
381 * arguments for the signal handler.
382 * -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06
383 */
384 regs->ARM_r1 = (unsigned long)frame->pinfo;
385 regs->ARM_r2 = (unsigned long)frame->puc;
386 }
387
388 return err;
389}
390
391static inline void restart_syscall(struct pt_regs *regs)
392{
393 regs->ARM_r0 = regs->ARM_ORIG_r0;
394 regs->ARM_pc -= 4;
395}
396
397/*
398 * OK, we're invoking a handler
399 */
400static void
401handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
402 struct pt_regs * regs, int syscall)
403{
404 struct thread_info *thread = current_thread_info();
405 struct task_struct *tsk = current;
406 struct k_sigaction *ka = &tsk->sighand->action[sig-1];
407 int usig = sig;
408 int ret;
409
410 /*
411 * If we were from a system call, check for system call restarting...
412 */
413 if (syscall) {
414 switch (regs->ARM_r0) {
415 case -ERESTART_RESTARTBLOCK:
416 current_thread_info()->restart_block.fn =
417 do_no_restart_syscall;
418 case -ERESTARTNOHAND:
419 regs->ARM_r0 = -EINTR;
420 break;
421 case -ERESTARTSYS:
422 if (!(ka->sa.sa_flags & SA_RESTART)) {
423 regs->ARM_r0 = -EINTR;
424 break;
425 }
426 /* fallthrough */
427 case -ERESTARTNOINTR:
428 restart_syscall(regs);
429 }
430 }
431
432 /*
433 * translate the signal
434 */
435 if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
436 usig = thread->exec_domain->signal_invmap[usig];
437
438 /*
439 * Set up the stack frame
440 */
441 if (ka->sa.sa_flags & SA_SIGINFO)
442 ret = setup_rt_frame(usig, ka, info, oldset, regs);
443 else
444 ret = setup_frame(usig, ka, oldset, regs);
445
446 /*
447 * Check that the resulting registers are actually sane.
448 */
449 ret |= !valid_user_regs(regs);
450
451 if (ret == 0) {
452 if (ka->sa.sa_flags & SA_ONESHOT)
453 ka->sa.sa_handler = SIG_DFL;
454
455 spin_lock_irq(&tsk->sighand->siglock);
456 sigorsets(&tsk->blocked, &tsk->blocked,
457 &ka->sa.sa_mask);
458 if (!(ka->sa.sa_flags & SA_NODEFER))
459 sigaddset(&tsk->blocked, sig);
460 recalc_sigpending();
461 spin_unlock_irq(&tsk->sighand->siglock);
462 return;
463 }
464
465 force_sigsegv(sig, tsk);
466}
467
468/*
469 * Note that 'init' is a special process: it doesn't get signals it doesn't
470 * want to handle. Thus you cannot kill init even with a SIGKILL even by
471 * mistake.
472 *
473 * Note that we go through the signals twice: once to check the signals that
474 * the kernel can handle, and then we build all the user-level signal handling
475 * stack-frames in one go after that.
476 */
477static int do_signal(sigset_t *oldset, struct pt_regs *regs, int syscall)
478{
479 siginfo_t info;
480 int signr;
481 struct k_sigaction ka;
482
483 /*
484 * We want the common case to go fast, which
485 * is why we may in certain cases get here from
486 * kernel mode. Just return without doing anything
487 * if so.
488 */
489 if (!user_mode(regs))
490 return 0;
491
492 if (current->ptrace & PT_SINGLESTEP)
493 ptrace_cancel_bpt(current);
494
495 signr = get_signal_to_deliver(&info, &ka, regs, NULL);
496 if (signr > 0) {
497 handle_signal(signr, &info, oldset, regs, syscall);
498 if (current->ptrace & PT_SINGLESTEP)
499 ptrace_set_bpt(current);
500 return 1;
501 }
502
503 /*
504 * No signal to deliver to the process - restart the syscall.
505 */
506 if (syscall) {
507 if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) {
508 u32 *usp;
509
510 regs->ARM_sp -= 12;
511 usp = (u32 *)regs->ARM_sp;
512
513 put_user(regs->ARM_pc, &usp[0]);
514 /* swi __NR_restart_syscall */
515 put_user(0xef000000 | __NR_restart_syscall, &usp[1]);
516 /* ldr pc, [sp], #12 */
517// FIXME!!! is #12 correct there?
518 put_user(0xe49df00c, &usp[2]);
519
520 regs->ARM_pc = regs->ARM_sp + 4;
521 }
522 if (regs->ARM_r0 == -ERESTARTNOHAND ||
523 regs->ARM_r0 == -ERESTARTSYS ||
524 regs->ARM_r0 == -ERESTARTNOINTR) {
525 restart_syscall(regs);
526 }
527 }
528 if (current->ptrace & PT_SINGLESTEP)
529 ptrace_set_bpt(current);
530 return 0;
531}
532
533asmlinkage void
534do_notify_resume(struct pt_regs *regs, unsigned int thread_flags, int syscall)
535{
536 if (thread_flags & _TIF_SIGPENDING)
537 do_signal(&current->blocked, regs, syscall);
538}
diff --git a/arch/arm26/kernel/sys_arm.c b/arch/arm26/kernel/sys_arm.c
deleted file mode 100644
index dc05aba58baf..000000000000
--- a/arch/arm26/kernel/sys_arm.c
+++ /dev/null
@@ -1,323 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/sys_arm.c
3 *
4 * Copyright (C) People who wrote linux/arch/i386/kernel/sys_i386.c
5 * Copyright (C) 1995, 1996 Russell King.
6 * Copyright (C) 2003 Ian Molton.
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 * This file contains various random system calls that
13 * have a non-standard calling sequence on the Linux/arm
14 * platform.
15 */
16#include <linux/module.h>
17#include <linux/errno.h>
18#include <linux/sched.h>
19#include <linux/slab.h>
20#include <linux/mm.h>
21#include <linux/sem.h>
22#include <linux/msg.h>
23#include <linux/shm.h>
24#include <linux/stat.h>
25#include <linux/syscalls.h>
26#include <linux/mman.h>
27#include <linux/fs.h>
28#include <linux/file.h>
29#include <linux/utsname.h>
30
31#include <asm/uaccess.h>
32#include <asm/ipc.h>
33
34extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
35 unsigned long new_len, unsigned long flags,
36 unsigned long new_addr);
37
38/*
39 * sys_pipe() is the normal C calling standard for creating
40 * a pipe. It's not the way unix traditionally does this, though.
41 */
42asmlinkage int sys_pipe(unsigned long * fildes)
43{
44 int fd[2];
45 int error;
46
47 error = do_pipe(fd);
48 if (!error) {
49 if (copy_to_user(fildes, fd, 2*sizeof(int)))
50 error = -EFAULT;
51 }
52 return error;
53}
54
55/* common code for old and new mmaps */
56inline long do_mmap2(
57 unsigned long addr, unsigned long len,
58 unsigned long prot, unsigned long flags,
59 unsigned long fd, unsigned long pgoff)
60{
61 int error = -EINVAL;
62 struct file * file = NULL;
63
64 flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
65
66 /*
67 * If we are doing a fixed mapping, and address < FIRST_USER_ADDRESS,
68 * then deny it.
69 */
70 if (flags & MAP_FIXED && addr < FIRST_USER_ADDRESS)
71 goto out;
72
73 error = -EBADF;
74 if (!(flags & MAP_ANONYMOUS)) {
75 file = fget(fd);
76 if (!file)
77 goto out;
78 }
79
80 down_write(&current->mm->mmap_sem);
81 error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
82 up_write(&current->mm->mmap_sem);
83
84 if (file)
85 fput(file);
86out:
87 return error;
88}
89
90struct mmap_arg_struct {
91 unsigned long addr;
92 unsigned long len;
93 unsigned long prot;
94 unsigned long flags;
95 unsigned long fd;
96 unsigned long offset;
97};
98
99asmlinkage int old_mmap(struct mmap_arg_struct *arg)
100{
101 int error = -EFAULT;
102 struct mmap_arg_struct a;
103
104 if (copy_from_user(&a, arg, sizeof(a)))
105 goto out;
106
107 error = -EINVAL;
108 if (a.offset & ~PAGE_MASK)
109 goto out;
110
111 error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
112out:
113 return error;
114}
115
116asmlinkage unsigned long
117sys_arm_mremap(unsigned long addr, unsigned long old_len,
118 unsigned long new_len, unsigned long flags,
119 unsigned long new_addr)
120{
121 unsigned long ret = -EINVAL;
122
123 /*
124 * If we are doing a fixed mapping, and address < FIRST_USER_ADDRESS,
125 * then deny it.
126 */
127 if (flags & MREMAP_FIXED && new_addr < FIRST_USER_ADDRESS)
128 goto out;
129
130 down_write(&current->mm->mmap_sem);
131 ret = do_mremap(addr, old_len, new_len, flags, new_addr);
132 up_write(&current->mm->mmap_sem);
133
134out:
135 return ret;
136}
137
138/*
139 * Perform the select(nd, in, out, ex, tv) and mmap() system
140 * calls.
141 */
142
143struct sel_arg_struct {
144 unsigned long n;
145 fd_set *inp, *outp, *exp;
146 struct timeval *tvp;
147};
148
149asmlinkage int old_select(struct sel_arg_struct *arg)
150{
151 struct sel_arg_struct a;
152
153 if (copy_from_user(&a, arg, sizeof(a)))
154 return -EFAULT;
155 /* sys_select() does the appropriate kernel locking */
156 return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
157}
158
159/*
160 * sys_ipc() is the de-multiplexer for the SysV IPC calls..
161 *
162 * This is really horribly ugly.
163 */
164asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
165{
166 int version, ret;
167
168 version = call >> 16; /* hack for backward compatibility */
169 call &= 0xffff;
170
171 switch (call) {
172 case SEMOP:
173 return sys_semop (first, (struct sembuf *)ptr, second);
174 case SEMGET:
175 return sys_semget (first, second, third);
176 case SEMCTL: {
177 union semun fourth;
178 if (!ptr)
179 return -EINVAL;
180 if (get_user(fourth.__pad, (void **) ptr))
181 return -EFAULT;
182 return sys_semctl (first, second, third, fourth);
183 }
184
185 case MSGSND:
186 return sys_msgsnd (first, (struct msgbuf *) ptr,
187 second, third);
188 case MSGRCV:
189 switch (version) {
190 case 0: {
191 struct ipc_kludge tmp;
192 if (!ptr)
193 return -EINVAL;
194 if (copy_from_user(&tmp,(struct ipc_kludge *) ptr,
195 sizeof (tmp)))
196 return -EFAULT;
197 return sys_msgrcv (first, tmp.msgp, second,
198 tmp.msgtyp, third);
199 }
200 default:
201 return sys_msgrcv (first,
202 (struct msgbuf *) ptr,
203 second, fifth, third);
204 }
205 case MSGGET:
206 return sys_msgget ((key_t) first, second);
207 case MSGCTL:
208 return sys_msgctl (first, second, (struct msqid_ds *) ptr);
209
210 case SHMAT:
211 switch (version) {
212 default: {
213 ulong raddr;
214 ret = do_shmat (first, (char *) ptr, second, &raddr);
215 if (ret)
216 return ret;
217 return put_user (raddr, (ulong *) third);
218 }
219 case 1: /* iBCS2 emulator entry point */
220 if (!segment_eq(get_fs(), get_ds()))
221 return -EINVAL;
222 return do_shmat (first, (char *) ptr,
223 second, (ulong *) third);
224 }
225 case SHMDT:
226 return sys_shmdt ((char *)ptr);
227 case SHMGET:
228 return sys_shmget (first, second, third);
229 case SHMCTL:
230 return sys_shmctl (first, second,
231 (struct shmid_ds *) ptr);
232 default:
233 return -EINVAL;
234 }
235}
236
237/* Fork a new task - this creates a new program thread.
238 * This is called indirectly via a small wrapper
239 */
240asmlinkage int sys_fork(struct pt_regs *regs)
241{
242 return do_fork(SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
243}
244
245/* Clone a task - this clones the calling program thread.
246 * This is called indirectly via a small wrapper
247 */
248asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, struct pt_regs *regs)
249{
250 /*
251 * We don't support SETTID / CLEARTID (FIXME!!! (nicked from arm32))
252 */
253 if (clone_flags & (CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID))
254 return -EINVAL;
255
256 if (!newsp)
257 newsp = regs->ARM_sp;
258
259 return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
260}
261
262asmlinkage int sys_vfork(struct pt_regs *regs)
263{
264 return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
265}
266
267/* sys_execve() executes a new program.
268 * This is called indirectly via a small wrapper
269 */
270asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, struct pt_regs *regs)
271{
272 int error;
273 char * filename;
274
275 filename = getname(filenamei);
276 error = PTR_ERR(filename);
277 if (IS_ERR(filename))
278 goto out;
279 error = do_execve(filename, argv, envp, regs);
280 putname(filename);
281out:
282 return error;
283}
284
285/* FIXME - see if this is correct for arm26 */
286int kernel_execve(const char *filename, char *const argv[], char *const envp[])
287{
288 struct pt_regs regs;
289 int ret;
290 memset(&regs, 0, sizeof(struct pt_regs));
291 ret = do_execve((char *)filename, (char __user * __user *)argv, (char __user * __user *)envp, &regs);
292 if (ret < 0)
293 goto out;
294
295 /*
296 * Save argc to the register structure for userspace.
297 */
298 regs.ARM_r0 = ret;
299
300 /*
301 * We were successful. We won't be returning to our caller, but
302 * instead to user space by manipulating the kernel stack.
303 */
304 asm( "add r0, %0, %1\n\t"
305 "mov r1, %2\n\t"
306 "mov r2, %3\n\t"
307 "bl memmove\n\t" /* copy regs to top of stack */
308 "mov r8, #0\n\t" /* not a syscall */
309 "mov r9, %0\n\t" /* thread structure */
310 "mov sp, r0\n\t" /* reposition stack pointer */
311 "b ret_to_user"
312 :
313 : "r" (current_thread_info()),
314 "Ir" (THREAD_SIZE - 8 - sizeof(regs)),
315 "r" (&regs),
316 "Ir" (sizeof(regs))
317 : "r0", "r1", "r2", "r3", "ip", "memory");
318
319 out:
320 return ret;
321}
322
323EXPORT_SYMBOL(kernel_execve);
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
deleted file mode 100644
index 0f1d57fbd3d7..000000000000
--- a/arch/arm26/kernel/time.c
+++ /dev/null
@@ -1,210 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/time.c
3 *
4 * Copyright (C) 1991, 1992, 1995 Linus Torvalds
5 * Modifications for ARM (C) 1994-2001 Russell King
6 * Mods for ARM26 (C) 2003 Ian Molton
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 * This file contains the ARM-specific time handling details:
13 * reading the RTC at bootup, etc...
14 *
15 * 1994-07-02 Alan Modra
16 * fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
17 * 1998-12-20 Updated NTP code according to technical memorandum Jan '96
18 * "A Kernel Model for Precision Timekeeping" by Dave Mills
19 */
20
21#include <linux/module.h>
22#include <linux/kernel.h>
23#include <linux/interrupt.h>
24#include <linux/time.h>
25#include <linux/init.h>
26#include <linux/smp.h>
27#include <linux/timex.h>
28#include <linux/errno.h>
29#include <linux/profile.h>
30
31#include <asm/hardware.h>
32#include <asm/io.h>
33#include <asm/irq.h>
34#include <asm/ioc.h>
35
36/* this needs a better home */
37DEFINE_SPINLOCK(rtc_lock);
38
39/* change this if you have some constant time drift */
40#define USECS_PER_JIFFY (1000000/HZ)
41
42static int dummy_set_rtc(void)
43{
44 return 0;
45}
46
47/*
48 * hook for setting the RTC's idea of the current time.
49 */
50int (*set_rtc)(void) = dummy_set_rtc;
51
52/*
53 * Get time offset based on IOCs timer.
54 * FIXME - if this is called with interrutps off, why the shennanigans
55 * below ?
56 */
57static unsigned long gettimeoffset(void)
58{
59 unsigned int count1, count2, status;
60 long offset;
61
62 ioc_writeb (0, IOC_T0LATCH);
63 barrier ();
64 count1 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
65 barrier ();
66 status = ioc_readb(IOC_IRQREQA);
67 barrier ();
68 ioc_writeb (0, IOC_T0LATCH);
69 barrier ();
70 count2 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
71
72 offset = count2;
73 if (count2 < count1) {
74 /*
75 * We have not had an interrupt between reading count1
76 * and count2.
77 */
78 if (status & (1 << 5))
79 offset -= LATCH;
80 } else if (count2 > count1) {
81 /*
82 * We have just had another interrupt between reading
83 * count1 and count2.
84 */
85 offset -= LATCH;
86 }
87
88 offset = (LATCH - offset) * (tick_nsec / 1000);
89 return (offset + LATCH/2) / LATCH;
90}
91
92static unsigned long next_rtc_update;
93
94/*
95 * If we have an externally synchronized linux clock, then update
96 * CMOS clock accordingly every ~11 minutes. set_rtc() has to be
97 * called as close as possible to 500 ms before the new second
98 * starts.
99 */
100static inline void do_set_rtc(void)
101{
102 if (!ntp_synced() || set_rtc == NULL)
103 return;
104
105//FIXME - timespec.tv_sec is a time_t not unsigned long
106 if (next_rtc_update &&
107 time_before((unsigned long)xtime.tv_sec, next_rtc_update))
108 return;
109
110 if (xtime.tv_nsec < 500000000 - ((unsigned) tick_nsec >> 1) &&
111 xtime.tv_nsec >= 500000000 + ((unsigned) tick_nsec >> 1))
112 return;
113
114 if (set_rtc())
115 /*
116 * rtc update failed. Try again in 60s
117 */
118 next_rtc_update = xtime.tv_sec + 60;
119 else
120 next_rtc_update = xtime.tv_sec + 660;
121}
122
123#define do_leds()
124
125void do_gettimeofday(struct timeval *tv)
126{
127 unsigned long flags;
128 unsigned long seq;
129 unsigned long usec, sec;
130
131 do {
132 seq = read_seqbegin_irqsave(&xtime_lock, flags);
133 usec = gettimeoffset();
134 sec = xtime.tv_sec;
135 usec += xtime.tv_nsec / 1000;
136 } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
137
138 /* usec may have gone up a lot: be safe */
139 while (usec >= 1000000) {
140 usec -= 1000000;
141 sec++;
142 }
143
144 tv->tv_sec = sec;
145 tv->tv_usec = usec;
146}
147
148EXPORT_SYMBOL(do_gettimeofday);
149
150int do_settimeofday(struct timespec *tv)
151{
152 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
153 return -EINVAL;
154
155 write_seqlock_irq(&xtime_lock);
156 /*
157 * This is revolting. We need to set "xtime" correctly. However, the
158 * value in this location is the value at the most recent update of
159 * wall time. Discover what correction gettimeofday() would have
160 * done, and then undo it!
161 */
162 tv->tv_nsec -= 1000 * gettimeoffset();
163
164 while (tv->tv_nsec < 0) {
165 tv->tv_nsec += NSEC_PER_SEC;
166 tv->tv_sec--;
167 }
168
169 xtime.tv_sec = tv->tv_sec;
170 xtime.tv_nsec = tv->tv_nsec;
171 ntp_clear();
172 write_sequnlock_irq(&xtime_lock);
173 clock_was_set();
174 return 0;
175}
176
177EXPORT_SYMBOL(do_settimeofday);
178
179static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
180{
181 do_timer(1);
182#ifndef CONFIG_SMP
183 update_process_times(user_mode(regs));
184#endif
185 do_set_rtc(); //FIME - EVERY timer IRQ?
186 profile_tick(CPU_PROFILING, regs);
187 return IRQ_HANDLED; //FIXME - is this right?
188}
189
190static struct irqaction timer_irq = {
191 .name = "timer",
192 .flags = IRQF_DISABLED,
193 .handler = timer_interrupt,
194};
195
196extern void ioctime_init(void);
197
198/*
199 * Set up timer interrupt.
200 */
201void __init time_init(void)
202{
203 ioc_writeb(LATCH & 255, IOC_T0LTCHL);
204 ioc_writeb(LATCH >> 8, IOC_T0LTCHH);
205 ioc_writeb(0, IOC_T0GO);
206
207
208 setup_irq(IRQ_TIMER, &timer_irq);
209}
210
diff --git a/arch/arm26/kernel/traps.c b/arch/arm26/kernel/traps.c
deleted file mode 100644
index 2911e2eae80e..000000000000
--- a/arch/arm26/kernel/traps.c
+++ /dev/null
@@ -1,548 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/traps.c
3 *
4 * Copyright (C) 1995-2002 Russell King
5 * Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds
6 * Copyright (C) 2003 Ian Molton (ARM26)
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 * 'traps.c' handles hardware exceptions after we have saved some state in
13 * 'linux/arch/arm26/lib/traps.S'. Mostly a debugging aid, but will probably
14 * kill the offending process.
15 */
16
17#include <linux/module.h>
18#include <linux/types.h>
19#include <linux/kernel.h>
20#include <linux/signal.h>
21#include <linux/sched.h>
22#include <linux/mm.h>
23#include <linux/spinlock.h>
24#include <linux/personality.h>
25#include <linux/ptrace.h>
26#include <linux/elf.h>
27#include <linux/interrupt.h>
28#include <linux/init.h>
29
30#include <asm/atomic.h>
31#include <asm/io.h>
32#include <asm/pgtable.h>
33#include <asm/system.h>
34#include <asm/uaccess.h>
35#include <asm/unistd.h>
36#include <linux/mutex.h>
37
38#include "ptrace.h"
39
40extern void c_backtrace (unsigned long fp, int pmode);
41extern void show_pte(struct mm_struct *mm, unsigned long addr);
42
43const char *processor_modes[] = { "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" };
44
45static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" "*bad reason*"};
46
47/*
48 * Stack pointers should always be within the kernels view of
49 * physical memory. If it is not there, then we can't dump
50 * out any information relating to the stack.
51 */
52static int verify_stack(unsigned long sp)
53{
54 if (sp < PAGE_OFFSET || (sp > (unsigned long)high_memory && high_memory != 0))
55 return -EFAULT;
56
57 return 0;
58}
59
60/*
61 * Dump out the contents of some memory nicely...
62 */
63static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
64{
65 unsigned long p = bottom & ~31;
66 mm_segment_t fs;
67 int i;
68
69 /*
70 * We need to switch to kernel mode so that we can use __get_user
71 * to safely read from kernel space. Note that we now dump the
72 * code first, just in case the backtrace kills us.
73 */
74 fs = get_fs();
75 set_fs(KERNEL_DS);
76
77 printk("%s", str);
78 printk("(0x%08lx to 0x%08lx)\n", bottom, top);
79
80 for (p = bottom & ~31; p < top;) {
81 printk("%04lx: ", p & 0xffff);
82
83 for (i = 0; i < 8; i++, p += 4) {
84 unsigned int val;
85
86 if (p < bottom || p >= top)
87 printk(" ");
88 else {
89 __get_user(val, (unsigned long *)p);
90 printk("%08x ", val);
91 }
92 }
93 printk ("\n");
94 }
95
96 set_fs(fs);
97}
98
99static void dump_instr(struct pt_regs *regs)
100{
101 unsigned long addr = instruction_pointer(regs);
102 const int width = 8;
103 mm_segment_t fs;
104 int i;
105
106 /*
107 * We need to switch to kernel mode so that we can use __get_user
108 * to safely read from kernel space. Note that we now dump the
109 * code first, just in case the backtrace kills us.
110 */
111 fs = get_fs();
112 set_fs(KERNEL_DS);
113
114 printk("Code: ");
115 for (i = -4; i < 1; i++) {
116 unsigned int val, bad;
117
118 bad = __get_user(val, &((u32 *)addr)[i]);
119
120 if (!bad)
121 printk(i == 0 ? "(%0*x) " : "%0*x ", width, val);
122 else {
123 printk("bad PC value.");
124 break;
125 }
126 }
127 printk("\n");
128
129 set_fs(fs);
130}
131
132/*static*/ void __dump_stack(struct task_struct *tsk, unsigned long sp)
133{
134 dump_mem("Stack: ", sp, 8192+(unsigned long)task_stack_page(tsk));
135}
136
137void dump_stack(void)
138{
139#ifdef CONFIG_DEBUG_ERRORS
140 __backtrace();
141#endif
142}
143
144EXPORT_SYMBOL(dump_stack);
145
146//FIXME - was a static fn
147void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
148{
149 unsigned int fp;
150 int ok = 1;
151
152 printk("Backtrace: ");
153 fp = regs->ARM_fp;
154 if (!fp) {
155 printk("no frame pointer");
156 ok = 0;
157 } else if (verify_stack(fp)) {
158 printk("invalid frame pointer 0x%08x", fp);
159 ok = 0;
160 } else if (fp < (unsigned long)end_of_stack(tsk))
161 printk("frame pointer underflow");
162 printk("\n");
163
164 if (ok)
165 c_backtrace(fp, processor_mode(regs));
166}
167
168/* FIXME - this is probably wrong.. */
169void show_stack(struct task_struct *task, unsigned long *sp) {
170 dump_mem("Stack: ", (unsigned long)sp, 8192+(unsigned long)task_stack_page(task));
171}
172
173DEFINE_SPINLOCK(die_lock);
174
175/*
176 * This function is protected against re-entrancy.
177 */
178NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
179{
180 struct task_struct *tsk = current;
181
182 console_verbose();
183 spin_lock_irq(&die_lock);
184
185 printk("Internal error: %s: %x\n", str, err);
186 printk("CPU: %d\n", smp_processor_id());
187 show_regs(regs);
188 add_taint(TAINT_DIE);
189 printk("Process %s (pid: %d, stack limit = 0x%p)\n",
190 current->comm, current->pid, end_of_stack(tsk));
191
192 if (!user_mode(regs) || in_interrupt()) {
193 __dump_stack(tsk, (unsigned long)(regs + 1));
194 dump_backtrace(regs, tsk);
195 dump_instr(regs);
196 }
197while(1);
198 spin_unlock_irq(&die_lock);
199 do_exit(SIGSEGV);
200}
201
202void die_if_kernel(const char *str, struct pt_regs *regs, int err)
203{
204 if (user_mode(regs))
205 return;
206
207 die(str, regs, err);
208}
209
210static DEFINE_MUTEX(undef_mutex);
211static int (*undef_hook)(struct pt_regs *);
212
213int request_undef_hook(int (*fn)(struct pt_regs *))
214{
215 int ret = -EBUSY;
216
217 mutex_lock(&undef_mutex);
218 if (undef_hook == NULL) {
219 undef_hook = fn;
220 ret = 0;
221 }
222 mutex_unlock(&undef_mutex);
223
224 return ret;
225}
226
227int release_undef_hook(int (*fn)(struct pt_regs *))
228{
229 int ret = -EINVAL;
230
231 mutex_lock(&undef_mutex);
232 if (undef_hook == fn) {
233 undef_hook = NULL;
234 ret = 0;
235 }
236 mutex_unlock(&undef_mutex);
237
238 return ret;
239}
240
241static int undefined_extension(struct pt_regs *regs, unsigned int op)
242{
243 switch (op) {
244 case 1: /* 0xde01 / 0x?7f001f0 */
245 ptrace_break(current, regs);
246 return 0;
247 }
248 return 1;
249}
250
251asmlinkage void do_undefinstr(struct pt_regs *regs)
252{
253 siginfo_t info;
254 void *pc;
255
256 regs->ARM_pc -= 4;
257
258 pc = (unsigned long *)instruction_pointer(regs); /* strip PSR */
259
260 if (user_mode(regs)) {
261 u32 instr;
262
263 get_user(instr, (u32 *)pc);
264
265 if ((instr & 0x0fff00ff) == 0x07f000f0 &&
266 undefined_extension(regs, (instr >> 8) & 255) == 0) {
267 regs->ARM_pc += 4;
268 return;
269 }
270 } else {
271 if (undef_hook && undef_hook(regs) == 0) {
272 regs->ARM_pc += 4;
273 return;
274 }
275 }
276
277#ifdef CONFIG_DEBUG_USER
278 printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
279 current->comm, current->pid, pc);
280 dump_instr(regs);
281#endif
282
283 current->thread.error_code = 0;
284 current->thread.trap_no = 6;
285
286 info.si_signo = SIGILL;
287 info.si_errno = 0;
288 info.si_code = ILL_ILLOPC;
289 info.si_addr = pc;
290
291 force_sig_info(SIGILL, &info, current);
292
293 die_if_kernel("Oops - undefined instruction", regs, 0);
294}
295
296asmlinkage void do_excpt(unsigned long address, struct pt_regs *regs, int mode)
297{
298 siginfo_t info;
299
300#ifdef CONFIG_DEBUG_USER
301 printk(KERN_INFO "%s (%d): address exception: pc=%08lx\n",
302 current->comm, current->pid, instruction_pointer(regs));
303 dump_instr(regs);
304#endif
305
306 current->thread.error_code = 0;
307 current->thread.trap_no = 11;
308
309 info.si_signo = SIGBUS;
310 info.si_errno = 0;
311 info.si_code = BUS_ADRERR;
312 info.si_addr = (void *)address;
313
314 force_sig_info(SIGBUS, &info, current);
315
316 die_if_kernel("Oops - address exception", regs, mode);
317}
318
319asmlinkage void do_unexp_fiq (struct pt_regs *regs)
320{
321#ifndef CONFIG_IGNORE_FIQ
322 printk("Hmm. Unexpected FIQ received, but trying to continue\n");
323 printk("You may have a hardware problem...\n");
324#endif
325}
326
327/*
328 * bad_mode handles the impossible case in the vectors. If you see one of
329 * these, then it's extremely serious, and could mean you have buggy hardware.
330 * It never returns, and never tries to sync. We hope that we can at least
331 * dump out some state information...
332 */
333asmlinkage void bad_mode(struct pt_regs *regs, int reason, int proc_mode)
334{
335 unsigned int vectors = vectors_base();
336
337 console_verbose();
338
339 printk(KERN_CRIT "Bad mode in %s handler detected: mode %s\n",
340 handler[reason<5?reason:4], processor_modes[proc_mode]);
341
342 /*
343 * Dump out the vectors and stub routines. Maybe a better solution
344 * would be to dump them out only if we detect that they are corrupted.
345 */
346 dump_mem(KERN_CRIT "Vectors: ", vectors, vectors + 0x40);
347 dump_mem(KERN_CRIT "Stubs: ", vectors + 0x200, vectors + 0x4b8);
348
349 die("Oops", regs, 0);
350 local_irq_disable();
351 panic("bad mode");
352}
353
354static int bad_syscall(int n, struct pt_regs *regs)
355{
356 struct thread_info *thread = current_thread_info();
357 siginfo_t info;
358
359 if (current->personality != PER_LINUX && thread->exec_domain->handler) {
360 thread->exec_domain->handler(n, regs);
361 return regs->ARM_r0;
362 }
363
364#ifdef CONFIG_DEBUG_USER
365 printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
366 current->pid, current->comm, n);
367 dump_instr(regs);
368#endif
369
370 info.si_signo = SIGILL;
371 info.si_errno = 0;
372 info.si_code = ILL_ILLTRP;
373 info.si_addr = (void *)instruction_pointer(regs) - 4;
374
375 force_sig_info(SIGILL, &info, current);
376 die_if_kernel("Oops", regs, n);
377 return regs->ARM_r0;
378}
379
380static inline void
381do_cache_op(unsigned long start, unsigned long end, int flags)
382{
383 struct vm_area_struct *vma;
384
385 if (end < start)
386 return;
387
388 vma = find_vma(current->active_mm, start);
389 if (vma && vma->vm_start < end) {
390 if (start < vma->vm_start)
391 start = vma->vm_start;
392 if (end > vma->vm_end)
393 end = vma->vm_end;
394 }
395}
396
397/*
398 * Handle all unrecognised system calls.
399 * 0x9f0000 - 0x9fffff are some more esoteric system calls
400 */
401#define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE)
402asmlinkage int arm_syscall(int no, struct pt_regs *regs)
403{
404 siginfo_t info;
405
406 if ((no >> 16) != 0x9f)
407 return bad_syscall(no, regs);
408
409 switch (no & 0xffff) {
410 case 0: /* branch through 0 */
411 info.si_signo = SIGSEGV;
412 info.si_errno = 0;
413 info.si_code = SEGV_MAPERR;
414 info.si_addr = NULL;
415
416 force_sig_info(SIGSEGV, &info, current);
417
418 die_if_kernel("branch through zero", regs, 0);
419 return 0;
420
421 case NR(breakpoint): /* SWI BREAK_POINT */
422 ptrace_break(current, regs);
423 return regs->ARM_r0;
424
425 case NR(cacheflush):
426 return 0;
427
428 case NR(usr26):
429 break;
430
431 default:
432 /* Calls 9f00xx..9f07ff are defined to return -ENOSYS
433 if not implemented, rather than raising SIGILL. This
434 way the calling program can gracefully determine whether
435 a feature is supported. */
436 if (no <= 0x7ff)
437 return -ENOSYS;
438 break;
439 }
440#ifdef CONFIG_DEBUG_USER
441 /*
442 * experience shows that these seem to indicate that
443 * something catastrophic has happened
444 */
445 printk("[%d] %s: arm syscall %d\n", current->pid, current->comm, no);
446 dump_instr(regs);
447 if (user_mode(regs)) {
448 show_regs(regs);
449 c_backtrace(regs->ARM_fp, processor_mode(regs));
450 }
451#endif
452 info.si_signo = SIGILL;
453 info.si_errno = 0;
454 info.si_code = ILL_ILLTRP;
455 info.si_addr = (void *)instruction_pointer(regs) - 4;
456
457 force_sig_info(SIGILL, &info, current);
458 die_if_kernel("Oops", regs, no);
459 return 0;
460}
461
462void __bad_xchg(volatile void *ptr, int size)
463{
464 printk("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
465 __builtin_return_address(0), ptr, size);
466 BUG();
467}
468
469/*
470 * A data abort trap was taken, but we did not handle the instruction.
471 * Try to abort the user program, or panic if it was the kernel.
472 */
473asmlinkage void
474baddataabort(int code, unsigned long instr, struct pt_regs *regs)
475{
476 unsigned long addr = instruction_pointer(regs);
477 siginfo_t info;
478
479#ifdef CONFIG_DEBUG_USER
480 printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
481 current->pid, current->comm, code, instr);
482 dump_instr(regs);
483 show_pte(current->mm, addr);
484#endif
485
486 info.si_signo = SIGILL;
487 info.si_errno = 0;
488 info.si_code = ILL_ILLOPC;
489 info.si_addr = (void *)addr;
490
491 force_sig_info(SIGILL, &info, current);
492 die_if_kernel("unknown data abort code", regs, instr);
493}
494
495volatile void __bug(const char *file, int line, void *data)
496{
497 printk(KERN_CRIT"kernel BUG at %s:%d!", file, line);
498 if (data)
499 printk(KERN_CRIT" - extra data = %p", data);
500 printk("\n");
501 *(int *)0 = 0;
502}
503
504void __readwrite_bug(const char *fn)
505{
506 printk("%s called, but not implemented", fn);
507 BUG();
508}
509
510void __pte_error(const char *file, int line, unsigned long val)
511{
512 printk("%s:%d: bad pte %08lx.\n", file, line, val);
513}
514
515void __pmd_error(const char *file, int line, unsigned long val)
516{
517 printk("%s:%d: bad pmd %08lx.\n", file, line, val);
518}
519
520void __pgd_error(const char *file, int line, unsigned long val)
521{
522 printk("%s:%d: bad pgd %08lx.\n", file, line, val);
523}
524
525asmlinkage void __div0(void)
526{
527 printk("Division by zero in kernel.\n");
528 dump_stack();
529}
530
531void abort(void)
532{
533 BUG();
534
535 /* if that doesn't kill us, halt */
536 panic("Oops failed to kill thread");
537}
538
539void __init trap_init(void)
540{
541 extern void __trap_init(unsigned long);
542 unsigned long base = vectors_base();
543
544 __trap_init(base);
545 if (base != 0)
546 printk(KERN_DEBUG "Relocating machine vectors to 0x%08lx\n",
547 base);
548}
diff --git a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
deleted file mode 100644
index 4ec715c25dea..000000000000
--- a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
+++ /dev/null
@@ -1,136 +0,0 @@
1/* ld script to make ARM Linux kernel
2 * taken from the i386 version by Russell King
3 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
4 * borrowed from Russels ARM port by Ian Molton
5 */
6
7#include <asm-generic/vmlinux.lds.h>
8
9OUTPUT_ARCH(arm)
10ENTRY(stext)
11jiffies = jiffies_64;
12SECTIONS
13{
14 . = TEXTADDR;
15 .init : { /* Init code and data */
16 _stext = .;
17 __init_begin = .;
18 _sinittext = .;
19 *(.init.text)
20 _einittext = .;
21 __proc_info_begin = .;
22 *(.proc.info)
23 __proc_info_end = .;
24 __arch_info_begin = .;
25 *(.arch.info)
26 __arch_info_end = .;
27 __tagtable_begin = .;
28 *(.taglist)
29 __tagtable_end = .;
30 . = ALIGN(16);
31 __setup_start = .;
32 *(.init.setup)
33 __setup_end = .;
34 __early_begin = .;
35 *(__early_param)
36 __early_end = .;
37 __initcall_start = .;
38 *(.initcall1.init)
39 *(.initcall2.init)
40 *(.initcall3.init)
41 *(.initcall4.init)
42 *(.initcall5.init)
43 *(.initcall6.init)
44 *(.initcall7.init)
45 __initcall_end = .;
46 __con_initcall_start = .;
47 *(.con_initcall.init)
48 __con_initcall_end = .;
49#ifdef CONFIG_BLK_DEV_INITRD
50 . = ALIGN(32);
51 __initramfs_start = .;
52 usr/built-in.o(.init.ramfs)
53 __initramfs_end = .;
54#endif
55 . = ALIGN(32768);
56 __init_end = .;
57 }
58
59 /DISCARD/ : { /* Exit code and data */
60 *(.exit.text)
61 *(.exit.data)
62 *(.exitcall.exit)
63 }
64
65 .text : { /* Real text segment */
66 _text = .; /* Text and read-only data */
67 TEXT_TEXT
68 SCHED_TEXT
69 LOCK_TEXT /* FIXME - borrowed from arm32 - check*/
70 *(.fixup)
71 *(.gnu.warning)
72 *(.rodata)
73 *(.rodata.*)
74 *(.glue_7)
75 *(.glue_7t)
76 *(.got) /* Global offset table */
77
78 _etext = .; /* End of text section */
79 }
80
81 . = ALIGN(16);
82 __ex_table : { /* Exception table */
83 __start___ex_table = .;
84 *(__ex_table)
85 __stop___ex_table = .;
86 }
87
88 RODATA
89
90 _endtext = .;
91
92 . = DATAADDR;
93
94 _sdata = .;
95
96 .data : {
97 . = ALIGN(8192);
98 /*
99 * first, the init thread union, aligned
100 * to an 8192 byte boundary. (see arm26/kernel/init_task.c)
101 * FIXME - sould this be 32K aligned on arm26?
102 */
103 *(.init.task)
104
105 /*
106 * The cacheline aligned data
107 */
108 . = ALIGN(32);
109 *(.data.cacheline_aligned)
110
111 /*
112 * and the usual data section
113 */
114 DATA_DATA
115 CONSTRUCTORS
116
117 *(.init.data)
118
119 _edata = .;
120 }
121
122 .bss : {
123 __bss_start = .; /* BSS */
124 *(.bss)
125 *(COMMON)
126 _end = . ;
127 }
128 /* Stabs debugging sections. */
129 .stab 0 : { *(.stab) }
130 .stabstr 0 : { *(.stabstr) }
131 .stab.excl 0 : { *(.stab.excl) }
132 .stab.exclstr 0 : { *(.stab.exclstr) }
133 .stab.index 0 : { *(.stab.index) }
134 .stab.indexstr 0 : { *(.stab.indexstr) }
135 .comment 0 : { *(.comment) }
136}
diff --git a/arch/arm26/kernel/vmlinux-arm26.lds.in b/arch/arm26/kernel/vmlinux-arm26.lds.in
deleted file mode 100644
index 6c44f6a17bf7..000000000000
--- a/arch/arm26/kernel/vmlinux-arm26.lds.in
+++ /dev/null
@@ -1,129 +0,0 @@
1/* ld script to make ARM Linux kernel
2 * taken from the i386 version by Russell King
3 * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
4 * borrowed from Russels ARM port by Ian Molton and subsequently modified.
5 */
6
7#include <asm-generic/vmlinux.lds.h>
8
9OUTPUT_ARCH(arm)
10ENTRY(stext)
11jiffies = jiffies_64;
12SECTIONS
13{
14 . = TEXTADDR;
15 .init : { /* Init code and data */
16 _stext = .;
17 __init_begin = .;
18 _sinittext = .;
19 *(.init.text)
20 _einittext = .;
21 __proc_info_begin = .;
22 *(.proc.info)
23 __proc_info_end = .;
24 __arch_info_begin = .;
25 *(.arch.info)
26 __arch_info_end = .;
27 __tagtable_begin = .;
28 *(.taglist)
29 __tagtable_end = .;
30 *(.init.data)
31 . = ALIGN(16);
32 __setup_start = .;
33 *(.init.setup)
34 __setup_end = .;
35 __early_begin = .;
36 *(__early_param)
37 __early_end = .;
38 __initcall_start = .;
39 *(.initcall1.init)
40 *(.initcall2.init)
41 *(.initcall3.init)
42 *(.initcall4.init)
43 *(.initcall5.init)
44 *(.initcall6.init)
45 *(.initcall7.init)
46 __initcall_end = .;
47 __con_initcall_start = .;
48 *(.con_initcall.init)
49 __con_initcall_end = .;
50#ifdef CONFIG_BLK_DEV_INITRD
51 . = ALIGN(32);
52 __initramfs_start = .;
53 usr/built-in.o(.init.ramfs)
54 __initramfs_end = .;
55#endif
56 . = ALIGN(32768);
57 __init_end = .;
58 }
59
60 /DISCARD/ : { /* Exit code and data */
61 *(.exit.text)
62 *(.exit.data)
63 *(.exitcall.exit)
64 }
65
66 .text : { /* Real text segment */
67 _text = .; /* Text and read-only data */
68 TEXT_TEXT
69 SCHED_TEXT
70 LOCK_TEXT
71 *(.fixup)
72 *(.gnu.warning)
73 *(.rodata)
74 *(.rodata.*)
75 *(.glue_7)
76 *(.glue_7t)
77 *(.got) /* Global offset table */
78
79 _etext = .; /* End of text section */
80 }
81
82 . = ALIGN(16);
83 __ex_table : { /* Exception table */
84 __start___ex_table = .;
85 *(__ex_table)
86 __stop___ex_table = .;
87 }
88
89 RODATA
90
91 . = ALIGN(8192);
92
93 .data : {
94 /*
95 * first, the init task union, aligned
96 * to an 8192 byte boundary. (see arm26/kernel/init_task.c)
97 */
98 *(.init.task)
99
100 /*
101 * The cacheline aligned data
102 */
103 . = ALIGN(32);
104 *(.data.cacheline_aligned)
105
106 /*
107 * and the usual data section
108 */
109 DATA_DATA
110 CONSTRUCTORS
111
112 _edata = .;
113 }
114
115 .bss : {
116 __bss_start = .; /* BSS */
117 *(.bss)
118 *(COMMON)
119 _end = . ;
120 }
121 /* Stabs debugging sections. */
122 .stab 0 : { *(.stab) }
123 .stabstr 0 : { *(.stabstr) }
124 .stab.excl 0 : { *(.stab.excl) }
125 .stab.exclstr 0 : { *(.stab.exclstr) }
126 .stab.index 0 : { *(.stab.index) }
127 .stab.indexstr 0 : { *(.stab.indexstr) }
128 .comment 0 : { *(.comment) }
129}
diff --git a/arch/arm26/kernel/vmlinux.lds.S b/arch/arm26/kernel/vmlinux.lds.S
deleted file mode 100644
index 1fa39f02e07c..000000000000
--- a/arch/arm26/kernel/vmlinux.lds.S
+++ /dev/null
@@ -1,11 +0,0 @@
1
2#ifdef CONFIG_XIP_KERNEL
3
4#include "vmlinux-arm26-xip.lds.in"
5
6#else
7
8#include "vmlinux-arm26.lds.in"
9
10#endif
11
diff --git a/arch/arm26/lib/Makefile b/arch/arm26/lib/Makefile
deleted file mode 100644
index 6df2b793d367..000000000000
--- a/arch/arm26/lib/Makefile
+++ /dev/null
@@ -1,26 +0,0 @@
1#
2# linux/arch/arm26/lib/Makefile
3#
4# Copyright (C) 1995-2000 Russell King
5#
6
7lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \
8 csumpartialcopy.o csumpartialcopyuser.o clearbit.o \
9 copy_page.o delay.o findbit.o memchr.o memcpy.o \
10 memset.o memzero.o setbit.o \
11 strchr.o strrchr.o testchangebit.o \
12 testclearbit.o testsetbit.o getuser.o \
13 putuser.o ashldi3.o ashrdi3.o lshrdi3.o muldi3.o \
14 ucmpdi2.o udivdi3.o lib1funcs.o ecard.o io-acorn.o \
15 floppydma.o io-readsb.o io-writesb.o io-writesl.o \
16 uaccess-kernel.o uaccess-user.o io-readsw.o \
17 io-writesw.o io-readsl.o ecard.o io-acorn.o \
18 floppydma.o
19
20lib-n :=
21
22lib-$(CONFIG_VT)+= kbd.o
23
24csumpartialcopy.o: csumpartialcopygeneric.S
25csumpartialcopyuser.o: csumpartialcopygeneric.S
26
diff --git a/arch/arm26/lib/ashldi3.c b/arch/arm26/lib/ashldi3.c
deleted file mode 100644
index 130f5a839669..000000000000
--- a/arch/arm26/lib/ashldi3.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/* More subroutines needed by GCC output code on some machines. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License.
28 */
29/* support functions required by the kernel. based on code from gcc-2.95.3 */
30/* I Molton 29/07/01 */
31
32#include "gcclib.h"
33
34DItype
35__ashldi3 (DItype u, word_type b)
36{
37 DIunion w;
38 word_type bm;
39 DIunion uu;
40
41 if (b == 0)
42 return u;
43
44 uu.ll = u;
45
46 bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
47 if (bm <= 0)
48 {
49 w.s.low = 0;
50 w.s.high = (USItype)uu.s.low << -bm;
51 }
52 else
53 {
54 USItype carries = (USItype)uu.s.low >> bm;
55 w.s.low = (USItype)uu.s.low << b;
56 w.s.high = ((USItype)uu.s.high << b) | carries;
57 }
58
59 return w.ll;
60}
61
diff --git a/arch/arm26/lib/ashrdi3.c b/arch/arm26/lib/ashrdi3.c
deleted file mode 100644
index 71625d218f8d..000000000000
--- a/arch/arm26/lib/ashrdi3.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/* More subroutines needed by GCC output code on some machines. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License.
28 */
29/* support functions required by the kernel. based on code from gcc-2.95.3 */
30/* I Molton 29/07/01 */
31
32#include "gcclib.h"
33
34DItype
35__ashrdi3 (DItype u, word_type b)
36{
37 DIunion w;
38 word_type bm;
39 DIunion uu;
40
41 if (b == 0)
42 return u;
43
44 uu.ll = u;
45
46 bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
47 if (bm <= 0)
48 {
49 /* w.s.high = 1..1 or 0..0 */
50 w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
51 w.s.low = uu.s.high >> -bm;
52 }
53 else
54 {
55 USItype carries = (USItype)uu.s.high << bm;
56 w.s.high = uu.s.high >> b;
57 w.s.low = ((USItype)uu.s.low >> b) | carries;
58 }
59
60 return w.ll;
61}
diff --git a/arch/arm26/lib/backtrace.S b/arch/arm26/lib/backtrace.S
deleted file mode 100644
index e27feb1e891d..000000000000
--- a/arch/arm26/lib/backtrace.S
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 * linux/arch/arm26/lib/backtrace.S
3 *
4 * Copyright (C) 1995, 1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14@ fp is 0 or stack frame
15
16#define frame r4
17#define next r5
18#define save r6
19#define mask r7
20#define offset r8
21
22ENTRY(__backtrace)
23 mov r1, #0x10
24 mov r0, fp
25
26ENTRY(c_backtrace)
27
28#ifdef CONFIG_NO_FRAME_POINTER
29 mov pc, lr
30#else
31
32 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
33 mov mask, #0xfc000003
34 tst mask, r0
35 movne r0, #0
36 movs frame, r0
371: moveq r0, #-2
38 LOADREGS(eqfd, sp!, {r4 - r8, pc})
39
402: stmfd sp!, {pc} @ calculate offset of PC in STMIA instruction
41 ldr r0, [sp], #4
42 adr r1, 2b - 4
43 sub offset, r0, r1
44
453: tst frame, mask @ Check for address exceptions...
46 bne 1b
47
481001: ldr next, [frame, #-12] @ get fp
491002: ldr r2, [frame, #-4] @ get lr
501003: ldr r3, [frame, #0] @ get pc
51 sub save, r3, offset @ Correct PC for prefetching
52 bic save, save, mask
531004: ldr r1, [save, #0] @ get instruction at function
54 mov r1, r1, lsr #10
55 ldr r3, .Ldsi+4
56 teq r1, r3
57 subeq save, save, #4
58 adr r0, .Lfe
59 mov r1, save
60 bic r2, r2, mask
61 bl printk @ print pc and link register
62
63 ldr r0, [frame, #-8] @ get sp
64 sub r0, r0, #4
651005: ldr r1, [save, #4] @ get instruction at function+4
66 mov r3, r1, lsr #10
67 ldr r2, .Ldsi+4
68 teq r3, r2 @ Check for stmia sp!, {args}
69 addeq save, save, #4 @ next instruction
70 bleq .Ldumpstm
71
72 sub r0, frame, #16
731006: ldr r1, [save, #4] @ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
74 mov r3, r1, lsr #10
75 ldr r2, .Ldsi
76 teq r3, r2
77 bleq .Ldumpstm
78
79 teq frame, next
80 movne frame, next
81 teqne frame, #0
82 bne 3b
83 LOADREGS(fd, sp!, {r4 - r8, pc})
84
85/*
86 * Fixup for LDMDB
87 */
88 .section .fixup,"ax"
89 .align 0
901007: ldr r0, =.Lbad
91 mov r1, frame
92 bl printk
93 LOADREGS(fd, sp!, {r4 - r8, pc})
94 .ltorg
95 .previous
96
97 .section __ex_table,"a"
98 .align 3
99 .long 1001b, 1007b
100 .long 1002b, 1007b
101 .long 1003b, 1007b
102 .long 1004b, 1007b
103 .long 1005b, 1007b
104 .long 1006b, 1007b
105 .previous
106
107#define instr r4
108#define reg r5
109#define stack r6
110
111.Ldumpstm: stmfd sp!, {instr, reg, stack, r7, lr}
112 mov stack, r0
113 mov instr, r1
114 mov reg, #9
115 mov r7, #0
1161: mov r3, #1
117 tst instr, r3, lsl reg
118 beq 2f
119 add r7, r7, #1
120 teq r7, #4
121 moveq r7, #0
122 moveq r3, #'\n'
123 movne r3, #' '
124 ldr r2, [stack], #-4
125 mov r1, reg
126 adr r0, .Lfp
127 bl printk
1282: subs reg, reg, #1
129 bpl 1b
130 teq r7, #0
131 adrne r0, .Lcr
132 blne printk
133 mov r0, stack
134 LOADREGS(fd, sp!, {instr, reg, stack, r7, pc})
135
136.Lfe: .asciz "Function entered at [<%p>] from [<%p>]\n"
137.Lfp: .asciz " r%d = %08X%c"
138.Lcr: .asciz "\n"
139.Lbad: .asciz "Backtrace aborted due to bad frame pointer <%p>\n"
140 .align
141.Ldsi: .word 0x00e92dd8 >> 2
142 .word 0x00e92d00 >> 2
143
144#endif
diff --git a/arch/arm26/lib/changebit.S b/arch/arm26/lib/changebit.S
deleted file mode 100644
index 1b6a077be5a6..000000000000
--- a/arch/arm26/lib/changebit.S
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * linux/arch/arm26/lib/changebit.S
3 *
4 * Copyright (C) 1995-1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14/* Purpose : Function to change a bit
15 * Prototype: int change_bit(int bit, void *addr)
16 */
17ENTRY(_change_bit_be)
18 eor r0, r0, #0x18 @ big endian byte ordering
19ENTRY(_change_bit_le)
20 and r2, r0, #7
21 mov r3, #1
22 mov r3, r3, lsl r2
23 save_and_disable_irqs ip, r2
24 ldrb r2, [r1, r0, lsr #3]
25 eor r2, r2, r3
26 strb r2, [r1, r0, lsr #3]
27 restore_irqs ip
28 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/clearbit.S b/arch/arm26/lib/clearbit.S
deleted file mode 100644
index 0a895b0c759f..000000000000
--- a/arch/arm26/lib/clearbit.S
+++ /dev/null
@@ -1,31 +0,0 @@
1/*
2 * linux/arch/arm26/lib/clearbit.S
3 *
4 * Copyright (C) 1995-1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14/*
15 * Purpose : Function to clear a bit
16 * Prototype: int clear_bit(int bit, void *addr)
17 */
18ENTRY(_clear_bit_be)
19 eor r0, r0, #0x18 @ big endian byte ordering
20ENTRY(_clear_bit_le)
21 and r2, r0, #7
22 mov r3, #1
23 mov r3, r3, lsl r2
24 save_and_disable_irqs ip, r2
25 ldrb r2, [r1, r0, lsr #3]
26 bic r2, r2, r3
27 strb r2, [r1, r0, lsr #3]
28 restore_irqs ip
29 RETINSTR(mov,pc,lr)
30
31
diff --git a/arch/arm26/lib/copy_page.S b/arch/arm26/lib/copy_page.S
deleted file mode 100644
index c7511a2739d3..000000000000
--- a/arch/arm26/lib/copy_page.S
+++ /dev/null
@@ -1,62 +0,0 @@
1/*
2 * linux/arch/arm26/lib/copypage.S
3 *
4 * Copyright (C) 1995-1999 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14#include <asm/asm-offsets.h>
15
16 .text
17 .align 5
18/*
19 * ARMv3 optimised copy_user_page
20 *
21 * FIXME: rmk do we need to handle cache stuff...
22 * FIXME: im is this right on ARM26?
23 */
24ENTRY(__copy_user_page)
25 stmfd sp!, {r4, lr} @ 2
26 mov r2, #PAGE_SZ/64 @ 1
27 ldmia r1!, {r3, r4, ip, lr} @ 4+1
281: stmia r0!, {r3, r4, ip, lr} @ 4
29 ldmia r1!, {r3, r4, ip, lr} @ 4+1
30 stmia r0!, {r3, r4, ip, lr} @ 4
31 ldmia r1!, {r3, r4, ip, lr} @ 4+1
32 stmia r0!, {r3, r4, ip, lr} @ 4
33 ldmia r1!, {r3, r4, ip, lr} @ 4
34 subs r2, r2, #1 @ 1
35 stmia r0!, {r3, r4, ip, lr} @ 4
36 ldmneia r1!, {r3, r4, ip, lr} @ 4
37 bne 1b @ 1
38 LOADREGS(fd, sp!, {r4, pc}) @ 3
39
40 .align 5
41/*
42 * ARMv3 optimised clear_user_page
43 *
44 * FIXME: rmk do we need to handle cache stuff...
45 */
46ENTRY(__clear_user_page)
47 str lr, [sp, #-4]!
48 mov r1, #PAGE_SZ/64 @ 1
49 mov r2, #0 @ 1
50 mov r3, #0 @ 1
51 mov ip, #0 @ 1
52 mov lr, #0 @ 1
531: stmia r0!, {r2, r3, ip, lr} @ 4
54 stmia r0!, {r2, r3, ip, lr} @ 4
55 stmia r0!, {r2, r3, ip, lr} @ 4
56 stmia r0!, {r2, r3, ip, lr} @ 4
57 subs r1, r1, #1 @ 1
58 bne 1b @ 1
59 ldr pc, [sp], #4
60
61 .section ".init.text", #alloc, #execinstr
62
diff --git a/arch/arm26/lib/csumipv6.S b/arch/arm26/lib/csumipv6.S
deleted file mode 100644
index 62831155acde..000000000000
--- a/arch/arm26/lib/csumipv6.S
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * linux/arch/arm26/lib/csumipv6.S
3 *
4 * Copyright (C) 1995-1998 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12
13 .text
14
15ENTRY(__csum_ipv6_magic)
16 str lr, [sp, #-4]!
17 adds ip, r2, r3
18 ldmia r1, {r1 - r3, lr}
19 adcs ip, ip, r1
20 adcs ip, ip, r2
21 adcs ip, ip, r3
22 adcs ip, ip, lr
23 ldmia r0, {r0 - r3}
24 adcs r0, ip, r0
25 adcs r0, r0, r1
26 adcs r0, r0, r2
27 ldr r2, [sp, #4]
28 adcs r0, r0, r3
29 adcs r0, r0, r2
30 adcs r0, r0, #0
31 LOADREGS(fd, sp!, {pc})
32
diff --git a/arch/arm26/lib/csumpartial.S b/arch/arm26/lib/csumpartial.S
deleted file mode 100644
index e53e7109e623..000000000000
--- a/arch/arm26/lib/csumpartial.S
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 * linux/arch/arm26/lib/csumpartial.S
3 *
4 * Copyright (C) 1995-1998 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12
13 .text
14
15/*
16 * Function: __u32 csum_partial(const char *src, int len, __u32 sum)
17 * Params : r0 = buffer, r1 = len, r2 = checksum
18 * Returns : r0 = new checksum
19 */
20
21buf .req r0
22len .req r1
23sum .req r2
24td0 .req r3
25td1 .req r4 @ save before use
26td2 .req r5 @ save before use
27td3 .req lr
28
29.zero: mov r0, sum
30 add sp, sp, #4
31 ldr pc, [sp], #4
32
33 /*
34 * Handle 0 to 7 bytes, with any alignment of source and
35 * destination pointers. Note that when we get here, C = 0
36 */
37.less8: teq len, #0 @ check for zero count
38 beq .zero
39
40 /* we must have at least one byte. */
41 tst buf, #1 @ odd address?
42 ldrneb td0, [buf], #1
43 subne len, len, #1
44 adcnes sum, sum, td0, lsl #byte(1)
45
46.less4: tst len, #6
47 beq .less8_byte
48
49 /* we are now half-word aligned */
50
51.less8_wordlp:
52#if __LINUX_ARM_ARCH__ >= 4
53 ldrh td0, [buf], #2
54 sub len, len, #2
55#else
56 ldrb td0, [buf], #1
57 ldrb td3, [buf], #1
58 sub len, len, #2
59 orr td0, td0, td3, lsl #8
60#endif
61 adcs sum, sum, td0
62 tst len, #6
63 bne .less8_wordlp
64
65.less8_byte: tst len, #1 @ odd number of bytes
66 ldrneb td0, [buf], #1 @ include last byte
67 adcnes sum, sum, td0, lsl #byte(0) @ update checksum
68
69.done: adc r0, sum, #0 @ collect up the last carry
70 ldr td0, [sp], #4
71 tst td0, #1 @ check buffer alignment
72 movne td0, r0, lsl #8 @ rotate checksum by 8 bits
73 orrne r0, td0, r0, lsr #24
74 ldr pc, [sp], #4 @ return
75
76.not_aligned: tst buf, #1 @ odd address
77 ldrneb td0, [buf], #1 @ make even
78 subne len, len, #1
79 adcnes sum, sum, td0, lsl #byte(1) @ update checksum
80
81 tst buf, #2 @ 32-bit aligned?
82#if __LINUX_ARM_ARCH__ >= 4
83 ldrneh td0, [buf], #2 @ make 32-bit aligned
84 subne len, len, #2
85#else
86 ldrneb td0, [buf], #1
87 ldrneb ip, [buf], #1
88 subne len, len, #2
89 orrne td0, td0, ip, lsl #8
90#endif
91 adcnes sum, sum, td0 @ update checksum
92 mov pc, lr
93
94ENTRY(csum_partial)
95 stmfd sp!, {buf, lr}
96 cmp len, #8 @ Ensure that we have at least
97 blo .less8 @ 8 bytes to copy.
98
99 adds sum, sum, #0 @ C = 0
100 tst buf, #3 @ Test destination alignment
101 blne .not_aligned @ aligh destination, return here
102
1031: bics ip, len, #31
104 beq 3f
105
106 stmfd sp!, {r4 - r5}
1072: ldmia buf!, {td0, td1, td2, td3}
108 adcs sum, sum, td0
109 adcs sum, sum, td1
110 adcs sum, sum, td2
111 adcs sum, sum, td3
112 ldmia buf!, {td0, td1, td2, td3}
113 adcs sum, sum, td0
114 adcs sum, sum, td1
115 adcs sum, sum, td2
116 adcs sum, sum, td3
117 sub ip, ip, #32
118 teq ip, #0
119 bne 2b
120 ldmfd sp!, {r4 - r5}
121
1223: tst len, #0x1c @ should not change C
123 beq .less4
124
1254: ldr td0, [buf], #4
126 sub len, len, #4
127 adcs sum, sum, td0
128 tst len, #0x1c
129 bne 4b
130 b .less4
diff --git a/arch/arm26/lib/csumpartialcopy.S b/arch/arm26/lib/csumpartialcopy.S
deleted file mode 100644
index a1c4b5fdd498..000000000000
--- a/arch/arm26/lib/csumpartialcopy.S
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * linux/arch/arm26/lib/csumpartialcopy.S
3 *
4 * Copyright (C) 1995-1998 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12
13 .text
14
15/* Function: __u32 csum_partial_copy_nocheck(const char *src, char *dst, int len, __u32 sum)
16 * Params : r0 = src, r1 = dst, r2 = len, r3 = checksum
17 * Returns : r0 = new checksum
18 */
19
20 .macro save_regs
21 stmfd sp!, {r1, r4 - r8, fp, ip, lr, pc}
22 .endm
23
24 .macro load_regs,flags
25 LOADREGS(\flags,fp,{r1, r4 - r8, fp, sp, pc})
26 .endm
27
28 .macro load1b, reg1
29 ldrb \reg1, [r0], #1
30 .endm
31
32 .macro load2b, reg1, reg2
33 ldrb \reg1, [r0], #1
34 ldrb \reg2, [r0], #1
35 .endm
36
37 .macro load1l, reg1
38 ldr \reg1, [r0], #4
39 .endm
40
41 .macro load2l, reg1, reg2
42 ldr \reg1, [r0], #4
43 ldr \reg2, [r0], #4
44 .endm
45
46 .macro load4l, reg1, reg2, reg3, reg4
47 ldmia r0!, {\reg1, \reg2, \reg3, \reg4}
48 .endm
49
50#define FN_ENTRY ENTRY(csum_partial_copy_nocheck)
51
52#include "csumpartialcopygeneric.S"
diff --git a/arch/arm26/lib/csumpartialcopygeneric.S b/arch/arm26/lib/csumpartialcopygeneric.S
deleted file mode 100644
index 5249c3ad11db..000000000000
--- a/arch/arm26/lib/csumpartialcopygeneric.S
+++ /dev/null
@@ -1,352 +0,0 @@
1/*
2 * linux/arch/arm26/lib/csumpartialcopygeneric.S
3 *
4 * Copyright (C) 1995-2001 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * JMA 01/06/03 Commented out some shl0s; probobly irrelevant to arm26
11 *
12 */
13
14/*
15 * unsigned int
16 * csum_partial_copy_xxx(const char *src, char *dst, int len, int sum, )
17 * r0 = src, r1 = dst, r2 = len, r3 = sum
18 * Returns : r0 = checksum
19 *
20 * Note that 'tst' and 'teq' preserve the carry flag.
21 */
22
23/* Quick hack */
24 .macro save_regs
25 stmfd sp!, {r1, r4 - r8, fp, ip, lr, pc}
26 .endm
27
28/* end Quick Hack */
29
30src .req r0
31dst .req r1
32len .req r2
33sum .req r3
34
35.zero: mov r0, sum
36 load_regs ea
37
38 /*
39 * Align an unaligned destination pointer. We know that
40 * we have >= 8 bytes here, so we don't need to check
41 * the length. Note that the source pointer hasn't been
42 * aligned yet.
43 */
44.dst_unaligned: tst dst, #1
45 beq .dst_16bit
46
47 load1b ip
48 sub len, len, #1
49 adcs sum, sum, ip, lsl #byte(1) @ update checksum
50 strb ip, [dst], #1
51 tst dst, #2
52 moveq pc, lr @ dst is now 32bit aligned
53
54.dst_16bit: load2b r8, ip
55 sub len, len, #2
56 adcs sum, sum, r8, lsl #byte(0)
57 strb r8, [dst], #1
58 adcs sum, sum, ip, lsl #byte(1)
59 strb ip, [dst], #1
60 mov pc, lr @ dst is now 32bit aligned
61
62 /*
63 * Handle 0 to 7 bytes, with any alignment of source and
64 * destination pointers. Note that when we get here, C = 0
65 */
66.less8: teq len, #0 @ check for zero count
67 beq .zero
68
69 /* we must have at least one byte. */
70 tst dst, #1 @ dst 16-bit aligned
71 beq .less8_aligned
72
73 /* Align dst */
74 load1b ip
75 sub len, len, #1
76 adcs sum, sum, ip, lsl #byte(1) @ update checksum
77 strb ip, [dst], #1
78 tst len, #6
79 beq .less8_byteonly
80
811: load2b r8, ip
82 sub len, len, #2
83 adcs sum, sum, r8, lsl #byte(0)
84 strb r8, [dst], #1
85 adcs sum, sum, ip, lsl #byte(1)
86 strb ip, [dst], #1
87.less8_aligned: tst len, #6
88 bne 1b
89.less8_byteonly:
90 tst len, #1
91 beq .done
92 load1b r8
93 adcs sum, sum, r8, lsl #byte(0) @ update checksum
94 strb r8, [dst], #1
95 b .done
96
97FN_ENTRY
98 mov ip, sp
99 save_regs
100 sub fp, ip, #4
101
102 cmp len, #8 @ Ensure that we have at least
103 blo .less8 @ 8 bytes to copy.
104
105 adds sum, sum, #0 @ C = 0
106 tst dst, #3 @ Test destination alignment
107 blne .dst_unaligned @ align destination, return here
108
109 /*
110 * Ok, the dst pointer is now 32bit aligned, and we know
111 * that we must have more than 4 bytes to copy. Note
112 * that C contains the carry from the dst alignment above.
113 */
114
115 tst src, #3 @ Test source alignment
116 bne .src_not_aligned
117
118 /* Routine for src & dst aligned */
119
120 bics ip, len, #15
121 beq 2f
122
1231: load4l r4, r5, r6, r7
124 stmia dst!, {r4, r5, r6, r7}
125 adcs sum, sum, r4
126 adcs sum, sum, r5
127 adcs sum, sum, r6
128 adcs sum, sum, r7
129 sub ip, ip, #16
130 teq ip, #0
131 bne 1b
132
1332: ands ip, len, #12
134 beq 4f
135 tst ip, #8
136 beq 3f
137 load2l r4, r5
138 stmia dst!, {r4, r5}
139 adcs sum, sum, r4
140 adcs sum, sum, r5
141 tst ip, #4
142 beq 4f
143
1443: load1l r4
145 str r4, [dst], #4
146 adcs sum, sum, r4
147
1484: ands len, len, #3
149 beq .done
150 load1l r4
151 tst len, #2
152/* mov r5, r4, lsr #byte(0)
153FIXME? 0 Shift anyhow!
154*/
155 beq .exit
156 adcs sum, sum, r4, push #16
157 strb r5, [dst], #1
158 mov r5, r4, lsr #byte(1)
159 strb r5, [dst], #1
160 mov r5, r4, lsr #byte(2)
161.exit: tst len, #1
162 strneb r5, [dst], #1
163 andne r5, r5, #255
164 adcnes sum, sum, r5, lsl #byte(0)
165
166 /*
167 * If the dst pointer was not 16-bit aligned, we
168 * need to rotate the checksum here to get around
169 * the inefficient byte manipulations in the
170 * architecture independent code.
171 */
172.done: adc r0, sum, #0
173 ldr sum, [sp, #0] @ dst
174 tst sum, #1
175 movne sum, r0, lsl #8
176 orrne r0, sum, r0, lsr #24
177 load_regs ea
178
179.src_not_aligned:
180 adc sum, sum, #0 @ include C from dst alignment
181 and ip, src, #3
182 bic src, src, #3
183 load1l r5
184 cmp ip, #2
185 beq .src2_aligned
186 bhi .src3_aligned
187 mov r4, r5, pull #8 @ C = 0
188 bics ip, len, #15
189 beq 2f
1901: load4l r5, r6, r7, r8
191 orr r4, r4, r5, push #24
192 mov r5, r5, pull #8
193 orr r5, r5, r6, push #24
194 mov r6, r6, pull #8
195 orr r6, r6, r7, push #24
196 mov r7, r7, pull #8
197 orr r7, r7, r8, push #24
198 stmia dst!, {r4, r5, r6, r7}
199 adcs sum, sum, r4
200 adcs sum, sum, r5
201 adcs sum, sum, r6
202 adcs sum, sum, r7
203 mov r4, r8, pull #8
204 sub ip, ip, #16
205 teq ip, #0
206 bne 1b
2072: ands ip, len, #12
208 beq 4f
209 tst ip, #8
210 beq 3f
211 load2l r5, r6
212 orr r4, r4, r5, push #24
213 mov r5, r5, pull #8
214 orr r5, r5, r6, push #24
215 stmia dst!, {r4, r5}
216 adcs sum, sum, r4
217 adcs sum, sum, r5
218 mov r4, r6, pull #8
219 tst ip, #4
220 beq 4f
2213: load1l r5
222 orr r4, r4, r5, push #24
223 str r4, [dst], #4
224 adcs sum, sum, r4
225 mov r4, r5, pull #8
2264: ands len, len, #3
227 beq .done
228/* mov r5, r4, lsr #byte(0)
229FIXME? 0 Shift anyhow
230*/
231 tst len, #2
232 beq .exit
233 adcs sum, sum, r4, push #16
234 strb r5, [dst], #1
235 mov r5, r4, lsr #byte(1)
236 strb r5, [dst], #1
237 mov r5, r4, lsr #byte(2)
238 b .exit
239
240.src2_aligned: mov r4, r5, pull #16
241 adds sum, sum, #0
242 bics ip, len, #15
243 beq 2f
2441: load4l r5, r6, r7, r8
245 orr r4, r4, r5, push #16
246 mov r5, r5, pull #16
247 orr r5, r5, r6, push #16
248 mov r6, r6, pull #16
249 orr r6, r6, r7, push #16
250 mov r7, r7, pull #16
251 orr r7, r7, r8, push #16
252 stmia dst!, {r4, r5, r6, r7}
253 adcs sum, sum, r4
254 adcs sum, sum, r5
255 adcs sum, sum, r6
256 adcs sum, sum, r7
257 mov r4, r8, pull #16
258 sub ip, ip, #16
259 teq ip, #0
260 bne 1b
2612: ands ip, len, #12
262 beq 4f
263 tst ip, #8
264 beq 3f
265 load2l r5, r6
266 orr r4, r4, r5, push #16
267 mov r5, r5, pull #16
268 orr r5, r5, r6, push #16
269 stmia dst!, {r4, r5}
270 adcs sum, sum, r4
271 adcs sum, sum, r5
272 mov r4, r6, pull #16
273 tst ip, #4
274 beq 4f
2753: load1l r5
276 orr r4, r4, r5, push #16
277 str r4, [dst], #4
278 adcs sum, sum, r4
279 mov r4, r5, pull #16
2804: ands len, len, #3
281 beq .done
282/* mov r5, r4, lsr #byte(0)
283FIXME? 0 Shift anyhow
284*/
285 tst len, #2
286 beq .exit
287 adcs sum, sum, r4
288 strb r5, [dst], #1
289 mov r5, r4, lsr #byte(1)
290 strb r5, [dst], #1
291 tst len, #1
292 beq .done
293 load1b r5
294 b .exit
295
296.src3_aligned: mov r4, r5, pull #24
297 adds sum, sum, #0
298 bics ip, len, #15
299 beq 2f
3001: load4l r5, r6, r7, r8
301 orr r4, r4, r5, push #8
302 mov r5, r5, pull #24
303 orr r5, r5, r6, push #8
304 mov r6, r6, pull #24
305 orr r6, r6, r7, push #8
306 mov r7, r7, pull #24
307 orr r7, r7, r8, push #8
308 stmia dst!, {r4, r5, r6, r7}
309 adcs sum, sum, r4
310 adcs sum, sum, r5
311 adcs sum, sum, r6
312 adcs sum, sum, r7
313 mov r4, r8, pull #24
314 sub ip, ip, #16
315 teq ip, #0
316 bne 1b
3172: ands ip, len, #12
318 beq 4f
319 tst ip, #8
320 beq 3f
321 load2l r5, r6
322 orr r4, r4, r5, push #8
323 mov r5, r5, pull #24
324 orr r5, r5, r6, push #8
325 stmia dst!, {r4, r5}
326 adcs sum, sum, r4
327 adcs sum, sum, r5
328 mov r4, r6, pull #24
329 tst ip, #4
330 beq 4f
3313: load1l r5
332 orr r4, r4, r5, push #8
333 str r4, [dst], #4
334 adcs sum, sum, r4
335 mov r4, r5, pull #24
3364: ands len, len, #3
337 beq .done
338/* mov r5, r4, lsr #byte(0)
339FIXME? 0 Shift anyhow
340*/
341 tst len, #2
342 beq .exit
343 strb r5, [dst], #1
344 adcs sum, sum, r4
345 load1l r4
346/* mov r5, r4, lsr #byte(0)
347FIXME? 0 Shift anyhow
348*/
349 strb r5, [dst], #1
350 adcs sum, sum, r4, push #24
351 mov r5, r4, lsr #byte(1)
352 b .exit
diff --git a/arch/arm26/lib/csumpartialcopyuser.S b/arch/arm26/lib/csumpartialcopyuser.S
deleted file mode 100644
index a98eea74305a..000000000000
--- a/arch/arm26/lib/csumpartialcopyuser.S
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 * linux/arch/arm26/lib/csumpartialcopyuser.S
3 *
4 * Copyright (C) 1995-1998 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/errno.h>
13#include <asm/asm-offsets.h>
14
15 .text
16
17 .macro save_regs
18 stmfd sp!, {r1 - r2, r4 - r9, fp, ip, lr, pc}
19 mov r9, sp, lsr #13
20 mov r9, r9, lsl #13
21 ldr r9, [r9, #TSK_ADDR_LIMIT]
22 mov r9, r9, lsr #24
23 .endm
24
25 .macro load_regs,flags
26 ldm\flags fp, {r1, r2, r4-r9, fp, sp, pc}^
27 .endm
28
29 .macro load1b, reg1
30 tst r9, #0x01
319999: ldreqbt \reg1, [r0], #1
32 ldrneb \reg1, [r0], #1
33 .section __ex_table, "a"
34 .align 3
35 .long 9999b, 6001f
36 .previous
37 .endm
38
39 .macro load2b, reg1, reg2
40 tst r9, #0x01
419999: ldreqbt \reg1, [r0], #1
42 ldrneb \reg1, [r0], #1
439998: ldreqbt \reg2, [r0], #1
44 ldrneb \reg2, [r0], #1
45 .section __ex_table, "a"
46 .long 9999b, 6001f
47 .long 9998b, 6001f
48 .previous
49 .endm
50
51 .macro load1l, reg1
52 tst r9, #0x01
539999: ldreqt \reg1, [r0], #4
54 ldrne \reg1, [r0], #4
55 .section __ex_table, "a"
56 .align 3
57 .long 9999b, 6001f
58 .previous
59 .endm
60
61 .macro load2l, reg1, reg2
62 tst r9, #0x01
63 ldmneia r0!, {\reg1, \reg2}
649999: ldreqt \reg1, [r0], #4
659998: ldreqt \reg2, [r0], #4
66 .section __ex_table, "a"
67 .long 9999b, 6001f
68 .long 9998b, 6001f
69 .previous
70 .endm
71
72 .macro load4l, reg1, reg2, reg3, reg4
73 tst r9, #0x01
74 ldmneia r0!, {\reg1, \reg2, \reg3, \reg4}
759999: ldreqt \reg1, [r0], #4
769998: ldreqt \reg2, [r0], #4
779997: ldreqt \reg3, [r0], #4
789996: ldreqt \reg4, [r0], #4
79 .section __ex_table, "a"
80 .long 9999b, 6001f
81 .long 9998b, 6001f
82 .long 9997b, 6001f
83 .long 9996b, 6001f
84 .previous
85 .endm
86
87/*
88 * unsigned int
89 * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
90 * r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr
91 * Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT
92 */
93
94#define FN_ENTRY ENTRY(csum_partial_copy_from_user)
95
96#include "csumpartialcopygeneric.S"
97
98/*
99 * FIXME: minor buglet here
100 * We don't return the checksum for the data present in the buffer. To do
101 * so properly, we would have to add in whatever registers were loaded before
102 * the fault, which, with the current asm above is not predictable.
103 */
104 .align 4
1056001: mov r4, #-EFAULT
106 ldr r5, [fp, #4] @ *err_ptr
107 str r4, [r5]
108 ldmia sp, {r1, r2} @ retrieve dst, len
109 add r2, r2, r1
110 mov r0, #0 @ zero the buffer
1116002: teq r2, r1
112 strneb r0, [r1], #1
113 bne 6002b
114 load_regs ea
diff --git a/arch/arm26/lib/delay.S b/arch/arm26/lib/delay.S
deleted file mode 100644
index 66f2b68e1b13..000000000000
--- a/arch/arm26/lib/delay.S
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * linux/arch/arm26/lib/delay.S
3 *
4 * Copyright (C) 1995, 1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14LC0: .word loops_per_jiffy
15
16/*
17 * 0 <= r0 <= 2000
18 */
19ENTRY(udelay)
20 mov r2, #0x6800
21 orr r2, r2, #0x00db
22 mul r1, r0, r2
23 ldr r2, LC0
24 ldr r2, [r2]
25 mov r1, r1, lsr #11
26 mov r2, r2, lsr #11
27 mul r0, r1, r2
28 movs r0, r0, lsr #6
29 RETINSTR(moveq,pc,lr)
30
31/*
32 * loops = (r0 * 0x10c6 * 100 * loops_per_jiffy) / 2^32
33 *
34 * Oh, if only we had a cycle counter...
35 */
36
37@ Delay routine
38ENTRY(__delay)
39 subs r0, r0, #1
40#if 0
41 RETINSTR(movls,pc,lr)
42 subs r0, r0, #1
43 RETINSTR(movls,pc,lr)
44 subs r0, r0, #1
45 RETINSTR(movls,pc,lr)
46 subs r0, r0, #1
47 RETINSTR(movls,pc,lr)
48 subs r0, r0, #1
49 RETINSTR(movls,pc,lr)
50 subs r0, r0, #1
51 RETINSTR(movls,pc,lr)
52 subs r0, r0, #1
53 RETINSTR(movls,pc,lr)
54 subs r0, r0, #1
55#endif
56 bhi __delay
57 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/ecard.S b/arch/arm26/lib/ecard.S
deleted file mode 100644
index 658bc4529c9d..000000000000
--- a/arch/arm26/lib/ecard.S
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * linux/arch/arm26/lib/ecard.S
3 *
4 * Copyright (C) 1995, 1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14#define CPSR2SPSR(rt)
15
16@ Purpose: call an expansion card loader to read bytes.
17@ Proto : char read_loader(int offset, char *card_base, char *loader);
18@ Returns: byte read
19
20ENTRY(ecard_loader_read)
21 stmfd sp!, {r4 - r12, lr}
22 mov r11, r1
23 mov r1, r0
24 CPSR2SPSR(r0)
25 mov lr, pc
26 mov pc, r2
27 LOADREGS(fd, sp!, {r4 - r12, pc})
28
29@ Purpose: call an expansion card loader to reset the card
30@ Proto : void read_loader(int card_base, char *loader);
31@ Returns: byte read
32
33ENTRY(ecard_loader_reset)
34 stmfd sp!, {r4 - r12, lr}
35 mov r11, r0
36 CPSR2SPSR(r0)
37 mov lr, pc
38 add pc, r1, #8
39 LOADREGS(fd, sp!, {r4 - r12, pc})
40
diff --git a/arch/arm26/lib/findbit.S b/arch/arm26/lib/findbit.S
deleted file mode 100644
index 26f67cccc37c..000000000000
--- a/arch/arm26/lib/findbit.S
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * linux/arch/arm/lib/findbit.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * 16th March 2001 - John Ripley <jripley@sonicblue.com>
11 * Fixed so that "size" is an exclusive not an inclusive quantity.
12 * All users of these functions expect exclusive sizes, and may
13 * also call with zero size.
14 * Reworked by rmk.
15 */
16#include <linux/linkage.h>
17#include <asm/assembler.h>
18 .text
19
20/*
21 * Purpose : Find a 'zero' bit
22 * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
23 */
24ENTRY(_find_first_zero_bit_le)
25 teq r1, #0
26 beq 3f
27 mov r2, #0
281: ldrb r3, [r0, r2, lsr #3]
29 eors r3, r3, #0xff @ invert bits
30 bne .found @ any now set - found zero bit
31 add r2, r2, #8 @ next bit pointer
322: cmp r2, r1 @ any more?
33 blo 1b
343: mov r0, r1 @ no free bits
35 RETINSTR(mov,pc,lr)
36
37/*
38 * Purpose : Find next 'zero' bit
39 * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
40 */
41ENTRY(_find_next_zero_bit_le)
42 teq r1, #0
43 beq 2b
44 ands ip, r2, #7
45 beq 1b @ If new byte, goto old routine
46 ldrb r3, [r0, r2, lsr #3]
47 eor r3, r3, #0xff @ now looking for a 1 bit
48 movs r3, r3, lsr ip @ shift off unused bits
49 bne .found
50 orr r2, r2, #7 @ if zero, then no bits here
51 add r2, r2, #1 @ align bit pointer
52 b 2b @ loop for next bit
53
54/*
55 * One or more bits in the LSB of r3 are assumed to be set.
56 */
57.found: tst r3, #0x0f
58 addeq r2, r2, #4
59 movne r3, r3, lsl #4
60 tst r3, #0x30
61 addeq r2, r2, #2
62 movne r3, r3, lsl #2
63 tst r3, #0x40
64 addeq r2, r2, #1
65 mov r0, r2
66 RETINSTR(mov,pc,lr)
67
diff --git a/arch/arm26/lib/floppydma.S b/arch/arm26/lib/floppydma.S
deleted file mode 100644
index e99ebbb20353..000000000000
--- a/arch/arm26/lib/floppydma.S
+++ /dev/null
@@ -1,32 +0,0 @@
1/*
2 * linux/arch/arm26/lib/floppydma.S
3 *
4 * Copyright (C) 1995, 1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14 .global floppy_fiqin_end
15ENTRY(floppy_fiqin_start)
16 subs r9, r9, #1
17 ldrgtb r12, [r11, #-4]
18 ldrleb r12, [r11], #0
19 strb r12, [r10], #1
20 subs pc, lr, #4
21floppy_fiqin_end:
22
23 .global floppy_fiqout_end
24ENTRY(floppy_fiqout_start)
25 subs r9, r9, #1
26 ldrgeb r12, [r10], #1
27 movlt r12, #0
28 strleb r12, [r11], #0
29 subles pc, lr, #4
30 strb r12, [r11, #-4]
31 subs pc, lr, #4
32floppy_fiqout_end:
diff --git a/arch/arm26/lib/gcclib.h b/arch/arm26/lib/gcclib.h
deleted file mode 100644
index 9895e78904b5..000000000000
--- a/arch/arm26/lib/gcclib.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/* gcclib.h -- definitions for various functions 'borrowed' from gcc-2.95.3 */
2/* I Molton 29/07/01 */
3
4#define BITS_PER_UNIT 8
5#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
6
7typedef unsigned int UQItype __attribute__ ((mode (QI)));
8typedef int SItype __attribute__ ((mode (SI)));
9typedef unsigned int USItype __attribute__ ((mode (SI)));
10typedef int DItype __attribute__ ((mode (DI)));
11typedef int word_type __attribute__ ((mode (__word__)));
12typedef unsigned int UDItype __attribute__ ((mode (DI)));
13
14struct DIstruct {SItype low, high;};
15
16typedef union
17{
18 struct DIstruct s;
19 DItype ll;
20} DIunion;
21
diff --git a/arch/arm26/lib/getuser.S b/arch/arm26/lib/getuser.S
deleted file mode 100644
index 2b1de7fbfe1f..000000000000
--- a/arch/arm26/lib/getuser.S
+++ /dev/null
@@ -1,112 +0,0 @@
1/*
2 * linux/arch/arm26/lib/getuser.S
3 *
4 * Copyright (C) 2001 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Idea from x86 version, (C) Copyright 1998 Linus Torvalds
11 *
12 * These functions have a non-standard call interface to make them more
13 * efficient, especially as they return an error value in addition to
14 * the "real" return value.
15 *
16 * __get_user_X
17 *
18 * Inputs: r0 contains the address
19 * Outputs: r0 is the error code
20 * r1, r2 contains the zero-extended value
21 * lr corrupted
22 *
23 * No other registers must be altered. (see include/asm-arm/uaccess.h
24 * for specific ASM register usage).
25 *
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000.
27 * Note also that it is intended that __get_user_bad is not global.
28 */
29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h>
31#include <asm/errno.h>
32
33 .global __get_user_1
34__get_user_1:
35 bic r1, sp, #0x1f00
36 bic r1, r1, #0x00ff
37 str lr, [sp, #-4]!
38 ldr r1, [r1, #TI_ADDR_LIMIT]
39 sub r1, r1, #1
40 cmp r0, r1
41 bge __get_user_bad
42 cmp r0, #0x02000000
431: ldrlsbt r1, [r0]
44 ldrgeb r1, [r0]
45 mov r0, #0
46 ldmfd sp!, {pc}^
47
48 .global __get_user_2
49__get_user_2:
50 bic r2, sp, #0x1f00
51 bic r2, r2, #0x00ff
52 str lr, [sp, #-4]!
53 ldr r2, [r2, #TI_ADDR_LIMIT]
54 sub r2, r2, #2
55 cmp r0, r2
56 bge __get_user_bad
57 cmp r0, #0x02000000
582: ldrlsbt r1, [r0], #1
593: ldrlsbt r2, [r0]
60 ldrgeb r1, [r0], #1
61 ldrgeb r2, [r0]
62 orr r1, r1, r2, lsl #8
63 mov r0, #0
64 ldmfd sp!, {pc}^
65
66 .global __get_user_4
67__get_user_4:
68 bic r1, sp, #0x1f00
69 bic r1, r1, #0x00ff
70 str lr, [sp, #-4]!
71 ldr r1, [r1, #TI_ADDR_LIMIT]
72 sub r1, r1, #4
73 cmp r0, r1
74 bge __get_user_bad
75 cmp r0, #0x02000000
764: ldrlst r1, [r0]
77 ldrge r1, [r0]
78 mov r0, #0
79 ldmfd sp!, {pc}^
80
81 .global __get_user_8
82__get_user_8:
83 bic r2, sp, #0x1f00
84 bic r2, r2, #0x00ff
85 str lr, [sp, #-4]!
86 ldr r2, [r2, #TI_ADDR_LIMIT]
87 sub r2, r2, #8
88 cmp r0, r2
89 bge __get_user_bad_8
90 cmp r0, #0x02000000
915: ldrlst r1, [r0], #4
926: ldrlst r2, [r0]
93 ldrge r1, [r0], #4
94 ldrge r2, [r0]
95 mov r0, #0
96 ldmfd sp!, {pc}^
97
98__get_user_bad_8:
99 mov r2, #0
100__get_user_bad:
101 mov r1, #0
102 mov r0, #-EFAULT
103 ldmfd sp!, {pc}^
104
105.section __ex_table, "a"
106 .long 1b, __get_user_bad
107 .long 2b, __get_user_bad
108 .long 3b, __get_user_bad
109 .long 4b, __get_user_bad
110 .long 5b, __get_user_bad_8
111 .long 6b, __get_user_bad_8
112.previous
diff --git a/arch/arm26/lib/io-acorn.S b/arch/arm26/lib/io-acorn.S
deleted file mode 100644
index 5f62ade5be39..000000000000
--- a/arch/arm26/lib/io-acorn.S
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-acorn.S
3 *
4 * Copyright (C) 1995, 1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14 .text
15 .align
16
17 .equ diff_pcio_base, PCIO_BASE - IO_BASE
18
19 .macro outw2 rd
20 mov r8, \rd, lsl #16
21 orr r8, r8, r8, lsr #16
22 str r8, [r3, r0, lsl #2]
23 mov r8, \rd, lsr #16
24 orr r8, r8, r8, lsl #16
25 str r8, [r3, r0, lsl #2]
26 .endm
27
28 .macro inw2 rd, mask, temp
29 ldr \rd, [r0]
30 and \rd, \rd, \mask
31 ldr \temp, [r0]
32 orr \rd, \rd, \temp, lsl #16
33 .endm
34
35 .macro addr rd
36 tst \rd, #0x80000000
37 mov \rd, \rd, lsl #2
38 add \rd, \rd, #IO_BASE
39 addeq \rd, \rd, #diff_pcio_base
40 .endm
41
42.iosl_warning:
43 .ascii "<4>insl/outsl not implemented, called from %08lX\0"
44 .align
45
46/*
47 * These make no sense on Acorn machines.
48 * Print a warning message.
49 */
50ENTRY(insl)
51ENTRY(outsl)
52 adr r0, .iosl_warning
53 mov r1, lr
54 b printk
55
56@ Purpose: write a memc register
57@ Proto : void memc_write(int register, int value);
58@ Returns: nothing
59
60ENTRY(memc_write)
61 cmp r0, #7
62 RETINSTR(movgt,pc,lr)
63 mov r0, r0, lsl #17
64 mov r1, r1, lsl #15
65 mov r1, r1, lsr #17
66 orr r0, r0, r1, lsl #2
67 add r0, r0, #0x03600000
68 strb r0, [r0]
69 RETINSTR(mov,pc,lr)
70
diff --git a/arch/arm26/lib/io-readsb.S b/arch/arm26/lib/io-readsb.S
deleted file mode 100644
index 4c4d99c05856..000000000000
--- a/arch/arm26/lib/io-readsb.S
+++ /dev/null
@@ -1,116 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-readsb.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14.insb_align: rsb ip, ip, #4
15 cmp ip, r2
16 movgt ip, r2
17 cmp ip, #2
18 ldrb r3, [r0]
19 strb r3, [r1], #1
20 ldrgeb r3, [r0]
21 strgeb r3, [r1], #1
22 ldrgtb r3, [r0]
23 strgtb r3, [r1], #1
24 subs r2, r2, ip
25 bne .insb_aligned
26
27ENTRY(__raw_readsb)
28 teq r2, #0 @ do we have to check for the zero len?
29 moveq pc, lr
30 ands ip, r1, #3
31 bne .insb_align
32
33.insb_aligned: stmfd sp!, {r4 - r6, lr}
34
35 subs r2, r2, #16
36 bmi .insb_no_16
37
38.insb_16_lp: ldrb r3, [r0]
39 ldrb r4, [r0]
40 orr r3, r3, r4, lsl #8
41 ldrb r4, [r0]
42 orr r3, r3, r4, lsl #16
43 ldrb r4, [r0]
44 orr r3, r3, r4, lsl #24
45 ldrb r4, [r0]
46 ldrb r5, [r0]
47 orr r4, r4, r5, lsl #8
48 ldrb r5, [r0]
49 orr r4, r4, r5, lsl #16
50 ldrb r5, [r0]
51 orr r4, r4, r5, lsl #24
52 ldrb r5, [r0]
53 ldrb r6, [r0]
54 orr r5, r5, r6, lsl #8
55 ldrb r6, [r0]
56 orr r5, r5, r6, lsl #16
57 ldrb r6, [r0]
58 orr r5, r5, r6, lsl #24
59 ldrb r6, [r0]
60 ldrb ip, [r0]
61 orr r6, r6, ip, lsl #8
62 ldrb ip, [r0]
63 orr r6, r6, ip, lsl #16
64 ldrb ip, [r0]
65 orr r6, r6, ip, lsl #24
66 stmia r1!, {r3 - r6}
67
68 subs r2, r2, #16
69 bpl .insb_16_lp
70
71 tst r2, #15
72 LOADREGS(eqfd, sp!, {r4 - r6, pc})
73
74.insb_no_16: tst r2, #8
75 beq .insb_no_8
76
77 ldrb r3, [r0]
78 ldrb r4, [r0]
79 orr r3, r3, r4, lsl #8
80 ldrb r4, [r0]
81 orr r3, r3, r4, lsl #16
82 ldrb r4, [r0]
83 orr r3, r3, r4, lsl #24
84 ldrb r4, [r0]
85 ldrb r5, [r0]
86 orr r4, r4, r5, lsl #8
87 ldrb r5, [r0]
88 orr r4, r4, r5, lsl #16
89 ldrb r5, [r0]
90 orr r4, r4, r5, lsl #24
91 stmia r1!, {r3, r4}
92
93.insb_no_8: tst r2, #4
94 beq .insb_no_4
95
96 ldrb r3, [r0]
97 ldrb r4, [r0]
98 orr r3, r3, r4, lsl #8
99 ldrb r4, [r0]
100 orr r3, r3, r4, lsl #16
101 ldrb r4, [r0]
102 orr r3, r3, r4, lsl #24
103 str r3, [r1], #4
104
105.insb_no_4: ands r2, r2, #3
106 LOADREGS(eqfd, sp!, {r4 - r6, pc})
107
108 cmp r2, #2
109 ldrb r3, [r0]
110 strb r3, [r1], #1
111 ldrgeb r3, [r0]
112 strgeb r3, [r1], #1
113 ldrgtb r3, [r0]
114 strgtb r3, [r1]
115
116 LOADREGS(fd, sp!, {r4 - r6, pc})
diff --git a/arch/arm26/lib/io-readsl.S b/arch/arm26/lib/io-readsl.S
deleted file mode 100644
index 7be208bd23c6..000000000000
--- a/arch/arm26/lib/io-readsl.S
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-readsl.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14/*
15 * Note that some reads can be aligned on half-word boundaries.
16 */
17ENTRY(__raw_readsl)
18 teq r2, #0 @ do we have to check for the zero len?
19 moveq pc, lr
20 ands ip, r1, #3
21 bne 2f
22
231: ldr r3, [r0]
24 str r3, [r1], #4
25 subs r2, r2, #1
26 bne 1b
27 mov pc, lr
28
292: cmp ip, #2
30 ldr ip, [r0]
31 blt 4f
32 bgt 6f
33
34 strb ip, [r1], #1
35 mov ip, ip, lsr #8
36 strb ip, [r1], #1
37 mov ip, ip, lsr #8
383: subs r2, r2, #1
39 ldrne r3, [r0]
40 orrne ip, ip, r3, lsl #16
41 strne ip, [r1], #4
42 movne ip, r3, lsr #16
43 bne 3b
44 strb ip, [r1], #1
45 mov ip, ip, lsr #8
46 strb ip, [r1], #1
47 mov pc, lr
48
494: strb ip, [r1], #1
50 mov ip, ip, lsr #8
51 strb ip, [r1], #1
52 mov ip, ip, lsr #8
53 strb ip, [r1], #1
54 mov ip, ip, lsr #8
555: subs r2, r2, #1
56 ldrne r3, [r0]
57 orrne ip, ip, r3, lsl #8
58 strne ip, [r1], #4
59 movne ip, r3, lsr #24
60 bne 5b
61 strb ip, [r1], #1
62 mov pc, lr
63
646: strb ip, [r1], #1
65 mov ip, ip, lsr #8
667: subs r2, r2, #1
67 ldrne r3, [r0]
68 orrne ip, ip, r3, lsl #24
69 strne ip, [r1], #4
70 movne ip, r3, lsr #8
71 bne 7b
72 strb ip, [r1], #1
73 mov ip, ip, lsr #8
74 strb ip, [r1], #1
75 mov ip, ip, lsr #8
76 strb ip, [r1], #1
77 mov pc, lr
78
diff --git a/arch/arm26/lib/io-readsw.S b/arch/arm26/lib/io-readsw.S
deleted file mode 100644
index c65c1f28fcff..000000000000
--- a/arch/arm26/lib/io-readsw.S
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-readsw.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14.insw_bad_alignment:
15 adr r0, .insw_bad_align_msg
16 mov r2, lr
17 b panic
18.insw_bad_align_msg:
19 .asciz "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
20 .align
21
22.insw_align: tst r1, #1
23 bne .insw_bad_alignment
24
25 ldr r3, [r0]
26 strb r3, [r1], #1
27 mov r3, r3, lsr #8
28 strb r3, [r1], #1
29
30 subs r2, r2, #1
31 RETINSTR(moveq, pc, lr)
32
33ENTRY(__raw_readsw)
34 teq r2, #0 @ do we have to check for the zero len?
35 moveq pc, lr
36 tst r1, #3
37 bne .insw_align
38
39.insw_aligned: mov ip, #0xff
40 orr ip, ip, ip, lsl #8
41 stmfd sp!, {r4, r5, r6, lr}
42
43 subs r2, r2, #8
44 bmi .no_insw_8
45
46.insw_8_lp: ldr r3, [r0]
47 and r3, r3, ip
48 ldr r4, [r0]
49 orr r3, r3, r4, lsl #16
50
51 ldr r4, [r0]
52 and r4, r4, ip
53 ldr r5, [r0]
54 orr r4, r4, r5, lsl #16
55
56 ldr r5, [r0]
57 and r5, r5, ip
58 ldr r6, [r0]
59 orr r5, r5, r6, lsl #16
60
61 ldr r6, [r0]
62 and r6, r6, ip
63 ldr lr, [r0]
64 orr r6, r6, lr, lsl #16
65
66 stmia r1!, {r3 - r6}
67
68 subs r2, r2, #8
69 bpl .insw_8_lp
70
71 tst r2, #7
72 LOADREGS(eqfd, sp!, {r4, r5, r6, pc})
73
74.no_insw_8: tst r2, #4
75 beq .no_insw_4
76
77 ldr r3, [r0]
78 and r3, r3, ip
79 ldr r4, [r0]
80 orr r3, r3, r4, lsl #16
81
82 ldr r4, [r0]
83 and r4, r4, ip
84 ldr r5, [r0]
85 orr r4, r4, r5, lsl #16
86
87 stmia r1!, {r3, r4}
88
89.no_insw_4: tst r2, #2
90 beq .no_insw_2
91
92 ldr r3, [r0]
93 and r3, r3, ip
94 ldr r4, [r0]
95 orr r3, r3, r4, lsl #16
96
97 str r3, [r1], #4
98
99.no_insw_2: tst r2, #1
100 ldrne r3, [r0]
101 strneb r3, [r1], #1
102 movne r3, r3, lsr #8
103 strneb r3, [r1]
104
105 LOADREGS(fd, sp!, {r4, r5, r6, pc})
106
107
diff --git a/arch/arm26/lib/io-writesb.S b/arch/arm26/lib/io-writesb.S
deleted file mode 100644
index 16251b4d5101..000000000000
--- a/arch/arm26/lib/io-writesb.S
+++ /dev/null
@@ -1,122 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-writesb.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14.outsb_align: rsb ip, ip, #4
15 cmp ip, r2
16 movgt ip, r2
17 cmp ip, #2
18 ldrb r3, [r1], #1
19 strb r3, [r0]
20 ldrgeb r3, [r1], #1
21 strgeb r3, [r0]
22 ldrgtb r3, [r1], #1
23 strgtb r3, [r0]
24 subs r2, r2, ip
25 bne .outsb_aligned
26
27ENTRY(__raw_writesb)
28 teq r2, #0 @ do we have to check for the zero len?
29 moveq pc, lr
30 ands ip, r1, #3
31 bne .outsb_align
32
33.outsb_aligned: stmfd sp!, {r4 - r6, lr}
34
35 subs r2, r2, #16
36 bmi .outsb_no_16
37
38.outsb_16_lp: ldmia r1!, {r3 - r6}
39
40 strb r3, [r0]
41 mov r3, r3, lsr #8
42 strb r3, [r0]
43 mov r3, r3, lsr #8
44 strb r3, [r0]
45 mov r3, r3, lsr #8
46 strb r3, [r0]
47
48 strb r4, [r0]
49 mov r4, r4, lsr #8
50 strb r4, [r0]
51 mov r4, r4, lsr #8
52 strb r4, [r0]
53 mov r4, r4, lsr #8
54 strb r4, [r0]
55
56 strb r5, [r0]
57 mov r5, r5, lsr #8
58 strb r5, [r0]
59 mov r5, r5, lsr #8
60 strb r5, [r0]
61 mov r5, r5, lsr #8
62 strb r5, [r0]
63
64 strb r6, [r0]
65 mov r6, r6, lsr #8
66 strb r6, [r0]
67 mov r6, r6, lsr #8
68 strb r6, [r0]
69 mov r6, r6, lsr #8
70 strb r6, [r0]
71
72 subs r2, r2, #16
73 bpl .outsb_16_lp
74
75 tst r2, #15
76 LOADREGS(eqfd, sp!, {r4 - r6, pc})
77
78.outsb_no_16: tst r2, #8
79 beq .outsb_no_8
80
81 ldmia r1!, {r3, r4}
82
83 strb r3, [r0]
84 mov r3, r3, lsr #8
85 strb r3, [r0]
86 mov r3, r3, lsr #8
87 strb r3, [r0]
88 mov r3, r3, lsr #8
89 strb r3, [r0]
90
91 strb r4, [r0]
92 mov r4, r4, lsr #8
93 strb r4, [r0]
94 mov r4, r4, lsr #8
95 strb r4, [r0]
96 mov r4, r4, lsr #8
97 strb r4, [r0]
98
99.outsb_no_8: tst r2, #4
100 beq .outsb_no_4
101
102 ldr r3, [r1], #4
103 strb r3, [r0]
104 mov r3, r3, lsr #8
105 strb r3, [r0]
106 mov r3, r3, lsr #8
107 strb r3, [r0]
108 mov r3, r3, lsr #8
109 strb r3, [r0]
110
111.outsb_no_4: ands r2, r2, #3
112 LOADREGS(eqfd, sp!, {r4 - r6, pc})
113
114 cmp r2, #2
115 ldrb r3, [r1], #1
116 strb r3, [r0]
117 ldrgeb r3, [r1], #1
118 strgeb r3, [r0]
119 ldrgtb r3, [r1]
120 strgtb r3, [r0]
121
122 LOADREGS(fd, sp!, {r4 - r6, pc})
diff --git a/arch/arm26/lib/io-writesl.S b/arch/arm26/lib/io-writesl.S
deleted file mode 100644
index 4d6049b16e71..000000000000
--- a/arch/arm26/lib/io-writesl.S
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-writesl.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14ENTRY(__raw_writesl)
15 teq r2, #0 @ do we have to check for the zero len?
16 moveq pc, lr
17 ands ip, r1, #3
18 bne 2f
19
201: ldr r3, [r1], #4
21 str r3, [r0]
22 subs r2, r2, #1
23 bne 1b
24 mov pc, lr
25
262: bic r1, r1, #3
27 cmp ip, #2
28 ldr r3, [r1], #4
29 bgt 4f
30 blt 5f
31
323: mov ip, r3, lsr #16
33 ldr r3, [r1], #4
34 orr ip, ip, r3, lsl #16
35 str ip, [r0]
36 subs r2, r2, #1
37 bne 3b
38 mov pc, lr
39
404: mov ip, r3, lsr #24
41 ldr r3, [r1], #4
42 orr ip, ip, r3, lsl #8
43 str ip, [r0]
44 subs r2, r2, #1
45 bne 4b
46 mov pc, lr
47
485: mov ip, r3, lsr #8
49 ldr r3, [r1], #4
50 orr ip, ip, r3, lsl #24
51 str ip, [r0]
52 subs r2, r2, #1
53 bne 5b
54 mov pc, lr
55
56
diff --git a/arch/arm26/lib/io-writesw.S b/arch/arm26/lib/io-writesw.S
deleted file mode 100644
index a24f891f6b1c..000000000000
--- a/arch/arm26/lib/io-writesw.S
+++ /dev/null
@@ -1,127 +0,0 @@
1/*
2 * linux/arch/arm26/lib/io-writesw.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12#include <asm/hardware.h>
13
14.outsw_bad_alignment:
15 adr r0, .outsw_bad_align_msg
16 mov r2, lr
17 b panic
18.outsw_bad_align_msg:
19 .asciz "outsw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
20 .align
21
22.outsw_align: tst r1, #1
23 bne .outsw_bad_alignment
24
25 add r1, r1, #2
26
27 ldr r3, [r1, #-4]
28 mov r3, r3, lsr #16
29 orr r3, r3, r3, lsl #16
30 str r3, [r0]
31 subs r2, r2, #1
32 RETINSTR(moveq, pc, lr)
33
34ENTRY(__raw_writesw)
35 teq r2, #0 @ do we have to check for the zero len?
36 moveq pc, lr
37 tst r1, #3
38 bne .outsw_align
39
40.outsw_aligned: stmfd sp!, {r4, r5, r6, lr}
41
42 subs r2, r2, #8
43 bmi .no_outsw_8
44
45.outsw_8_lp: ldmia r1!, {r3, r4, r5, r6}
46
47 mov ip, r3, lsl #16
48 orr ip, ip, ip, lsr #16
49 str ip, [r0]
50
51 mov ip, r3, lsr #16
52 orr ip, ip, ip, lsl #16
53 str ip, [r0]
54
55 mov ip, r4, lsl #16
56 orr ip, ip, ip, lsr #16
57 str ip, [r0]
58
59 mov ip, r4, lsr #16
60 orr ip, ip, ip, lsl #16
61 str ip, [r0]
62
63 mov ip, r5, lsl #16
64 orr ip, ip, ip, lsr #16
65 str ip, [r0]
66
67 mov ip, r5, lsr #16
68 orr ip, ip, ip, lsl #16
69 str ip, [r0]
70
71 mov ip, r6, lsl #16
72 orr ip, ip, ip, lsr #16
73 str ip, [r0]
74
75 mov ip, r6, lsr #16
76 orr ip, ip, ip, lsl #16
77 str ip, [r0]
78
79 subs r2, r2, #8
80 bpl .outsw_8_lp
81
82 tst r2, #7
83 LOADREGS(eqfd, sp!, {r4, r5, r6, pc})
84
85.no_outsw_8: tst r2, #4
86 beq .no_outsw_4
87
88 ldmia r1!, {r3, r4}
89
90 mov ip, r3, lsl #16
91 orr ip, ip, ip, lsr #16
92 str ip, [r0]
93
94 mov ip, r3, lsr #16
95 orr ip, ip, ip, lsl #16
96 str ip, [r0]
97
98 mov ip, r4, lsl #16
99 orr ip, ip, ip, lsr #16
100 str ip, [r0]
101
102 mov ip, r4, lsr #16
103 orr ip, ip, ip, lsl #16
104 str ip, [r0]
105
106.no_outsw_4: tst r2, #2
107 beq .no_outsw_2
108
109 ldr r3, [r1], #4
110
111 mov ip, r3, lsl #16
112 orr ip, ip, ip, lsr #16
113 str ip, [r0]
114
115 mov ip, r3, lsr #16
116 orr ip, ip, ip, lsl #16
117 str ip, [r0]
118
119.no_outsw_2: tst r2, #1
120
121 ldrne r3, [r1]
122
123 movne ip, r3, lsl #16
124 orrne ip, ip, ip, lsr #16
125 strne ip, [r0]
126
127 LOADREGS(fd, sp!, {r4, r5, r6, pc})
diff --git a/arch/arm26/lib/kbd.c b/arch/arm26/lib/kbd.c
deleted file mode 100644
index cb56e943e006..000000000000
--- a/arch/arm26/lib/kbd.c
+++ /dev/null
@@ -1,278 +0,0 @@
1#include <linux/kd.h>
2//#include <linux/kbd_ll.h>
3#include <linux/kbd_kern.h>
4
5/*
6 * Translation of escaped scancodes to keycodes.
7 * This is now user-settable.
8 * The keycodes 1-88,96-111,119 are fairly standard, and
9 * should probably not be changed - changing might confuse X.
10 * X also interprets scancode 0x5d (KEY_Begin).
11 *
12 * For 1-88 keycode equals scancode.
13 */
14
15#define E0_KPENTER 96
16#define E0_RCTRL 97
17#define E0_KPSLASH 98
18#define E0_PRSCR 99
19#define E0_RALT 100
20#define E0_BREAK 101 /* (control-pause) */
21#define E0_HOME 102
22#define E0_UP 103
23#define E0_PGUP 104
24#define E0_LEFT 105
25#define E0_RIGHT 106
26#define E0_END 107
27#define E0_DOWN 108
28#define E0_PGDN 109
29#define E0_INS 110
30#define E0_DEL 111
31
32/* for USB 106 keyboard */
33#define E0_YEN 124
34#define E0_BACKSLASH 89
35
36
37#define E1_PAUSE 119
38
39/*
40 * The keycodes below are randomly located in 89-95,112-118,120-127.
41 * They could be thrown away (and all occurrences below replaced by 0),
42 * but that would force many users to use the `setkeycodes' utility, where
43 * they needed not before. It does not matter that there are duplicates, as
44 * long as no duplication occurs for any single keyboard.
45 */
46#define SC_LIM 89
47
48#define FOCUS_PF1 85 /* actual code! */
49#define FOCUS_PF2 89
50#define FOCUS_PF3 90
51#define FOCUS_PF4 91
52#define FOCUS_PF5 92
53#define FOCUS_PF6 93
54#define FOCUS_PF7 94
55#define FOCUS_PF8 95
56#define FOCUS_PF9 120
57#define FOCUS_PF10 121
58#define FOCUS_PF11 122
59#define FOCUS_PF12 123
60
61#define JAP_86 124
62/* tfj@olivia.ping.dk:
63 * The four keys are located over the numeric keypad, and are
64 * labelled A1-A4. It's an rc930 keyboard, from
65 * Regnecentralen/RC International, Now ICL.
66 * Scancodes: 59, 5a, 5b, 5c.
67 */
68#define RGN1 124
69#define RGN2 125
70#define RGN3 126
71#define RGN4 127
72
73static unsigned char high_keys[128 - SC_LIM] = {
74 RGN1, RGN2, RGN3, RGN4, 0, 0, 0, /* 0x59-0x5f */
75 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
76 0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12, /* 0x68-0x6f */
77 0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3, /* 0x70-0x77 */
78 FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7, /* 0x78-0x7b */
79 FOCUS_PF8, JAP_86, FOCUS_PF10, 0 /* 0x7c-0x7f */
80};
81
82/* BTC */
83#define E0_MACRO 112
84/* LK450 */
85#define E0_F13 113
86#define E0_F14 114
87#define E0_HELP 115
88#define E0_DO 116
89#define E0_F17 117
90#define E0_KPMINPLUS 118
91/*
92 * My OmniKey generates e0 4c for the "OMNI" key and the
93 * right alt key does nada. [kkoller@nyx10.cs.du.edu]
94 */
95#define E0_OK 124
96/*
97 * New microsoft keyboard is rumoured to have
98 * e0 5b (left window button), e0 5c (right window button),
99 * e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
100 * [or: Windows_L, Windows_R, TaskMan]
101 */
102#define E0_MSLW 125
103#define E0_MSRW 126
104#define E0_MSTM 127
105
106static unsigned char e0_keys[128] = {
107 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x07 */
108 0, 0, 0, 0, 0, 0, 0, 0, /* 0x08-0x0f */
109 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
110 0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0, /* 0x18-0x1f */
111 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */
112 0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
113 0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */
114 E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP, /* 0x38-0x3f */
115 E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME, /* 0x40-0x47 */
116 E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END, /* 0x48-0x4f */
117 E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0, /* 0x50-0x57 */
118 0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0, /* 0x58-0x5f */
119 0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
120 0, 0, 0, 0, 0, 0, 0, E0_MACRO, /* 0x68-0x6f */
121 //0, 0, 0, 0, 0, 0, 0, 0, /* 0x70-0x77 */
122 0, 0, 0, 0, 0, E0_BACKSLASH, 0, 0, /* 0x70-0x77 */
123 0, 0, 0, E0_YEN, 0, 0, 0, 0 /* 0x78-0x7f */
124};
125
126static int gen_setkeycode(unsigned int scancode, unsigned int keycode)
127{
128 if (scancode < SC_LIM || scancode > 255 || keycode > 127)
129 return -EINVAL;
130 if (scancode < 128)
131 high_keys[scancode - SC_LIM] = keycode;
132 else
133 e0_keys[scancode - 128] = keycode;
134 return 0;
135}
136
137static int gen_getkeycode(unsigned int scancode)
138{
139 return
140 (scancode < SC_LIM || scancode > 255) ? -EINVAL :
141 (scancode <
142 128) ? high_keys[scancode - SC_LIM] : e0_keys[scancode - 128];
143}
144
145static int
146gen_translate(unsigned char scancode, unsigned char *keycode, char raw_mode)
147{
148 static int prev_scancode;
149
150 /* special prefix scancodes.. */
151 if (scancode == 0xe0 || scancode == 0xe1) {
152 prev_scancode = scancode;
153 return 0;
154 }
155
156 /* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
157 if (scancode == 0x00 || scancode == 0xff) {
158 prev_scancode = 0;
159 return 0;
160 }
161
162 scancode &= 0x7f;
163
164 if (prev_scancode) {
165 /*
166 * usually it will be 0xe0, but a Pause key generates
167 * e1 1d 45 e1 9d c5 when pressed, and nothing when released
168 */
169 if (prev_scancode != 0xe0) {
170 if (prev_scancode == 0xe1 && scancode == 0x1d) {
171 prev_scancode = 0x100;
172 return 0;
173 }
174 else if (prev_scancode == 0x100
175 && scancode == 0x45) {
176 *keycode = E1_PAUSE;
177 prev_scancode = 0;
178 } else {
179#ifdef KBD_REPORT_UNKN
180 if (!raw_mode)
181 printk(KERN_INFO
182 "keyboard: unknown e1 escape sequence\n");
183#endif
184 prev_scancode = 0;
185 return 0;
186 }
187 } else {
188 prev_scancode = 0;
189 /*
190 * The keyboard maintains its own internal caps lock and
191 * num lock statuses. In caps lock mode E0 AA precedes make
192 * code and E0 2A follows break code. In num lock mode,
193 * E0 2A precedes make code and E0 AA follows break code.
194 * We do our own book-keeping, so we will just ignore these.
195 */
196 /*
197 * For my keyboard there is no caps lock mode, but there are
198 * both Shift-L and Shift-R modes. The former mode generates
199 * E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
200 * So, we should also ignore the latter. - aeb@cwi.nl
201 */
202 if (scancode == 0x2a || scancode == 0x36)
203 return 0;
204
205 if (e0_keys[scancode])
206 *keycode = e0_keys[scancode];
207 else {
208#ifdef KBD_REPORT_UNKN
209 if (!raw_mode)
210 printk(KERN_INFO
211 "keyboard: unknown scancode e0 %02x\n",
212 scancode);
213#endif
214 return 0;
215 }
216 }
217 } else if (scancode >= SC_LIM) {
218 /* This happens with the FOCUS 9000 keyboard
219 Its keys PF1..PF12 are reported to generate
220 55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
221 Moreover, unless repeated, they do not generate
222 key-down events, so we have to zero up_flag below */
223 /* Also, Japanese 86/106 keyboards are reported to
224 generate 0x73 and 0x7d for \ - and \ | respectively. */
225 /* Also, some Brazilian keyboard is reported to produce
226 0x73 and 0x7e for \ ? and KP-dot, respectively. */
227
228 *keycode = high_keys[scancode - SC_LIM];
229
230 if (!*keycode) {
231 if (!raw_mode) {
232#ifdef KBD_REPORT_UNKN
233 printk(KERN_INFO
234 "keyboard: unrecognized scancode (%02x)"
235 " - ignored\n", scancode);
236#endif
237 }
238 return 0;
239 }
240 } else
241 *keycode = scancode;
242 return 1;
243}
244
245static char gen_unexpected_up(unsigned char keycode)
246{
247 /* unexpected, but this can happen: maybe this was a key release for a
248 FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */
249 if (keycode >= SC_LIM || keycode == 85)
250 return 0;
251 else
252 return 0200;
253}
254
255/*
256 * These are the default mappings
257 */
258int (*k_setkeycode)(unsigned int, unsigned int) = gen_setkeycode;
259int (*k_getkeycode)(unsigned int) = gen_getkeycode;
260int (*k_translate)(unsigned char, unsigned char *, char) = gen_translate;
261char (*k_unexpected_up)(unsigned char) = gen_unexpected_up;
262void (*k_leds)(unsigned char);
263
264/* Simple translation table for the SysRq keys */
265
266#ifdef CONFIG_MAGIC_SYSRQ
267static unsigned char gen_sysrq_xlate[128] =
268 "\000\0331234567890-=\177\t" /* 0x00 - 0x0f */
269 "qwertyuiop[]\r\000as" /* 0x10 - 0x1f */
270 "dfghjkl;'`\000\\zxcv" /* 0x20 - 0x2f */
271 "bnm,./\000*\000 \000\201\202\203\204\205" /* 0x30 - 0x3f */
272 "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
273 "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000" /* 0x50 - 0x5f */
274 "\r\000/"; /* 0x60 - 0x6f */
275
276unsigned char *k_sysrq_xlate = gen_sysrq_xlate;
277int k_sysrq_key = 0x54;
278#endif
diff --git a/arch/arm26/lib/lib1funcs.S b/arch/arm26/lib/lib1funcs.S
deleted file mode 100644
index 0e29970b0e8a..000000000000
--- a/arch/arm26/lib/lib1funcs.S
+++ /dev/null
@@ -1,313 +0,0 @@
1@ libgcc1 routines for ARM cpu.
2@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
3
4/* Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
5
6This file is free software; you can redistribute it and/or modify it
7under the terms of the GNU General Public License as published by the
8Free Software Foundation; either version 2, or (at your option) any
9later version.
10
11In addition to the permissions in the GNU General Public License, the
12Free Software Foundation gives you unlimited permission to link the
13compiled version of this file with other programs, and to distribute
14those programs without any restriction coming from the use of this
15file. (The General Public License restrictions do apply in other
16respects; for example, they cover modification of the file, and
17distribution when not linked into another program.)
18
19This file is distributed in the hope that it will be useful, but
20WITHOUT ANY WARRANTY; without even the implied warranty of
21MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22General Public License for more details.
23
24You should have received a copy of the GNU General Public License
25along with this program; see the file COPYING. If not, write to
26the Free Software Foundation, 59 Temple Place - Suite 330,
27Boston, MA 02111-1307, USA. */
28
29/* As a special exception, if you link this library with other files,
30 some of which are compiled with GCC, to produce an executable,
31 this library does not by itself cause the resulting executable
32 to be covered by the GNU General Public License.
33 This exception does not however invalidate any other reasons why
34 the executable file might be covered by the GNU General Public License.
35 */
36/* This code is derived from gcc 2.95.3 */
37/* I Molton 29/07/01 */
38
39#include <linux/linkage.h>
40#include <asm/assembler.h>
41#include <asm/hardware.h>
42
43#define RET movs
44#define RETc(x) mov##x##s
45#define RETCOND ^
46
47dividend .req r0
48divisor .req r1
49result .req r2
50overdone .req r2
51curbit .req r3
52ip .req r12
53sp .req r13
54lr .req r14
55pc .req r15
56
57ENTRY(__udivsi3)
58 cmp divisor, #0
59 beq Ldiv0
60 mov curbit, #1
61 mov result, #0
62 cmp dividend, divisor
63 bcc Lgot_result_udivsi3
641:
65 @ Unless the divisor is very big, shift it up in multiples of
66 @ four bits, since this is the amount of unwinding in the main
67 @ division loop. Continue shifting until the divisor is
68 @ larger than the dividend.
69 cmp divisor, #0x10000000
70 cmpcc divisor, dividend
71 movcc divisor, divisor, lsl #4
72 movcc curbit, curbit, lsl #4
73 bcc 1b
74
752:
76 @ For very big divisors, we must shift it a bit at a time, or
77 @ we will be in danger of overflowing.
78 cmp divisor, #0x80000000
79 cmpcc divisor, dividend
80 movcc divisor, divisor, lsl #1
81 movcc curbit, curbit, lsl #1
82 bcc 2b
83
843:
85 @ Test for possible subtractions, and note which bits
86 @ are done in the result. On the final pass, this may subtract
87 @ too much from the dividend, but the result will be ok, since the
88 @ "bit" will have been shifted out at the bottom.
89 cmp dividend, divisor
90 subcs dividend, dividend, divisor
91 orrcs result, result, curbit
92 cmp dividend, divisor, lsr #1
93 subcs dividend, dividend, divisor, lsr #1
94 orrcs result, result, curbit, lsr #1
95 cmp dividend, divisor, lsr #2
96 subcs dividend, dividend, divisor, lsr #2
97 orrcs result, result, curbit, lsr #2
98 cmp dividend, divisor, lsr #3
99 subcs dividend, dividend, divisor, lsr #3
100 orrcs result, result, curbit, lsr #3
101 cmp dividend, #0 @ Early termination?
102 movnes curbit, curbit, lsr #4 @ No, any more bits to do?
103 movne divisor, divisor, lsr #4
104 bne 3b
105Lgot_result_udivsi3:
106 mov r0, result
107 RET pc, lr
108
109Ldiv0:
110 str lr, [sp, #-4]!
111 bl __div0
112 mov r0, #0 @ about as wrong as it could be
113 ldmia sp!, {pc}RETCOND
114
115/* __umodsi3 ----------------------- */
116
117ENTRY(__umodsi3)
118 cmp divisor, #0
119 beq Ldiv0
120 mov curbit, #1
121 cmp dividend, divisor
122 RETc(cc) pc, lr
1231:
124 @ Unless the divisor is very big, shift it up in multiples of
125 @ four bits, since this is the amount of unwinding in the main
126 @ division loop. Continue shifting until the divisor is
127 @ larger than the dividend.
128 cmp divisor, #0x10000000
129 cmpcc divisor, dividend
130 movcc divisor, divisor, lsl #4
131 movcc curbit, curbit, lsl #4
132 bcc 1b
133
1342:
135 @ For very big divisors, we must shift it a bit at a time, or
136 @ we will be in danger of overflowing.
137 cmp divisor, #0x80000000
138 cmpcc divisor, dividend
139 movcc divisor, divisor, lsl #1
140 movcc curbit, curbit, lsl #1
141 bcc 2b
142
1433:
144 @ Test for possible subtractions. On the final pass, this may
145 @ subtract too much from the dividend, so keep track of which
146 @ subtractions are done, we can fix them up afterwards...
147 mov overdone, #0
148 cmp dividend, divisor
149 subcs dividend, dividend, divisor
150 cmp dividend, divisor, lsr #1
151 subcs dividend, dividend, divisor, lsr #1
152 orrcs overdone, overdone, curbit, ror #1
153 cmp dividend, divisor, lsr #2
154 subcs dividend, dividend, divisor, lsr #2
155 orrcs overdone, overdone, curbit, ror #2
156 cmp dividend, divisor, lsr #3
157 subcs dividend, dividend, divisor, lsr #3
158 orrcs overdone, overdone, curbit, ror #3
159 mov ip, curbit
160 cmp dividend, #0 @ Early termination?
161 movnes curbit, curbit, lsr #4 @ No, any more bits to do?
162 movne divisor, divisor, lsr #4
163 bne 3b
164
165 @ Any subtractions that we should not have done will be recorded in
166 @ the top three bits of "overdone". Exactly which were not needed
167 @ are governed by the position of the bit, stored in ip.
168 @ If we terminated early, because dividend became zero,
169 @ then none of the below will match, since the bit in ip will not be
170 @ in the bottom nibble.
171 ands overdone, overdone, #0xe0000000
172 RETc(eq) pc, lr @ No fixups needed
173 tst overdone, ip, ror #3
174 addne dividend, dividend, divisor, lsr #3
175 tst overdone, ip, ror #2
176 addne dividend, dividend, divisor, lsr #2
177 tst overdone, ip, ror #1
178 addne dividend, dividend, divisor, lsr #1
179 RET pc, lr
180
181ENTRY(__divsi3)
182 eor ip, dividend, divisor @ Save the sign of the result.
183 mov curbit, #1
184 mov result, #0
185 cmp divisor, #0
186 rsbmi divisor, divisor, #0 @ Loops below use unsigned.
187 beq Ldiv0
188 cmp dividend, #0
189 rsbmi dividend, dividend, #0
190 cmp dividend, divisor
191 bcc Lgot_result_divsi3
192
1931:
194 @ Unless the divisor is very big, shift it up in multiples of
195 @ four bits, since this is the amount of unwinding in the main
196 @ division loop. Continue shifting until the divisor is
197 @ larger than the dividend.
198 cmp divisor, #0x10000000
199 cmpcc divisor, dividend
200 movcc divisor, divisor, lsl #4
201 movcc curbit, curbit, lsl #4
202 bcc 1b
203
2042:
205 @ For very big divisors, we must shift it a bit at a time, or
206 @ we will be in danger of overflowing.
207 cmp divisor, #0x80000000
208 cmpcc divisor, dividend
209 movcc divisor, divisor, lsl #1
210 movcc curbit, curbit, lsl #1
211 bcc 2b
212
2133:
214 @ Test for possible subtractions, and note which bits
215 @ are done in the result. On the final pass, this may subtract
216 @ too much from the dividend, but the result will be ok, since the
217 @ "bit" will have been shifted out at the bottom.
218 cmp dividend, divisor
219 subcs dividend, dividend, divisor
220 orrcs result, result, curbit
221 cmp dividend, divisor, lsr #1
222 subcs dividend, dividend, divisor, lsr #1
223 orrcs result, result, curbit, lsr #1
224 cmp dividend, divisor, lsr #2
225 subcs dividend, dividend, divisor, lsr #2
226 orrcs result, result, curbit, lsr #2
227 cmp dividend, divisor, lsr #3
228 subcs dividend, dividend, divisor, lsr #3
229 orrcs result, result, curbit, lsr #3
230 cmp dividend, #0 @ Early termination?
231 movnes curbit, curbit, lsr #4 @ No, any more bits to do?
232 movne divisor, divisor, lsr #4
233 bne 3b
234Lgot_result_divsi3:
235 mov r0, result
236 cmp ip, #0
237 rsbmi r0, r0, #0
238 RET pc, lr
239
240ENTRY(__modsi3)
241 mov curbit, #1
242 cmp divisor, #0
243 rsbmi divisor, divisor, #0 @ Loops below use unsigned.
244 beq Ldiv0
245 @ Need to save the sign of the dividend, unfortunately, we need
246 @ ip later on; this is faster than pushing lr and using that.
247 str dividend, [sp, #-4]!
248 cmp dividend, #0
249 rsbmi dividend, dividend, #0
250 cmp dividend, divisor
251 bcc Lgot_result_modsi3
252
2531:
254 @ Unless the divisor is very big, shift it up in multiples of
255 @ four bits, since this is the amount of unwinding in the main
256 @ division loop. Continue shifting until the divisor is
257 @ larger than the dividend.
258 cmp divisor, #0x10000000
259 cmpcc divisor, dividend
260 movcc divisor, divisor, lsl #4
261 movcc curbit, curbit, lsl #4
262 bcc 1b
263
2642:
265 @ For very big divisors, we must shift it a bit at a time, or
266 @ we will be in danger of overflowing.
267 cmp divisor, #0x80000000
268 cmpcc divisor, dividend
269 movcc divisor, divisor, lsl #1
270 movcc curbit, curbit, lsl #1
271 bcc 2b
272
2733:
274 @ Test for possible subtractions. On the final pass, this may
275 @ subtract too much from the dividend, so keep track of which
276 @ subtractions are done, we can fix them up afterwards...
277 mov overdone, #0
278 cmp dividend, divisor
279 subcs dividend, dividend, divisor
280 cmp dividend, divisor, lsr #1
281 subcs dividend, dividend, divisor, lsr #1
282 orrcs overdone, overdone, curbit, ror #1
283 cmp dividend, divisor, lsr #2
284 subcs dividend, dividend, divisor, lsr #2
285 orrcs overdone, overdone, curbit, ror #2
286 cmp dividend, divisor, lsr #3
287 subcs dividend, dividend, divisor, lsr #3
288 orrcs overdone, overdone, curbit, ror #3
289 mov ip, curbit
290 cmp dividend, #0 @ Early termination?
291 movnes curbit, curbit, lsr #4 @ No, any more bits to do?
292 movne divisor, divisor, lsr #4
293 bne 3b
294
295 @ Any subtractions that we should not have done will be recorded in
296 @ the top three bits of "overdone". Exactly which were not needed
297 @ are governed by the position of the bit, stored in ip.
298 @ If we terminated early, because dividend became zero,
299 @ then none of the below will match, since the bit in ip will not be
300 @ in the bottom nibble.
301 ands overdone, overdone, #0xe0000000
302 beq Lgot_result_modsi3
303 tst overdone, ip, ror #3
304 addne dividend, dividend, divisor, lsr #3
305 tst overdone, ip, ror #2
306 addne dividend, dividend, divisor, lsr #2
307 tst overdone, ip, ror #1
308 addne dividend, dividend, divisor, lsr #1
309Lgot_result_modsi3:
310 ldr ip, [sp], #4
311 cmp ip, #0
312 rsbmi dividend, dividend, #0
313 RET pc, lr
diff --git a/arch/arm26/lib/longlong.h b/arch/arm26/lib/longlong.h
deleted file mode 100644
index 05ec1abd6a2c..000000000000
--- a/arch/arm26/lib/longlong.h
+++ /dev/null
@@ -1,184 +0,0 @@
1/* longlong.h -- based on code from gcc-2.95.3
2
3 definitions for mixed size 32/64 bit arithmetic.
4 Copyright (C) 1991, 92, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
5
6 This definition file is free software; you can redistribute it
7 and/or modify it under the terms of the GNU General Public
8 License as published by the Free Software Foundation; either
9 version 2, or (at your option) any later version.
10
11 This definition file is distributed in the hope that it will be
12 useful, but WITHOUT ANY WARRANTY; without even the implied
13 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 See the 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,
19 Boston, MA 02111-1307, USA. */
20
21/* Borrowed from GCC 2.95.3, I Molton 29/07/01 */
22
23#ifndef SI_TYPE_SIZE
24#define SI_TYPE_SIZE 32
25#endif
26
27#define __BITS4 (SI_TYPE_SIZE / 4)
28#define __ll_B (1L << (SI_TYPE_SIZE / 2))
29#define __ll_lowpart(t) ((USItype) (t) % __ll_B)
30#define __ll_highpart(t) ((USItype) (t) / __ll_B)
31
32/* Define auxiliary asm macros.
33
34 1) umul_ppmm(high_prod, low_prod, multipler, multiplicand)
35 multiplies two USItype integers MULTIPLER and MULTIPLICAND,
36 and generates a two-part USItype product in HIGH_PROD and
37 LOW_PROD.
38
39 2) __umulsidi3(a,b) multiplies two USItype integers A and B,
40 and returns a UDItype product. This is just a variant of umul_ppmm.
41
42 3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
43 denominator) divides a two-word unsigned integer, composed by the
44 integers HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and
45 places the quotient in QUOTIENT and the remainder in REMAINDER.
46 HIGH_NUMERATOR must be less than DENOMINATOR for correct operation.
47 If, in addition, the most significant bit of DENOMINATOR must be 1,
48 then the pre-processor symbol UDIV_NEEDS_NORMALIZATION is defined to 1.
49
50 4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
51 denominator). Like udiv_qrnnd but the numbers are signed. The
52 quotient is rounded towards 0.
53
54 5) count_leading_zeros(count, x) counts the number of zero-bits from
55 the msb to the first non-zero bit. This is the number of steps X
56 needs to be shifted left to set the msb. Undefined for X == 0.
57
58 6) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,
59 high_addend_2, low_addend_2) adds two two-word unsigned integers,
60 composed by HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and
61 LOW_ADDEND_2 respectively. The result is placed in HIGH_SUM and
62 LOW_SUM. Overflow (i.e. carry out) is not stored anywhere, and is
63 lost.
64
65 7) sub_ddmmss(high_difference, low_difference, high_minuend,
66 low_minuend, high_subtrahend, low_subtrahend) subtracts two
67 two-word unsigned integers, composed by HIGH_MINUEND_1 and
68 LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and LOW_SUBTRAHEND_2
69 respectively. The result is placed in HIGH_DIFFERENCE and
70 LOW_DIFFERENCE. Overflow (i.e. carry out) is not stored anywhere,
71 and is lost.
72
73 If any of these macros are left undefined for a particular CPU,
74 C macros are used. */
75
76#if defined (__arm__)
77#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
78 __asm__ ("adds %1, %4, %5 \n\
79 adc %0, %2, %3" \
80 : "=r" ((USItype) (sh)), \
81 "=&r" ((USItype) (sl)) \
82 : "%r" ((USItype) (ah)), \
83 "rI" ((USItype) (bh)), \
84 "%r" ((USItype) (al)), \
85 "rI" ((USItype) (bl)))
86#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
87 __asm__ ("subs %1, %4, %5 \n\
88 sbc %0, %2, %3" \
89 : "=r" ((USItype) (sh)), \
90 "=&r" ((USItype) (sl)) \
91 : "r" ((USItype) (ah)), \
92 "rI" ((USItype) (bh)), \
93 "r" ((USItype) (al)), \
94 "rI" ((USItype) (bl)))
95#define umul_ppmm(xh, xl, a, b) \
96{register USItype __t0, __t1, __t2; \
97 __asm__ ("%@ Inlined umul_ppmm \n\
98 mov %2, %5, lsr #16 \n\
99 mov %0, %6, lsr #16 \n\
100 bic %3, %5, %2, lsl #16 \n\
101 bic %4, %6, %0, lsl #16 \n\
102 mul %1, %3, %4 \n\
103 mul %4, %2, %4 \n\
104 mul %3, %0, %3 \n\
105 mul %0, %2, %0 \n\
106 adds %3, %4, %3 \n\
107 addcs %0, %0, #65536 \n\
108 adds %1, %1, %3, lsl #16 \n\
109 adc %0, %0, %3, lsr #16" \
110 : "=&r" ((USItype) (xh)), \
111 "=r" ((USItype) (xl)), \
112 "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
113 : "r" ((USItype) (a)), \
114 "r" ((USItype) (b)));}
115#define UMUL_TIME 20
116#define UDIV_TIME 100
117#endif /* __arm__ */
118
119#define __umulsidi3(u, v) \
120 ({DIunion __w; \
121 umul_ppmm (__w.s.high, __w.s.low, u, v); \
122 __w.ll; })
123
124#define __udiv_qrnnd_c(q, r, n1, n0, d) \
125 do { \
126 USItype __d1, __d0, __q1, __q0; \
127 USItype __r1, __r0, __m; \
128 __d1 = __ll_highpart (d); \
129 __d0 = __ll_lowpart (d); \
130 \
131 __r1 = (n1) % __d1; \
132 __q1 = (n1) / __d1; \
133 __m = (USItype) __q1 * __d0; \
134 __r1 = __r1 * __ll_B | __ll_highpart (n0); \
135 if (__r1 < __m) \
136 { \
137 __q1--, __r1 += (d); \
138 if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\
139 if (__r1 < __m) \
140 __q1--, __r1 += (d); \
141 } \
142 __r1 -= __m; \
143 \
144 __r0 = __r1 % __d1; \
145 __q0 = __r1 / __d1; \
146 __m = (USItype) __q0 * __d0; \
147 __r0 = __r0 * __ll_B | __ll_lowpart (n0); \
148 if (__r0 < __m) \
149 { \
150 __q0--, __r0 += (d); \
151 if (__r0 >= (d)) \
152 if (__r0 < __m) \
153 __q0--, __r0 += (d); \
154 } \
155 __r0 -= __m; \
156 \
157 (q) = (USItype) __q1 * __ll_B | __q0; \
158 (r) = __r0; \
159 } while (0)
160
161#define UDIV_NEEDS_NORMALIZATION 1
162#define udiv_qrnnd __udiv_qrnnd_c
163
164extern const UQItype __clz_tab[];
165#define count_leading_zeros(count, x) \
166 do { \
167 USItype __xr = (x); \
168 USItype __a; \
169 \
170 if (SI_TYPE_SIZE <= 32) \
171 { \
172 __a = __xr < ((USItype)1<<2*__BITS4) \
173 ? (__xr < ((USItype)1<<__BITS4) ? 0 : __BITS4) \
174 : (__xr < ((USItype)1<<3*__BITS4) ? 2*__BITS4 : 3*__BITS4); \
175 } \
176 else \
177 { \
178 for (__a = SI_TYPE_SIZE - 8; __a > 0; __a -= 8) \
179 if (((__xr >> __a) & 0xff) != 0) \
180 break; \
181 } \
182 \
183 (count) = SI_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a); \
184 } while (0)
diff --git a/arch/arm26/lib/lshrdi3.c b/arch/arm26/lib/lshrdi3.c
deleted file mode 100644
index b666f1bad451..000000000000
--- a/arch/arm26/lib/lshrdi3.c
+++ /dev/null
@@ -1,61 +0,0 @@
1/* More subroutines needed by GCC output code on some machines. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License.
28 */
29/* support functions required by the kernel. based on code from gcc-2.95.3 */
30/* I Molton 29/07/01 */
31
32#include "gcclib.h"
33
34DItype
35__lshrdi3 (DItype u, word_type b)
36{
37 DIunion w;
38 word_type bm;
39 DIunion uu;
40
41 if (b == 0)
42 return u;
43
44 uu.ll = u;
45
46 bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
47 if (bm <= 0)
48 {
49 w.s.high = 0;
50 w.s.low = (USItype)uu.s.high >> -bm;
51 }
52 else
53 {
54 USItype carries = (USItype)uu.s.high << bm;
55 w.s.high = (USItype)uu.s.high >> b;
56 w.s.low = ((USItype)uu.s.low >> b) | carries;
57 }
58
59 return w.ll;
60}
61
diff --git a/arch/arm26/lib/memchr.S b/arch/arm26/lib/memchr.S
deleted file mode 100644
index 34e7c14c08ad..000000000000
--- a/arch/arm26/lib/memchr.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * linux/arch/arm26/lib/memchr.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14
15 .text
16 .align 5
17ENTRY(memchr)
181: subs r2, r2, #1
19 bmi 2f
20 ldrb r3, [r0], #1
21 teq r3, r1
22 bne 1b
23 sub r0, r0, #1
242: movne r0, #0
25 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/memcpy.S b/arch/arm26/lib/memcpy.S
deleted file mode 100644
index 3f719e412069..000000000000
--- a/arch/arm26/lib/memcpy.S
+++ /dev/null
@@ -1,318 +0,0 @@
1/*
2 * linux/arch/arm26/lib/memcpy.S
3 *
4 * Copyright (C) 1995-1999 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14
15 .text
16
17#define ENTER \
18 mov ip,sp ;\
19 stmfd sp!,{r4-r9,fp,ip,lr,pc} ;\
20 sub fp,ip,#4
21
22#define EXIT \
23 LOADREGS(ea, fp, {r4 - r9, fp, sp, pc})
24
25#define EXITEQ \
26 LOADREGS(eqea, fp, {r4 - r9, fp, sp, pc})
27
28/*
29 * Prototype: void memcpy(void *to,const void *from,unsigned long n);
30 * ARM3: cant use memcopy here!!!
31 */
32ENTRY(memcpy)
33ENTRY(memmove)
34 ENTER
35 cmp r1, r0
36 bcc 19f
37 subs r2, r2, #4
38 blt 6f
39 ands ip, r0, #3
40 bne 7f
41 ands ip, r1, #3
42 bne 8f
43
441: subs r2, r2, #8
45 blt 5f
46 subs r2, r2, #0x14
47 blt 3f
482: ldmia r1!,{r3 - r9, ip}
49 stmia r0!,{r3 - r9, ip}
50 subs r2, r2, #32
51 bge 2b
52 cmn r2, #16
53 ldmgeia r1!, {r3 - r6}
54 stmgeia r0!, {r3 - r6}
55 subge r2, r2, #0x10
563: adds r2, r2, #0x14
574: ldmgeia r1!, {r3 - r5}
58 stmgeia r0!, {r3 - r5}
59 subges r2, r2, #12
60 bge 4b
615: adds r2, r2, #8
62 blt 6f
63 subs r2, r2, #4
64 ldrlt r3, [r1], #4
65 ldmgeia r1!, {r4, r5}
66 strlt r3, [r0], #4
67 stmgeia r0!, {r4, r5}
68 subge r2, r2, #4
69
706: adds r2, r2, #4
71 EXITEQ
72 cmp r2, #2
73 ldrb r3, [r1], #1
74 ldrgeb r4, [r1], #1
75 ldrgtb r5, [r1], #1
76 strb r3, [r0], #1
77 strgeb r4, [r0], #1
78 strgtb r5, [r0], #1
79 EXIT
80
817: rsb ip, ip, #4
82 cmp ip, #2
83 ldrb r3, [r1], #1
84 ldrgeb r4, [r1], #1
85 ldrgtb r5, [r1], #1
86 strb r3, [r0], #1
87 strgeb r4, [r0], #1
88 strgtb r5, [r0], #1
89 subs r2, r2, ip
90 blt 6b
91 ands ip, r1, #3
92 beq 1b
93
948: bic r1, r1, #3
95 ldr r7, [r1], #4
96 cmp ip, #2
97 bgt 15f
98 beq 11f
99 cmp r2, #12
100 blt 10f
101 sub r2, r2, #12
1029: mov r3, r7, pull #8
103 ldmia r1!, {r4 - r7}
104 orr r3, r3, r4, push #24
105 mov r4, r4, pull #8
106 orr r4, r4, r5, push #24
107 mov r5, r5, pull #8
108 orr r5, r5, r6, push #24
109 mov r6, r6, pull #8
110 orr r6, r6, r7, push #24
111 stmia r0!, {r3 - r6}
112 subs r2, r2, #16
113 bge 9b
114 adds r2, r2, #12
115 blt 100f
11610: mov r3, r7, pull #8
117 ldr r7, [r1], #4
118 subs r2, r2, #4
119 orr r3, r3, r7, push #24
120 str r3, [r0], #4
121 bge 10b
122100: sub r1, r1, #3
123 b 6b
124
12511: cmp r2, #12
126 blt 13f /* */
127 sub r2, r2, #12
12812: mov r3, r7, pull #16
129 ldmia r1!, {r4 - r7}
130 orr r3, r3, r4, push #16
131 mov r4, r4, pull #16
132 orr r4, r4, r5, push #16
133 mov r5, r5, pull #16
134 orr r5, r5, r6, push #16
135 mov r6, r6, pull #16
136 orr r6, r6, r7, push #16
137 stmia r0!, {r3 - r6}
138 subs r2, r2, #16
139 bge 12b
140 adds r2, r2, #12
141 blt 14f
14213: mov r3, r7, pull #16
143 ldr r7, [r1], #4
144 subs r2, r2, #4
145 orr r3, r3, r7, push #16
146 str r3, [r0], #4
147 bge 13b
14814: sub r1, r1, #2
149 b 6b
150
15115: cmp r2, #12
152 blt 17f
153 sub r2, r2, #12
15416: mov r3, r7, pull #24
155 ldmia r1!, {r4 - r7}
156 orr r3, r3, r4, push #8
157 mov r4, r4, pull #24
158 orr r4, r4, r5, push #8
159 mov r5, r5, pull #24
160 orr r5, r5, r6, push #8
161 mov r6, r6, pull #24
162 orr r6, r6, r7, push #8
163 stmia r0!, {r3 - r6}
164 subs r2, r2, #16
165 bge 16b
166 adds r2, r2, #12
167 blt 18f
16817: mov r3, r7, pull #24
169 ldr r7, [r1], #4
170 subs r2, r2, #4
171 orr r3, r3, r7, push #8
172 str r3, [r0], #4
173 bge 17b
17418: sub r1, r1, #1
175 b 6b
176
177
17819: add r1, r1, r2
179 add r0, r0, r2
180 subs r2, r2, #4
181 blt 24f
182 ands ip, r0, #3
183 bne 25f
184 ands ip, r1, #3
185 bne 26f
186
18720: subs r2, r2, #8
188 blt 23f
189 subs r2, r2, #0x14
190 blt 22f
19121: ldmdb r1!, {r3 - r9, ip}
192 stmdb r0!, {r3 - r9, ip}
193 subs r2, r2, #32
194 bge 21b
19522: cmn r2, #16
196 ldmgedb r1!, {r3 - r6}
197 stmgedb r0!, {r3 - r6}
198 subge r2, r2, #16
199 adds r2, r2, #20
200 ldmgedb r1!, {r3 - r5}
201 stmgedb r0!, {r3 - r5}
202 subge r2, r2, #12
20323: adds r2, r2, #8
204 blt 24f
205 subs r2, r2, #4
206 ldrlt r3, [r1, #-4]!
207 ldmgedb r1!, {r4, r5}
208 strlt r3, [r0, #-4]!
209 stmgedb r0!, {r4, r5}
210 subge r2, r2, #4
211
21224: adds r2, r2, #4
213 EXITEQ
214 cmp r2, #2
215 ldrb r3, [r1, #-1]!
216 ldrgeb r4, [r1, #-1]!
217 ldrgtb r5, [r1, #-1]!
218 strb r3, [r0, #-1]!
219 strgeb r4, [r0, #-1]!
220 strgtb r5, [r0, #-1]!
221 EXIT
222
22325: cmp ip, #2
224 ldrb r3, [r1, #-1]!
225 ldrgeb r4, [r1, #-1]!
226 ldrgtb r5, [r1, #-1]!
227 strb r3, [r0, #-1]!
228 strgeb r4, [r0, #-1]!
229 strgtb r5, [r0, #-1]!
230 subs r2, r2, ip
231 blt 24b
232 ands ip, r1, #3
233 beq 20b
234
23526: bic r1, r1, #3
236 ldr r3, [r1], #0
237 cmp ip, #2
238 blt 34f
239 beq 30f
240 cmp r2, #12
241 blt 28f
242 sub r2, r2, #12
24327: mov r7, r3, push #8
244 ldmdb r1!, {r3, r4, r5, r6}
245 orr r7, r7, r6, pull #24
246 mov r6, r6, push #8
247 orr r6, r6, r5, pull #24
248 mov r5, r5, push #8
249 orr r5, r5, r4, pull #24
250 mov r4, r4, push #8
251 orr r4, r4, r3, pull #24
252 stmdb r0!, {r4, r5, r6, r7}
253 subs r2, r2, #16
254 bge 27b
255 adds r2, r2, #12
256 blt 29f
25728: mov ip, r3, push #8
258 ldr r3, [r1, #-4]!
259 subs r2, r2, #4
260 orr ip, ip, r3, pull #24
261 str ip, [r0, #-4]!
262 bge 28b
26329: add r1, r1, #3
264 b 24b
265
26630: cmp r2, #12
267 blt 32f
268 sub r2, r2, #12
26931: mov r7, r3, push #16
270 ldmdb r1!, {r3, r4, r5, r6}
271 orr r7, r7, r6, pull #16
272 mov r6, r6, push #16
273 orr r6, r6, r5, pull #16
274 mov r5, r5, push #16
275 orr r5, r5, r4, pull #16
276 mov r4, r4, push #16
277 orr r4, r4, r3, pull #16
278 stmdb r0!, {r4, r5, r6, r7}
279 subs r2, r2, #16
280 bge 31b
281 adds r2, r2, #12
282 blt 33f
28332: mov ip, r3, push #16
284 ldr r3, [r1, #-4]!
285 subs r2, r2, #4
286 orr ip, ip, r3, pull #16
287 str ip, [r0, #-4]!
288 bge 32b
28933: add r1, r1, #2
290 b 24b
291
29234: cmp r2, #12
293 blt 36f
294 sub r2, r2, #12
29535: mov r7, r3, push #24
296 ldmdb r1!, {r3, r4, r5, r6}
297 orr r7, r7, r6, pull #8
298 mov r6, r6, push #24
299 orr r6, r6, r5, pull #8
300 mov r5, r5, push #24
301 orr r5, r5, r4, pull #8
302 mov r4, r4, push #24
303 orr r4, r4, r3, pull #8
304 stmdb r0!, {r4, r5, r6, r7}
305 subs r2, r2, #16
306 bge 35b
307 adds r2, r2, #12
308 blt 37f
30936: mov ip, r3, push #24
310 ldr r3, [r1, #-4]!
311 subs r2, r2, #4
312 orr ip, ip, r3, pull #8
313 str ip, [r0, #-4]!
314 bge 36b
31537: add r1, r1, #1
316 b 24b
317
318 .align
diff --git a/arch/arm26/lib/memset.S b/arch/arm26/lib/memset.S
deleted file mode 100644
index aedec10b58f5..000000000000
--- a/arch/arm26/lib/memset.S
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * linux/arch/arm26/lib/memset.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14
15 .text
16 .align 5
17 .word 0
18
191: subs r2, r2, #4 @ 1 do we have enough
20 blt 5f @ 1 bytes to align with?
21 cmp r3, #2 @ 1
22 strltb r1, [r0], #1 @ 1
23 strleb r1, [r0], #1 @ 1
24 strb r1, [r0], #1 @ 1
25 add r2, r2, r3 @ 1 (r2 = r2 - (4 - r3))
26/*
27 * The pointer is now aligned and the length is adjusted. Try doing the
28 * memzero again.
29 */
30
31ENTRY(memset)
32 ands r3, r0, #3 @ 1 unaligned?
33 bne 1b @ 1
34/*
35 * we know that the pointer in r0 is aligned to a word boundary.
36 */
37 orr r1, r1, r1, lsl #8
38 orr r1, r1, r1, lsl #16
39 mov r3, r1
40 cmp r2, #16
41 blt 4f
42/*
43 * We need an extra register for this loop - save the return address and
44 * use the LR
45 */
46 str lr, [sp, #-4]!
47 mov ip, r1
48 mov lr, r1
49
502: subs r2, r2, #64
51 stmgeia r0!, {r1, r3, ip, lr} @ 64 bytes at a time.
52 stmgeia r0!, {r1, r3, ip, lr}
53 stmgeia r0!, {r1, r3, ip, lr}
54 stmgeia r0!, {r1, r3, ip, lr}
55 bgt 2b
56 LOADREGS(eqfd, sp!, {pc}) @ Now <64 bytes to go.
57/*
58 * No need to correct the count; we're only testing bits from now on
59 */
60 tst r2, #32
61 stmneia r0!, {r1, r3, ip, lr}
62 stmneia r0!, {r1, r3, ip, lr}
63 tst r2, #16
64 stmneia r0!, {r1, r3, ip, lr}
65 ldr lr, [sp], #4
66
674: tst r2, #8
68 stmneia r0!, {r1, r3}
69 tst r2, #4
70 strne r1, [r0], #4
71/*
72 * When we get here, we've got less than 4 bytes to zero. We
73 * may have an unaligned pointer as well.
74 */
755: tst r2, #2
76 strneb r1, [r0], #1
77 strneb r1, [r0], #1
78 tst r2, #1
79 strneb r1, [r0], #1
80 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/memzero.S b/arch/arm26/lib/memzero.S
deleted file mode 100644
index cc5bf6860061..000000000000
--- a/arch/arm26/lib/memzero.S
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * linux/arch/arm26/lib/memzero.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12
13 .text
14 .align 5
15 .word 0
16/*
17 * Align the pointer in r0. r3 contains the number of bytes that we are
18 * mis-aligned by, and r1 is the number of bytes. If r1 < 4, then we
19 * don't bother; we use byte stores instead.
20 */
211: subs r1, r1, #4 @ 1 do we have enough
22 blt 5f @ 1 bytes to align with?
23 cmp r3, #2 @ 1
24 strltb r2, [r0], #1 @ 1
25 strleb r2, [r0], #1 @ 1
26 strb r2, [r0], #1 @ 1
27 add r1, r1, r3 @ 1 (r1 = r1 - (4 - r3))
28/*
29 * The pointer is now aligned and the length is adjusted. Try doing the
30 * memzero again.
31 */
32
33ENTRY(__memzero)
34 mov r2, #0 @ 1
35 ands r3, r0, #3 @ 1 unaligned?
36 bne 1b @ 1
37/*
38 * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
39 */
40 cmp r1, #16 @ 1 we can skip this chunk if we
41 blt 4f @ 1 have < 16 bytes
42/*
43 * We need an extra register for this loop - save the return address and
44 * use the LR
45 */
46 str lr, [sp, #-4]! @ 1
47 mov ip, r2 @ 1
48 mov lr, r2 @ 1
49
503: subs r1, r1, #64 @ 1 write 32 bytes out per loop
51 stmgeia r0!, {r2, r3, ip, lr} @ 4
52 stmgeia r0!, {r2, r3, ip, lr} @ 4
53 stmgeia r0!, {r2, r3, ip, lr} @ 4
54 stmgeia r0!, {r2, r3, ip, lr} @ 4
55 bgt 3b @ 1
56 LOADREGS(eqfd, sp!, {pc}) @ 1/2 quick exit
57/*
58 * No need to correct the count; we're only testing bits from now on
59 */
60 tst r1, #32 @ 1
61 stmneia r0!, {r2, r3, ip, lr} @ 4
62 stmneia r0!, {r2, r3, ip, lr} @ 4
63 tst r1, #16 @ 1 16 bytes or more?
64 stmneia r0!, {r2, r3, ip, lr} @ 4
65 ldr lr, [sp], #4 @ 1
66
674: tst r1, #8 @ 1 8 bytes or more?
68 stmneia r0!, {r2, r3} @ 2
69 tst r1, #4 @ 1 4 bytes or more?
70 strne r2, [r0], #4 @ 1
71/*
72 * When we get here, we've got less than 4 bytes to zero. We
73 * may have an unaligned pointer as well.
74 */
755: tst r1, #2 @ 1 2 bytes or more?
76 strneb r2, [r0], #1 @ 1
77 strneb r2, [r0], #1 @ 1
78 tst r1, #1 @ 1 a byte left over
79 strneb r2, [r0], #1 @ 1
80 RETINSTR(mov,pc,lr) @ 1
diff --git a/arch/arm26/lib/muldi3.c b/arch/arm26/lib/muldi3.c
deleted file mode 100644
index 44d611b1cfdb..000000000000
--- a/arch/arm26/lib/muldi3.c
+++ /dev/null
@@ -1,77 +0,0 @@
1/* More subroutines needed by GCC output code on some machines. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License.
28 */
29/* support functions required by the kernel. based on code from gcc-2.95.3 */
30/* I Molton 29/07/01 */
31
32#include "gcclib.h"
33
34#define umul_ppmm(xh, xl, a, b) \
35{register USItype __t0, __t1, __t2; \
36 __asm__ ("%@ Inlined umul_ppmm \n\
37 mov %2, %5, lsr #16 \n\
38 mov %0, %6, lsr #16 \n\
39 bic %3, %5, %2, lsl #16 \n\
40 bic %4, %6, %0, lsl #16 \n\
41 mul %1, %3, %4 \n\
42 mul %4, %2, %4 \n\
43 mul %3, %0, %3 \n\
44 mul %0, %2, %0 \n\
45 adds %3, %4, %3 \n\
46 addcs %0, %0, #65536 \n\
47 adds %1, %1, %3, lsl #16 \n\
48 adc %0, %0, %3, lsr #16" \
49 : "=&r" ((USItype) (xh)), \
50 "=r" ((USItype) (xl)), \
51 "=&r" (__t0), "=&r" (__t1), "=r" (__t2) \
52 : "r" ((USItype) (a)), \
53 "r" ((USItype) (b)));}
54
55
56#define __umulsidi3(u, v) \
57 ({DIunion __w; \
58 umul_ppmm (__w.s.high, __w.s.low, u, v); \
59 __w.ll; })
60
61
62DItype
63__muldi3 (DItype u, DItype v)
64{
65 DIunion w;
66 DIunion uu, vv;
67
68 uu.ll = u,
69 vv.ll = v;
70
71 w.ll = __umulsidi3 (uu.s.low, vv.s.low);
72 w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
73 + (USItype) uu.s.high * (USItype) vv.s.low);
74
75 return w.ll;
76}
77
diff --git a/arch/arm26/lib/putuser.S b/arch/arm26/lib/putuser.S
deleted file mode 100644
index 46c7f15f9f2d..000000000000
--- a/arch/arm26/lib/putuser.S
+++ /dev/null
@@ -1,109 +0,0 @@
1/*
2 * linux/arch/arm26/lib/putuser.S
3 *
4 * Copyright (C) 2001 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Idea from x86 version, (C) Copyright 1998 Linus Torvalds
11 *
12 * These functions have a non-standard call interface to make
13 * them more efficient, especially as they return an error
14 * value in addition to the "real" return value.
15 *
16 * __put_user_X
17 *
18 * Inputs: r0 contains the address
19 * r1, r2 contains the value
20 * Outputs: r0 is the error code
21 * lr corrupted
22 *
23 * No other registers must be altered. (see include/asm-arm/uaccess.h
24 * for specific ASM register usage).
25 *
26 * Note that ADDR_LIMIT is either 0 or 0xc0000000
27 * Note also that it is intended that __put_user_bad is not global.
28 */
29#include <asm/asm-offsets.h>
30#include <asm/thread_info.h>
31#include <asm/errno.h>
32
33 .global __put_user_1
34__put_user_1:
35 bic r2, sp, #0x1f00
36 bic r2, r2, #0x00ff
37 str lr, [sp, #-4]!
38 ldr r2, [r2, #TI_ADDR_LIMIT]
39 sub r2, r2, #1
40 cmp r0, r2
41 bge __put_user_bad
421: cmp r0, #0x02000000
43 strlsbt r1, [r0]
44 strgeb r1, [r0]
45 mov r0, #0
46 ldmfd sp!, {pc}^
47
48 .global __put_user_2
49__put_user_2:
50 bic r2, sp, #0x1f00
51 bic r2, r2, #0x00ff
52 str lr, [sp, #-4]!
53 ldr r2, [r2, #TI_ADDR_LIMIT]
54 sub r2, r2, #2
55 cmp r0, r2
56 bge __put_user_bad
572: cmp r0, #0x02000000
58 strlsbt r1, [r0], #1
59 strgeb r1, [r0], #1
60 mov r1, r1, lsr #8
613: strlsbt r1, [r0]
62 strgeb r1, [r0]
63 mov r0, #0
64 ldmfd sp!, {pc}^
65
66 .global __put_user_4
67__put_user_4:
68 bic r2, sp, #0x1f00
69 bic r2, r2, #0x00ff
70 str lr, [sp, #-4]!
71 ldr r2, [r2, #TI_ADDR_LIMIT]
72 sub r2, r2, #4
73 cmp r0, r2
744: bge __put_user_bad
75 cmp r0, #0x02000000
76 strlst r1, [r0]
77 strge r1, [r0]
78 mov r0, #0
79 ldmfd sp!, {pc}^
80
81 .global __put_user_8
82__put_user_8:
83 bic ip, sp, #0x1f00
84 bic ip, ip, #0x00ff
85 str lr, [sp, #-4]!
86 ldr ip, [ip, #TI_ADDR_LIMIT]
87 sub ip, ip, #8
88 cmp r0, ip
89 bge __put_user_bad
90 cmp r0, #0x02000000
915: strlst r1, [r0], #4
926: strlst r2, [r0]
93 strge r1, [r0], #4
94 strge r2, [r0]
95 mov r0, #0
96 ldmfd sp!, {pc}^
97
98__put_user_bad:
99 mov r0, #-EFAULT
100 mov pc, lr
101
102.section __ex_table, "a"
103 .long 1b, __put_user_bad
104 .long 2b, __put_user_bad
105 .long 3b, __put_user_bad
106 .long 4b, __put_user_bad
107 .long 5b, __put_user_bad
108 .long 6b, __put_user_bad
109.previous
diff --git a/arch/arm26/lib/setbit.S b/arch/arm26/lib/setbit.S
deleted file mode 100644
index e180c1a1b2f1..000000000000
--- a/arch/arm26/lib/setbit.S
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * linux/arch/arm26/lib/setbit.S
3 *
4 * Copyright (C) 1995-1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14/*
15 * Purpose : Function to set a bit
16 * Prototype: int set_bit(int bit, void *addr)
17 */
18ENTRY(_set_bit_be)
19 eor r0, r0, #0x18 @ big endian byte ordering
20ENTRY(_set_bit_le)
21 and r2, r0, #7
22 mov r3, #1
23 mov r3, r3, lsl r2
24 save_and_disable_irqs ip, r2
25 ldrb r2, [r1, r0, lsr #3]
26 orr r2, r2, r3
27 strb r2, [r1, r0, lsr #3]
28 restore_irqs ip
29 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/strchr.S b/arch/arm26/lib/strchr.S
deleted file mode 100644
index ecfff21aa7c7..000000000000
--- a/arch/arm26/lib/strchr.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * linux/arch/arm26/lib/strchr.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14
15 .text
16 .align 5
17ENTRY(strchr)
181: ldrb r2, [r0], #1
19 teq r2, r1
20 teqne r2, #0
21 bne 1b
22 teq r2, #0
23 moveq r0, #0
24 subne r0, r0, #1
25 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/strrchr.S b/arch/arm26/lib/strrchr.S
deleted file mode 100644
index db43b28e78dc..000000000000
--- a/arch/arm26/lib/strrchr.S
+++ /dev/null
@@ -1,25 +0,0 @@
1/*
2 * linux/arch/arm26/lib/strrchr.S
3 *
4 * Copyright (C) 1995-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * ASM optimised string functions
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14
15 .text
16 .align 5
17ENTRY(strrchr)
18 mov r3, #0
191: ldrb r2, [r0], #1
20 teq r2, r1
21 subeq r3, r0, #1
22 teq r2, #0
23 bne 1b
24 mov r0, r3
25 RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/testchangebit.S b/arch/arm26/lib/testchangebit.S
deleted file mode 100644
index 17049a2d93a4..000000000000
--- a/arch/arm26/lib/testchangebit.S
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * linux/arch/arm26/lib/testchangebit.S
3 *
4 * Copyright (C) 1995-1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14ENTRY(_test_and_change_bit_be)
15 eor r0, r0, #0x18 @ big endian byte ordering
16ENTRY(_test_and_change_bit_le)
17 add r1, r1, r0, lsr #3
18 and r3, r0, #7
19 mov r0, #1
20 save_and_disable_irqs ip, r2
21 ldrb r2, [r1]
22 tst r2, r0, lsl r3
23 eor r2, r2, r0, lsl r3
24 strb r2, [r1]
25 restore_irqs ip
26 moveq r0, #0
27 RETINSTR(mov,pc,lr)
28
29
diff --git a/arch/arm26/lib/testclearbit.S b/arch/arm26/lib/testclearbit.S
deleted file mode 100644
index 2506bd743ab4..000000000000
--- a/arch/arm26/lib/testclearbit.S
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * linux/arch/arm26/lib/testclearbit.S
3 *
4 * Copyright (C) 1995-1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14ENTRY(_test_and_clear_bit_be)
15 eor r0, r0, #0x18 @ big endian byte ordering
16ENTRY(_test_and_clear_bit_le)
17 add r1, r1, r0, lsr #3 @ Get byte offset
18 and r3, r0, #7 @ Get bit offset
19 mov r0, #1
20 save_and_disable_irqs ip, r2
21 ldrb r2, [r1]
22 tst r2, r0, lsl r3
23 bic r2, r2, r0, lsl r3
24 strb r2, [r1]
25 restore_irqs ip
26 moveq r0, #0
27 RETINSTR(mov,pc,lr)
28
29
diff --git a/arch/arm26/lib/testsetbit.S b/arch/arm26/lib/testsetbit.S
deleted file mode 100644
index f827de64b22d..000000000000
--- a/arch/arm26/lib/testsetbit.S
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * linux/arch/arm26/lib/testsetbit.S
3 *
4 * Copyright (C) 1995-1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/linkage.h>
11#include <asm/assembler.h>
12 .text
13
14ENTRY(_test_and_set_bit_be)
15 eor r0, r0, #0x18 @ big endian byte ordering
16ENTRY(_test_and_set_bit_le)
17 add r1, r1, r0, lsr #3 @ Get byte offset
18 and r3, r0, #7 @ Get bit offset
19 mov r0, #1
20 save_and_disable_irqs ip, r2
21 ldrb r2, [r1]
22 tst r2, r0, lsl r3
23 orr r2, r2, r0, lsl r3
24 strb r2, [r1]
25 restore_irqs ip
26 moveq r0, #0
27 RETINSTR(mov,pc,lr)
28
29
diff --git a/arch/arm26/lib/uaccess-kernel.S b/arch/arm26/lib/uaccess-kernel.S
deleted file mode 100644
index 3950a1f6bc99..000000000000
--- a/arch/arm26/lib/uaccess-kernel.S
+++ /dev/null
@@ -1,173 +0,0 @@
1/*
2 * linux/arch/arm26/lib/uaccess-kernel.S
3 *
4 * Copyright (C) 1998 Russell King
5 *
6 * Note! Some code fragments found in here have a special calling
7 * convention - they are not APCS compliant!
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 version 2 as
11 * published by the Free Software Foundation.
12 */
13#include <linux/linkage.h>
14#include <asm/assembler.h>
15
16 .text
17
18//FIXME - surely this can be done in C not asm, removing the problem of keeping C and asm in sync? (this is a struct uaccess_t)
19
20 .globl uaccess_kernel
21uaccess_kernel:
22 .word uaccess_kernel_put_byte
23 .word uaccess_kernel_get_byte
24 .word uaccess_kernel_put_half
25 .word uaccess_kernel_get_half
26 .word uaccess_kernel_put_word
27 .word uaccess_kernel_get_word
28 .word uaccess_kernel_put_dword
29 .word uaccess_kernel_copy
30 .word uaccess_kernel_copy
31 .word uaccess_kernel_clear
32 .word uaccess_kernel_strncpy
33 .word uaccess_kernel_strnlen
34
35@ In : r0 = x, r1 = addr, r2 = error
36@ Out: r2 = error
37uaccess_kernel_put_byte:
38 stmfd sp!, {lr}
39 strb r0, [r1]
40 ldmfd sp!, {pc}^
41
42@ In : r0 = x, r1 = addr, r2 = error
43@ Out: r2 = error
44uaccess_kernel_put_half:
45 stmfd sp!, {lr}
46 strb r0, [r1]
47 mov r0, r0, lsr #8
48 strb r0, [r1, #1]
49 ldmfd sp!, {pc}^
50
51@ In : r0 = x, r1 = addr, r2 = error
52@ Out: r2 = error
53uaccess_kernel_put_word:
54 stmfd sp!, {lr}
55 str r0, [r1]
56 ldmfd sp!, {pc}^
57
58@ In : r0 = x, r1 = addr, r2 = error
59@ Out: r2 = error
60uaccess_kernel_put_dword:
61 stmfd sp!, {lr}
62 str r0, [r1], #4
63 str r0, [r1], #0
64 ldmfd sp!, {pc}^
65
66@ In : r0 = addr, r1 = error
67@ Out: r0 = x, r1 = error
68uaccess_kernel_get_byte:
69 stmfd sp!, {lr}
70 ldrb r0, [r0]
71 ldmfd sp!, {pc}^
72
73@ In : r0 = addr, r1 = error
74@ Out: r0 = x, r1 = error
75uaccess_kernel_get_half:
76 stmfd sp!, {lr}
77 ldr r0, [r0]
78 mov r0, r0, lsl #16
79 mov r0, r0, lsr #16
80 ldmfd sp!, {pc}^
81
82@ In : r0 = addr, r1 = error
83@ Out: r0 = x, r1 = error
84uaccess_kernel_get_word:
85 stmfd sp!, {lr}
86 ldr r0, [r0]
87 ldmfd sp!, {pc}^
88
89
90/* Prototype: int uaccess_kernel_copy(void *to, const char *from, size_t n)
91 * Purpose : copy a block to kernel memory from kernel memory
92 * Params : to - kernel memory
93 * : from - kernel memory
94 * : n - number of bytes to copy
95 * Returns : Number of bytes NOT copied.
96 */
97uaccess_kernel_copy:
98 stmfd sp!, {lr}
99 bl memcpy
100 mov r0, #0
101 ldmfd sp!, {pc}^
102
103/* Prototype: int uaccess_kernel_clear(void *addr, size_t sz)
104 * Purpose : clear some kernel memory
105 * Params : addr - kernel memory address to clear
106 * : sz - number of bytes to clear
107 * Returns : number of bytes NOT cleared
108 */
109uaccess_kernel_clear:
110 stmfd sp!, {lr}
111 mov r2, #0
112 cmp r1, #4
113 blt 2f
114 ands ip, r0, #3
115 beq 1f
116 cmp ip, #1
117 strb r2, [r0], #1
118 strleb r2, [r0], #1
119 strltb r2, [r0], #1
120 rsb ip, ip, #4
121 sub r1, r1, ip @ 7 6 5 4 3 2 1
1221: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
123 bmi 2f
124 str r2, [r0], #4
125 str r2, [r0], #4
126 b 1b
1272: adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
128 strpl r2, [r0], #4
129 tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
130 strneb r2, [r0], #1
131 strneb r2, [r0], #1
132 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
133 strneb r2, [r0], #1
134 mov r0, #0
135 ldmfd sp!, {pc}^
136
137/* Prototype: size_t uaccess_kernel_strncpy(char *dst, char *src, size_t len)
138 * Purpose : copy a string from kernel memory to kernel memory
139 * Params : dst - kernel memory destination
140 * : src - kernel memory source
141 * : len - maximum length of string
142 * Returns : number of characters copied
143 */
144uaccess_kernel_strncpy:
145 stmfd sp!, {lr}
146 mov ip, r2
1471: subs r2, r2, #1
148 bmi 2f
149 ldrb r3, [r1], #1
150 strb r3, [r0], #1
151 teq r3, #0
152 bne 1b
1532: subs r0, ip, r2
154 ldmfd sp!, {pc}^
155
156/* Prototype: int uaccess_kernel_strlen(char *str, long n)
157 * Purpose : get length of a string in kernel memory
158 * Params : str - address of string in kernel memory
159 * Returns : length of string *including terminator*,
160 * or zero on exception, or n + 1 if too long
161 */
162uaccess_kernel_strnlen:
163 stmfd sp!, {lr}
164 mov r2, r0
1651: ldrb r1, [r0], #1
166 teq r1, #0
167 beq 2f
168 subs r1, r1, #1
169 bne 1b
170 add r0, r0, #1
1712: sub r0, r0, r2
172 ldmfd sp!, {pc}^
173
diff --git a/arch/arm26/lib/uaccess-user.S b/arch/arm26/lib/uaccess-user.S
deleted file mode 100644
index 130b8f28610a..000000000000
--- a/arch/arm26/lib/uaccess-user.S
+++ /dev/null
@@ -1,718 +0,0 @@
1/*
2 * linux/arch/arm26/lib/uaccess-user.S
3 *
4 * Copyright (C) 1995, 1996,1997,1998 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Routines to block copy data to/from user memory
11 * These are highly optimised both for the 4k page size
12 * and for various alignments.
13 */
14#include <linux/linkage.h>
15#include <asm/assembler.h>
16#include <asm/errno.h>
17#include <asm/page.h>
18
19 .text
20
21//FIXME - surely this can be done in C not asm, removing the problem of keeping C and asm in sync? (this is a struct uaccess_t)
22 .globl uaccess_user
23uaccess_user:
24 .word uaccess_user_put_byte
25 .word uaccess_user_get_byte
26 .word uaccess_user_put_half
27 .word uaccess_user_get_half
28 .word uaccess_user_put_word
29 .word uaccess_user_get_word
30 .word uaccess_user_put_dword
31 .word uaccess_user_copy_from_user
32 .word uaccess_user_copy_to_user
33 .word uaccess_user_clear_user
34 .word uaccess_user_strncpy_from_user
35 .word uaccess_user_strnlen_user
36
37
38@ In : r0 = x, r1 = addr, r2 = error
39@ Out: r2 = error
40uaccess_user_put_byte:
41 stmfd sp!, {lr}
42USER( strbt r0, [r1])
43 ldmfd sp!, {pc}^
44
45@ In : r0 = x, r1 = addr, r2 = error
46@ Out: r2 = error
47uaccess_user_put_half:
48 stmfd sp!, {lr}
49USER( strbt r0, [r1], #1)
50 mov r0, r0, lsr #8
51USER( strbt r0, [r1])
52 ldmfd sp!, {pc}^
53
54@ In : r0 = x, r1 = addr, r2 = error
55@ Out: r2 = error
56uaccess_user_put_word:
57 stmfd sp!, {lr}
58USER( strt r0, [r1])
59 ldmfd sp!, {pc}^
60
61@ In : r0 = x, r1 = addr, r2 = error
62@ Out: r2 = error
63uaccess_user_put_dword:
64 stmfd sp!, {lr}
65USER( strt r0, [r1], #4)
66USER( strt r0, [r1], #0)
67 ldmfd sp!, {pc}^
68
699001: mov r2, #-EFAULT
70 ldmfd sp!, {pc}^
71
72
73@ In : r0 = addr, r1 = error
74@ Out: r0 = x, r1 = error
75uaccess_user_get_byte:
76 stmfd sp!, {lr}
77USER( ldrbt r0, [r0])
78 ldmfd sp!, {pc}^
79
80@ In : r0 = addr, r1 = error
81@ Out: r0 = x, r1 = error
82uaccess_user_get_half:
83 stmfd sp!, {lr}
84USER( ldrt r0, [r0])
85 mov r0, r0, lsl #16
86 mov r0, r0, lsr #16
87 ldmfd sp!, {pc}^
88
89@ In : r0 = addr, r1 = error
90@ Out: r0 = x, r1 = error
91uaccess_user_get_word:
92 stmfd sp!, {lr}
93USER( ldrt r0, [r0])
94 ldmfd sp!, {pc}^
95
969001: mov r1, #-EFAULT
97 ldmfd sp!, {pc}^
98
99/* Prototype: int uaccess_user_copy_to_user(void *to, const char *from, size_t n)
100 * Purpose : copy a block to user memory from kernel memory
101 * Params : to - user memory
102 * : from - kernel memory
103 * : n - number of bytes to copy
104 * Returns : Number of bytes NOT copied.
105 */
106
107.c2u_dest_not_aligned:
108 rsb ip, ip, #4
109 cmp ip, #2
110 ldrb r3, [r1], #1
111USER( strbt r3, [r0], #1) @ May fault
112 ldrgeb r3, [r1], #1
113USER( strgebt r3, [r0], #1) @ May fault
114 ldrgtb r3, [r1], #1
115USER( strgtbt r3, [r0], #1) @ May fault
116 sub r2, r2, ip
117 b .c2u_dest_aligned
118
119ENTRY(uaccess_user_copy_to_user)
120 stmfd sp!, {r2, r4 - r7, lr}
121 cmp r2, #4
122 blt .c2u_not_enough
123 ands ip, r0, #3
124 bne .c2u_dest_not_aligned
125.c2u_dest_aligned:
126
127 ands ip, r1, #3
128 bne .c2u_src_not_aligned
129/*
130 * Seeing as there has to be at least 8 bytes to copy, we can
131 * copy one word, and force a user-mode page fault...
132 */
133
134.c2u_0fupi: subs r2, r2, #4
135 addmi ip, r2, #4
136 bmi .c2u_0nowords
137 ldr r3, [r1], #4
138USER( strt r3, [r0], #4) @ May fault
139 mov ip, r0, lsl #32 - PAGE_SHIFT @ On each page, use a ld/st??t instruction
140 rsb ip, ip, #0
141 movs ip, ip, lsr #32 - PAGE_SHIFT
142 beq .c2u_0fupi
143/*
144 * ip = max no. of bytes to copy before needing another "strt" insn
145 */
146 cmp r2, ip
147 movlt ip, r2
148 sub r2, r2, ip
149 subs ip, ip, #32
150 blt .c2u_0rem8lp
151
152.c2u_0cpy8lp: ldmia r1!, {r3 - r6}
153 stmia r0!, {r3 - r6} @ Shouldnt fault
154 ldmia r1!, {r3 - r6}
155 stmia r0!, {r3 - r6} @ Shouldnt fault
156 subs ip, ip, #32
157 bpl .c2u_0cpy8lp
158.c2u_0rem8lp: cmn ip, #16
159 ldmgeia r1!, {r3 - r6}
160 stmgeia r0!, {r3 - r6} @ Shouldnt fault
161 tst ip, #8
162 ldmneia r1!, {r3 - r4}
163 stmneia r0!, {r3 - r4} @ Shouldnt fault
164 tst ip, #4
165 ldrne r3, [r1], #4
166 strnet r3, [r0], #4 @ Shouldnt fault
167 ands ip, ip, #3
168 beq .c2u_0fupi
169.c2u_0nowords: teq ip, #0
170 beq .c2u_finished
171.c2u_nowords: cmp ip, #2
172 ldrb r3, [r1], #1
173USER( strbt r3, [r0], #1) @ May fault
174 ldrgeb r3, [r1], #1
175USER( strgebt r3, [r0], #1) @ May fault
176 ldrgtb r3, [r1], #1
177USER( strgtbt r3, [r0], #1) @ May fault
178 b .c2u_finished
179
180.c2u_not_enough:
181 movs ip, r2
182 bne .c2u_nowords
183.c2u_finished: mov r0, #0
184 LOADREGS(fd,sp!,{r2, r4 - r7, pc})
185
186.c2u_src_not_aligned:
187 bic r1, r1, #3
188 ldr r7, [r1], #4
189 cmp ip, #2
190 bgt .c2u_3fupi
191 beq .c2u_2fupi
192.c2u_1fupi: subs r2, r2, #4
193 addmi ip, r2, #4
194 bmi .c2u_1nowords
195 mov r3, r7, pull #8
196 ldr r7, [r1], #4
197 orr r3, r3, r7, push #24
198USER( strt r3, [r0], #4) @ May fault
199 mov ip, r0, lsl #32 - PAGE_SHIFT
200 rsb ip, ip, #0
201 movs ip, ip, lsr #32 - PAGE_SHIFT
202 beq .c2u_1fupi
203 cmp r2, ip
204 movlt ip, r2
205 sub r2, r2, ip
206 subs ip, ip, #16
207 blt .c2u_1rem8lp
208
209.c2u_1cpy8lp: mov r3, r7, pull #8
210 ldmia r1!, {r4 - r7}
211 orr r3, r3, r4, push #24
212 mov r4, r4, pull #8
213 orr r4, r4, r5, push #24
214 mov r5, r5, pull #8
215 orr r5, r5, r6, push #24
216 mov r6, r6, pull #8
217 orr r6, r6, r7, push #24
218 stmia r0!, {r3 - r6} @ Shouldnt fault
219 subs ip, ip, #16
220 bpl .c2u_1cpy8lp
221.c2u_1rem8lp: tst ip, #8
222 movne r3, r7, pull #8
223 ldmneia r1!, {r4, r7}
224 orrne r3, r3, r4, push #24
225 movne r4, r4, pull #8
226 orrne r4, r4, r7, push #24
227 stmneia r0!, {r3 - r4} @ Shouldnt fault
228 tst ip, #4
229 movne r3, r7, pull #8
230 ldrne r7, [r1], #4
231 orrne r3, r3, r7, push #24
232 strnet r3, [r0], #4 @ Shouldnt fault
233 ands ip, ip, #3
234 beq .c2u_1fupi
235.c2u_1nowords: mov r3, r7, lsr #byte(1)
236 teq ip, #0
237 beq .c2u_finished
238 cmp ip, #2
239USER( strbt r3, [r0], #1) @ May fault
240 movge r3, r7, lsr #byte(2)
241USER( strgebt r3, [r0], #1) @ May fault
242 movgt r3, r7, lsr #byte(3)
243USER( strgtbt r3, [r0], #1) @ May fault
244 b .c2u_finished
245
246.c2u_2fupi: subs r2, r2, #4
247 addmi ip, r2, #4
248 bmi .c2u_2nowords
249 mov r3, r7, pull #16
250 ldr r7, [r1], #4
251 orr r3, r3, r7, push #16
252USER( strt r3, [r0], #4) @ May fault
253 mov ip, r0, lsl #32 - PAGE_SHIFT
254 rsb ip, ip, #0
255 movs ip, ip, lsr #32 - PAGE_SHIFT
256 beq .c2u_2fupi
257 cmp r2, ip
258 movlt ip, r2
259 sub r2, r2, ip
260 subs ip, ip, #16
261 blt .c2u_2rem8lp
262
263.c2u_2cpy8lp: mov r3, r7, pull #16
264 ldmia r1!, {r4 - r7}
265 orr r3, r3, r4, push #16
266 mov r4, r4, pull #16
267 orr r4, r4, r5, push #16
268 mov r5, r5, pull #16
269 orr r5, r5, r6, push #16
270 mov r6, r6, pull #16
271 orr r6, r6, r7, push #16
272 stmia r0!, {r3 - r6} @ Shouldnt fault
273 subs ip, ip, #16
274 bpl .c2u_2cpy8lp
275.c2u_2rem8lp: tst ip, #8
276 movne r3, r7, pull #16
277 ldmneia r1!, {r4, r7}
278 orrne r3, r3, r4, push #16
279 movne r4, r4, pull #16
280 orrne r4, r4, r7, push #16
281 stmneia r0!, {r3 - r4} @ Shouldnt fault
282 tst ip, #4
283 movne r3, r7, pull #16
284 ldrne r7, [r1], #4
285 orrne r3, r3, r7, push #16
286 strnet r3, [r0], #4 @ Shouldnt fault
287 ands ip, ip, #3
288 beq .c2u_2fupi
289.c2u_2nowords: mov r3, r7, lsr #byte(2)
290 teq ip, #0
291 beq .c2u_finished
292 cmp ip, #2
293USER( strbt r3, [r0], #1) @ May fault
294 movge r3, r7, lsr #byte(3)
295USER( strgebt r3, [r0], #1) @ May fault
296 ldrgtb r3, [r1], #0
297USER( strgtbt r3, [r0], #1) @ May fault
298 b .c2u_finished
299
300.c2u_3fupi: subs r2, r2, #4
301 addmi ip, r2, #4
302 bmi .c2u_3nowords
303 mov r3, r7, pull #24
304 ldr r7, [r1], #4
305 orr r3, r3, r7, push #8
306USER( strt r3, [r0], #4) @ May fault
307 mov ip, r0, lsl #32 - PAGE_SHIFT
308 rsb ip, ip, #0
309 movs ip, ip, lsr #32 - PAGE_SHIFT
310 beq .c2u_3fupi
311 cmp r2, ip
312 movlt ip, r2
313 sub r2, r2, ip
314 subs ip, ip, #16
315 blt .c2u_3rem8lp
316
317.c2u_3cpy8lp: mov r3, r7, pull #24
318 ldmia r1!, {r4 - r7}
319 orr r3, r3, r4, push #8
320 mov r4, r4, pull #24
321 orr r4, r4, r5, push #8
322 mov r5, r5, pull #24
323 orr r5, r5, r6, push #8
324 mov r6, r6, pull #24
325 orr r6, r6, r7, push #8
326 stmia r0!, {r3 - r6} @ Shouldnt fault
327 subs ip, ip, #16
328 bpl .c2u_3cpy8lp
329.c2u_3rem8lp: tst ip, #8
330 movne r3, r7, pull #24
331 ldmneia r1!, {r4, r7}
332 orrne r3, r3, r4, push #8
333 movne r4, r4, pull #24
334 orrne r4, r4, r7, push #8
335 stmneia r0!, {r3 - r4} @ Shouldnt fault
336 tst ip, #4
337 movne r3, r7, pull #24
338 ldrne r7, [r1], #4
339 orrne r3, r3, r7, push #8
340 strnet r3, [r0], #4 @ Shouldnt fault
341 ands ip, ip, #3
342 beq .c2u_3fupi
343.c2u_3nowords: mov r3, r7, lsr #byte(3)
344 teq ip, #0
345 beq .c2u_finished
346 cmp ip, #2
347USER( strbt r3, [r0], #1) @ May fault
348 ldrgeb r3, [r1], #1
349USER( strgebt r3, [r0], #1) @ May fault
350 ldrgtb r3, [r1], #0
351USER( strgtbt r3, [r0], #1) @ May fault
352 b .c2u_finished
353
354 .section .fixup,"ax"
355 .align 0
3569001: LOADREGS(fd,sp!, {r0, r4 - r7, pc})
357 .previous
358
359/* Prototype: unsigned long uaccess_user_copy_from_user(void *to,const void *from,unsigned long n);
360 * Purpose : copy a block from user memory to kernel memory
361 * Params : to - kernel memory
362 * : from - user memory
363 * : n - number of bytes to copy
364 * Returns : Number of bytes NOT copied.
365 */
366.cfu_dest_not_aligned:
367 rsb ip, ip, #4
368 cmp ip, #2
369USER( ldrbt r3, [r1], #1) @ May fault
370 strb r3, [r0], #1
371USER( ldrgebt r3, [r1], #1) @ May fault
372 strgeb r3, [r0], #1
373USER( ldrgtbt r3, [r1], #1) @ May fault
374 strgtb r3, [r0], #1
375 sub r2, r2, ip
376 b .cfu_dest_aligned
377
378ENTRY(uaccess_user_copy_from_user)
379 stmfd sp!, {r0, r2, r4 - r7, lr}
380 cmp r2, #4
381 blt .cfu_not_enough
382 ands ip, r0, #3
383 bne .cfu_dest_not_aligned
384.cfu_dest_aligned:
385 ands ip, r1, #3
386 bne .cfu_src_not_aligned
387/*
388 * Seeing as there has to be at least 8 bytes to copy, we can
389 * copy one word, and force a user-mode page fault...
390 */
391
392.cfu_0fupi: subs r2, r2, #4
393 addmi ip, r2, #4
394 bmi .cfu_0nowords
395USER( ldrt r3, [r1], #4)
396 str r3, [r0], #4
397 mov ip, r1, lsl #32 - PAGE_SHIFT @ On each page, use a ld/st??t instruction
398 rsb ip, ip, #0
399 movs ip, ip, lsr #32 - PAGE_SHIFT
400 beq .cfu_0fupi
401/*
402 * ip = max no. of bytes to copy before needing another "strt" insn
403 */
404 cmp r2, ip
405 movlt ip, r2
406 sub r2, r2, ip
407 subs ip, ip, #32
408 blt .cfu_0rem8lp
409
410.cfu_0cpy8lp: ldmia r1!, {r3 - r6} @ Shouldnt fault
411 stmia r0!, {r3 - r6}
412 ldmia r1!, {r3 - r6} @ Shouldnt fault
413 stmia r0!, {r3 - r6}
414 subs ip, ip, #32
415 bpl .cfu_0cpy8lp
416.cfu_0rem8lp: cmn ip, #16
417 ldmgeia r1!, {r3 - r6} @ Shouldnt fault
418 stmgeia r0!, {r3 - r6}
419 tst ip, #8
420 ldmneia r1!, {r3 - r4} @ Shouldnt fault
421 stmneia r0!, {r3 - r4}
422 tst ip, #4
423 ldrnet r3, [r1], #4 @ Shouldnt fault
424 strne r3, [r0], #4
425 ands ip, ip, #3
426 beq .cfu_0fupi
427.cfu_0nowords: teq ip, #0
428 beq .cfu_finished
429.cfu_nowords: cmp ip, #2
430USER( ldrbt r3, [r1], #1) @ May fault
431 strb r3, [r0], #1
432USER( ldrgebt r3, [r1], #1) @ May fault
433 strgeb r3, [r0], #1
434USER( ldrgtbt r3, [r1], #1) @ May fault
435 strgtb r3, [r0], #1
436 b .cfu_finished
437
438.cfu_not_enough:
439 movs ip, r2
440 bne .cfu_nowords
441.cfu_finished: mov r0, #0
442 add sp, sp, #8
443 LOADREGS(fd,sp!,{r4 - r7, pc})
444
445.cfu_src_not_aligned:
446 bic r1, r1, #3
447USER( ldrt r7, [r1], #4) @ May fault
448 cmp ip, #2
449 bgt .cfu_3fupi
450 beq .cfu_2fupi
451.cfu_1fupi: subs r2, r2, #4
452 addmi ip, r2, #4
453 bmi .cfu_1nowords
454 mov r3, r7, pull #8
455USER( ldrt r7, [r1], #4) @ May fault
456 orr r3, r3, r7, push #24
457 str r3, [r0], #4
458 mov ip, r1, lsl #32 - PAGE_SHIFT
459 rsb ip, ip, #0
460 movs ip, ip, lsr #32 - PAGE_SHIFT
461 beq .cfu_1fupi
462 cmp r2, ip
463 movlt ip, r2
464 sub r2, r2, ip
465 subs ip, ip, #16
466 blt .cfu_1rem8lp
467
468.cfu_1cpy8lp: mov r3, r7, pull #8
469 ldmia r1!, {r4 - r7} @ Shouldnt fault
470 orr r3, r3, r4, push #24
471 mov r4, r4, pull #8
472 orr r4, r4, r5, push #24
473 mov r5, r5, pull #8
474 orr r5, r5, r6, push #24
475 mov r6, r6, pull #8
476 orr r6, r6, r7, push #24
477 stmia r0!, {r3 - r6}
478 subs ip, ip, #16
479 bpl .cfu_1cpy8lp
480.cfu_1rem8lp: tst ip, #8
481 movne r3, r7, pull #8
482 ldmneia r1!, {r4, r7} @ Shouldnt fault
483 orrne r3, r3, r4, push #24
484 movne r4, r4, pull #8
485 orrne r4, r4, r7, push #24
486 stmneia r0!, {r3 - r4}
487 tst ip, #4
488 movne r3, r7, pull #8
489USER( ldrnet r7, [r1], #4) @ May fault
490 orrne r3, r3, r7, push #24
491 strne r3, [r0], #4
492 ands ip, ip, #3
493 beq .cfu_1fupi
494.cfu_1nowords: mov r3, r7, lsr #byte(1)
495 teq ip, #0
496 beq .cfu_finished
497 cmp ip, #2
498 strb r3, [r0], #1
499 movge r3, r7, lsr #byte(2)
500 strgeb r3, [r0], #1
501 movgt r3, r7, lsr #byte(3)
502 strgtb r3, [r0], #1
503 b .cfu_finished
504
505.cfu_2fupi: subs r2, r2, #4
506 addmi ip, r2, #4
507 bmi .cfu_2nowords
508 mov r3, r7, pull #16
509USER( ldrt r7, [r1], #4) @ May fault
510 orr r3, r3, r7, push #16
511 str r3, [r0], #4
512 mov ip, r1, lsl #32 - PAGE_SHIFT
513 rsb ip, ip, #0
514 movs ip, ip, lsr #32 - PAGE_SHIFT
515 beq .cfu_2fupi
516 cmp r2, ip
517 movlt ip, r2
518 sub r2, r2, ip
519 subs ip, ip, #16
520 blt .cfu_2rem8lp
521
522.cfu_2cpy8lp: mov r3, r7, pull #16
523 ldmia r1!, {r4 - r7} @ Shouldnt fault
524 orr r3, r3, r4, push #16
525 mov r4, r4, pull #16
526 orr r4, r4, r5, push #16
527 mov r5, r5, pull #16
528 orr r5, r5, r6, push #16
529 mov r6, r6, pull #16
530 orr r6, r6, r7, push #16
531 stmia r0!, {r3 - r6}
532 subs ip, ip, #16
533 bpl .cfu_2cpy8lp
534.cfu_2rem8lp: tst ip, #8
535 movne r3, r7, pull #16
536 ldmneia r1!, {r4, r7} @ Shouldnt fault
537 orrne r3, r3, r4, push #16
538 movne r4, r4, pull #16
539 orrne r4, r4, r7, push #16
540 stmneia r0!, {r3 - r4}
541 tst ip, #4
542 movne r3, r7, pull #16
543USER( ldrnet r7, [r1], #4) @ May fault
544 orrne r3, r3, r7, push #16
545 strne r3, [r0], #4
546 ands ip, ip, #3
547 beq .cfu_2fupi
548.cfu_2nowords: mov r3, r7, lsr #byte(2)
549 teq ip, #0
550 beq .cfu_finished
551 cmp ip, #2
552 strb r3, [r0], #1
553 movge r3, r7, lsr #byte(3)
554 strgeb r3, [r0], #1
555USER( ldrgtbt r3, [r1], #0) @ May fault
556 strgtb r3, [r0], #1
557 b .cfu_finished
558
559.cfu_3fupi: subs r2, r2, #4
560 addmi ip, r2, #4
561 bmi .cfu_3nowords
562 mov r3, r7, pull #24
563USER( ldrt r7, [r1], #4) @ May fault
564 orr r3, r3, r7, push #8
565 str r3, [r0], #4
566 mov ip, r1, lsl #32 - PAGE_SHIFT
567 rsb ip, ip, #0
568 movs ip, ip, lsr #32 - PAGE_SHIFT
569 beq .cfu_3fupi
570 cmp r2, ip
571 movlt ip, r2
572 sub r2, r2, ip
573 subs ip, ip, #16
574 blt .cfu_3rem8lp
575
576.cfu_3cpy8lp: mov r3, r7, pull #24
577 ldmia r1!, {r4 - r7} @ Shouldnt fault
578 orr r3, r3, r4, push #8
579 mov r4, r4, pull #24
580 orr r4, r4, r5, push #8
581 mov r5, r5, pull #24
582 orr r5, r5, r6, push #8
583 mov r6, r6, pull #24
584 orr r6, r6, r7, push #8
585 stmia r0!, {r3 - r6}
586 subs ip, ip, #16
587 bpl .cfu_3cpy8lp
588.cfu_3rem8lp: tst ip, #8
589 movne r3, r7, pull #24
590 ldmneia r1!, {r4, r7} @ Shouldnt fault
591 orrne r3, r3, r4, push #8
592 movne r4, r4, pull #24
593 orrne r4, r4, r7, push #8
594 stmneia r0!, {r3 - r4}
595 tst ip, #4
596 movne r3, r7, pull #24
597USER( ldrnet r7, [r1], #4) @ May fault
598 orrne r3, r3, r7, push #8
599 strne r3, [r0], #4
600 ands ip, ip, #3
601 beq .cfu_3fupi
602.cfu_3nowords: mov r3, r7, lsr #byte(3)
603 teq ip, #0
604 beq .cfu_finished
605 cmp ip, #2
606 strb r3, [r0], #1
607USER( ldrgebt r3, [r1], #1) @ May fault
608 strgeb r3, [r0], #1
609USER( ldrgtbt r3, [r1], #1) @ May fault
610 strgtb r3, [r0], #1
611 b .cfu_finished
612
613 .section .fixup,"ax"
614 .align 0
615 /*
616 * We took an exception. r0 contains a pointer to
617 * the byte not copied.
618 */
6199001: ldr r2, [sp], #4 @ void *to
620 sub r2, r0, r2 @ bytes copied
621 ldr r1, [sp], #4 @ unsigned long count
622 subs r4, r1, r2 @ bytes left to copy
623 movne r1, r4
624 blne __memzero
625 mov r0, r4
626 LOADREGS(fd,sp!, {r4 - r7, pc})
627 .previous
628
629/* Prototype: int uaccess_user_clear_user(void *addr, size_t sz)
630 * Purpose : clear some user memory
631 * Params : addr - user memory address to clear
632 * : sz - number of bytes to clear
633 * Returns : number of bytes NOT cleared
634 */
635ENTRY(uaccess_user_clear_user)
636 stmfd sp!, {r1, lr}
637 mov r2, #0
638 cmp r1, #4
639 blt 2f
640 ands ip, r0, #3
641 beq 1f
642 cmp ip, #2
643USER( strbt r2, [r0], #1)
644USER( strlebt r2, [r0], #1)
645USER( strltbt r2, [r0], #1)
646 rsb ip, ip, #4
647 sub r1, r1, ip @ 7 6 5 4 3 2 1
6481: subs r1, r1, #8 @ -1 -2 -3 -4 -5 -6 -7
649USER( strplt r2, [r0], #4)
650USER( strplt r2, [r0], #4)
651 bpl 1b
652 adds r1, r1, #4 @ 3 2 1 0 -1 -2 -3
653USER( strplt r2, [r0], #4)
6542: tst r1, #2 @ 1x 1x 0x 0x 1x 1x 0x
655USER( strnebt r2, [r0], #1)
656USER( strnebt r2, [r0], #1)
657 tst r1, #1 @ x1 x0 x1 x0 x1 x0 x1
658USER( strnebt r2, [r0], #1)
659 mov r0, #0
660 LOADREGS(fd,sp!, {r1, pc})
661
662 .section .fixup,"ax"
663 .align 0
6649001: LOADREGS(fd,sp!, {r0, pc})
665 .previous
666
667/*
668 * Copy a string from user space to kernel space.
669 * r0 = dst, r1 = src, r2 = byte length
670 * returns the number of characters copied (strlen of copied string),
671 * -EFAULT on exception, or "len" if we fill the whole buffer
672 */
673ENTRY(uaccess_user_strncpy_from_user)
674 save_lr
675 mov ip, r1
6761: subs r2, r2, #1
677USER( ldrplbt r3, [r1], #1)
678 bmi 2f
679 strb r3, [r0], #1
680 teq r3, #0
681 bne 1b
682 sub r1, r1, #1 @ take NUL character out of count
6832: sub r0, r1, ip
684 restore_pc
685
686 .section .fixup,"ax"
687 .align 0
6889001: mov r3, #0
689 strb r3, [r0, #0] @ null terminate
690 mov r0, #-EFAULT
691 restore_pc
692 .previous
693
694/* Prototype: unsigned long uaccess_user_strnlen_user(const char *str, long n)
695 * Purpose : get length of a string in user memory
696 * Params : str - address of string in user memory
697 * Returns : length of string *including terminator*
698 * or zero on exception, or n + 1 if too long
699 */
700ENTRY(uaccess_user_strnlen_user)
701 save_lr
702 mov r2, r0
7031:
704USER( ldrbt r3, [r0], #1)
705 teq r3, #0
706 beq 2f
707 subs r1, r1, #1
708 bne 1b
709 add r0, r0, #1
7102: sub r0, r0, r2
711 restore_pc
712
713 .section .fixup,"ax"
714 .align 0
7159001: mov r0, #0
716 restore_pc
717 .previous
718
diff --git a/arch/arm26/lib/ucmpdi2.c b/arch/arm26/lib/ucmpdi2.c
deleted file mode 100644
index 6c6ae63efa02..000000000000
--- a/arch/arm26/lib/ucmpdi2.c
+++ /dev/null
@@ -1,51 +0,0 @@
1/* More subroutines needed by GCC output code on some machines. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License.
28 */
29/* support functions required by the kernel. based on code from gcc-2.95.3 */
30/* I Molton 29/07/01 */
31
32#include "gcclib.h"
33
34word_type
35__ucmpdi2 (DItype a, DItype b)
36{
37 DIunion au, bu;
38
39 au.ll = a, bu.ll = b;
40
41 if ((USItype) au.s.high < (USItype) bu.s.high)
42 return 0;
43 else if ((USItype) au.s.high > (USItype) bu.s.high)
44 return 2;
45 if ((USItype) au.s.low < (USItype) bu.s.low)
46 return 0;
47 else if ((USItype) au.s.low > (USItype) bu.s.low)
48 return 2;
49 return 1;
50}
51
diff --git a/arch/arm26/lib/udivdi3.c b/arch/arm26/lib/udivdi3.c
deleted file mode 100644
index d25195f673f4..000000000000
--- a/arch/arm26/lib/udivdi3.c
+++ /dev/null
@@ -1,242 +0,0 @@
1/* More subroutines needed by GCC output code on some machines. */
2/* Compile this one with gcc. */
3/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
4
5This file is part of GNU CC.
6
7GNU CC is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU CC is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU CC; see the file COPYING. If not, write to
19the Free Software Foundation, 59 Temple Place - Suite 330,
20Boston, MA 02111-1307, USA. */
21
22/* As a special exception, if you link this library with other files,
23 some of which are compiled with GCC, to produce an executable,
24 this library does not by itself cause the resulting executable
25 to be covered by the GNU General Public License.
26 This exception does not however invalidate any other reasons why
27 the executable file might be covered by the GNU General Public License.
28 */
29/* support functions required by the kernel. based on code from gcc-2.95.3 */
30/* I Molton 29/07/01 */
31
32#include "gcclib.h"
33#include "longlong.h"
34
35static const UQItype __clz_tab[] =
36{
37 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
38 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
39 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
40 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
41 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
42 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
43 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
44 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
45};
46
47UDItype
48__udivmoddi4 (UDItype n, UDItype d, UDItype *rp)
49{
50 DIunion ww;
51 DIunion nn, dd;
52 DIunion rr;
53 USItype d0, d1, n0, n1, n2;
54 USItype q0, q1;
55 USItype b, bm;
56
57 nn.ll = n;
58 dd.ll = d;
59
60 d0 = dd.s.low;
61 d1 = dd.s.high;
62 n0 = nn.s.low;
63 n1 = nn.s.high;
64
65 if (d1 == 0)
66 {
67 if (d0 > n1)
68 {
69 /* 0q = nn / 0D */
70
71 count_leading_zeros (bm, d0);
72
73 if (bm != 0)
74 {
75 /* Normalize, i.e. make the most significant bit of the
76 denominator set. */
77
78 d0 = d0 << bm;
79 n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
80 n0 = n0 << bm;
81 }
82
83 udiv_qrnnd (q0, n0, n1, n0, d0);
84 q1 = 0;
85
86 /* Remainder in n0 >> bm. */
87 }
88 else
89 {
90 /* qq = NN / 0d */
91
92 if (d0 == 0)
93 d0 = 1 / d0; /* Divide intentionally by zero. */
94
95 count_leading_zeros (bm, d0);
96
97 if (bm == 0)
98 {
99 /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
100 conclude (the most significant bit of n1 is set) /\ (the
101 leading quotient digit q1 = 1).
102
103 This special case is necessary, not an optimization.
104 (Shifts counts of SI_TYPE_SIZE are undefined.) */
105
106 n1 -= d0;
107 q1 = 1;
108 }
109 else
110 {
111 /* Normalize. */
112
113 b = SI_TYPE_SIZE - bm;
114
115 d0 = d0 << bm;
116 n2 = n1 >> b;
117 n1 = (n1 << bm) | (n0 >> b);
118 n0 = n0 << bm;
119
120 udiv_qrnnd (q1, n1, n2, n1, d0);
121 }
122
123 /* n1 != d0... */
124
125 udiv_qrnnd (q0, n0, n1, n0, d0);
126
127 /* Remainder in n0 >> bm. */
128 }
129
130 if (rp != 0)
131 {
132 rr.s.low = n0 >> bm;
133 rr.s.high = 0;
134 *rp = rr.ll;
135 }
136 }
137 else
138 {
139 if (d1 > n1)
140 {
141 /* 00 = nn / DD */
142
143 q0 = 0;
144 q1 = 0;
145
146 /* Remainder in n1n0. */
147 if (rp != 0)
148 {
149 rr.s.low = n0;
150 rr.s.high = n1;
151 *rp = rr.ll;
152 }
153 }
154 else
155 {
156 /* 0q = NN / dd */
157
158 count_leading_zeros (bm, d1);
159 if (bm == 0)
160 {
161 /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
162 conclude (the most significant bit of n1 is set) /\ (the
163 quotient digit q0 = 0 or 1).
164
165 This special case is necessary, not an optimization. */
166
167 /* The condition on the next line takes advantage of that
168 n1 >= d1 (true due to program flow). */
169 if (n1 > d1 || n0 >= d0)
170 {
171 q0 = 1;
172 sub_ddmmss (n1, n0, n1, n0, d1, d0);
173 }
174 else
175 q0 = 0;
176
177 q1 = 0;
178
179 if (rp != 0)
180 {
181 rr.s.low = n0;
182 rr.s.high = n1;
183 *rp = rr.ll;
184 }
185 }
186 else
187 {
188 USItype m1, m0;
189 /* Normalize. */
190
191 b = SI_TYPE_SIZE - bm;
192
193 d1 = (d1 << bm) | (d0 >> b);
194 d0 = d0 << bm;
195 n2 = n1 >> b;
196 n1 = (n1 << bm) | (n0 >> b);
197 n0 = n0 << bm;
198
199 udiv_qrnnd (q0, n1, n2, n1, d1);
200 umul_ppmm (m1, m0, q0, d0);
201
202 if (m1 > n1 || (m1 == n1 && m0 > n0))
203 {
204 q0--;
205 sub_ddmmss (m1, m0, m1, m0, d1, d0);
206 }
207
208 q1 = 0;
209
210 /* Remainder in (n1n0 - m1m0) >> bm. */
211 if (rp != 0)
212 {
213 sub_ddmmss (n1, n0, n1, n0, m1, m0);
214 rr.s.low = (n1 << b) | (n0 >> bm);
215 rr.s.high = n1 >> bm;
216 *rp = rr.ll;
217 }
218 }
219 }
220 }
221
222 ww.s.low = q0;
223 ww.s.high = q1;
224 return ww.ll;
225}
226
227UDItype
228__udivdi3 (UDItype n, UDItype d)
229{
230 return __udivmoddi4 (n, d, (UDItype *) 0);
231}
232
233UDItype
234__umoddi3 (UDItype u, UDItype v)
235{
236 UDItype w;
237
238 (void) __udivmoddi4 (u ,v, &w);
239
240 return w;
241}
242
diff --git a/arch/arm26/machine/Makefile b/arch/arm26/machine/Makefile
deleted file mode 100644
index 86ea97cc07fc..000000000000
--- a/arch/arm26/machine/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := dma.o irq.o latches.o
8
diff --git a/arch/arm26/machine/dma.c b/arch/arm26/machine/dma.c
deleted file mode 100644
index 4402a5a1b78f..000000000000
--- a/arch/arm26/machine/dma.c
+++ /dev/null
@@ -1,214 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/dma.c
3 *
4 * Copyright (C) 1998-1999 Dave Gilbert / Russell King
5 * Copyright (C) 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * DMA functions specific to Archimedes and A5000 architecture
12 */
13#include <linux/sched.h>
14#include <linux/init.h>
15
16#include <asm/dma.h>
17#include <asm/fiq.h>
18#include <asm/irq.h>
19#include <asm/io.h>
20#include <asm/hardware.h>
21#include <asm/mach-types.h>
22
23#define DPRINTK(x...) printk(KERN_DEBUG x)
24
25#if defined(CONFIG_BLK_DEV_FD1772) || defined(CONFIG_BLK_DEV_FD1772_MODULE)
26
27extern unsigned char fdc1772_dma_read, fdc1772_dma_read_end;
28extern unsigned char fdc1772_dma_write, fdc1772_dma_write_end;
29extern void fdc1772_setupdma(unsigned int count,unsigned int addr);
30
31static void arc_floppy_data_enable_dma(dmach_t channel, dma_t *dma)
32{
33 DPRINTK("arc_floppy_data_enable_dma\n");
34
35 if (dma->using_sg)
36 BUG();
37
38 switch (dma->dma_mode) {
39 case DMA_MODE_READ: { /* read */
40 unsigned long flags;
41 DPRINTK("enable_dma fdc1772 data read\n");
42 local_save_flags_cli(flags);
43 clf();
44
45 memcpy ((void *)0x1c, (void *)&fdc1772_dma_read,
46 &fdc1772_dma_read_end - &fdc1772_dma_read);
47 fdc1772_setupdma(dma->buf.length, dma->buf.__address); /* Sets data pointer up */
48 enable_fiq(FIQ_FLOPPYDATA);
49 local_irq_restore(flags);
50 }
51 break;
52
53 case DMA_MODE_WRITE: { /* write */
54 unsigned long flags;
55 DPRINTK("enable_dma fdc1772 data write\n");
56 local_save_flags_cli(flags);
57 clf();
58 memcpy ((void *)0x1c, (void *)&fdc1772_dma_write,
59 &fdc1772_dma_write_end - &fdc1772_dma_write);
60 fdc1772_setupdma(dma->buf.length, dma->buf.__address); /* Sets data pointer up */
61 enable_fiq(FIQ_FLOPPYDATA);
62
63 local_irq_restore(flags);
64 }
65 break;
66 default:
67 printk ("enable_dma: dma%d not initialised\n", channel);
68 }
69}
70
71static int arc_floppy_data_get_dma_residue(dmach_t channel, dma_t *dma)
72{
73 extern unsigned int fdc1772_bytestogo;
74
75 /* 10/1/1999 DAG - I presume its the number of bytes left? */
76 return fdc1772_bytestogo;
77}
78
79static void arc_floppy_cmdend_enable_dma(dmach_t channel, dma_t *dma)
80{
81 /* Need to build a branch at the FIQ address */
82 extern void fdc1772_comendhandler(void);
83 unsigned long flags;
84
85 DPRINTK("arc_floppy_cmdend_enable_dma\n");
86 /*printk("enable_dma fdc1772 command end FIQ\n");*/
87 save_flags(flags);
88 clf();
89
90 /* B fdc1772_comendhandler */
91 *((unsigned int *)0x1c)=0xea000000 |
92 (((unsigned int)fdc1772_comendhandler-(0x1c+8))/4);
93
94 local_irq_restore(flags);
95}
96
97static int arc_floppy_cmdend_get_dma_residue(dmach_t channel, dma_t *dma)
98{
99 /* 10/1/1999 DAG - Presume whether there is an outstanding command? */
100 extern unsigned int fdc1772_fdc_int_done;
101
102 /* Explicit! If the int done is 0 then 1 int to go */
103 return (fdc1772_fdc_int_done==0)?1:0;
104}
105
106static void arc_disable_dma(dmach_t channel, dma_t *dma)
107{
108 disable_fiq(dma->dma_irq);
109}
110
111static struct dma_ops arc_floppy_data_dma_ops = {
112 .type = "FIQDMA",
113 .enable = arc_floppy_data_enable_dma,
114 .disable = arc_disable_dma,
115 .residue = arc_floppy_data_get_dma_residue,
116};
117
118static struct dma_ops arc_floppy_cmdend_dma_ops = {
119 .type = "FIQCMD",
120 .enable = arc_floppy_cmdend_enable_dma,
121 .disable = arc_disable_dma,
122 .residue = arc_floppy_cmdend_get_dma_residue,
123};
124#endif
125
126#ifdef CONFIG_ARCH_A5K
127static struct fiq_handler fh = {
128 .name = "floppydata"
129};
130
131static int a5k_floppy_get_dma_residue(dmach_t channel, dma_t *dma)
132{
133 struct pt_regs regs;
134 get_fiq_regs(&regs);
135 return regs.ARM_r9;
136}
137
138static void a5k_floppy_enable_dma(dmach_t channel, dma_t *dma)
139{
140 struct pt_regs regs;
141 void *fiqhandler_start;
142 unsigned int fiqhandler_length;
143 extern void floppy_fiqsetup(unsigned long len, unsigned long addr,
144 unsigned long port);
145
146 if (dma->using_sg)
147 BUG();
148
149 if (dma->dma_mode == DMA_MODE_READ) {
150 extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
151 fiqhandler_start = &floppy_fiqin_start;
152 fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start;
153 } else {
154 extern unsigned char floppy_fiqout_start, floppy_fiqout_end;
155 fiqhandler_start = &floppy_fiqout_start;
156 fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
157 }
158 if (claim_fiq(&fh)) {
159 printk("floppydma: couldn't claim FIQ.\n");
160 return;
161 }
162 memcpy((void *)0x1c, fiqhandler_start, fiqhandler_length);
163 regs.ARM_r9 = dma->buf.length;
164 regs.ARM_r10 = (unsigned long)dma->buf.__address;
165 regs.ARM_fp = FLOPPYDMA_BASE;
166 set_fiq_regs(&regs);
167 enable_fiq(dma->dma_irq);
168}
169
170static void a5k_floppy_disable_dma(dmach_t channel, dma_t *dma)
171{
172 disable_fiq(dma->dma_irq);
173 release_fiq(&fh);
174}
175
176static struct dma_ops a5k_floppy_dma_ops = {
177 .type = "FIQDMA",
178 .enable = a5k_floppy_enable_dma,
179 .disable = a5k_floppy_disable_dma,
180 .residue = a5k_floppy_get_dma_residue,
181};
182#endif
183
184/*
185 * This is virtual DMA - we don't need anything here
186 */
187static void sound_enable_disable_dma(dmach_t channel, dma_t *dma)
188{
189}
190
191static struct dma_ops sound_dma_ops = {
192 .type = "VIRTUAL",
193 .enable = sound_enable_disable_dma,
194 .disable = sound_enable_disable_dma,
195};
196
197void __init arch_dma_init(dma_t *dma)
198{
199#if defined(CONFIG_BLK_DEV_FD1772) || defined(CONFIG_BLK_DEV_FD1772_MODULE)
200 if (machine_is_archimedes()) {
201 dma[DMA_VIRTUAL_FLOPPY0].dma_irq = FIQ_FLOPPYDATA;
202 dma[DMA_VIRTUAL_FLOPPY0].d_ops = &arc_floppy_data_dma_ops;
203 dma[DMA_VIRTUAL_FLOPPY1].dma_irq = 1;
204 dma[DMA_VIRTUAL_FLOPPY1].d_ops = &arc_floppy_cmdend_dma_ops;
205 }
206#endif
207#ifdef CONFIG_ARCH_A5K
208 if (machine_is_a5k()) {
209 dma[DMA_VIRTUAL_FLOPPY0].dma_irq = FIQ_FLOPPYDATA;
210 dma[DMA_VIRTUAL_FLOPPY0].d_ops = &a5k_floppy_dma_ops;
211 }
212#endif
213 dma[DMA_VIRTUAL_SOUND].d_ops = &sound_dma_ops;
214}
diff --git a/arch/arm26/machine/irq.c b/arch/arm26/machine/irq.c
deleted file mode 100644
index a60d543edecc..000000000000
--- a/arch/arm26/machine/irq.c
+++ /dev/null
@@ -1,164 +0,0 @@
1/*
2 * linux/arch/arm26/mach-arc/irq.c
3 *
4 * Copyright (C) 1996 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Changelog:
11 * 24-09-1996 RMK Created
12 * 10-10-1996 RMK Brought up to date with arch-sa110eval
13 * 22-10-1996 RMK Changed interrupt numbers & uses new inb/outb macros
14 * 11-01-1998 RMK Added mask_and_ack_irq
15 * 22-08-1998 RMK Restructured IRQ routines
16 * 08-09-2002 IM Brought up to date for 2.5
17 * 01-06-2003 JMA Removed arc_fiq_chip
18 */
19#include <linux/init.h>
20
21#include <asm/irq.h>
22#include <asm/irqchip.h>
23#include <asm/ioc.h>
24#include <asm/io.h>
25#include <asm/system.h>
26
27extern void init_FIQ(void);
28
29#define a_clf() clf()
30#define a_stf() stf()
31
32static void arc_ack_irq_a(unsigned int irq)
33{
34 unsigned int val, mask;
35
36 mask = 1 << irq;
37 a_clf();
38 val = ioc_readb(IOC_IRQMASKA);
39 ioc_writeb(val & ~mask, IOC_IRQMASKA);
40 ioc_writeb(mask, IOC_IRQCLRA);
41 a_stf();
42}
43
44static void arc_mask_irq_a(unsigned int irq)
45{
46 unsigned int val, mask;
47
48 mask = 1 << irq;
49 a_clf();
50 val = ioc_readb(IOC_IRQMASKA);
51 ioc_writeb(val & ~mask, IOC_IRQMASKA);
52 a_stf();
53}
54
55static void arc_unmask_irq_a(unsigned int irq)
56{
57 unsigned int val, mask;
58
59 mask = 1 << irq;
60 a_clf();
61 val = ioc_readb(IOC_IRQMASKA);
62 ioc_writeb(val | mask, IOC_IRQMASKA);
63 a_stf();
64}
65
66static struct irqchip arc_a_chip = {
67 .ack = arc_ack_irq_a,
68 .mask = arc_mask_irq_a,
69 .unmask = arc_unmask_irq_a,
70};
71
72static void arc_mask_irq_b(unsigned int irq)
73{
74 unsigned int val, mask;
75 mask = 1 << (irq & 7);
76 val = ioc_readb(IOC_IRQMASKB);
77 ioc_writeb(val & ~mask, IOC_IRQMASKB);
78}
79
80static void arc_unmask_irq_b(unsigned int irq)
81{
82 unsigned int val, mask;
83
84 mask = 1 << (irq & 7);
85 val = ioc_readb(IOC_IRQMASKB);
86 ioc_writeb(val | mask, IOC_IRQMASKB);
87}
88
89static struct irqchip arc_b_chip = {
90 .ack = arc_mask_irq_b,
91 .mask = arc_mask_irq_b,
92 .unmask = arc_unmask_irq_b,
93};
94
95/* FIXME - JMA none of these functions are used in arm26 currently
96static void arc_mask_irq_fiq(unsigned int irq)
97{
98 unsigned int val, mask;
99
100 mask = 1 << (irq & 7);
101 val = ioc_readb(IOC_FIQMASK);
102 ioc_writeb(val & ~mask, IOC_FIQMASK);
103}
104
105static void arc_unmask_irq_fiq(unsigned int irq)
106{
107 unsigned int val, mask;
108
109 mask = 1 << (irq & 7);
110 val = ioc_readb(IOC_FIQMASK);
111 ioc_writeb(val | mask, IOC_FIQMASK);
112}
113
114static struct irqchip arc_fiq_chip = {
115 .ack = arc_mask_irq_fiq,
116 .mask = arc_mask_irq_fiq,
117 .unmask = arc_unmask_irq_fiq,
118};
119*/
120
121void __init arc_init_irq(void)
122{
123 unsigned int irq, flags;
124
125 /* Disable all IOC interrupt sources */
126 ioc_writeb(0, IOC_IRQMASKA);
127 ioc_writeb(0, IOC_IRQMASKB);
128 ioc_writeb(0, IOC_FIQMASK);
129
130 for (irq = 0; irq < NR_IRQS; irq++) {
131 flags = IRQF_VALID;
132
133 if (irq <= 6 || (irq >= 9 && irq <= 15))
134 flags |= IRQF_PROBE;
135
136 if (irq == IRQ_KEYBOARDTX)
137 flags |= IRQF_NOAUTOEN;
138
139 switch (irq) {
140 case 0 ... 7:
141 set_irq_chip(irq, &arc_a_chip);
142 set_irq_handler(irq, do_level_IRQ);
143 set_irq_flags(irq, flags);
144 break;
145
146 case 8 ... 15:
147 set_irq_chip(irq, &arc_b_chip);
148 set_irq_handler(irq, do_level_IRQ);
149 set_irq_flags(irq, flags);
150
151/* case 64 ... 72:
152 set_irq_chip(irq, &arc_fiq_chip);
153 set_irq_flags(irq, flags);
154 break;
155*/
156
157 }
158 }
159
160 irq_desc[IRQ_KEYBOARDTX].noautoenable = 1;
161
162 init_FIQ();
163}
164
diff --git a/arch/arm26/machine/latches.c b/arch/arm26/machine/latches.c
deleted file mode 100644
index 94f05d2a3b2b..000000000000
--- a/arch/arm26/machine/latches.c
+++ /dev/null
@@ -1,72 +0,0 @@
1/*
2 * linux/arch/arm26/kernel/latches.c
3 *
4 * Copyright (C) David Alan Gilbert 1995/1996,2000
5 * Copyright (C) Ian Molton 2003
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Support for the latches on the old Archimedes which control the floppy,
12 * hard disc and printer
13 */
14#include <linux/module.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/sched.h>
18
19#include <asm/io.h>
20#include <asm/hardware.h>
21#include <asm/mach-types.h>
22#include <asm/oldlatches.h>
23
24static unsigned char latch_a_copy;
25static unsigned char latch_b_copy;
26
27/* newval=(oldval & ~mask)|newdata */
28void oldlatch_aupdate(unsigned char mask,unsigned char newdata)
29{
30 unsigned long flags;
31
32 BUG_ON(!machine_is_archimedes());
33
34 local_irq_save(flags); //FIXME: was local_save_flags
35 latch_a_copy = (latch_a_copy & ~mask) | newdata;
36 __raw_writeb(latch_a_copy, LATCHA_BASE);
37 local_irq_restore(flags);
38
39 printk("Latch: A = 0x%02x\n", latch_a_copy);
40}
41
42
43/* newval=(oldval & ~mask)|newdata */
44void oldlatch_bupdate(unsigned char mask,unsigned char newdata)
45{
46 unsigned long flags;
47
48 BUG_ON(!machine_is_archimedes());
49
50
51 local_irq_save(flags);//FIXME: was local_save_flags
52 latch_b_copy = (latch_b_copy & ~mask) | newdata;
53 __raw_writeb(latch_b_copy, LATCHB_BASE);
54 local_irq_restore(flags);
55
56 printk("Latch: B = 0x%02x\n", latch_b_copy);
57}
58
59static int __init oldlatch_init(void)
60{
61 if (machine_is_archimedes()) {
62 oldlatch_aupdate(0xff, 0xff);
63 /* Thats no FDC reset...*/
64 oldlatch_bupdate(0xff, LATCHB_FDCRESET);
65 }
66 return 0;
67}
68
69arch_initcall(oldlatch_init);
70
71EXPORT_SYMBOL(oldlatch_aupdate);
72EXPORT_SYMBOL(oldlatch_bupdate);
diff --git a/arch/arm26/mm/Makefile b/arch/arm26/mm/Makefile
deleted file mode 100644
index a8fb166d5c6d..000000000000
--- a/arch/arm26/mm/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1#
2# Makefile for the linux arm26-specific parts of the memory manager.
3#
4
5obj-y := init.o extable.o proc-funcs.o memc.o fault.o \
6 small_page.o
diff --git a/arch/arm26/mm/extable.c b/arch/arm26/mm/extable.c
deleted file mode 100644
index 38e1958d9538..000000000000
--- a/arch/arm26/mm/extable.c
+++ /dev/null
@@ -1,24 +0,0 @@
1/*
2 * linux/arch/arm26/mm/extable.c
3 */
4
5#include <linux/module.h>
6#include <asm/uaccess.h>
7
8int fixup_exception(struct pt_regs *regs)
9{
10 const struct exception_table_entry *fixup;
11
12 fixup = search_exception_tables(instruction_pointer(regs));
13
14 /*
15 * The kernel runs in SVC mode - make sure we keep running in SVC mode
16 * by frobbing the PSR appropriately (PSR and PC are in the same reg.
17 * on ARM26)
18 */
19 if (fixup)
20 regs->ARM_pc = fixup->fixup | PSR_I_BIT | MODE_SVC26;
21
22 return fixup != NULL;
23}
24
diff --git a/arch/arm26/mm/fault.c b/arch/arm26/mm/fault.c
deleted file mode 100644
index dec638a0c8d9..000000000000
--- a/arch/arm26/mm/fault.c
+++ /dev/null
@@ -1,312 +0,0 @@
1/*
2 * linux/arch/arm26/mm/fault.c
3 *
4 * Copyright (C) 1995 Linus Torvalds
5 * Modifications for ARM processor (c) 1995-2001 Russell King
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11#include <linux/signal.h>
12#include <linux/sched.h>
13#include <linux/kernel.h>
14#include <linux/errno.h>
15#include <linux/string.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18#include <linux/mman.h>
19#include <linux/mm.h>
20#include <linux/interrupt.h>
21#include <linux/proc_fs.h>
22#include <linux/init.h>
23
24#include <asm/system.h>
25#include <asm/pgtable.h>
26#include <asm/uaccess.h> //FIXME this header may be bogusly included
27
28#include "fault.h"
29
30#define FAULT_CODE_LDRSTRPOST 0x80
31#define FAULT_CODE_LDRSTRPRE 0x40
32#define FAULT_CODE_LDRSTRREG 0x20
33#define FAULT_CODE_LDMSTM 0x10
34#define FAULT_CODE_LDCSTC 0x08
35#define FAULT_CODE_PREFETCH 0x04
36#define FAULT_CODE_WRITE 0x02
37#define FAULT_CODE_FORCECOW 0x01
38
39#define DO_COW(m) ((m) & (FAULT_CODE_WRITE|FAULT_CODE_FORCECOW))
40#define READ_FAULT(m) (!((m) & FAULT_CODE_WRITE))
41#define DEBUG
42/*
43 * This is useful to dump out the page tables associated with
44 * 'addr' in mm 'mm'.
45 */
46void show_pte(struct mm_struct *mm, unsigned long addr)
47{
48 pgd_t *pgd;
49
50 if (!mm)
51 mm = &init_mm;
52
53 printk(KERN_ALERT "pgd = %p\n", mm->pgd);
54 pgd = pgd_offset(mm, addr);
55 printk(KERN_ALERT "[%08lx] *pgd=%08lx", addr, pgd_val(*pgd));
56
57 do {
58 pmd_t *pmd;
59 pte_t *pte;
60
61 pmd = pmd_offset(pgd, addr);
62
63 if (pmd_none(*pmd))
64 break;
65
66 if (pmd_bad(*pmd)) {
67 printk("(bad)");
68 break;
69 }
70
71 /* We must not map this if we have highmem enabled */
72 /* FIXME */
73 pte = pte_offset_map(pmd, addr);
74 printk(", *pte=%08lx", pte_val(*pte));
75 pte_unmap(pte);
76 } while(0);
77
78 printk("\n");
79}
80
81/*
82 * Oops. The kernel tried to access some page that wasn't present.
83 */
84static void
85__do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
86 struct pt_regs *regs)
87{
88 /*
89 * Are we prepared to handle this kernel fault?
90 */
91 if (fixup_exception(regs))
92 return;
93
94 /*
95 * No handler, we'll have to terminate things with extreme prejudice.
96 */
97 bust_spinlocks(1);
98 printk(KERN_ALERT
99 "Unable to handle kernel %s at virtual address %08lx\n",
100 (addr < PAGE_SIZE) ? "NULL pointer dereference" :
101 "paging request", addr);
102
103 show_pte(mm, addr);
104 die("Oops", regs, fsr);
105 bust_spinlocks(0);
106 do_exit(SIGKILL);
107}
108
109/*
110 * Something tried to access memory that isn't in our memory map..
111 * User mode accesses just cause a SIGSEGV
112 */
113static void
114__do_user_fault(struct task_struct *tsk, unsigned long addr,
115 unsigned int fsr, int code, struct pt_regs *regs)
116{
117 struct siginfo si;
118
119#ifdef CONFIG_DEBUG_USER
120 printk("%s: unhandled page fault at 0x%08lx, code 0x%03x\n",
121 tsk->comm, addr, fsr);
122 show_pte(tsk->mm, addr);
123 show_regs(regs);
124 //dump_backtrace(regs, tsk); // FIXME ARM32 dropped this - why?
125 while(1); //FIXME - hack to stop debug going nutso
126#endif
127
128 tsk->thread.address = addr;
129 tsk->thread.error_code = fsr;
130 tsk->thread.trap_no = 14;
131 si.si_signo = SIGSEGV;
132 si.si_errno = 0;
133 si.si_code = code;
134 si.si_addr = (void *)addr;
135 force_sig_info(SIGSEGV, &si, tsk);
136}
137
138static int
139__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
140 struct task_struct *tsk)
141{
142 struct vm_area_struct *vma;
143 int fault, mask;
144
145 vma = find_vma(mm, addr);
146 fault = -2; /* bad map area */
147 if (!vma)
148 goto out;
149 if (vma->vm_start > addr)
150 goto check_stack;
151
152 /*
153 * Ok, we have a good vm_area for this
154 * memory access, so we can handle it.
155 */
156good_area:
157 if (READ_FAULT(fsr)) /* read? */
158 mask = VM_READ|VM_EXEC|VM_WRITE;
159 else
160 mask = VM_WRITE;
161
162 fault = -1; /* bad access type */
163 if (!(vma->vm_flags & mask))
164 goto out;
165
166 /*
167 * If for any reason at all we couldn't handle
168 * the fault, make sure we exit gracefully rather
169 * than endlessly redo the fault.
170 */
171survive:
172 fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, DO_COW(fsr));
173 if (unlikely(fault & VM_FAULT_ERROR)) {
174 if (fault & VM_FAULT_OOM)
175 goto out_of_memory;
176 else if (fault & VM_FAULT_SIGBUS)
177 return fault;
178 BUG();
179 }
180 if (fault & VM_FAULT_MAJOR)
181 tsk->maj_flt++;
182 else
183 tsk->min_flt++;
184 return fault;
185
186out_of_memory:
187 fault = -3; /* out of memory */
188 if (!is_init(tsk))
189 goto out;
190
191 /*
192 * If we are out of memory for pid1,
193 * sleep for a while and retry
194 */
195 yield();
196 goto survive;
197
198check_stack:
199 if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
200 goto good_area;
201out:
202 return fault;
203}
204
205int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
206{
207 struct task_struct *tsk;
208 struct mm_struct *mm;
209 int fault;
210
211 tsk = current;
212 mm = tsk->mm;
213
214 /*
215 * If we're in an interrupt or have no user
216 * context, we must not take the fault..
217 */
218 if (in_atomic() || !mm)
219 goto no_context;
220
221 down_read(&mm->mmap_sem);
222 fault = __do_page_fault(mm, addr, fsr, tsk);
223 up_read(&mm->mmap_sem);
224
225 /*
226 * Handle the "normal" case first
227 */
228 if (likely(!(fault & VM_FAULT_ERROR)))
229 return 0;
230 if (fault & VM_FAULT_SIGBUS)
231 goto do_sigbus;
232 /* else VM_FAULT_OOM */
233
234 /*
235 * If we are in kernel mode at this point, we
236 * have no context to handle this fault with.
237 * FIXME - is this test right?
238 */
239 if (!user_mode(regs)){
240 goto no_context;
241 }
242
243 if (fault == -3) {
244 /*
245 * We ran out of memory, or some other thing happened to
246 * us that made us unable to handle the page fault gracefully.
247 */
248 printk("VM: killing process %s\n", tsk->comm);
249 do_exit(SIGKILL);
250 }
251 else{
252 __do_user_fault(tsk, addr, fsr, fault == -1 ? SEGV_ACCERR : SEGV_MAPERR, regs);
253 }
254
255 return 0;
256
257
258/*
259 * We ran out of memory, or some other thing happened to us that made
260 * us unable to handle the page fault gracefully.
261 */
262do_sigbus:
263 /*
264 * Send a sigbus, regardless of whether we were in kernel
265 * or user mode.
266 */
267 tsk->thread.address = addr; //FIXME - need other bits setting?
268 tsk->thread.error_code = fsr;
269 tsk->thread.trap_no = 14;
270 force_sig(SIGBUS, tsk);
271#ifdef CONFIG_DEBUG_USER
272 printk(KERN_DEBUG "%s: sigbus at 0x%08lx, pc=0x%08lx\n",
273 current->comm, addr, instruction_pointer(regs));
274#endif
275
276 /* Kernel mode? Handle exceptions or die */
277 if (user_mode(regs))
278 return 0;
279
280no_context:
281 __do_kernel_fault(mm, addr, fsr, regs);
282 return 0;
283}
284
285/*
286 * Handle a data abort. Note that we have to handle a range of addresses
287 * on ARM2/3 for ldm. If both pages are zero-mapped, then we have to force
288 * a copy-on-write. However, on the second page, we always force COW.
289 */
290asmlinkage void
291do_DataAbort(unsigned long min_addr, unsigned long max_addr, int mode, struct pt_regs *regs)
292{
293 do_page_fault(min_addr, mode, regs);
294
295 if ((min_addr ^ max_addr) >> PAGE_SHIFT){
296 do_page_fault(max_addr, mode | FAULT_CODE_FORCECOW, regs);
297 }
298}
299
300asmlinkage int
301do_PrefetchAbort(unsigned long addr, struct pt_regs *regs)
302{
303#if 0
304 if (the memc mapping for this page exists) {
305 printk ("Page in, but got abort (undefined instruction?)\n");
306 return 0;
307 }
308#endif
309 do_page_fault(addr, FAULT_CODE_PREFETCH, regs);
310 return 1;
311}
312
diff --git a/arch/arm26/mm/fault.h b/arch/arm26/mm/fault.h
deleted file mode 100644
index 4442d00d86ac..000000000000
--- a/arch/arm26/mm/fault.h
+++ /dev/null
@@ -1,5 +0,0 @@
1void show_pte(struct mm_struct *mm, unsigned long addr);
2
3int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
4
5unsigned long search_extable(unsigned long addr); //FIXME - is it right?
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c
deleted file mode 100644
index 36e7ee3f8321..000000000000
--- a/arch/arm26/mm/init.c
+++ /dev/null
@@ -1,403 +0,0 @@
1/*
2 * linux/arch/arm26/mm/init.c
3 *
4 * Copyright (C) 1995-2002 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/signal.h>
11#include <linux/sched.h>
12#include <linux/kernel.h>
13#include <linux/errno.h>
14#include <linux/string.h>
15#include <linux/types.h>
16#include <linux/ptrace.h>
17#include <linux/mman.h>
18#include <linux/mm.h>
19#include <linux/swap.h>
20#include <linux/smp.h>
21#include <linux/init.h>
22#include <linux/initrd.h>
23#include <linux/bootmem.h>
24#include <linux/blkdev.h>
25#include <linux/pfn.h>
26
27#include <asm/segment.h>
28#include <asm/mach-types.h>
29#include <asm/dma.h>
30#include <asm/hardware.h>
31#include <asm/setup.h>
32#include <asm/tlb.h>
33
34#include <asm/map.h>
35
36struct mmu_gather mmu_gathers[NR_CPUS];
37
38extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
39extern char _stext, _text, _etext, _end, __init_begin, __init_end;
40#ifdef CONFIG_XIP_KERNEL
41extern char _endtext, _sdata;
42#endif
43extern unsigned long phys_initrd_start;
44extern unsigned long phys_initrd_size;
45
46/*
47 * The sole use of this is to pass memory configuration
48 * data from paging_init to mem_init.
49 */
50static struct meminfo meminfo __initdata = { 0, };
51
52/*
53 * empty_zero_page is a special page that is used for
54 * zero-initialized data and COW.
55 */
56struct page *empty_zero_page;
57
58void show_mem(void)
59{
60 int free = 0, total = 0, reserved = 0;
61 int shared = 0, cached = 0, slab = 0;
62 struct page *page, *end;
63
64 printk("Mem-info:\n");
65 show_free_areas();
66 printk("Free swap: %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
67
68
69 page = NODE_MEM_MAP(0);
70 end = page + NODE_DATA(0)->node_spanned_pages;
71
72 do {
73 total++;
74 if (PageReserved(page))
75 reserved++;
76 else if (PageSwapCache(page))
77 cached++;
78 else if (PageSlab(page))
79 slab++;
80 else if (!page_count(page))
81 free++;
82 else
83 shared += page_count(page) - 1;
84 page++;
85 } while (page < end);
86
87 printk("%d pages of RAM\n", total);
88 printk("%d free pages\n", free);
89 printk("%d reserved pages\n", reserved);
90 printk("%d slab pages\n", slab);
91 printk("%d pages shared\n", shared);
92 printk("%d pages swap cached\n", cached);
93}
94
95struct node_info {
96 unsigned int start;
97 unsigned int end;
98 int bootmap_pages;
99};
100
101/*
102 * FIXME: We really want to avoid allocating the bootmap bitmap
103 * over the top of the initrd. Hopefully, this is located towards
104 * the start of a bank, so if we allocate the bootmap bitmap at
105 * the end, we won't clash.
106 */
107static unsigned int __init
108find_bootmap_pfn(struct meminfo *mi, unsigned int bootmap_pages)
109{
110 unsigned int start_pfn, bootmap_pfn;
111 unsigned int start, end;
112
113 start_pfn = PFN_UP((unsigned long)&_end);
114 bootmap_pfn = 0;
115
116 /* ARM26 machines only have one node */
117 if (mi->bank->node != 0)
118 BUG();
119
120 start = PFN_UP(mi->bank->start);
121 end = PFN_DOWN(mi->bank->size + mi->bank->start);
122
123 if (start < start_pfn)
124 start = start_pfn;
125
126 if (end <= start)
127 BUG();
128
129 if (end - start >= bootmap_pages)
130 bootmap_pfn = start;
131 else
132 BUG();
133
134 return bootmap_pfn;
135}
136
137/*
138 * Scan the memory info structure and pull out:
139 * - the end of memory
140 * - the number of nodes
141 * - the pfn range of each node
142 * - the number of bootmem bitmap pages
143 */
144static void __init
145find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
146{
147 unsigned int memend_pfn = 0;
148
149 nodes_clear(node_online_map);
150 node_set_online(0);
151
152 np->bootmap_pages = 0;
153
154 if (mi->bank->size == 0) {
155 BUG();
156 }
157
158 /*
159 * Get the start and end pfns for this bank
160 */
161 np->start = PFN_UP(mi->bank->start);
162 np->end = PFN_DOWN(mi->bank->start + mi->bank->size);
163
164 if (memend_pfn < np->end)
165 memend_pfn = np->end;
166
167 /*
168 * Calculate the number of pages we require to
169 * store the bootmem bitmaps.
170 */
171 np->bootmap_pages = bootmem_bootmap_pages(np->end - np->start);
172
173 /*
174 * This doesn't seem to be used by the Linux memory
175 * manager any more. If we can get rid of it, we
176 * also get rid of some of the stuff above as well.
177 */
178 max_low_pfn = memend_pfn - PFN_DOWN(PHYS_OFFSET);
179 max_pfn = memend_pfn - PFN_DOWN(PHYS_OFFSET);
180 mi->end = memend_pfn << PAGE_SHIFT;
181
182}
183
184/*
185 * Initialise the bootmem allocator for all nodes. This is called
186 * early during the architecture specific initialisation.
187 */
188void __init bootmem_init(struct meminfo *mi)
189{
190 struct node_info node_info;
191 unsigned int bootmap_pfn;
192 pg_data_t *pgdat = NODE_DATA(0);
193
194 find_memend_and_nodes(mi, &node_info);
195
196 bootmap_pfn = find_bootmap_pfn(mi, node_info.bootmap_pages);
197
198 /*
199 * Note that node 0 must always have some pages.
200 */
201 if (node_info.end == 0)
202 BUG();
203
204 /*
205 * Initialise the bootmem allocator.
206 */
207 init_bootmem_node(pgdat, bootmap_pfn, node_info.start, node_info.end);
208
209 /*
210 * Register all available RAM in this node with the bootmem allocator.
211 */
212 free_bootmem_node(pgdat, mi->bank->start, mi->bank->size);
213
214 /*
215 * Register the kernel text and data with bootmem.
216 * Note: with XIP we dont register .text since
217 * its in ROM.
218 */
219#ifdef CONFIG_XIP_KERNEL
220 reserve_bootmem_node(pgdat, __pa(&_sdata), &_end - &_sdata);
221#else
222 reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
223#endif
224
225 /*
226 * And don't forget to reserve the allocator bitmap,
227 * which will be freed later.
228 */
229 reserve_bootmem_node(pgdat, bootmap_pfn << PAGE_SHIFT,
230 node_info.bootmap_pages << PAGE_SHIFT);
231
232 /*
233 * These should likewise go elsewhere. They pre-reserve
234 * the screen memory region at the start of main system
235 * memory. FIXME - screen RAM is not 512K!
236 */
237 reserve_bootmem_node(pgdat, 0x02000000, 0x00080000);
238
239#ifdef CONFIG_BLK_DEV_INITRD
240 initrd_start = phys_initrd_start;
241 initrd_end = initrd_start + phys_initrd_size;
242
243 /* Achimedes machines only have one node, so initrd is in node 0 */
244#ifdef CONFIG_XIP_KERNEL
245 /* Only reserve initrd space if it is in RAM */
246 if(initrd_start && initrd_start < 0x03000000){
247#else
248 if(initrd_start){
249#endif
250 reserve_bootmem_node(pgdat, __pa(initrd_start),
251 initrd_end - initrd_start);
252 }
253#endif /* CONFIG_BLK_DEV_INITRD */
254
255
256}
257
258/*
259 * paging_init() sets up the page tables, initialises the zone memory
260 * maps, and sets up the zero page, bad page and bad page tables.
261 */
262void __init paging_init(struct meminfo *mi)
263{
264 void *zero_page;
265 unsigned long zone_size[MAX_NR_ZONES];
266 unsigned long zhole_size[MAX_NR_ZONES];
267 struct bootmem_data *bdata;
268 pg_data_t *pgdat;
269 int i;
270
271 memcpy(&meminfo, mi, sizeof(meminfo));
272
273 /*
274 * allocate the zero page. Note that we count on this going ok.
275 */
276 zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
277
278 /*
279 * initialise the page tables.
280 */
281 memtable_init(mi);
282 flush_tlb_all();
283
284 /*
285 * initialise the zones in node 0 (archimedes have only 1 node)
286 */
287
288 for (i = 0; i < MAX_NR_ZONES; i++) {
289 zone_size[i] = 0;
290 zhole_size[i] = 0;
291 }
292
293 pgdat = NODE_DATA(0);
294 bdata = pgdat->bdata;
295 zone_size[0] = bdata->node_low_pfn -
296 (bdata->node_boot_start >> PAGE_SHIFT);
297 if (!zone_size[0])
298 BUG();
299 pgdat->node_mem_map = NULL;
300 free_area_init_node(0, pgdat, zone_size,
301 bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
302
303 /*
304 * finish off the bad pages once
305 * the mem_map is initialised
306 */
307 memzero(zero_page, PAGE_SIZE);
308 empty_zero_page = virt_to_page(zero_page);
309}
310
311static inline void free_area(unsigned long addr, unsigned long end, char *s)
312{
313 unsigned int size = (end - addr) >> 10;
314
315 for (; addr < end; addr += PAGE_SIZE) {
316 struct page *page = virt_to_page(addr);
317 ClearPageReserved(page);
318 init_page_count(page);
319 free_page(addr);
320 totalram_pages++;
321 }
322
323 if (size && s)
324 printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
325}
326
327/*
328 * mem_init() marks the free areas in the mem_map and tells us how much
329 * memory is free. This is done after various parts of the system have
330 * claimed their memory after the kernel image.
331 */
332void __init mem_init(void)
333{
334 unsigned int codepages, datapages, initpages;
335 pg_data_t *pgdat = NODE_DATA(0);
336 extern int sysctl_overcommit_memory;
337
338
339 /* Note: data pages includes BSS */
340#ifdef CONFIG_XIP_KERNEL
341 codepages = &_endtext - &_text;
342 datapages = &_end - &_sdata;
343#else
344 codepages = &_etext - &_text;
345 datapages = &_end - &_etext;
346#endif
347 initpages = &__init_end - &__init_begin;
348
349 high_memory = (void *)__va(meminfo.end);
350 max_mapnr = virt_to_page(high_memory) - mem_map;
351
352 /* this will put all unused low memory onto the freelists */
353 if (pgdat->node_spanned_pages != 0)
354 totalram_pages += free_all_bootmem_node(pgdat);
355
356 num_physpages = meminfo.bank[0].size >> PAGE_SHIFT;
357
358 printk(KERN_INFO "Memory: %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
359 printk(KERN_NOTICE "Memory: %luKB available (%dK code, "
360 "%dK data, %dK init)\n",
361 (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
362 codepages >> 10, datapages >> 10, initpages >> 10);
363
364 /*
365 * Turn on overcommit on tiny machines
366 */
367 if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
368 sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
369 printk("Turning on overcommit\n");
370 }
371}
372
373void free_initmem(void){
374#ifndef CONFIG_XIP_KERNEL
375 free_area((unsigned long)(&__init_begin),
376 (unsigned long)(&__init_end),
377 "init");
378#endif
379}
380
381#ifdef CONFIG_BLK_DEV_INITRD
382
383static int keep_initrd;
384
385void free_initrd_mem(unsigned long start, unsigned long end)
386{
387#ifdef CONFIG_XIP_KERNEL
388 /* Only bin initrd if it is in RAM... */
389 if(!keep_initrd && start < 0x03000000)
390#else
391 if (!keep_initrd)
392#endif
393 free_area(start, end, "initrd");
394}
395
396static int __init keepinitrd_setup(char *__unused)
397{
398 keep_initrd = 1;
399 return 1;
400}
401
402__setup("keepinitrd", keepinitrd_setup);
403#endif
diff --git a/arch/arm26/mm/memc.c b/arch/arm26/mm/memc.c
deleted file mode 100644
index ffecd8578247..000000000000
--- a/arch/arm26/mm/memc.c
+++ /dev/null
@@ -1,184 +0,0 @@
1/*
2 * linux/arch/arm26/mm/memc.c
3 *
4 * Copyright (C) 1998-2000 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * Page table sludge for older ARM processor architectures.
11 */
12#include <linux/sched.h>
13#include <linux/mm.h>
14#include <linux/init.h>
15#include <linux/bootmem.h>
16
17#include <asm/pgtable.h>
18#include <asm/pgalloc.h>
19#include <asm/page.h>
20#include <asm/memory.h>
21#include <asm/hardware.h>
22
23#include <asm/map.h>
24
25#define MEMC_TABLE_SIZE (256*sizeof(unsigned long))
26
27struct kmem_cache *pte_cache, *pgd_cache;
28int page_nr;
29
30/*
31 * Allocate space for a page table and a MEMC table.
32 * Note that we place the MEMC
33 * table before the page directory. This means we can
34 * easily get to both tightly-associated data structures
35 * with a single pointer.
36 */
37static inline pgd_t *alloc_pgd_table(void)
38{
39 void *pg2k = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
40
41 if (pg2k)
42 pg2k += MEMC_TABLE_SIZE;
43
44 return (pgd_t *)pg2k;
45}
46
47/*
48 * Free a page table. this function is the counterpart to get_pgd_slow
49 * below, not alloc_pgd_table above.
50 */
51void free_pgd_slow(pgd_t *pgd)
52{
53 unsigned long tbl = (unsigned long)pgd;
54
55 tbl -= MEMC_TABLE_SIZE;
56
57 kmem_cache_free(pgd_cache, (void *)tbl);
58}
59
60/*
61 * Allocate a new pgd and fill it in ready for use
62 *
63 * A new tasks pgd is completely empty (all pages !present) except for:
64 *
65 * o The machine vectors at virtual address 0x0
66 * o The vmalloc region at the top of address space
67 *
68 */
69#define FIRST_KERNEL_PGD_NR (FIRST_USER_PGD_NR + USER_PTRS_PER_PGD)
70
71pgd_t *get_pgd_slow(struct mm_struct *mm)
72{
73 pgd_t *new_pgd, *init_pgd;
74 pmd_t *new_pmd, *init_pmd;
75 pte_t *new_pte, *init_pte;
76
77 new_pgd = alloc_pgd_table();
78 if (!new_pgd)
79 goto no_pgd;
80
81 /*
82 * On ARM, first page must always be allocated since it contains
83 * the machine vectors.
84 */
85 new_pmd = pmd_alloc(mm, new_pgd, 0);
86 if (!new_pmd)
87 goto no_pmd;
88
89 new_pte = pte_alloc_map(mm, new_pmd, 0);
90 if (!new_pte)
91 goto no_pte;
92
93 init_pgd = pgd_offset(&init_mm, 0);
94 init_pmd = pmd_offset(init_pgd, 0);
95 init_pte = pte_offset(init_pmd, 0);
96
97 set_pte(new_pte, *init_pte);
98 pte_unmap(new_pte);
99
100 /*
101 * the page table entries are zeroed
102 * when the table is created. (see the cache_ctor functions below)
103 * Now we need to plonk the kernel (vmalloc) area at the end of
104 * the address space. We copy this from the init thread, just like
105 * the init_pte we copied above...
106 */
107 memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
108 (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
109
110 /* update MEMC tables */
111 cpu_memc_update_all(new_pgd);
112 return new_pgd;
113
114no_pte:
115 pmd_free(new_pmd);
116no_pmd:
117 free_pgd_slow(new_pgd);
118no_pgd:
119 return NULL;
120}
121
122/*
123 * No special code is required here.
124 */
125void setup_mm_for_reboot(char mode)
126{
127}
128
129/*
130 * This contains the code to setup the memory map on an ARM2/ARM250/ARM3
131 * o swapper_pg_dir = 0x0207d000
132 * o kernel proper starts at 0x0208000
133 * o create (allocate) a pte to contain the machine vectors
134 * o populate the pte (points to 0x02078000) (FIXME - is it zeroed?)
135 * o populate the init tasks page directory (pgd) with the new pte
136 * o zero the rest of the init tasks pgdir (FIXME - what about vmalloc?!)
137 */
138void __init memtable_init(struct meminfo *mi)
139{
140 pte_t *pte;
141 int i;
142
143 page_nr = max_low_pfn;
144
145 pte = alloc_bootmem_low_pages(PTRS_PER_PTE * sizeof(pte_t));
146 pte[0] = mk_pte_phys(PAGE_OFFSET + SCREEN_SIZE, PAGE_READONLY);
147 pmd_populate(&init_mm, pmd_offset(swapper_pg_dir, 0), pte);
148
149 for (i = 1; i < PTRS_PER_PGD; i++)
150 pgd_val(swapper_pg_dir[i]) = 0;
151}
152
153void __init iotable_init(struct map_desc *io_desc)
154{
155 /* nothing to do */
156}
157
158/*
159 * We never have holes in the memmap
160 */
161void __init create_memmap_holes(struct meminfo *mi)
162{
163}
164
165static void pte_cache_ctor(void *pte, struct kmem_cache *cache, unsigned long flags)
166{
167 memzero(pte, sizeof(pte_t) * PTRS_PER_PTE);
168}
169
170static void pgd_cache_ctor(void *pgd, struct kmem_cache *cache, unsigned long flags)
171{
172 memzero(pgd + MEMC_TABLE_SIZE, USER_PTRS_PER_PGD * sizeof(pgd_t));
173}
174
175void __init pgtable_cache_init(void)
176{
177 pte_cache = kmem_cache_create("pte-cache",
178 sizeof(pte_t) * PTRS_PER_PTE,
179 0, SLAB_PANIC, pte_cache_ctor);
180
181 pgd_cache = kmem_cache_create("pgd-cache", MEMC_TABLE_SIZE +
182 sizeof(pgd_t) * PTRS_PER_PGD,
183 0, SLAB_PANIC, pgd_cache_ctor);
184}
diff --git a/arch/arm26/mm/proc-funcs.S b/arch/arm26/mm/proc-funcs.S
deleted file mode 100644
index f9fca524c57a..000000000000
--- a/arch/arm26/mm/proc-funcs.S
+++ /dev/null
@@ -1,359 +0,0 @@
1/*
2 * linux/arch/arm26/mm/proc-arm2,3.S
3 *
4 * Copyright (C) 1997-1999 Russell King
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 version 2 as
8 * published by the Free Software Foundation.
9 *
10 * MMU functions for ARM2,3
11 *
12 * These are the low level assembler for performing cache
13 * and memory functions on ARM2, ARM250 and ARM3 processors.
14 */
15#include <linux/linkage.h>
16#include <asm/assembler.h>
17#include <asm/asm-offsets.h>
18#include <asm/procinfo.h>
19#include <asm/ptrace.h>
20
21/*
22 * MEMC workhorse code. It's both a horse which things it's a pig.
23 */
24/*
25 * Function: cpu_memc_update_entry(pgd_t *pgd, unsigned long phys_pte, unsigned long addr)
26 * Params : pgd Page tables/MEMC mapping
27 * : phys_pte physical address, or PTE
28 * : addr virtual address
29 */
30ENTRY(cpu_memc_update_entry)
31 tst r1, #PAGE_PRESENT @ is the page present
32 orreq r1, r1, #PAGE_OLD | PAGE_CLEAN
33 moveq r2, #0x01f00000
34 mov r3, r1, lsr #13 @ convert to physical page nr
35 and r3, r3, #0x3fc
36 adr ip, memc_phys_table_32
37 ldr r3, [ip, r3]
38 tst r1, #PAGE_OLD | PAGE_NOT_USER
39 biceq r3, r3, #0x200
40 tsteq r1, #PAGE_READONLY | PAGE_CLEAN
41 biceq r3, r3, #0x300
42 mov r2, r2, lsr #15 @ virtual -> nr
43 orr r3, r3, r2, lsl #15
44 and r2, r2, #0x300
45 orr r3, r3, r2, lsl #2
46 and r2, r3, #255
47 sub r0, r0, #256 * 4
48 str r3, [r0, r2, lsl #2]
49 strb r3, [r3]
50 movs pc, lr
51/*
52 * Params : r0 = preserved
53 * : r1 = memc table base (preserved)
54 * : r2 = page table entry
55 * : r3 = preserved
56 * : r4 = unused
57 * : r5 = memc physical address translation table
58 * : ip = virtual address (preserved)
59 */
60update_pte:
61 mov r4, r2, lsr #13
62 and r4, r4, #0x3fc
63 ldr r4, [r5, r4] @ covert to MEMC page
64
65 tst r2, #PAGE_OLD | PAGE_NOT_USER @ check for MEMC read
66 biceq r4, r4, #0x200
67 tsteq r2, #PAGE_READONLY | PAGE_CLEAN @ check for MEMC write
68 biceq r4, r4, #0x300
69
70 orr r4, r4, ip
71 and r2, ip, #0x01800000
72 orr r4, r4, r2, lsr #13
73
74 and r2, r4, #255
75 str r4, [r1, r2, lsl #2]
76 movs pc, lr
77
78/*
79 * Params : r0 = preserved
80 * : r1 = memc table base (preserved)
81 * : r2 = page table base
82 * : r3 = preserved
83 * : r4 = unused
84 * : r5 = memc physical address translation table
85 * : ip = virtual address (updated)
86 */
87update_pte_table:
88 stmfd sp!, {r0, lr}
89 bic r0, r2, #3
901: ldr r2, [r0], #4 @ get entry
91 tst r2, #PAGE_PRESENT @ page present
92 blne update_pte @ process pte
93 add ip, ip, #32768 @ increment virt addr
94 ldr r2, [r0], #4 @ get entry
95 tst r2, #PAGE_PRESENT @ page present
96 blne update_pte @ process pte
97 add ip, ip, #32768 @ increment virt addr
98 ldr r2, [r0], #4 @ get entry
99 tst r2, #PAGE_PRESENT @ page present
100 blne update_pte @ process pte
101 add ip, ip, #32768 @ increment virt addr
102 ldr r2, [r0], #4 @ get entry
103 tst r2, #PAGE_PRESENT @ page present
104 blne update_pte @ process pte
105 add ip, ip, #32768 @ increment virt addr
106 tst ip, #32768 * 31 @ finished?
107 bne 1b
108 ldmfd sp!, {r0, pc}^
109
110/*
111 * Function: cpu_memc_update_all(pgd_t *pgd)
112 * Params : pgd Page tables/MEMC mapping
113 * Notes : this is optimised for 32k pages
114 */
115ENTRY(cpu_memc_update_all)
116 stmfd sp!, {r4, r5, lr}
117 bl clear_tables
118 sub r1, r0, #256 * 4 @ start of MEMC tables
119 adr r5, memc_phys_table_32 @ Convert to logical page number
120 mov ip, #0 @ virtual address
1211: ldmia r0!, {r2, r3} @ load two pgd entries
122 tst r2, #PAGE_PRESENT @ is pgd entry present?
123 addeq ip, ip, #1048576 @FIXME - PAGE_PRESENT is for PTEs technically...
124 blne update_pte_table
125 mov r2, r3
126 tst r2, #PAGE_PRESENT @ is pgd entry present?
127 addeq ip, ip, #1048576
128 blne update_pte_table
129 teq ip, #32 * 1048576
130 bne 1b
131 ldmfd sp!, {r4, r5, pc}^
132
133/*
134 * Build the table to map from physical page number to memc page number
135 */
136 .type memc_phys_table_32, #object
137memc_phys_table_32:
138 .irp b7, 0x00, 0x80
139 .irp b6, 0x00, 0x02
140 .irp b5, 0x00, 0x04
141 .irp b4, 0x00, 0x01
142
143 .irp b3, 0x00, 0x40
144 .irp b2, 0x00, 0x20
145 .irp b1, 0x00, 0x10
146 .irp b0, 0x00, 0x08
147 .long 0x03800300 + \b7 + \b6 + \b5 + \b4 + \b3 + \b2 + \b1 + \b0
148 .endr
149 .endr
150 .endr
151 .endr
152
153 .endr
154 .endr
155 .endr
156 .endr
157 .size memc_phys_table_32, . - memc_phys_table_32
158
159/*
160 * helper for cpu_memc_update_all, this clears out all
161 * mappings, setting them close to the top of memory,
162 * and inaccessible (0x01f00000).
163 * Params : r0 = page table pointer
164 */
165clear_tables: ldr r1, _arm3_set_pgd - 4
166 ldr r2, [r1]
167 sub r1, r0, #256 * 4 @ start of MEMC tables
168 add r2, r1, r2, lsl #2 @ end of tables
169 mov r3, #0x03f00000 @ Default mapping (null mapping)
170 orr r3, r3, #0x00000f00
171 orr r4, r3, #1
172 orr r5, r3, #2
173 orr ip, r3, #3
1741: stmia r1!, {r3, r4, r5, ip}
175 add r3, r3, #4
176 add r4, r4, #4
177 add r5, r5, #4
178 add ip, ip, #4
179 stmia r1!, {r3, r4, r5, ip}
180 add r3, r3, #4
181 add r4, r4, #4
182 add r5, r5, #4
183 add ip, ip, #4
184 teq r1, r2
185 bne 1b
186 mov pc, lr
187
188/*
189 * Function: *_set_pgd(pgd_t *pgd)
190 * Params : pgd New page tables/MEMC mapping
191 * Purpose : update MEMC hardware with new mapping
192 */
193 .word page_nr @ extern - declared in mm-memc.c
194_arm3_set_pgd: mcr p15, 0, r1, c1, c0, 0 @ flush cache
195_arm2_set_pgd: stmfd sp!, {lr}
196 ldr r1, _arm3_set_pgd - 4
197 ldr r2, [r1]
198 sub r0, r0, #256 * 4 @ start of MEMC tables
199 add r1, r0, r2, lsl #2 @ end of tables
2001: ldmia r0!, {r2, r3, ip, lr}
201 strb r2, [r2]
202 strb r3, [r3]
203 strb ip, [ip]
204 strb lr, [lr]
205 ldmia r0!, {r2, r3, ip, lr}
206 strb r2, [r2]
207 strb r3, [r3]
208 strb ip, [ip]
209 strb lr, [lr]
210 teq r0, r1
211 bne 1b
212 ldmfd sp!, {pc}^
213
214/*
215 * Function: *_proc_init (void)
216 * Purpose : Initialise the cache control registers
217 */
218_arm3_proc_init:
219 mov r0, #0x001f0000
220 orr r0, r0, #0x0000ff00
221 orr r0, r0, #0x000000ff
222 mcr p15, 0, r0, c3, c0 @ ARM3 Cacheable
223 mcr p15, 0, r0, c4, c0 @ ARM3 Updateable
224 mov r0, #0
225 mcr p15, 0, r0, c5, c0 @ ARM3 Disruptive
226 mcr p15, 0, r0, c1, c0 @ ARM3 Flush
227 mov r0, #3
228 mcr p15, 0, r0, c2, c0 @ ARM3 Control
229_arm2_proc_init:
230 movs pc, lr
231
232/*
233 * Function: *_proc_fin (void)
234 * Purpose : Finalise processor (disable caches)
235 */
236_arm3_proc_fin: mov r0, #2
237 mcr p15, 0, r0, c2, c0
238_arm2_proc_fin: orrs pc, lr, #PSR_I_BIT|PSR_F_BIT
239
240/*
241 * Function: *_xchg_1 (int new, volatile void *ptr)
242 * Params : new New value to store at...
243 * : ptr pointer to byte-wide location
244 * Purpose : Performs an exchange operation
245 * Returns : Original byte data at 'ptr'
246 */
247_arm2_xchg_1: mov r2, pc
248 orr r2, r2, #PSR_I_BIT
249 teqp r2, #0
250 ldrb r2, [r1]
251 strb r0, [r1]
252 mov r0, r2
253 movs pc, lr
254
255_arm3_xchg_1: swpb r0, r0, [r1]
256 movs pc, lr
257
258/*
259 * Function: *_xchg_4 (int new, volatile void *ptr)
260 * Params : new New value to store at...
261 * : ptr pointer to word-wide location
262 * Purpose : Performs an exchange operation
263 * Returns : Original word data at 'ptr'
264 */
265_arm2_xchg_4: mov r2, pc
266 orr r2, r2, #PSR_I_BIT
267 teqp r2, #0
268 ldr r2, [r1]
269 str r0, [r1]
270 mov r0, r2
271 movs pc, lr
272
273_arm3_xchg_4: swp r0, r0, [r1]
274 movs pc, lr
275
276_arm2_3_check_bugs:
277 bics pc, lr, #PSR_F_BIT @ Clear FIQ disable bit
278
279armvlsi_name: .asciz "ARM/VLSI"
280_arm2_name: .asciz "ARM 2"
281_arm250_name: .asciz "ARM 250"
282_arm3_name: .asciz "ARM 3"
283
284 .section ".init.text", #alloc, #execinstr
285/*
286 * Purpose : Function pointers used to access above functions - all calls
287 * come through these
288 */
289 .globl arm2_processor_functions
290arm2_processor_functions:
291 .word _arm2_3_check_bugs
292 .word _arm2_proc_init
293 .word _arm2_proc_fin
294 .word _arm2_set_pgd
295 .word _arm2_xchg_1
296 .word _arm2_xchg_4
297
298cpu_arm2_info:
299 .long armvlsi_name
300 .long _arm2_name
301
302 .globl arm250_processor_functions
303arm250_processor_functions:
304 .word _arm2_3_check_bugs
305 .word _arm2_proc_init
306 .word _arm2_proc_fin
307 .word _arm2_set_pgd
308 .word _arm3_xchg_1
309 .word _arm3_xchg_4
310
311cpu_arm250_info:
312 .long armvlsi_name
313 .long _arm250_name
314
315 .globl arm3_processor_functions
316arm3_processor_functions:
317 .word _arm2_3_check_bugs
318 .word _arm3_proc_init
319 .word _arm3_proc_fin
320 .word _arm3_set_pgd
321 .word _arm3_xchg_1
322 .word _arm3_xchg_4
323
324cpu_arm3_info:
325 .long armvlsi_name
326 .long _arm3_name
327
328arm2_arch_name: .asciz "armv1"
329arm3_arch_name: .asciz "armv2"
330arm2_elf_name: .asciz "v1"
331arm3_elf_name: .asciz "v2"
332 .align
333
334 .section ".proc.info", #alloc, #execinstr
335
336 .long 0x41560200
337 .long 0xfffffff0
338 .long arm2_arch_name
339 .long arm2_elf_name
340 .long 0
341 .long cpu_arm2_info
342 .long arm2_processor_functions
343
344 .long 0x41560250
345 .long 0xfffffff0
346 .long arm3_arch_name
347 .long arm3_elf_name
348 .long 0
349 .long cpu_arm250_info
350 .long arm250_processor_functions
351
352 .long 0x41560300
353 .long 0xfffffff0
354 .long arm3_arch_name
355 .long arm3_elf_name
356 .long 0
357 .long cpu_arm3_info
358 .long arm3_processor_functions
359
diff --git a/arch/arm26/mm/small_page.c b/arch/arm26/mm/small_page.c
deleted file mode 100644
index 30447106c25f..000000000000
--- a/arch/arm26/mm/small_page.c
+++ /dev/null
@@ -1,192 +0,0 @@
1/*
2 * linux/arch/arm26/mm/small_page.c
3 *
4 * Copyright (C) 1996 Russell King
5 * Copyright (C) 2003 Ian Molton
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * Changelog:
12 * 26/01/1996 RMK Cleaned up various areas to make little more generic
13 * 07/02/1999 RMK Support added for 16K and 32K page sizes
14 * containing 8K blocks
15 * 23/05/2004 IM Fixed to use struct page->lru (thanks wli)
16 *
17 */
18#include <linux/signal.h>
19#include <linux/sched.h>
20#include <linux/kernel.h>
21#include <linux/errno.h>
22#include <linux/string.h>
23#include <linux/types.h>
24#include <linux/ptrace.h>
25#include <linux/mman.h>
26#include <linux/mm.h>
27#include <linux/swap.h>
28#include <linux/smp.h>
29#include <linux/bitops.h>
30
31#include <asm/pgtable.h>
32
33#define PEDANTIC
34
35/*
36 * Requirement:
37 * We need to be able to allocate naturally aligned memory of finer
38 * granularity than the page size. This is typically used for the
39 * second level page tables on 32-bit ARMs.
40 *
41 * FIXME - this comment is *out of date*
42 * Theory:
43 * We "misuse" the Linux memory management system. We use alloc_page
44 * to allocate a page and then mark it as reserved. The Linux memory
45 * management system will then ignore the "offset", "next_hash" and
46 * "pprev_hash" entries in the mem_map for this page.
47 *
48 * We then use a bitstring in the "offset" field to mark which segments
49 * of the page are in use, and manipulate this as required during the
50 * allocation and freeing of these small pages.
51 *
52 * We also maintain a queue of pages being used for this purpose using
53 * the "next_hash" and "pprev_hash" entries of mem_map;
54 */
55
56struct order {
57 struct list_head queue;
58 unsigned int mask; /* (1 << shift) - 1 */
59 unsigned int shift; /* (1 << shift) size of page */
60 unsigned int block_mask; /* nr_blocks - 1 */
61 unsigned int all_used; /* (1 << nr_blocks) - 1 */
62};
63
64
65static struct order orders[] = {
66#if PAGE_SIZE == 32768
67 { LIST_HEAD_INIT(orders[0].queue), 2047, 11, 15, 0x0000ffff },
68 { LIST_HEAD_INIT(orders[1].queue), 8191, 13, 3, 0x0000000f }
69#else
70#error unsupported page size (ARGH!)
71#endif
72};
73
74#define USED_MAP(pg) ((pg)->index)
75#define TEST_AND_CLEAR_USED(pg,off) (test_and_clear_bit(off, &USED_MAP(pg)))
76#define SET_USED(pg,off) (set_bit(off, &USED_MAP(pg)))
77
78static DEFINE_SPINLOCK(small_page_lock);
79
80static unsigned long __get_small_page(int priority, struct order *order)
81{
82 unsigned long flags;
83 struct page *page;
84 int offset;
85
86 do {
87 spin_lock_irqsave(&small_page_lock, flags);
88
89 if (list_empty(&order->queue))
90 goto need_new_page;
91
92 page = list_entry(order->queue.next, struct page, lru);
93again:
94#ifdef PEDANTIC
95 BUG_ON(USED_MAP(page) & ~order->all_used);
96#endif
97 offset = ffz(USED_MAP(page));
98 SET_USED(page, offset);
99 if (USED_MAP(page) == order->all_used)
100 list_del_init(&page->lru);
101 spin_unlock_irqrestore(&small_page_lock, flags);
102
103 return (unsigned long) page_address(page) + (offset << order->shift);
104
105need_new_page:
106 spin_unlock_irqrestore(&small_page_lock, flags);
107 page = alloc_page(priority);
108 spin_lock_irqsave(&small_page_lock, flags);
109
110 if (list_empty(&order->queue)) {
111 if (!page)
112 goto no_page;
113 SetPageReserved(page);
114 USED_MAP(page) = 0;
115 list_add(&page->lru, &order->queue);
116 goto again;
117 }
118
119 spin_unlock_irqrestore(&small_page_lock, flags);
120 __free_page(page);
121 } while (1);
122
123no_page:
124 spin_unlock_irqrestore(&small_page_lock, flags);
125 return 0;
126}
127
128static void __free_small_page(unsigned long spage, struct order *order)
129{
130 unsigned long flags;
131 struct page *page;
132
133 if (virt_addr_valid(spage)) {
134 page = virt_to_page(spage);
135
136 /*
137 * The container-page must be marked Reserved
138 */
139 if (!PageReserved(page) || spage & order->mask)
140 goto non_small;
141
142#ifdef PEDANTIC
143 BUG_ON(USED_MAP(page) & ~order->all_used);
144#endif
145
146 spage = spage >> order->shift;
147 spage &= order->block_mask;
148
149 /*
150 * the following must be atomic wrt get_page
151 */
152 spin_lock_irqsave(&small_page_lock, flags);
153
154 if (USED_MAP(page) == order->all_used)
155 list_add(&page->lru, &order->queue);
156
157 if (!TEST_AND_CLEAR_USED(page, spage))
158 goto already_free;
159
160 if (USED_MAP(page) == 0)
161 goto free_page;
162
163 spin_unlock_irqrestore(&small_page_lock, flags);
164 }
165 return;
166
167free_page:
168 /*
169 * unlink the page from the small page queue and free it
170 */
171 list_del_init(&page->lru);
172 spin_unlock_irqrestore(&small_page_lock, flags);
173 ClearPageReserved(page);
174 __free_page(page);
175 return;
176
177non_small:
178 printk("Trying to free non-small page from %p\n", __builtin_return_address(0));
179 return;
180already_free:
181 printk("Trying to free free small page from %p\n", __builtin_return_address(0));
182}
183
184unsigned long get_page_8k(int priority)
185{
186 return __get_small_page(priority, orders+1);
187}
188
189void free_page_8k(unsigned long spage)
190{
191 __free_small_page(spage, orders+1);
192}
diff --git a/arch/arm26/nwfpe/ARM-gcc.h b/arch/arm26/nwfpe/ARM-gcc.h
deleted file mode 100644
index e6598470b076..000000000000
--- a/arch/arm26/nwfpe/ARM-gcc.h
+++ /dev/null
@@ -1,120 +0,0 @@
1/*
2-------------------------------------------------------------------------------
3The macro `BITS64' can be defined to indicate that 64-bit integer types are
4supported by the compiler.
5-------------------------------------------------------------------------------
6*/
7#define BITS64
8
9/*
10-------------------------------------------------------------------------------
11Each of the following `typedef's defines the most convenient type that holds
12integers of at least as many bits as specified. For example, `uint8' should
13be the most convenient type that can hold unsigned integers of as many as
148 bits. The `flag' type must be able to hold either a 0 or 1. For most
15implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
16to the same as `int'.
17-------------------------------------------------------------------------------
18*/
19typedef char flag;
20typedef unsigned char uint8;
21typedef signed char int8;
22typedef int uint16;
23typedef int int16;
24typedef unsigned int uint32;
25typedef signed int int32;
26#ifdef BITS64
27typedef unsigned long long int bits64;
28typedef signed long long int sbits64;
29#endif
30
31/*
32-------------------------------------------------------------------------------
33Each of the following `typedef's defines a type that holds integers
34of _exactly_ the number of bits specified. For instance, for most
35implementation of C, `bits16' and `sbits16' should be `typedef'ed to
36`unsigned short int' and `signed short int' (or `short int'), respectively.
37-------------------------------------------------------------------------------
38*/
39typedef unsigned char bits8;
40typedef signed char sbits8;
41typedef unsigned short int bits16;
42typedef signed short int sbits16;
43typedef unsigned int bits32;
44typedef signed int sbits32;
45#ifdef BITS64
46typedef unsigned long long int uint64;
47typedef signed long long int int64;
48#endif
49
50#ifdef BITS64
51/*
52-------------------------------------------------------------------------------
53The `LIT64' macro takes as its argument a textual integer literal and if
54necessary ``marks'' the literal as having a 64-bit integer type. For
55example, the Gnu C Compiler (`gcc') requires that 64-bit literals be
56appended with the letters `LL' standing for `long long', which is `gcc's
57name for the 64-bit integer type. Some compilers may allow `LIT64' to be
58defined as the identity macro: `#define LIT64( a ) a'.
59-------------------------------------------------------------------------------
60*/
61#define LIT64( a ) a##LL
62#endif
63
64/*
65-------------------------------------------------------------------------------
66The macro `INLINE' can be used before functions that should be inlined. If
67a compiler does not support explicit inlining, this macro should be defined
68to be `static'.
69-------------------------------------------------------------------------------
70*/
71#define INLINE extern __inline__
72
73
74/* For use as a GCC soft-float library we need some special function names. */
75
76#ifdef __LIBFLOAT__
77
78/* Some 32-bit ops can be mapped straight across by just changing the name. */
79#define float32_add __addsf3
80#define float32_sub __subsf3
81#define float32_mul __mulsf3
82#define float32_div __divsf3
83#define int32_to_float32 __floatsisf
84#define float32_to_int32_round_to_zero __fixsfsi
85#define float32_to_uint32_round_to_zero __fixunssfsi
86
87/* These ones go through the glue code. To avoid namespace pollution
88 we rename the internal functions too. */
89#define float32_eq ___float32_eq
90#define float32_le ___float32_le
91#define float32_lt ___float32_lt
92
93/* All the 64-bit ops have to go through the glue, so we pull the same
94 trick. */
95#define float64_add ___float64_add
96#define float64_sub ___float64_sub
97#define float64_mul ___float64_mul
98#define float64_div ___float64_div
99#define int32_to_float64 ___int32_to_float64
100#define float64_to_int32_round_to_zero ___float64_to_int32_round_to_zero
101#define float64_to_uint32_round_to_zero ___float64_to_uint32_round_to_zero
102#define float64_to_float32 ___float64_to_float32
103#define float32_to_float64 ___float32_to_float64
104#define float64_eq ___float64_eq
105#define float64_le ___float64_le
106#define float64_lt ___float64_lt
107
108#if 0
109#define float64_add __adddf3
110#define float64_sub __subdf3
111#define float64_mul __muldf3
112#define float64_div __divdf3
113#define int32_to_float64 __floatsidf
114#define float64_to_int32_round_to_zero __fixdfsi
115#define float64_to_uint32_round_to_zero __fixunsdfsi
116#define float64_to_float32 __truncdfsf2
117#define float32_to_float64 __extendsfdf2
118#endif
119
120#endif
diff --git a/arch/arm26/nwfpe/ChangeLog b/arch/arm26/nwfpe/ChangeLog
deleted file mode 100644
index 0c580f764baf..000000000000
--- a/arch/arm26/nwfpe/ChangeLog
+++ /dev/null
@@ -1,83 +0,0 @@
12002-01-19 Russell King <rmk@arm.linux.org.uk>
2
3 * fpa11.h - Add documentation
4 - remove userRegisters pointer from this structure.
5 - add new method to obtain integer register values.
6 * softfloat.c - Remove float128
7 * softfloat.h - Remove float128
8 * softfloat-specialize - Remove float128
9
10 * The FPA11 structure is not a kernel-specific data structure.
11 It is used by users of ptrace to examine the values of the
12 floating point registers. Therefore, any changes to the
13 FPA11 structure (size or position of elements contained
14 within) have to be well thought out.
15
16 * Since 128-bit float requires the FPA11 structure to change
17 size, it has been removed. 128-bit float is currently unused,
18 and needs various things to be re-worked so that we won't
19 overflow the available space in the task structure.
20
21 * The changes are designed to break any patch that goes on top
22 of this code, so that the authors properly review their changes.
23
241999-08-19 Scott Bambrough <scottb@netwinder.org>
25
26 * fpmodule.c - Changed version number to 0.95
27 * fpa11.h - modified FPA11, FPREG structures
28 * fpa11.c - Changes due to FPA11, FPREG structure alterations.
29 * fpa11_cpdo.c - Changes due to FPA11, FPREG structure alterations.
30 * fpa11_cpdt.c - Changes due to FPA11, FPREG structure alterations.
31 * fpa11_cprt.c - Changes due to FPA11, FPREG structure alterations.
32 * single_cpdo.c - Changes due to FPA11, FPREG structure alterations.
33 * double_cpdo.c - Changes due to FPA11, FPREG structure alterations.
34 * extended_cpdo.c - Changes due to FPA11, FPREG structure alterations.
35
36 * I discovered several bugs. First and worst is that the kernel
37 passes in a pointer to the FPE's state area. This is defined
38 as a struct user_fp (see user.h). This pointer was cast to a
39 FPA11*. Unfortunately FPA11 and user_fp are of different sizes;
40 user_fp is smaller. This meant that the FPE scribbled on things
41 below its area, which is bad, as the area is in the thread_struct
42 embedded in the process task structure. Thus we were scribbling
43 over one of the most important structures in the entire OS.
44
45 * user_fp and FPA11 have now been harmonized. Most of the changes
46 in the above code were dereferencing problems due to moving the
47 register type out of FPREG, and getting rid of the union variable
48 fpvalue.
49
50 * Second I noticed resetFPA11 was not always being called for a
51 task. This should happen on the first floating point exception
52 that occurs. It is controlled by init_flag in FPA11. The
53 comment in the code beside init_flag state the kernel guarantees
54 this to be zero. Not so. I found that the kernel recycles task
55 structures, and that recycled ones may not have init_flag zeroed.
56 I couldn't even find anything that guarantees it is zeroed when
57 when the task structure is initially allocated. In any case
58 I now initialize the entire FPE state in the thread structure to
59 zero when allocated and recycled. See alloc_task_struct() and
60 flush_thread() in arch/arm/process.c. The change to
61 alloc_task_struct() may not be necessary, but I left it in for
62 completeness (better safe than sorry).
63
641998-11-23 Scott Bambrough <scottb@netwinder.org>
65
66 * README.FPE - fix typo in description of lfm/sfm instructions
67 * NOTES - Added file to describe known bugs/problems
68 * fpmodule.c - Changed version number to 0.94
69
701998-11-20 Scott Bambrough <scottb@netwinder.org>
71
72 * README.FPE - fix description of URD, NRM instructions
73 * TODO - remove URD, NRM instructions from TODO list
74 * single_cpdo.c - implement URD, NRM
75 * double_cpdo.c - implement URD, NRM
76 * extended_cpdo.c - implement URD, NRM
77
781998-11-19 Scott Bambrough <scottb@netwinder.org>
79
80 * ChangeLog - Added this file to track changes made.
81 * fpa11.c - added code to initialize register types to typeNone
82 * fpa11_cpdt.c - fixed bug in storeExtended (typeExtended changed to
83 typeDouble in switch statement)
diff --git a/arch/arm26/nwfpe/Makefile b/arch/arm26/nwfpe/Makefile
deleted file mode 100644
index b39d34dff054..000000000000
--- a/arch/arm26/nwfpe/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
1#
2# Copyright (C) 1998, 1999, 2001 Philip Blundell
3#
4
5obj-y :=
6obj-m :=
7obj-n :=
8
9obj-$(CONFIG_FPE_NWFPE) += nwfpe.o
10
11nwfpe-objs := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o \
12 fpmodule.o fpopcode.o softfloat.o \
13 single_cpdo.o double_cpdo.o extended_cpdo.o \
14 entry.o
15
diff --git a/arch/arm26/nwfpe/double_cpdo.c b/arch/arm26/nwfpe/double_cpdo.c
deleted file mode 100644
index 7f4fef0216c7..000000000000
--- a/arch/arm26/nwfpe/double_cpdo.c
+++ /dev/null
@@ -1,288 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "softfloat.h"
24#include "fpopcode.h"
25
26float64 float64_exp(float64 Fm);
27float64 float64_ln(float64 Fm);
28float64 float64_sin(float64 rFm);
29float64 float64_cos(float64 rFm);
30float64 float64_arcsin(float64 rFm);
31float64 float64_arctan(float64 rFm);
32float64 float64_log(float64 rFm);
33float64 float64_tan(float64 rFm);
34float64 float64_arccos(float64 rFm);
35float64 float64_pow(float64 rFn,float64 rFm);
36float64 float64_pol(float64 rFn,float64 rFm);
37
38unsigned int DoubleCPDO(const unsigned int opcode)
39{
40 FPA11 *fpa11 = GET_FPA11();
41 float64 rFm, rFn = 0; //FIXME - should be zero?
42 unsigned int Fd, Fm, Fn, nRc = 1;
43
44 //printk("DoubleCPDO(0x%08x)\n",opcode);
45
46 Fm = getFm(opcode);
47 if (CONSTANT_FM(opcode))
48 {
49 rFm = getDoubleConstant(Fm);
50 }
51 else
52 {
53 switch (fpa11->fType[Fm])
54 {
55 case typeSingle:
56 rFm = float32_to_float64(fpa11->fpreg[Fm].fSingle);
57 break;
58
59 case typeDouble:
60 rFm = fpa11->fpreg[Fm].fDouble;
61 break;
62
63 case typeExtended:
64 // !! patb
65 //printk("not implemented! why not?\n");
66 //!! ScottB
67 // should never get here, if extended involved
68 // then other operand should be promoted then
69 // ExtendedCPDO called.
70 break;
71
72 default: return 0;
73 }
74 }
75
76 if (!MONADIC_INSTRUCTION(opcode))
77 {
78 Fn = getFn(opcode);
79 switch (fpa11->fType[Fn])
80 {
81 case typeSingle:
82 rFn = float32_to_float64(fpa11->fpreg[Fn].fSingle);
83 break;
84
85 case typeDouble:
86 rFn = fpa11->fpreg[Fn].fDouble;
87 break;
88
89 default: return 0;
90 }
91 }
92
93 Fd = getFd(opcode);
94 /* !! this switch isn't optimized; better (opcode & MASK_ARITHMETIC_OPCODE)>>24, sort of */
95 switch (opcode & MASK_ARITHMETIC_OPCODE)
96 {
97 /* dyadic opcodes */
98 case ADF_CODE:
99 fpa11->fpreg[Fd].fDouble = float64_add(rFn,rFm);
100 break;
101
102 case MUF_CODE:
103 case FML_CODE:
104 fpa11->fpreg[Fd].fDouble = float64_mul(rFn,rFm);
105 break;
106
107 case SUF_CODE:
108 fpa11->fpreg[Fd].fDouble = float64_sub(rFn,rFm);
109 break;
110
111 case RSF_CODE:
112 fpa11->fpreg[Fd].fDouble = float64_sub(rFm,rFn);
113 break;
114
115 case DVF_CODE:
116 case FDV_CODE:
117 fpa11->fpreg[Fd].fDouble = float64_div(rFn,rFm);
118 break;
119
120 case RDF_CODE:
121 case FRD_CODE:
122 fpa11->fpreg[Fd].fDouble = float64_div(rFm,rFn);
123 break;
124
125#if 0
126 case POW_CODE:
127 fpa11->fpreg[Fd].fDouble = float64_pow(rFn,rFm);
128 break;
129
130 case RPW_CODE:
131 fpa11->fpreg[Fd].fDouble = float64_pow(rFm,rFn);
132 break;
133#endif
134
135 case RMF_CODE:
136 fpa11->fpreg[Fd].fDouble = float64_rem(rFn,rFm);
137 break;
138
139#if 0
140 case POL_CODE:
141 fpa11->fpreg[Fd].fDouble = float64_pol(rFn,rFm);
142 break;
143#endif
144
145 /* monadic opcodes */
146 case MVF_CODE:
147 fpa11->fpreg[Fd].fDouble = rFm;
148 break;
149
150 case MNF_CODE:
151 {
152 unsigned int *p = (unsigned int*)&rFm;
153 p[1] ^= 0x80000000;
154 fpa11->fpreg[Fd].fDouble = rFm;
155 }
156 break;
157
158 case ABS_CODE:
159 {
160 unsigned int *p = (unsigned int*)&rFm;
161 p[1] &= 0x7fffffff;
162 fpa11->fpreg[Fd].fDouble = rFm;
163 }
164 break;
165
166 case RND_CODE:
167 case URD_CODE:
168 fpa11->fpreg[Fd].fDouble = float64_round_to_int(rFm);
169 break;
170
171 case SQT_CODE:
172 fpa11->fpreg[Fd].fDouble = float64_sqrt(rFm);
173 break;
174
175#if 0
176 case LOG_CODE:
177 fpa11->fpreg[Fd].fDouble = float64_log(rFm);
178 break;
179
180 case LGN_CODE:
181 fpa11->fpreg[Fd].fDouble = float64_ln(rFm);
182 break;
183
184 case EXP_CODE:
185 fpa11->fpreg[Fd].fDouble = float64_exp(rFm);
186 break;
187
188 case SIN_CODE:
189 fpa11->fpreg[Fd].fDouble = float64_sin(rFm);
190 break;
191
192 case COS_CODE:
193 fpa11->fpreg[Fd].fDouble = float64_cos(rFm);
194 break;
195
196 case TAN_CODE:
197 fpa11->fpreg[Fd].fDouble = float64_tan(rFm);
198 break;
199
200 case ASN_CODE:
201 fpa11->fpreg[Fd].fDouble = float64_arcsin(rFm);
202 break;
203
204 case ACS_CODE:
205 fpa11->fpreg[Fd].fDouble = float64_arccos(rFm);
206 break;
207
208 case ATN_CODE:
209 fpa11->fpreg[Fd].fDouble = float64_arctan(rFm);
210 break;
211#endif
212
213 case NRM_CODE:
214 break;
215
216 default:
217 {
218 nRc = 0;
219 }
220 }
221
222 if (0 != nRc) fpa11->fType[Fd] = typeDouble;
223 return nRc;
224}
225
226#if 0
227float64 float64_exp(float64 rFm)
228{
229 return rFm;
230//series
231}
232
233float64 float64_ln(float64 rFm)
234{
235 return rFm;
236//series
237}
238
239float64 float64_sin(float64 rFm)
240{
241 return rFm;
242//series
243}
244
245float64 float64_cos(float64 rFm)
246{
247 return rFm;
248 //series
249}
250
251#if 0
252float64 float64_arcsin(float64 rFm)
253{
254//series
255}
256
257float64 float64_arctan(float64 rFm)
258{
259 //series
260}
261#endif
262
263float64 float64_log(float64 rFm)
264{
265 return float64_div(float64_ln(rFm),getDoubleConstant(7));
266}
267
268float64 float64_tan(float64 rFm)
269{
270 return float64_div(float64_sin(rFm),float64_cos(rFm));
271}
272
273float64 float64_arccos(float64 rFm)
274{
275return rFm;
276 //return float64_sub(halfPi,float64_arcsin(rFm));
277}
278
279float64 float64_pow(float64 rFn,float64 rFm)
280{
281 return float64_exp(float64_mul(rFm,float64_ln(rFn)));
282}
283
284float64 float64_pol(float64 rFn,float64 rFm)
285{
286 return float64_arctan(float64_div(rFn,rFm));
287}
288#endif
diff --git a/arch/arm26/nwfpe/entry.S b/arch/arm26/nwfpe/entry.S
deleted file mode 100644
index e6312000d9f8..000000000000
--- a/arch/arm26/nwfpe/entry.S
+++ /dev/null
@@ -1,114 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998
4 (c) Philip Blundell 1998-1999
5
6 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
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 as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#include <asm/asm-offsets.h>
24
25/* This is the kernel's entry point into the floating point emulator.
26It is called from the kernel with code similar to this:
27
28 mov fp, #0
29 teqp pc, #PSR_I_BIT | MODE_SVC
30 ldr r4, .LC2
31 ldr pc, [r4] @ Call FP module USR entry point
32
33The kernel expects the emulator to return via one of two possible
34points of return it passes to the emulator. The emulator, if
35successful in its emulation, jumps to ret_from_exception and the
36kernel takes care of returning control from the trap to the user code.
37If the emulator is unable to emulate the instruction, it returns to
38fpundefinstr and the kernel halts the user program with a core dump.
39
40This routine does four things:
41
421) It saves SP into a variable called userRegisters. The kernel has
43created a struct pt_regs on the stack and saved the user registers
44into it. See /usr/include/asm/proc/ptrace.h for details. The
45emulator code uses userRegisters as the base of an array of words from
46which the contents of the registers can be extracted.
47
482) It locates the FP emulator work area within the TSS structure and
49points `fpa11' to it.
50
513) It calls EmulateAll to emulate a floating point instruction.
52EmulateAll returns 1 if the emulation was successful, or 0 if not.
53
544) If an instruction has been emulated successfully, it looks ahead at
55the next instruction. If it is a floating point instruction, it
56executes the instruction, without returning to user space. In this
57way it repeatedly looks ahead and executes floating point instructions
58until it encounters a non floating point instruction, at which time it
59returns via _fpreturn.
60
61This is done to reduce the effect of the trap overhead on each
62floating point instructions. GCC attempts to group floating point
63instructions to allow the emulator to spread the cost of the trap over
64several floating point instructions. */
65
66 .globl nwfpe_enter
67nwfpe_enter:
68 mov sl, sp
69 bl FPA11_CheckInit @ check to see if we are initialised
70
71 ldr r5, [sp, #60] @ get contents of PC
72 bic r5, r5, #0xfc000003
73 ldr r0, [r5, #-4] @ get actual instruction into r0
74 bl EmulateAll @ emulate the instruction
751: cmp r0, #0 @ was emulation successful
76 beq fpundefinstr @ no, return failure
77
78next:
79.Lx1: ldrt r6, [r5], #4 @ get the next instruction and
80 @ increment PC
81
82 and r2, r6, #0x0F000000 @ test for FP insns
83 teq r2, #0x0C000000
84 teqne r2, #0x0D000000
85 teqne r2, #0x0E000000
86 bne ret_from_exception @ return ok if not a fp insn
87
88 ldr r9, [sp, #60] @ get new condition codes
89 and r9, r9, #0xfc000003
90 orr r7, r5, r9
91 str r7, [sp, #60] @ update PC copy in regs
92
93 mov r0, r6 @ save a copy
94 mov r1, r9 @ fetch the condition codes
95 bl checkCondition @ check the condition
96 cmp r0, #0 @ r0 = 0 ==> condition failed
97
98 @ if condition code failed to match, next insn
99 beq next @ get the next instruction;
100
101 mov r0, r6 @ prepare for EmulateAll()
102 adr lr, 1b
103 orr lr, lr, #3
104 b EmulateAll @ if r0 != 0, goto EmulateAll
105
106.Lret: b ret_from_exception @ let the user eat segfaults
107
108 @ We need to be prepared for the instruction at .Lx1 to fault.
109 @ Emit the appropriate exception gunk to fix things up.
110 .section __ex_table,"a"
111 .align 3
112 .long .Lx1
113 ldr lr, [lr, $(.Lret - .Lx1)/4]
114 .previous
diff --git a/arch/arm26/nwfpe/extended_cpdo.c b/arch/arm26/nwfpe/extended_cpdo.c
deleted file mode 100644
index 331407596d91..000000000000
--- a/arch/arm26/nwfpe/extended_cpdo.c
+++ /dev/null
@@ -1,273 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "softfloat.h"
24#include "fpopcode.h"
25
26floatx80 floatx80_exp(floatx80 Fm);
27floatx80 floatx80_ln(floatx80 Fm);
28floatx80 floatx80_sin(floatx80 rFm);
29floatx80 floatx80_cos(floatx80 rFm);
30floatx80 floatx80_arcsin(floatx80 rFm);
31floatx80 floatx80_arctan(floatx80 rFm);
32floatx80 floatx80_log(floatx80 rFm);
33floatx80 floatx80_tan(floatx80 rFm);
34floatx80 floatx80_arccos(floatx80 rFm);
35floatx80 floatx80_pow(floatx80 rFn,floatx80 rFm);
36floatx80 floatx80_pol(floatx80 rFn,floatx80 rFm);
37
38unsigned int ExtendedCPDO(const unsigned int opcode)
39{
40 FPA11 *fpa11 = GET_FPA11();
41 floatx80 rFm, rFn;
42 unsigned int Fd, Fm, Fn, nRc = 1;
43
44 //printk("ExtendedCPDO(0x%08x)\n",opcode);
45
46 Fm = getFm(opcode);
47 if (CONSTANT_FM(opcode))
48 {
49 rFm = getExtendedConstant(Fm);
50 }
51 else
52 {
53 switch (fpa11->fType[Fm])
54 {
55 case typeSingle:
56 rFm = float32_to_floatx80(fpa11->fpreg[Fm].fSingle);
57 break;
58
59 case typeDouble:
60 rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble);
61 break;
62
63 case typeExtended:
64 rFm = fpa11->fpreg[Fm].fExtended;
65 break;
66
67 default: return 0;
68 }
69 }
70
71 if (!MONADIC_INSTRUCTION(opcode))
72 {
73 Fn = getFn(opcode);
74 switch (fpa11->fType[Fn])
75 {
76 case typeSingle:
77 rFn = float32_to_floatx80(fpa11->fpreg[Fn].fSingle);
78 break;
79
80 case typeDouble:
81 rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble);
82 break;
83
84 case typeExtended:
85 rFn = fpa11->fpreg[Fn].fExtended;
86 break;
87
88 default: return 0;
89 }
90 }
91
92 Fd = getFd(opcode);
93 switch (opcode & MASK_ARITHMETIC_OPCODE)
94 {
95 /* dyadic opcodes */
96 case ADF_CODE:
97 fpa11->fpreg[Fd].fExtended = floatx80_add(rFn,rFm);
98 break;
99
100 case MUF_CODE:
101 case FML_CODE:
102 fpa11->fpreg[Fd].fExtended = floatx80_mul(rFn,rFm);
103 break;
104
105 case SUF_CODE:
106 fpa11->fpreg[Fd].fExtended = floatx80_sub(rFn,rFm);
107 break;
108
109 case RSF_CODE:
110 fpa11->fpreg[Fd].fExtended = floatx80_sub(rFm,rFn);
111 break;
112
113 case DVF_CODE:
114 case FDV_CODE:
115 fpa11->fpreg[Fd].fExtended = floatx80_div(rFn,rFm);
116 break;
117
118 case RDF_CODE:
119 case FRD_CODE:
120 fpa11->fpreg[Fd].fExtended = floatx80_div(rFm,rFn);
121 break;
122
123#if 0
124 case POW_CODE:
125 fpa11->fpreg[Fd].fExtended = floatx80_pow(rFn,rFm);
126 break;
127
128 case RPW_CODE:
129 fpa11->fpreg[Fd].fExtended = floatx80_pow(rFm,rFn);
130 break;
131#endif
132
133 case RMF_CODE:
134 fpa11->fpreg[Fd].fExtended = floatx80_rem(rFn,rFm);
135 break;
136
137#if 0
138 case POL_CODE:
139 fpa11->fpreg[Fd].fExtended = floatx80_pol(rFn,rFm);
140 break;
141#endif
142
143 /* monadic opcodes */
144 case MVF_CODE:
145 fpa11->fpreg[Fd].fExtended = rFm;
146 break;
147
148 case MNF_CODE:
149 rFm.high ^= 0x8000;
150 fpa11->fpreg[Fd].fExtended = rFm;
151 break;
152
153 case ABS_CODE:
154 rFm.high &= 0x7fff;
155 fpa11->fpreg[Fd].fExtended = rFm;
156 break;
157
158 case RND_CODE:
159 case URD_CODE:
160 fpa11->fpreg[Fd].fExtended = floatx80_round_to_int(rFm);
161 break;
162
163 case SQT_CODE:
164 fpa11->fpreg[Fd].fExtended = floatx80_sqrt(rFm);
165 break;
166
167#if 0
168 case LOG_CODE:
169 fpa11->fpreg[Fd].fExtended = floatx80_log(rFm);
170 break;
171
172 case LGN_CODE:
173 fpa11->fpreg[Fd].fExtended = floatx80_ln(rFm);
174 break;
175
176 case EXP_CODE:
177 fpa11->fpreg[Fd].fExtended = floatx80_exp(rFm);
178 break;
179
180 case SIN_CODE:
181 fpa11->fpreg[Fd].fExtended = floatx80_sin(rFm);
182 break;
183
184 case COS_CODE:
185 fpa11->fpreg[Fd].fExtended = floatx80_cos(rFm);
186 break;
187
188 case TAN_CODE:
189 fpa11->fpreg[Fd].fExtended = floatx80_tan(rFm);
190 break;
191
192 case ASN_CODE:
193 fpa11->fpreg[Fd].fExtended = floatx80_arcsin(rFm);
194 break;
195
196 case ACS_CODE:
197 fpa11->fpreg[Fd].fExtended = floatx80_arccos(rFm);
198 break;
199
200 case ATN_CODE:
201 fpa11->fpreg[Fd].fExtended = floatx80_arctan(rFm);
202 break;
203#endif
204
205 case NRM_CODE:
206 break;
207
208 default:
209 {
210 nRc = 0;
211 }
212 }
213
214 if (0 != nRc) fpa11->fType[Fd] = typeExtended;
215 return nRc;
216}
217
218#if 0
219floatx80 floatx80_exp(floatx80 Fm)
220{
221//series
222}
223
224floatx80 floatx80_ln(floatx80 Fm)
225{
226//series
227}
228
229floatx80 floatx80_sin(floatx80 rFm)
230{
231//series
232}
233
234floatx80 floatx80_cos(floatx80 rFm)
235{
236//series
237}
238
239floatx80 floatx80_arcsin(floatx80 rFm)
240{
241//series
242}
243
244floatx80 floatx80_arctan(floatx80 rFm)
245{
246 //series
247}
248
249floatx80 floatx80_log(floatx80 rFm)
250{
251 return floatx80_div(floatx80_ln(rFm),getExtendedConstant(7));
252}
253
254floatx80 floatx80_tan(floatx80 rFm)
255{
256 return floatx80_div(floatx80_sin(rFm),floatx80_cos(rFm));
257}
258
259floatx80 floatx80_arccos(floatx80 rFm)
260{
261 //return floatx80_sub(halfPi,floatx80_arcsin(rFm));
262}
263
264floatx80 floatx80_pow(floatx80 rFn,floatx80 rFm)
265{
266 return floatx80_exp(floatx80_mul(rFm,floatx80_ln(rFn)));
267}
268
269floatx80 floatx80_pol(floatx80 rFn,floatx80 rFm)
270{
271 return floatx80_arctan(floatx80_div(rFn,rFm));
272}
273#endif
diff --git a/arch/arm26/nwfpe/fpa11.c b/arch/arm26/nwfpe/fpa11.c
deleted file mode 100644
index e954540a9464..000000000000
--- a/arch/arm26/nwfpe/fpa11.c
+++ /dev/null
@@ -1,221 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "fpopcode.h"
24
25#include "fpmodule.h"
26#include "fpmodule.inl"
27
28#include <linux/compiler.h>
29#include <asm/system.h>
30
31/* forward declarations */
32unsigned int EmulateCPDO(const unsigned int);
33unsigned int EmulateCPDT(const unsigned int);
34unsigned int EmulateCPRT(const unsigned int);
35
36/* Reset the FPA11 chip. Called to initialize and reset the emulator. */
37void resetFPA11(void)
38{
39 int i;
40 FPA11 *fpa11 = GET_FPA11();
41
42 /* initialize the register type array */
43 for (i=0;i<=7;i++)
44 {
45 fpa11->fType[i] = typeNone;
46 }
47
48 /* FPSR: set system id to FP_EMULATOR, set AC, clear all other bits */
49 fpa11->fpsr = FP_EMULATOR | BIT_AC;
50
51 /* FPCR: set SB, AB and DA bits, clear all others */
52#if MAINTAIN_FPCR
53 fpa11->fpcr = MASK_RESET;
54#endif
55}
56
57void SetRoundingMode(const unsigned int opcode)
58{
59#if MAINTAIN_FPCR
60 FPA11 *fpa11 = GET_FPA11();
61 fpa11->fpcr &= ~MASK_ROUNDING_MODE;
62#endif
63 switch (opcode & MASK_ROUNDING_MODE)
64 {
65 default:
66 case ROUND_TO_NEAREST:
67 float_rounding_mode = float_round_nearest_even;
68#if MAINTAIN_FPCR
69 fpa11->fpcr |= ROUND_TO_NEAREST;
70#endif
71 break;
72
73 case ROUND_TO_PLUS_INFINITY:
74 float_rounding_mode = float_round_up;
75#if MAINTAIN_FPCR
76 fpa11->fpcr |= ROUND_TO_PLUS_INFINITY;
77#endif
78 break;
79
80 case ROUND_TO_MINUS_INFINITY:
81 float_rounding_mode = float_round_down;
82#if MAINTAIN_FPCR
83 fpa11->fpcr |= ROUND_TO_MINUS_INFINITY;
84#endif
85 break;
86
87 case ROUND_TO_ZERO:
88 float_rounding_mode = float_round_to_zero;
89#if MAINTAIN_FPCR
90 fpa11->fpcr |= ROUND_TO_ZERO;
91#endif
92 break;
93 }
94}
95
96void SetRoundingPrecision(const unsigned int opcode)
97{
98#if MAINTAIN_FPCR
99 FPA11 *fpa11 = GET_FPA11();
100 fpa11->fpcr &= ~MASK_ROUNDING_PRECISION;
101#endif
102 switch (opcode & MASK_ROUNDING_PRECISION)
103 {
104 case ROUND_SINGLE:
105 floatx80_rounding_precision = 32;
106#if MAINTAIN_FPCR
107 fpa11->fpcr |= ROUND_SINGLE;
108#endif
109 break;
110
111 case ROUND_DOUBLE:
112 floatx80_rounding_precision = 64;
113#if MAINTAIN_FPCR
114 fpa11->fpcr |= ROUND_DOUBLE;
115#endif
116 break;
117
118 case ROUND_EXTENDED:
119 floatx80_rounding_precision = 80;
120#if MAINTAIN_FPCR
121 fpa11->fpcr |= ROUND_EXTENDED;
122#endif
123 break;
124
125 default: floatx80_rounding_precision = 80;
126 }
127}
128
129void FPA11_CheckInit(void)
130{
131 FPA11 *fpa11 = GET_FPA11();
132 if (unlikely(fpa11->initflag == 0))
133 {
134 resetFPA11();
135 SetRoundingMode(ROUND_TO_NEAREST);
136 SetRoundingPrecision(ROUND_EXTENDED);
137 fpa11->initflag = 1;
138 }
139}
140
141/* Emulate the instruction in the opcode. */
142unsigned int EmulateAll(unsigned int opcode)
143{
144 unsigned int nRc = 1, code;
145
146 code = opcode & 0x00000f00;
147 if (code == 0x00000100 || code == 0x00000200)
148 {
149 /* For coprocessor 1 or 2 (FPA11) */
150 code = opcode & 0x0e000000;
151 if (code == 0x0e000000)
152 {
153 if (opcode & 0x00000010)
154 {
155 /* Emulate conversion opcodes. */
156 /* Emulate register transfer opcodes. */
157 /* Emulate comparison opcodes. */
158 nRc = EmulateCPRT(opcode);
159 }
160 else
161 {
162 /* Emulate monadic arithmetic opcodes. */
163 /* Emulate dyadic arithmetic opcodes. */
164 nRc = EmulateCPDO(opcode);
165 }
166 }
167 else if (code == 0x0c000000)
168 {
169 /* Emulate load/store opcodes. */
170 /* Emulate load/store multiple opcodes. */
171 nRc = EmulateCPDT(opcode);
172 }
173 else
174 {
175 /* Invalid instruction detected. Return FALSE. */
176 nRc = 0;
177 }
178 }
179
180 return(nRc);
181}
182
183#if 0
184unsigned int EmulateAll1(unsigned int opcode)
185{
186 switch ((opcode >> 24) & 0xf)
187 {
188 case 0xc:
189 case 0xd:
190 if ((opcode >> 20) & 0x1)
191 {
192 switch ((opcode >> 8) & 0xf)
193 {
194 case 0x1: return PerformLDF(opcode); break;
195 case 0x2: return PerformLFM(opcode); break;
196 default: return 0;
197 }
198 }
199 else
200 {
201 switch ((opcode >> 8) & 0xf)
202 {
203 case 0x1: return PerformSTF(opcode); break;
204 case 0x2: return PerformSFM(opcode); break;
205 default: return 0;
206 }
207 }
208 break;
209
210 case 0xe:
211 if (opcode & 0x10)
212 return EmulateCPDO(opcode);
213 else
214 return EmulateCPRT(opcode);
215 break;
216
217 default: return 0;
218 }
219}
220#endif
221
diff --git a/arch/arm26/nwfpe/fpa11.h b/arch/arm26/nwfpe/fpa11.h
deleted file mode 100644
index be09902a211d..000000000000
--- a/arch/arm26/nwfpe/fpa11.h
+++ /dev/null
@@ -1,87 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.com, 1998-1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __FPA11_H__
23#define __FPA11_H__
24
25#define GET_FPA11() ((FPA11 *)(&current_thread_info()->fpstate))
26
27/*
28 * The processes registers are always at the very top of the 8K
29 * stack+task struct. Use the same method as 'current' uses to
30 * reach them.
31 */
32register unsigned int *user_registers asm("sl");
33
34#define GET_USERREG() (user_registers)
35
36#include <linux/thread_info.h>
37
38/* includes */
39#include "fpsr.h" /* FP control and status register definitions */
40#include "softfloat.h"
41
42#define typeNone 0x00
43#define typeSingle 0x01
44#define typeDouble 0x02
45#define typeExtended 0x03
46
47/*
48 * This must be no more and no less than 12 bytes.
49 */
50typedef union tagFPREG {
51 floatx80 fExtended;
52 float64 fDouble;
53 float32 fSingle;
54} FPREG;
55
56/*
57 * FPA11 device model.
58 *
59 * This structure is exported to user space. Do not re-order.
60 * Only add new stuff to the end, and do not change the size of
61 * any element. Elements of this structure are used by user
62 * space, and must match struct user_fp in include/asm-arm/user.h.
63 * We include the byte offsets below for documentation purposes.
64 *
65 * The size of this structure and FPREG are checked by fpmodule.c
66 * on initialisation. If the rules have been broken, NWFPE will
67 * not initialise.
68 */
69typedef struct tagFPA11 {
70/* 0 */ FPREG fpreg[8]; /* 8 floating point registers */
71/* 96 */ FPSR fpsr; /* floating point status register */
72/* 100 */ FPCR fpcr; /* floating point control register */
73/* 104 */ unsigned char fType[8]; /* type of floating point value held in
74 floating point registers. One of none
75 single, double or extended. */
76/* 112 */ int initflag; /* this is special. The kernel guarantees
77 to set it to 0 when a thread is launched,
78 so we can use it to detect whether this
79 instance of the emulator needs to be
80 initialised. */
81} FPA11;
82
83extern void resetFPA11(void);
84extern void SetRoundingMode(const unsigned int);
85extern void SetRoundingPrecision(const unsigned int);
86
87#endif
diff --git a/arch/arm26/nwfpe/fpa11.inl b/arch/arm26/nwfpe/fpa11.inl
deleted file mode 100644
index 1c45cba2de66..000000000000
--- a/arch/arm26/nwfpe/fpa11.inl
+++ /dev/null
@@ -1,51 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23
24/* Read and write floating point status register */
25extern __inline__ unsigned int readFPSR(void)
26{
27 FPA11 *fpa11 = GET_FPA11();
28 return(fpa11->fpsr);
29}
30
31extern __inline__ void writeFPSR(FPSR reg)
32{
33 FPA11 *fpa11 = GET_FPA11();
34 /* the sysid byte in the status register is readonly */
35 fpa11->fpsr = (fpa11->fpsr & MASK_SYSID) | (reg & ~MASK_SYSID);
36}
37
38/* Read and write floating point control register */
39extern __inline__ FPCR readFPCR(void)
40{
41 FPA11 *fpa11 = GET_FPA11();
42 /* clear SB, AB and DA bits before returning FPCR */
43 return(fpa11->fpcr & ~MASK_RFC);
44}
45
46extern __inline__ void writeFPCR(FPCR reg)
47{
48 FPA11 *fpa11 = GET_FPA11();
49 fpa11->fpcr &= ~MASK_WFC; /* clear SB, AB and DA bits */
50 fpa11->fpcr |= (reg & MASK_WFC); /* write SB, AB and DA bits */
51}
diff --git a/arch/arm26/nwfpe/fpa11_cpdo.c b/arch/arm26/nwfpe/fpa11_cpdo.c
deleted file mode 100644
index 343a6b9fd520..000000000000
--- a/arch/arm26/nwfpe/fpa11_cpdo.c
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "fpopcode.h"
24
25unsigned int SingleCPDO(const unsigned int opcode);
26unsigned int DoubleCPDO(const unsigned int opcode);
27unsigned int ExtendedCPDO(const unsigned int opcode);
28
29unsigned int EmulateCPDO(const unsigned int opcode)
30{
31 FPA11 *fpa11 = GET_FPA11();
32 unsigned int Fd, nType, nDest, nRc = 1;
33
34 //printk("EmulateCPDO(0x%08x)\n",opcode);
35
36 /* Get the destination size. If not valid let Linux perform
37 an invalid instruction trap. */
38 nDest = getDestinationSize(opcode);
39 if (typeNone == nDest) return 0;
40
41 SetRoundingMode(opcode);
42
43 /* Compare the size of the operands in Fn and Fm.
44 Choose the largest size and perform operations in that size,
45 in order to make use of all the precision of the operands.
46 If Fm is a constant, we just grab a constant of a size
47 matching the size of the operand in Fn. */
48 if (MONADIC_INSTRUCTION(opcode))
49 nType = nDest;
50 else
51 nType = fpa11->fType[getFn(opcode)];
52
53 if (!CONSTANT_FM(opcode))
54 {
55 register unsigned int Fm = getFm(opcode);
56 if (nType < fpa11->fType[Fm])
57 {
58 nType = fpa11->fType[Fm];
59 }
60 }
61
62 switch (nType)
63 {
64 case typeSingle : nRc = SingleCPDO(opcode); break;
65 case typeDouble : nRc = DoubleCPDO(opcode); break;
66 case typeExtended : nRc = ExtendedCPDO(opcode); break;
67 default : nRc = 0;
68 }
69
70 /* If the operation succeeded, check to see if the result in the
71 destination register is the correct size. If not force it
72 to be. */
73 Fd = getFd(opcode);
74 nType = fpa11->fType[Fd];
75 if ((0 != nRc) && (nDest != nType))
76 {
77 switch (nDest)
78 {
79 case typeSingle:
80 {
81 if (typeDouble == nType)
82 fpa11->fpreg[Fd].fSingle =
83 float64_to_float32(fpa11->fpreg[Fd].fDouble);
84 else
85 fpa11->fpreg[Fd].fSingle =
86 floatx80_to_float32(fpa11->fpreg[Fd].fExtended);
87 }
88 break;
89
90 case typeDouble:
91 {
92 if (typeSingle == nType)
93 fpa11->fpreg[Fd].fDouble =
94 float32_to_float64(fpa11->fpreg[Fd].fSingle);
95 else
96 fpa11->fpreg[Fd].fDouble =
97 floatx80_to_float64(fpa11->fpreg[Fd].fExtended);
98 }
99 break;
100
101 case typeExtended:
102 {
103 if (typeSingle == nType)
104 fpa11->fpreg[Fd].fExtended =
105 float32_to_floatx80(fpa11->fpreg[Fd].fSingle);
106 else
107 fpa11->fpreg[Fd].fExtended =
108 float64_to_floatx80(fpa11->fpreg[Fd].fDouble);
109 }
110 break;
111 }
112
113 fpa11->fType[Fd] = nDest;
114 }
115
116 return nRc;
117}
diff --git a/arch/arm26/nwfpe/fpa11_cpdt.c b/arch/arm26/nwfpe/fpa11_cpdt.c
deleted file mode 100644
index e12db7c51a76..000000000000
--- a/arch/arm26/nwfpe/fpa11_cpdt.c
+++ /dev/null
@@ -1,368 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.com, 1998-1999
4 (c) Philip Blundell, 1998
5
6 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
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 as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#include "fpa11.h"
24#include "softfloat.h"
25#include "fpopcode.h"
26#include "fpmodule.h"
27#include "fpmodule.inl"
28
29#include <asm/uaccess.h>
30
31static inline
32void loadSingle(const unsigned int Fn,const unsigned int *pMem)
33{
34 FPA11 *fpa11 = GET_FPA11();
35 fpa11->fType[Fn] = typeSingle;
36 get_user(fpa11->fpreg[Fn].fSingle, pMem);
37}
38
39static inline
40void loadDouble(const unsigned int Fn,const unsigned int *pMem)
41{
42 FPA11 *fpa11 = GET_FPA11();
43 unsigned int *p;
44 p = (unsigned int*)&fpa11->fpreg[Fn].fDouble;
45 fpa11->fType[Fn] = typeDouble;
46 get_user(p[0], &pMem[1]);
47 get_user(p[1], &pMem[0]); /* sign & exponent */
48}
49
50static inline
51void loadExtended(const unsigned int Fn,const unsigned int *pMem)
52{
53 FPA11 *fpa11 = GET_FPA11();
54 unsigned int *p;
55 p = (unsigned int*)&fpa11->fpreg[Fn].fExtended;
56 fpa11->fType[Fn] = typeExtended;
57 get_user(p[0], &pMem[0]); /* sign & exponent */
58 get_user(p[1], &pMem[2]); /* ls bits */
59 get_user(p[2], &pMem[1]); /* ms bits */
60}
61
62static inline
63void loadMultiple(const unsigned int Fn,const unsigned int *pMem)
64{
65 FPA11 *fpa11 = GET_FPA11();
66 register unsigned int *p;
67 unsigned long x;
68
69 p = (unsigned int*)&(fpa11->fpreg[Fn]);
70 get_user(x, &pMem[0]);
71 fpa11->fType[Fn] = (x >> 14) & 0x00000003;
72
73 switch (fpa11->fType[Fn])
74 {
75 case typeSingle:
76 case typeDouble:
77 {
78 get_user(p[0], &pMem[2]); /* Single */
79 get_user(p[1], &pMem[1]); /* double msw */
80 p[2] = 0; /* empty */
81 }
82 break;
83
84 case typeExtended:
85 {
86 get_user(p[1], &pMem[2]);
87 get_user(p[2], &pMem[1]); /* msw */
88 p[0] = (x & 0x80003fff);
89 }
90 break;
91 }
92}
93
94static inline
95void storeSingle(const unsigned int Fn,unsigned int *pMem)
96{
97 FPA11 *fpa11 = GET_FPA11();
98 union
99 {
100 float32 f;
101 unsigned int i[1];
102 } val;
103
104 switch (fpa11->fType[Fn])
105 {
106 case typeDouble:
107 val.f = float64_to_float32(fpa11->fpreg[Fn].fDouble);
108 break;
109
110 case typeExtended:
111 val.f = floatx80_to_float32(fpa11->fpreg[Fn].fExtended);
112 break;
113
114 default: val.f = fpa11->fpreg[Fn].fSingle;
115 }
116
117 put_user(val.i[0], pMem);
118}
119
120static inline
121void storeDouble(const unsigned int Fn,unsigned int *pMem)
122{
123 FPA11 *fpa11 = GET_FPA11();
124 union
125 {
126 float64 f;
127 unsigned int i[2];
128 } val;
129
130 switch (fpa11->fType[Fn])
131 {
132 case typeSingle:
133 val.f = float32_to_float64(fpa11->fpreg[Fn].fSingle);
134 break;
135
136 case typeExtended:
137 val.f = floatx80_to_float64(fpa11->fpreg[Fn].fExtended);
138 break;
139
140 default: val.f = fpa11->fpreg[Fn].fDouble;
141 }
142
143 put_user(val.i[1], &pMem[0]); /* msw */
144 put_user(val.i[0], &pMem[1]); /* lsw */
145}
146
147static inline
148void storeExtended(const unsigned int Fn,unsigned int *pMem)
149{
150 FPA11 *fpa11 = GET_FPA11();
151 union
152 {
153 floatx80 f;
154 unsigned int i[3];
155 } val;
156
157 switch (fpa11->fType[Fn])
158 {
159 case typeSingle:
160 val.f = float32_to_floatx80(fpa11->fpreg[Fn].fSingle);
161 break;
162
163 case typeDouble:
164 val.f = float64_to_floatx80(fpa11->fpreg[Fn].fDouble);
165 break;
166
167 default: val.f = fpa11->fpreg[Fn].fExtended;
168 }
169
170 put_user(val.i[0], &pMem[0]); /* sign & exp */
171 put_user(val.i[1], &pMem[2]);
172 put_user(val.i[2], &pMem[1]); /* msw */
173}
174
175static inline
176void storeMultiple(const unsigned int Fn,unsigned int *pMem)
177{
178 FPA11 *fpa11 = GET_FPA11();
179 register unsigned int nType, *p;
180
181 p = (unsigned int*)&(fpa11->fpreg[Fn]);
182 nType = fpa11->fType[Fn];
183
184 switch (nType)
185 {
186 case typeSingle:
187 case typeDouble:
188 {
189 put_user(p[0], &pMem[2]); /* single */
190 put_user(p[1], &pMem[1]); /* double msw */
191 put_user(nType << 14, &pMem[0]);
192 }
193 break;
194
195 case typeExtended:
196 {
197 put_user(p[2], &pMem[1]); /* msw */
198 put_user(p[1], &pMem[2]);
199 put_user((p[0] & 0x80003fff) | (nType << 14), &pMem[0]);
200 }
201 break;
202 }
203}
204
205unsigned int PerformLDF(const unsigned int opcode)
206{
207 unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
208 write_back = WRITE_BACK(opcode);
209
210 //printk("PerformLDF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
211
212 pBase = (unsigned int*)readRegister(getRn(opcode));
213 if (REG_PC == getRn(opcode))
214 {
215 pBase += 2;
216 write_back = 0;
217 }
218
219 pFinal = pBase;
220 if (BIT_UP_SET(opcode))
221 pFinal += getOffset(opcode);
222 else
223 pFinal -= getOffset(opcode);
224
225 if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
226
227 switch (opcode & MASK_TRANSFER_LENGTH)
228 {
229 case TRANSFER_SINGLE : loadSingle(getFd(opcode),pAddress); break;
230 case TRANSFER_DOUBLE : loadDouble(getFd(opcode),pAddress); break;
231 case TRANSFER_EXTENDED: loadExtended(getFd(opcode),pAddress); break;
232 default: nRc = 0;
233 }
234
235 if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
236 return nRc;
237}
238
239unsigned int PerformSTF(const unsigned int opcode)
240{
241 unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
242 write_back = WRITE_BACK(opcode);
243
244 //printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
245 SetRoundingMode(ROUND_TO_NEAREST);
246
247 pBase = (unsigned int*)readRegister(getRn(opcode));
248 if (REG_PC == getRn(opcode))
249 {
250 pBase += 2;
251 write_back = 0;
252 }
253
254 pFinal = pBase;
255 if (BIT_UP_SET(opcode))
256 pFinal += getOffset(opcode);
257 else
258 pFinal -= getOffset(opcode);
259
260 if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
261
262 switch (opcode & MASK_TRANSFER_LENGTH)
263 {
264 case TRANSFER_SINGLE : storeSingle(getFd(opcode),pAddress); break;
265 case TRANSFER_DOUBLE : storeDouble(getFd(opcode),pAddress); break;
266 case TRANSFER_EXTENDED: storeExtended(getFd(opcode),pAddress); break;
267 default: nRc = 0;
268 }
269
270 if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
271 return nRc;
272}
273
274unsigned int PerformLFM(const unsigned int opcode)
275{
276 unsigned int i, Fd, *pBase, *pAddress, *pFinal,
277 write_back = WRITE_BACK(opcode);
278
279 pBase = (unsigned int*)readRegister(getRn(opcode));
280 if (REG_PC == getRn(opcode))
281 {
282 pBase += 2;
283 write_back = 0;
284 }
285
286 pFinal = pBase;
287 if (BIT_UP_SET(opcode))
288 pFinal += getOffset(opcode);
289 else
290 pFinal -= getOffset(opcode);
291
292 if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
293
294 Fd = getFd(opcode);
295 for (i=getRegisterCount(opcode);i>0;i--)
296 {
297 loadMultiple(Fd,pAddress);
298 pAddress += 3; Fd++;
299 if (Fd == 8) Fd = 0;
300 }
301
302 if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
303 return 1;
304}
305
306unsigned int PerformSFM(const unsigned int opcode)
307{
308 unsigned int i, Fd, *pBase, *pAddress, *pFinal,
309 write_back = WRITE_BACK(opcode);
310
311 pBase = (unsigned int*)readRegister(getRn(opcode));
312 if (REG_PC == getRn(opcode))
313 {
314 pBase += 2;
315 write_back = 0;
316 }
317
318 pFinal = pBase;
319 if (BIT_UP_SET(opcode))
320 pFinal += getOffset(opcode);
321 else
322 pFinal -= getOffset(opcode);
323
324 if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
325
326 Fd = getFd(opcode);
327 for (i=getRegisterCount(opcode);i>0;i--)
328 {
329 storeMultiple(Fd,pAddress);
330 pAddress += 3; Fd++;
331 if (Fd == 8) Fd = 0;
332 }
333
334 if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
335 return 1;
336}
337
338#if 1
339unsigned int EmulateCPDT(const unsigned int opcode)
340{
341 unsigned int nRc = 0;
342
343 //printk("EmulateCPDT(0x%08x)\n",opcode);
344
345 if (LDF_OP(opcode))
346 {
347 nRc = PerformLDF(opcode);
348 }
349 else if (LFM_OP(opcode))
350 {
351 nRc = PerformLFM(opcode);
352 }
353 else if (STF_OP(opcode))
354 {
355 nRc = PerformSTF(opcode);
356 }
357 else if (SFM_OP(opcode))
358 {
359 nRc = PerformSFM(opcode);
360 }
361 else
362 {
363 nRc = 0;
364 }
365
366 return nRc;
367}
368#endif
diff --git a/arch/arm26/nwfpe/fpa11_cprt.c b/arch/arm26/nwfpe/fpa11_cprt.c
deleted file mode 100644
index a201076c1f14..000000000000
--- a/arch/arm26/nwfpe/fpa11_cprt.c
+++ /dev/null
@@ -1,289 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4 (c) Philip Blundell, 1999
5
6 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
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 as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21*/
22
23#include "fpa11.h"
24#include "milieu.h"
25#include "softfloat.h"
26#include "fpopcode.h"
27#include "fpa11.inl"
28#include "fpmodule.h"
29#include "fpmodule.inl"
30
31extern flag floatx80_is_nan(floatx80);
32extern flag float64_is_nan( float64);
33extern flag float32_is_nan( float32);
34
35void SetRoundingMode(const unsigned int opcode);
36
37unsigned int PerformFLT(const unsigned int opcode);
38unsigned int PerformFIX(const unsigned int opcode);
39
40static unsigned int
41PerformComparison(const unsigned int opcode);
42
43unsigned int EmulateCPRT(const unsigned int opcode)
44{
45 unsigned int nRc = 1;
46
47 //printk("EmulateCPRT(0x%08x)\n",opcode);
48
49 if (opcode & 0x800000)
50 {
51 /* This is some variant of a comparison (PerformComparison will
52 sort out which one). Since most of the other CPRT
53 instructions are oddball cases of some sort or other it makes
54 sense to pull this out into a fast path. */
55 return PerformComparison(opcode);
56 }
57
58 /* Hint to GCC that we'd like a jump table rather than a load of CMPs */
59 switch ((opcode & 0x700000) >> 20)
60 {
61 case FLT_CODE >> 20: nRc = PerformFLT(opcode); break;
62 case FIX_CODE >> 20: nRc = PerformFIX(opcode); break;
63
64 case WFS_CODE >> 20: writeFPSR(readRegister(getRd(opcode))); break;
65 case RFS_CODE >> 20: writeRegister(getRd(opcode),readFPSR()); break;
66
67#if 0 /* We currently have no use for the FPCR, so there's no point
68 in emulating it. */
69 case WFC_CODE >> 20: writeFPCR(readRegister(getRd(opcode)));
70 case RFC_CODE >> 20: writeRegister(getRd(opcode),readFPCR()); break;
71#endif
72
73 default: nRc = 0;
74 }
75
76 return nRc;
77}
78
79unsigned int PerformFLT(const unsigned int opcode)
80{
81 FPA11 *fpa11 = GET_FPA11();
82
83 unsigned int nRc = 1;
84 SetRoundingMode(opcode);
85
86 switch (opcode & MASK_ROUNDING_PRECISION)
87 {
88 case ROUND_SINGLE:
89 {
90 fpa11->fType[getFn(opcode)] = typeSingle;
91 fpa11->fpreg[getFn(opcode)].fSingle =
92 int32_to_float32(readRegister(getRd(opcode)));
93 }
94 break;
95
96 case ROUND_DOUBLE:
97 {
98 fpa11->fType[getFn(opcode)] = typeDouble;
99 fpa11->fpreg[getFn(opcode)].fDouble =
100 int32_to_float64(readRegister(getRd(opcode)));
101 }
102 break;
103
104 case ROUND_EXTENDED:
105 {
106 fpa11->fType[getFn(opcode)] = typeExtended;
107 fpa11->fpreg[getFn(opcode)].fExtended =
108 int32_to_floatx80(readRegister(getRd(opcode)));
109 }
110 break;
111
112 default: nRc = 0;
113 }
114
115 return nRc;
116}
117
118unsigned int PerformFIX(const unsigned int opcode)
119{
120 FPA11 *fpa11 = GET_FPA11();
121 unsigned int nRc = 1;
122 unsigned int Fn = getFm(opcode);
123
124 SetRoundingMode(opcode);
125
126 switch (fpa11->fType[Fn])
127 {
128 case typeSingle:
129 {
130 writeRegister(getRd(opcode),
131 float32_to_int32(fpa11->fpreg[Fn].fSingle));
132 }
133 break;
134
135 case typeDouble:
136 {
137 writeRegister(getRd(opcode),
138 float64_to_int32(fpa11->fpreg[Fn].fDouble));
139 }
140 break;
141
142 case typeExtended:
143 {
144 writeRegister(getRd(opcode),
145 floatx80_to_int32(fpa11->fpreg[Fn].fExtended));
146 }
147 break;
148
149 default: nRc = 0;
150 }
151
152 return nRc;
153}
154
155
156static unsigned int __inline__
157PerformComparisonOperation(floatx80 Fn, floatx80 Fm)
158{
159 unsigned int flags = 0;
160
161 /* test for less than condition */
162 if (floatx80_lt(Fn,Fm))
163 {
164 flags |= CC_NEGATIVE;
165 }
166
167 /* test for equal condition */
168 if (floatx80_eq(Fn,Fm))
169 {
170 flags |= CC_ZERO;
171 }
172
173 /* test for greater than or equal condition */
174 if (floatx80_lt(Fm,Fn))
175 {
176 flags |= CC_CARRY;
177 }
178
179 writeConditionCodes(flags);
180 return 1;
181}
182
183/* This instruction sets the flags N, Z, C, V in the FPSR. */
184
185static unsigned int PerformComparison(const unsigned int opcode)
186{
187 FPA11 *fpa11 = GET_FPA11();
188 unsigned int Fn, Fm;
189 floatx80 rFn, rFm;
190 int e_flag = opcode & 0x400000; /* 1 if CxFE */
191 int n_flag = opcode & 0x200000; /* 1 if CNxx */
192 unsigned int flags = 0;
193
194 //printk("PerformComparison(0x%08x)\n",opcode);
195
196 Fn = getFn(opcode);
197 Fm = getFm(opcode);
198
199 /* Check for unordered condition and convert all operands to 80-bit
200 format.
201 ?? Might be some mileage in avoiding this conversion if possible.
202 Eg, if both operands are 32-bit, detect this and do a 32-bit
203 comparison (cheaper than an 80-bit one). */
204 switch (fpa11->fType[Fn])
205 {
206 case typeSingle:
207 //printk("single.\n");
208 if (float32_is_nan(fpa11->fpreg[Fn].fSingle))
209 goto unordered;
210 rFn = float32_to_floatx80(fpa11->fpreg[Fn].fSingle);
211 break;
212
213 case typeDouble:
214 //printk("double.\n");
215 if (float64_is_nan(fpa11->fpreg[Fn].fDouble))
216 goto unordered;
217 rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble);
218 break;
219
220 case typeExtended:
221 //printk("extended.\n");
222 if (floatx80_is_nan(fpa11->fpreg[Fn].fExtended))
223 goto unordered;
224 rFn = fpa11->fpreg[Fn].fExtended;
225 break;
226
227 default: return 0;
228 }
229
230 if (CONSTANT_FM(opcode))
231 {
232 //printk("Fm is a constant: #%d.\n",Fm);
233 rFm = getExtendedConstant(Fm);
234 if (floatx80_is_nan(rFm))
235 goto unordered;
236 }
237 else
238 {
239 //printk("Fm = r%d which contains a ",Fm);
240 switch (fpa11->fType[Fm])
241 {
242 case typeSingle:
243 //printk("single.\n");
244 if (float32_is_nan(fpa11->fpreg[Fm].fSingle))
245 goto unordered;
246 rFm = float32_to_floatx80(fpa11->fpreg[Fm].fSingle);
247 break;
248
249 case typeDouble:
250 //printk("double.\n");
251 if (float64_is_nan(fpa11->fpreg[Fm].fDouble))
252 goto unordered;
253 rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble);
254 break;
255
256 case typeExtended:
257 //printk("extended.\n");
258 if (floatx80_is_nan(fpa11->fpreg[Fm].fExtended))
259 goto unordered;
260 rFm = fpa11->fpreg[Fm].fExtended;
261 break;
262
263 default: return 0;
264 }
265 }
266
267 if (n_flag)
268 {
269 rFm.high ^= 0x8000;
270 }
271
272 return PerformComparisonOperation(rFn,rFm);
273
274 unordered:
275 /* ?? The FPA data sheet is pretty vague about this, in particular
276 about whether the non-E comparisons can ever raise exceptions.
277 This implementation is based on a combination of what it says in
278 the data sheet, observation of how the Acorn emulator actually
279 behaves (and how programs expect it to) and guesswork. */
280 flags |= CC_OVERFLOW;
281 flags &= ~(CC_ZERO | CC_NEGATIVE);
282
283 if (BIT_AC & readFPSR()) flags |= CC_CARRY;
284
285 if (e_flag) float_raise(float_flag_invalid);
286
287 writeConditionCodes(flags);
288 return 1;
289}
diff --git a/arch/arm26/nwfpe/fpmodule.c b/arch/arm26/nwfpe/fpmodule.c
deleted file mode 100644
index a8fad92eb44f..000000000000
--- a/arch/arm26/nwfpe/fpmodule.c
+++ /dev/null
@@ -1,180 +0,0 @@
1
2/*
3 NetWinder Floating Point Emulator
4 (c) Rebel.com, 1998-1999
5 (c) Philip Blundell, 1998-1999
6
7 Direct questions, comments to Scott Bambrough <scottb@netwinder.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., 675 Mass Ave, Cambridge, MA 02139, USA.
22*/
23
24#include "fpa11.h"
25
26#include <linux/module.h>
27#include <linux/version.h>
28
29/* XXX */
30#include <linux/errno.h>
31#include <linux/types.h>
32#include <linux/kernel.h>
33#include <linux/signal.h>
34#include <linux/sched.h>
35#include <linux/init.h>
36/* XXX */
37
38#include "softfloat.h"
39#include "fpopcode.h"
40#include "fpmodule.h"
41#include "fpa11.inl"
42
43/* kernel symbols required for signal handling */
44typedef struct task_struct* PTASK;
45
46#ifdef MODULE
47void fp_send_sig(unsigned long sig, PTASK p, int priv);
48
49MODULE_AUTHOR("Scott Bambrough <scottb@rebel.com>");
50MODULE_DESCRIPTION("NWFPE floating point emulator");
51
52#else
53#define fp_send_sig send_sig
54#define kern_fp_enter fp_enter
55
56extern char fpe_type[];
57#endif
58
59/* kernel function prototypes required */
60void fp_setup(void);
61
62/* external declarations for saved kernel symbols */
63extern void (*kern_fp_enter)(void);
64
65/* Original value of fp_enter from kernel before patched by fpe_init. */
66static void (*orig_fp_enter)(void);
67
68/* forward declarations */
69extern void nwfpe_enter(void);
70
71#ifdef MODULE
72/*
73 * Return 0 if we can be unloaded. This can only happen if
74 * kern_fp_enter is still pointing at nwfpe_enter
75 */
76static int fpe_unload(void)
77{
78 return (kern_fp_enter == nwfpe_enter) ? 0 : 1;
79}
80#endif
81
82static int __init fpe_init(void)
83{
84 if (sizeof(FPA11) > sizeof(union fp_state)) {
85 printk(KERN_ERR "nwfpe: bad structure size\n");
86 return -EINVAL;
87 }
88
89 if (sizeof(FPREG) != 12) {
90 printk(KERN_ERR "nwfpe: bad register size\n");
91 return -EINVAL;
92 }
93
94#ifdef MODULE
95 if (!mod_member_present(&__this_module, can_unload))
96 return -EINVAL;
97 __this_module.can_unload = fpe_unload;
98#else
99 if (fpe_type[0] && strcmp(fpe_type, "nwfpe"))
100 return 0;
101#endif
102
103 /* Display title, version and copyright information. */
104 printk(KERN_WARNING "NetWinder Floating Point Emulator V0.95 "
105 "(c) 1998-1999 Rebel.com\n");
106
107 /* Save pointer to the old FP handler and then patch ourselves in */
108 orig_fp_enter = kern_fp_enter;
109 kern_fp_enter = nwfpe_enter;
110
111 return 0;
112}
113
114static void __exit fpe_exit(void)
115{
116 /* Restore the values we saved earlier. */
117 kern_fp_enter = orig_fp_enter;
118}
119
120/*
121ScottB: November 4, 1998
122
123Moved this function out of softfloat-specialize into fpmodule.c.
124This effectively isolates all the changes required for integrating with the
125Linux kernel into fpmodule.c. Porting to NetBSD should only require modifying
126fpmodule.c to integrate with the NetBSD kernel (I hope!).
127
128[1/1/99: Not quite true any more unfortunately. There is Linux-specific
129code to access data in user space in some other source files at the
130moment (grep for get_user / put_user calls). --philb]
131
132float_exception_flags is a global variable in SoftFloat.
133
134This function is called by the SoftFloat routines to raise a floating
135point exception. We check the trap enable byte in the FPSR, and raise
136a SIGFPE exception if necessary. If not the relevant bits in the
137cumulative exceptions flag byte are set and we return.
138*/
139
140void float_raise(signed char flags)
141{
142 register unsigned int fpsr, cumulativeTraps;
143
144#ifdef CONFIG_DEBUG_USER
145 printk(KERN_DEBUG "NWFPE: %s[%d] takes exception %08x at %p from %08x\n",
146 current->comm, current->pid, flags,
147 __builtin_return_address(0), GET_USERREG()[15]);
148#endif
149
150 /* Keep SoftFloat exception flags up to date. */
151 float_exception_flags |= flags;
152
153 /* Read fpsr and initialize the cumulativeTraps. */
154 fpsr = readFPSR();
155 cumulativeTraps = 0;
156
157 /* For each type of exception, the cumulative trap exception bit is only
158 set if the corresponding trap enable bit is not set. */
159 if ((!(fpsr & BIT_IXE)) && (flags & BIT_IXC))
160 cumulativeTraps |= BIT_IXC;
161 if ((!(fpsr & BIT_UFE)) && (flags & BIT_UFC))
162 cumulativeTraps |= BIT_UFC;
163 if ((!(fpsr & BIT_OFE)) && (flags & BIT_OFC))
164 cumulativeTraps |= BIT_OFC;
165 if ((!(fpsr & BIT_DZE)) && (flags & BIT_DZC))
166 cumulativeTraps |= BIT_DZC;
167 if ((!(fpsr & BIT_IOE)) && (flags & BIT_IOC))
168 cumulativeTraps |= BIT_IOC;
169
170 /* Set the cumulative exceptions flags. */
171 if (cumulativeTraps)
172 writeFPSR(fpsr | cumulativeTraps);
173
174 /* Raise an exception if necessary. */
175 if (fpsr & (flags << 16))
176 fp_send_sig(SIGFPE, current, 1);
177}
178
179module_init(fpe_init);
180module_exit(fpe_exit);
diff --git a/arch/arm26/nwfpe/fpmodule.h b/arch/arm26/nwfpe/fpmodule.h
deleted file mode 100644
index f971ddd60cc1..000000000000
--- a/arch/arm26/nwfpe/fpmodule.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.com, 1998-1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __FPMODULE_H__
23#define __FPMODULE_H__
24
25
26#define REG_ORIG_R0 16
27#define REG_CPSR 15
28#define REG_PC 15
29#define REG_LR 14
30#define REG_SP 13
31#define REG_IP 12
32#define REG_FP 11
33#define REG_R10 10
34#define REG_R9 9
35#define REG_R9 9
36#define REG_R8 8
37#define REG_R7 7
38#define REG_R6 6
39#define REG_R5 5
40#define REG_R4 4
41#define REG_R3 3
42#define REG_R2 2
43#define REG_R1 1
44#define REG_R0 0
45
46#endif
diff --git a/arch/arm26/nwfpe/fpmodule.inl b/arch/arm26/nwfpe/fpmodule.inl
deleted file mode 100644
index ef228378ffaf..000000000000
--- a/arch/arm26/nwfpe/fpmodule.inl
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22extern __inline__
23unsigned int readRegister(const unsigned int nReg)
24{
25 /* Note: The CPU thinks it has dealt with the current instruction. As
26 a result the program counter has been advanced to the next
27 instruction, and points 4 bytes beyond the actual instruction
28 that caused the invalid instruction trap to occur. We adjust
29 for this in this routine. LDF/STF instructions with Rn = PC
30 depend on the PC being correct, as they use PC+8 in their
31 address calculations. */
32 unsigned int *userRegisters = GET_USERREG();
33 unsigned int val = userRegisters[nReg];
34 if (REG_PC == nReg) val -= 4;
35 return val;
36}
37
38extern __inline__
39void writeRegister(const unsigned int nReg, const unsigned int val)
40{
41 unsigned int *userRegisters = GET_USERREG();
42 userRegisters[nReg] = val;
43}
44
45extern __inline__
46unsigned int readCPSR(void)
47{
48 return(readRegister(REG_CPSR));
49}
50
51extern __inline__
52void writeCPSR(const unsigned int val)
53{
54 writeRegister(REG_CPSR,val);
55}
56
57extern __inline__
58unsigned int readConditionCodes(void)
59{
60#ifdef __FPEM_TEST__
61 return(0);
62#else
63 return(readCPSR() & CC_MASK);
64#endif
65}
66
67extern __inline__
68void writeConditionCodes(const unsigned int val)
69{
70 unsigned int *userRegisters = GET_USERREG();
71 unsigned int rval;
72 /*
73 * Operate directly on userRegisters since
74 * the CPSR may be the PC register itself.
75 */
76 rval = userRegisters[REG_CPSR] & ~CC_MASK;
77 userRegisters[REG_CPSR] = rval | (val & CC_MASK);
78}
79
80extern __inline__
81unsigned int readMemoryInt(unsigned int *pMem)
82{
83 return *pMem;
84}
diff --git a/arch/arm26/nwfpe/fpopcode.c b/arch/arm26/nwfpe/fpopcode.c
deleted file mode 100644
index d81ddd188322..000000000000
--- a/arch/arm26/nwfpe/fpopcode.c
+++ /dev/null
@@ -1,148 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "softfloat.h"
24#include "fpopcode.h"
25#include "fpsr.h"
26#include "fpmodule.h"
27#include "fpmodule.inl"
28
29const floatx80 floatx80Constant[] = {
30 { 0x0000, 0x0000000000000000ULL}, /* extended 0.0 */
31 { 0x3fff, 0x8000000000000000ULL}, /* extended 1.0 */
32 { 0x4000, 0x8000000000000000ULL}, /* extended 2.0 */
33 { 0x4000, 0xc000000000000000ULL}, /* extended 3.0 */
34 { 0x4001, 0x8000000000000000ULL}, /* extended 4.0 */
35 { 0x4001, 0xa000000000000000ULL}, /* extended 5.0 */
36 { 0x3ffe, 0x8000000000000000ULL}, /* extended 0.5 */
37 { 0x4002, 0xa000000000000000ULL} /* extended 10.0 */
38};
39
40const float64 float64Constant[] = {
41 0x0000000000000000ULL, /* double 0.0 */
42 0x3ff0000000000000ULL, /* double 1.0 */
43 0x4000000000000000ULL, /* double 2.0 */
44 0x4008000000000000ULL, /* double 3.0 */
45 0x4010000000000000ULL, /* double 4.0 */
46 0x4014000000000000ULL, /* double 5.0 */
47 0x3fe0000000000000ULL, /* double 0.5 */
48 0x4024000000000000ULL /* double 10.0 */
49};
50
51const float32 float32Constant[] = {
52 0x00000000, /* single 0.0 */
53 0x3f800000, /* single 1.0 */
54 0x40000000, /* single 2.0 */
55 0x40400000, /* single 3.0 */
56 0x40800000, /* single 4.0 */
57 0x40a00000, /* single 5.0 */
58 0x3f000000, /* single 0.5 */
59 0x41200000 /* single 10.0 */
60};
61
62unsigned int getTransferLength(const unsigned int opcode)
63{
64 unsigned int nRc;
65
66 switch (opcode & MASK_TRANSFER_LENGTH)
67 {
68 case 0x00000000: nRc = 1; break; /* single precision */
69 case 0x00008000: nRc = 2; break; /* double precision */
70 case 0x00400000: nRc = 3; break; /* extended precision */
71 default: nRc = 0;
72 }
73
74 return(nRc);
75}
76
77unsigned int getRegisterCount(const unsigned int opcode)
78{
79 unsigned int nRc;
80
81 switch (opcode & MASK_REGISTER_COUNT)
82 {
83 case 0x00000000: nRc = 4; break;
84 case 0x00008000: nRc = 1; break;
85 case 0x00400000: nRc = 2; break;
86 case 0x00408000: nRc = 3; break;
87 default: nRc = 0;
88 }
89
90 return(nRc);
91}
92
93unsigned int getRoundingPrecision(const unsigned int opcode)
94{
95 unsigned int nRc;
96
97 switch (opcode & MASK_ROUNDING_PRECISION)
98 {
99 case 0x00000000: nRc = 1; break;
100 case 0x00000080: nRc = 2; break;
101 case 0x00080000: nRc = 3; break;
102 default: nRc = 0;
103 }
104
105 return(nRc);
106}
107
108unsigned int getDestinationSize(const unsigned int opcode)
109{
110 unsigned int nRc;
111
112 switch (opcode & MASK_DESTINATION_SIZE)
113 {
114 case 0x00000000: nRc = typeSingle; break;
115 case 0x00000080: nRc = typeDouble; break;
116 case 0x00080000: nRc = typeExtended; break;
117 default: nRc = typeNone;
118 }
119
120 return(nRc);
121}
122
123/* condition code lookup table
124 index into the table is test code: EQ, NE, ... LT, GT, AL, NV
125 bit position in short is condition code: NZCV */
126static const unsigned short aCC[16] = {
127 0xF0F0, // EQ == Z set
128 0x0F0F, // NE
129 0xCCCC, // CS == C set
130 0x3333, // CC
131 0xFF00, // MI == N set
132 0x00FF, // PL
133 0xAAAA, // VS == V set
134 0x5555, // VC
135 0x0C0C, // HI == C set && Z clear
136 0xF3F3, // LS == C clear || Z set
137 0xAA55, // GE == (N==V)
138 0x55AA, // LT == (N!=V)
139 0x0A05, // GT == (!Z && (N==V))
140 0xF5FA, // LE == (Z || (N!=V))
141 0xFFFF, // AL always
142 0 // NV
143};
144
145unsigned int checkCondition(const unsigned int opcode, const unsigned int ccodes)
146{
147 return (aCC[opcode>>28] >> (ccodes>>28)) & 1;
148}
diff --git a/arch/arm26/nwfpe/fpopcode.h b/arch/arm26/nwfpe/fpopcode.h
deleted file mode 100644
index 13c7419262ab..000000000000
--- a/arch/arm26/nwfpe/fpopcode.h
+++ /dev/null
@@ -1,390 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __FPOPCODE_H__
23#define __FPOPCODE_H__
24
25/*
26ARM Floating Point Instruction Classes
27| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
28|c o n d|1 1 0 P|U|u|W|L| Rn |v| Fd |0|0|0|1| o f f s e t | CPDT
29|c o n d|1 1 0 P|U|w|W|L| Rn |x| Fd |0|0|0|1| o f f s e t | CPDT
30| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
31|c o n d|1 1 1 0|a|b|c|d|e| Fn |j| Fd |0|0|0|1|f|g|h|0|i| Fm | CPDO
32|c o n d|1 1 1 0|a|b|c|L|e| Fn | Rd |0|0|0|1|f|g|h|1|i| Fm | CPRT
33|c o n d|1 1 1 0|a|b|c|1|e| Fn |1|1|1|1|0|0|0|1|f|g|h|1|i| Fm | comparisons
34| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
35
36CPDT data transfer instructions
37 LDF, STF, LFM, SFM
38
39CPDO dyadic arithmetic instructions
40 ADF, MUF, SUF, RSF, DVF, RDF,
41 POW, RPW, RMF, FML, FDV, FRD, POL
42
43CPDO monadic arithmetic instructions
44 MVF, MNF, ABS, RND, SQT, LOG, LGN, EXP,
45 SIN, COS, TAN, ASN, ACS, ATN, URD, NRM
46
47CPRT joint arithmetic/data transfer instructions
48 FIX (arithmetic followed by load/store)
49 FLT (load/store followed by arithmetic)
50 CMF, CNF CMFE, CNFE (comparisons)
51 WFS, RFS (write/read floating point status register)
52 WFC, RFC (write/read floating point control register)
53
54cond condition codes
55P pre/post index bit: 0 = postindex, 1 = preindex
56U up/down bit: 0 = stack grows down, 1 = stack grows up
57W write back bit: 1 = update base register (Rn)
58L load/store bit: 0 = store, 1 = load
59Rn base register
60Rd destination/source register
61Fd floating point destination register
62Fn floating point source register
63Fm floating point source register or floating point constant
64
65uv transfer length (TABLE 1)
66wx register count (TABLE 2)
67abcd arithmetic opcode (TABLES 3 & 4)
68ef destination size (rounding precision) (TABLE 5)
69gh rounding mode (TABLE 6)
70j dyadic/monadic bit: 0 = dyadic, 1 = monadic
71i constant bit: 1 = constant (TABLE 6)
72*/
73
74/*
75TABLE 1
76+-------------------------+---+---+---------+---------+
77| Precision | u | v | FPSR.EP | length |
78+-------------------------+---+---+---------+---------+
79| Single | 0 ü 0 | x | 1 words |
80| Double | 1 ü 1 | x | 2 words |
81| Extended | 1 ü 1 | x | 3 words |
82| Packed decimal | 1 ü 1 | 0 | 3 words |
83| Expanded packed decimal | 1 ü 1 | 1 | 4 words |
84+-------------------------+---+---+---------+---------+
85Note: x = don't care
86*/
87
88/*
89TABLE 2
90+---+---+---------------------------------+
91| w | x | Number of registers to transfer |
92+---+---+---------------------------------+
93| 0 ü 1 | 1 |
94| 1 ü 0 | 2 |
95| 1 ü 1 | 3 |
96| 0 ü 0 | 4 |
97+---+---+---------------------------------+
98*/
99
100/*
101TABLE 3: Dyadic Floating Point Opcodes
102+---+---+---+---+----------+-----------------------+-----------------------+
103| a | b | c | d | Mnemonic | Description | Operation |
104+---+---+---+---+----------+-----------------------+-----------------------+
105| 0 | 0 | 0 | 0 | ADF | Add | Fd := Fn + Fm |
106| 0 | 0 | 0 | 1 | MUF | Multiply | Fd := Fn * Fm |
107| 0 | 0 | 1 | 0 | SUF | Subtract | Fd := Fn - Fm |
108| 0 | 0 | 1 | 1 | RSF | Reverse subtract | Fd := Fm - Fn |
109| 0 | 1 | 0 | 0 | DVF | Divide | Fd := Fn / Fm |
110| 0 | 1 | 0 | 1 | RDF | Reverse divide | Fd := Fm / Fn |
111| 0 | 1 | 1 | 0 | POW | Power | Fd := Fn ^ Fm |
112| 0 | 1 | 1 | 1 | RPW | Reverse power | Fd := Fm ^ Fn |
113| 1 | 0 | 0 | 0 | RMF | Remainder | Fd := IEEE rem(Fn/Fm) |
114| 1 | 0 | 0 | 1 | FML | Fast Multiply | Fd := Fn * Fm |
115| 1 | 0 | 1 | 0 | FDV | Fast Divide | Fd := Fn / Fm |
116| 1 | 0 | 1 | 1 | FRD | Fast reverse divide | Fd := Fm / Fn |
117| 1 | 1 | 0 | 0 | POL | Polar angle (ArcTan2) | Fd := arctan2(Fn,Fm) |
118| 1 | 1 | 0 | 1 | | undefined instruction | trap |
119| 1 | 1 | 1 | 0 | | undefined instruction | trap |
120| 1 | 1 | 1 | 1 | | undefined instruction | trap |
121+---+---+---+---+----------+-----------------------+-----------------------+
122Note: POW, RPW, POL are deprecated, and are available for backwards
123 compatibility only.
124*/
125
126/*
127TABLE 4: Monadic Floating Point Opcodes
128+---+---+---+---+----------+-----------------------+-----------------------+
129| a | b | c | d | Mnemonic | Description | Operation |
130+---+---+---+---+----------+-----------------------+-----------------------+
131| 0 | 0 | 0 | 0 | MVF | Move | Fd := Fm |
132| 0 | 0 | 0 | 1 | MNF | Move negated | Fd := - Fm |
133| 0 | 0 | 1 | 0 | ABS | Absolute value | Fd := abs(Fm) |
134| 0 | 0 | 1 | 1 | RND | Round to integer | Fd := int(Fm) |
135| 0 | 1 | 0 | 0 | SQT | Square root | Fd := sqrt(Fm) |
136| 0 | 1 | 0 | 1 | LOG | Log base 10 | Fd := log10(Fm) |
137| 0 | 1 | 1 | 0 | LGN | Log base e | Fd := ln(Fm) |
138| 0 | 1 | 1 | 1 | EXP | Exponent | Fd := e ^ Fm |
139| 1 | 0 | 0 | 0 | SIN | Sine | Fd := sin(Fm) |
140| 1 | 0 | 0 | 1 | COS | Cosine | Fd := cos(Fm) |
141| 1 | 0 | 1 | 0 | TAN | Tangent | Fd := tan(Fm) |
142| 1 | 0 | 1 | 1 | ASN | Arc Sine | Fd := arcsin(Fm) |
143| 1 | 1 | 0 | 0 | ACS | Arc Cosine | Fd := arccos(Fm) |
144| 1 | 1 | 0 | 1 | ATN | Arc Tangent | Fd := arctan(Fm) |
145| 1 | 1 | 1 | 0 | URD | Unnormalized round | Fd := int(Fm) |
146| 1 | 1 | 1 | 1 | NRM | Normalize | Fd := norm(Fm) |
147+---+---+---+---+----------+-----------------------+-----------------------+
148Note: LOG, LGN, EXP, SIN, COS, TAN, ASN, ACS, ATN are deprecated, and are
149 available for backwards compatibility only.
150*/
151
152/*
153TABLE 5
154+-------------------------+---+---+
155| Rounding Precision | e | f |
156+-------------------------+---+---+
157| IEEE Single precision | 0 ü 0 |
158| IEEE Double precision | 0 ü 1 |
159| IEEE Extended precision | 1 ü 0 |
160| undefined (trap) | 1 ü 1 |
161+-------------------------+---+---+
162*/
163
164/*
165TABLE 5
166+---------------------------------+---+---+
167| Rounding Mode | g | h |
168+---------------------------------+---+---+
169| Round to nearest (default) | 0 ü 0 |
170| Round toward plus infinity | 0 ü 1 |
171| Round toward negative infinity | 1 ü 0 |
172| Round toward zero | 1 ü 1 |
173+---------------------------------+---+---+
174*/
175
176/*
177===
178=== Definitions for load and store instructions
179===
180*/
181
182/* bit masks */
183#define BIT_PREINDEX 0x01000000
184#define BIT_UP 0x00800000
185#define BIT_WRITE_BACK 0x00200000
186#define BIT_LOAD 0x00100000
187
188/* masks for load/store */
189#define MASK_CPDT 0x0c000000 /* data processing opcode */
190#define MASK_OFFSET 0x000000ff
191#define MASK_TRANSFER_LENGTH 0x00408000
192#define MASK_REGISTER_COUNT MASK_TRANSFER_LENGTH
193#define MASK_COPROCESSOR 0x00000f00
194
195/* Tests for transfer length */
196#define TRANSFER_SINGLE 0x00000000
197#define TRANSFER_DOUBLE 0x00008000
198#define TRANSFER_EXTENDED 0x00400000
199#define TRANSFER_PACKED MASK_TRANSFER_LENGTH
200
201/* Get the coprocessor number from the opcode. */
202#define getCoprocessorNumber(opcode) ((opcode & MASK_COPROCESSOR) >> 8)
203
204/* Get the offset from the opcode. */
205#define getOffset(opcode) (opcode & MASK_OFFSET)
206
207/* Tests for specific data transfer load/store opcodes. */
208#define TEST_OPCODE(opcode,mask) (((opcode) & (mask)) == (mask))
209
210#define LOAD_OP(opcode) TEST_OPCODE((opcode),MASK_CPDT | BIT_LOAD)
211#define STORE_OP(opcode) ((opcode & (MASK_CPDT | BIT_LOAD)) == MASK_CPDT)
212
213#define LDF_OP(opcode) (LOAD_OP(opcode) && (getCoprocessorNumber(opcode) == 1))
214#define LFM_OP(opcode) (LOAD_OP(opcode) && (getCoprocessorNumber(opcode) == 2))
215#define STF_OP(opcode) (STORE_OP(opcode) && (getCoprocessorNumber(opcode) == 1))
216#define SFM_OP(opcode) (STORE_OP(opcode) && (getCoprocessorNumber(opcode) == 2))
217
218#define PREINDEXED(opcode) ((opcode & BIT_PREINDEX) != 0)
219#define POSTINDEXED(opcode) ((opcode & BIT_PREINDEX) == 0)
220#define BIT_UP_SET(opcode) ((opcode & BIT_UP) != 0)
221#define BIT_UP_CLEAR(opcode) ((opcode & BIT_DOWN) == 0)
222#define WRITE_BACK(opcode) ((opcode & BIT_WRITE_BACK) != 0)
223#define LOAD(opcode) ((opcode & BIT_LOAD) != 0)
224#define STORE(opcode) ((opcode & BIT_LOAD) == 0)
225
226/*
227===
228=== Definitions for arithmetic instructions
229===
230*/
231/* bit masks */
232#define BIT_MONADIC 0x00008000
233#define BIT_CONSTANT 0x00000008
234
235#define CONSTANT_FM(opcode) ((opcode & BIT_CONSTANT) != 0)
236#define MONADIC_INSTRUCTION(opcode) ((opcode & BIT_MONADIC) != 0)
237
238/* instruction identification masks */
239#define MASK_CPDO 0x0e000000 /* arithmetic opcode */
240#define MASK_ARITHMETIC_OPCODE 0x00f08000
241#define MASK_DESTINATION_SIZE 0x00080080
242
243/* dyadic arithmetic opcodes. */
244#define ADF_CODE 0x00000000
245#define MUF_CODE 0x00100000
246#define SUF_CODE 0x00200000
247#define RSF_CODE 0x00300000
248#define DVF_CODE 0x00400000
249#define RDF_CODE 0x00500000
250#define POW_CODE 0x00600000
251#define RPW_CODE 0x00700000
252#define RMF_CODE 0x00800000
253#define FML_CODE 0x00900000
254#define FDV_CODE 0x00a00000
255#define FRD_CODE 0x00b00000
256#define POL_CODE 0x00c00000
257/* 0x00d00000 is an invalid dyadic arithmetic opcode */
258/* 0x00e00000 is an invalid dyadic arithmetic opcode */
259/* 0x00f00000 is an invalid dyadic arithmetic opcode */
260
261/* monadic arithmetic opcodes. */
262#define MVF_CODE 0x00008000
263#define MNF_CODE 0x00108000
264#define ABS_CODE 0x00208000
265#define RND_CODE 0x00308000
266#define SQT_CODE 0x00408000
267#define LOG_CODE 0x00508000
268#define LGN_CODE 0x00608000
269#define EXP_CODE 0x00708000
270#define SIN_CODE 0x00808000
271#define COS_CODE 0x00908000
272#define TAN_CODE 0x00a08000
273#define ASN_CODE 0x00b08000
274#define ACS_CODE 0x00c08000
275#define ATN_CODE 0x00d08000
276#define URD_CODE 0x00e08000
277#define NRM_CODE 0x00f08000
278
279/*
280===
281=== Definitions for register transfer and comparison instructions
282===
283*/
284
285#define MASK_CPRT 0x0e000010 /* register transfer opcode */
286#define MASK_CPRT_CODE 0x00f00000
287#define FLT_CODE 0x00000000
288#define FIX_CODE 0x00100000
289#define WFS_CODE 0x00200000
290#define RFS_CODE 0x00300000
291#define WFC_CODE 0x00400000
292#define RFC_CODE 0x00500000
293#define CMF_CODE 0x00900000
294#define CNF_CODE 0x00b00000
295#define CMFE_CODE 0x00d00000
296#define CNFE_CODE 0x00f00000
297
298/*
299===
300=== Common definitions
301===
302*/
303
304/* register masks */
305#define MASK_Rd 0x0000f000
306#define MASK_Rn 0x000f0000
307#define MASK_Fd 0x00007000
308#define MASK_Fm 0x00000007
309#define MASK_Fn 0x00070000
310
311/* condition code masks */
312#define CC_MASK 0xf0000000
313#define CC_NEGATIVE 0x80000000
314#define CC_ZERO 0x40000000
315#define CC_CARRY 0x20000000
316#define CC_OVERFLOW 0x10000000
317#define CC_EQ 0x00000000
318#define CC_NE 0x10000000
319#define CC_CS 0x20000000
320#define CC_HS CC_CS
321#define CC_CC 0x30000000
322#define CC_LO CC_CC
323#define CC_MI 0x40000000
324#define CC_PL 0x50000000
325#define CC_VS 0x60000000
326#define CC_VC 0x70000000
327#define CC_HI 0x80000000
328#define CC_LS 0x90000000
329#define CC_GE 0xa0000000
330#define CC_LT 0xb0000000
331#define CC_GT 0xc0000000
332#define CC_LE 0xd0000000
333#define CC_AL 0xe0000000
334#define CC_NV 0xf0000000
335
336/* rounding masks/values */
337#define MASK_ROUNDING_MODE 0x00000060
338#define ROUND_TO_NEAREST 0x00000000
339#define ROUND_TO_PLUS_INFINITY 0x00000020
340#define ROUND_TO_MINUS_INFINITY 0x00000040
341#define ROUND_TO_ZERO 0x00000060
342
343#define MASK_ROUNDING_PRECISION 0x00080080
344#define ROUND_SINGLE 0x00000000
345#define ROUND_DOUBLE 0x00000080
346#define ROUND_EXTENDED 0x00080000
347
348/* Get the condition code from the opcode. */
349#define getCondition(opcode) (opcode >> 28)
350
351/* Get the source register from the opcode. */
352#define getRn(opcode) ((opcode & MASK_Rn) >> 16)
353
354/* Get the destination floating point register from the opcode. */
355#define getFd(opcode) ((opcode & MASK_Fd) >> 12)
356
357/* Get the first source floating point register from the opcode. */
358#define getFn(opcode) ((opcode & MASK_Fn) >> 16)
359
360/* Get the second source floating point register from the opcode. */
361#define getFm(opcode) (opcode & MASK_Fm)
362
363/* Get the destination register from the opcode. */
364#define getRd(opcode) ((opcode & MASK_Rd) >> 12)
365
366/* Get the rounding mode from the opcode. */
367#define getRoundingMode(opcode) ((opcode & MASK_ROUNDING_MODE) >> 5)
368
369static inline const floatx80 getExtendedConstant(const unsigned int nIndex)
370{
371 extern const floatx80 floatx80Constant[];
372 return floatx80Constant[nIndex];
373}
374
375static inline const float64 getDoubleConstant(const unsigned int nIndex)
376{
377 extern const float64 float64Constant[];
378 return float64Constant[nIndex];
379}
380
381static inline const float32 getSingleConstant(const unsigned int nIndex)
382{
383 extern const float32 float32Constant[];
384 return float32Constant[nIndex];
385}
386
387extern unsigned int getRegisterCount(const unsigned int opcode);
388extern unsigned int getDestinationSize(const unsigned int opcode);
389
390#endif
diff --git a/arch/arm26/nwfpe/fpsr.h b/arch/arm26/nwfpe/fpsr.h
deleted file mode 100644
index 6dafb0f5243c..000000000000
--- a/arch/arm26/nwfpe/fpsr.h
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.com, 1998-1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#ifndef __FPSR_H__
23#define __FPSR_H__
24
25/*
26The FPSR is a 32 bit register consisting of 4 parts, each exactly
27one byte.
28
29 SYSTEM ID
30 EXCEPTION TRAP ENABLE BYTE
31 SYSTEM CONTROL BYTE
32 CUMULATIVE EXCEPTION FLAGS BYTE
33
34The FPCR is a 32 bit register consisting of bit flags.
35*/
36
37/* SYSTEM ID
38------------
39Note: the system id byte is read only */
40
41typedef unsigned int FPSR; /* type for floating point status register */
42typedef unsigned int FPCR; /* type for floating point control register */
43
44#define MASK_SYSID 0xff000000
45#define BIT_HARDWARE 0x80000000
46#define FP_EMULATOR 0x01000000 /* System ID for emulator */
47#define FP_ACCELERATOR 0x81000000 /* System ID for FPA11 */
48
49/* EXCEPTION TRAP ENABLE BYTE
50----------------------------- */
51
52#define MASK_TRAP_ENABLE 0x00ff0000
53#define MASK_TRAP_ENABLE_STRICT 0x001f0000
54#define BIT_IXE 0x00100000 /* inexact exception enable */
55#define BIT_UFE 0x00080000 /* underflow exception enable */
56#define BIT_OFE 0x00040000 /* overflow exception enable */
57#define BIT_DZE 0x00020000 /* divide by zero exception enable */
58#define BIT_IOE 0x00010000 /* invalid operation exception enable */
59
60/* SYSTEM CONTROL BYTE
61---------------------- */
62
63#define MASK_SYSTEM_CONTROL 0x0000ff00
64#define MASK_TRAP_STRICT 0x00001f00
65
66#define BIT_AC 0x00001000 /* use alternative C-flag definition
67 for compares */
68#define BIT_EP 0x00000800 /* use expanded packed decimal format */
69#define BIT_SO 0x00000400 /* select synchronous operation of FPA */
70#define BIT_NE 0x00000200 /* NaN exception bit */
71#define BIT_ND 0x00000100 /* no denormalized numbers bit */
72
73/* CUMULATIVE EXCEPTION FLAGS BYTE
74---------------------------------- */
75
76#define MASK_EXCEPTION_FLAGS 0x000000ff
77#define MASK_EXCEPTION_FLAGS_STRICT 0x0000001f
78
79#define BIT_IXC 0x00000010 /* inexact exception flag */
80#define BIT_UFC 0x00000008 /* underflow exception flag */
81#define BIT_OFC 0x00000004 /* overfloat exception flag */
82#define BIT_DZC 0x00000002 /* divide by zero exception flag */
83#define BIT_IOC 0x00000001 /* invalid operation exception flag */
84
85/* Floating Point Control Register
86----------------------------------*/
87
88#define BIT_RU 0x80000000 /* rounded up bit */
89#define BIT_IE 0x10000000 /* inexact bit */
90#define BIT_MO 0x08000000 /* mantissa overflow bit */
91#define BIT_EO 0x04000000 /* exponent overflow bit */
92#define BIT_SB 0x00000800 /* store bounce */
93#define BIT_AB 0x00000400 /* arithmetic bounce */
94#define BIT_RE 0x00000200 /* rounding exception */
95#define BIT_DA 0x00000100 /* disable FPA */
96
97#define MASK_OP 0x00f08010 /* AU operation code */
98#define MASK_PR 0x00080080 /* AU precision */
99#define MASK_S1 0x00070000 /* AU source register 1 */
100#define MASK_S2 0x00000007 /* AU source register 2 */
101#define MASK_DS 0x00007000 /* AU destination register */
102#define MASK_RM 0x00000060 /* AU rounding mode */
103#define MASK_ALU 0x9cfff2ff /* only ALU can write these bits */
104#define MASK_RESET 0x00000d00 /* bits set on reset, all others cleared */
105#define MASK_WFC MASK_RESET
106#define MASK_RFC ~MASK_RESET
107
108#endif
diff --git a/arch/arm26/nwfpe/milieu.h b/arch/arm26/nwfpe/milieu.h
deleted file mode 100644
index a3892ab2dca4..000000000000
--- a/arch/arm26/nwfpe/milieu.h
+++ /dev/null
@@ -1,48 +0,0 @@
1
2/*
3===============================================================================
4
5This C header file is part of the SoftFloat IEC/IEEE Floating-point
6Arithmetic Package, Release 2.
7
8Written by John R. Hauser. This work was made possible in part by the
9International Computer Science Institute, located at Suite 600, 1947 Center
10Street, Berkeley, California 94704. Funding was partially provided by the
11National Science Foundation under grant MIP-9311980. The original version
12of this code was written as part of a project to build a fixed-point vector
13processor in collaboration with the University of California at Berkeley,
14overseen by Profs. Nelson Morgan and John Wawrzynek. More information
15is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
16arithmetic/softfloat.html'.
17
18THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
19has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
20TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
21PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
22AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
23
24Derivative works are acceptable, even for commercial purposes, so long as
25(1) they include prominent notice that the work is derivative, and (2) they
26include prominent notice akin to these three paragraphs for those parts of
27this code that are retained.
28
29===============================================================================
30*/
31
32/*
33-------------------------------------------------------------------------------
34Include common integer types and flags.
35-------------------------------------------------------------------------------
36*/
37#include "ARM-gcc.h"
38
39/*
40-------------------------------------------------------------------------------
41Symbolic Boolean literals.
42-------------------------------------------------------------------------------
43*/
44enum {
45 FALSE = 0,
46 TRUE = 1
47};
48
diff --git a/arch/arm26/nwfpe/single_cpdo.c b/arch/arm26/nwfpe/single_cpdo.c
deleted file mode 100644
index 5cdcddbb8999..000000000000
--- a/arch/arm26/nwfpe/single_cpdo.c
+++ /dev/null
@@ -1,255 +0,0 @@
1/*
2 NetWinder Floating Point Emulator
3 (c) Rebel.COM, 1998,1999
4
5 Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
22#include "fpa11.h"
23#include "softfloat.h"
24#include "fpopcode.h"
25
26float32 float32_exp(float32 Fm);
27float32 float32_ln(float32 Fm);
28float32 float32_sin(float32 rFm);
29float32 float32_cos(float32 rFm);
30float32 float32_arcsin(float32 rFm);
31float32 float32_arctan(float32 rFm);
32float32 float32_log(float32 rFm);
33float32 float32_tan(float32 rFm);
34float32 float32_arccos(float32 rFm);
35float32 float32_pow(float32 rFn,float32 rFm);
36float32 float32_pol(float32 rFn,float32 rFm);
37
38unsigned int SingleCPDO(const unsigned int opcode)
39{
40 FPA11 *fpa11 = GET_FPA11();
41 float32 rFm, rFn = 0; //FIXME - should be zero?
42 unsigned int Fd, Fm, Fn, nRc = 1;
43
44 Fm = getFm(opcode);
45 if (CONSTANT_FM(opcode))
46 {
47 rFm = getSingleConstant(Fm);
48 }
49 else
50 {
51 switch (fpa11->fType[Fm])
52 {
53 case typeSingle:
54 rFm = fpa11->fpreg[Fm].fSingle;
55 break;
56
57 default: return 0;
58 }
59 }
60
61 if (!MONADIC_INSTRUCTION(opcode))
62 {
63 Fn = getFn(opcode);
64 switch (fpa11->fType[Fn])
65 {
66 case typeSingle:
67 rFn = fpa11->fpreg[Fn].fSingle;
68 break;
69
70 default: return 0;
71 }
72 }
73
74 Fd = getFd(opcode);
75 switch (opcode & MASK_ARITHMETIC_OPCODE)
76 {
77 /* dyadic opcodes */
78 case ADF_CODE:
79 fpa11->fpreg[Fd].fSingle = float32_add(rFn,rFm);
80 break;
81
82 case MUF_CODE:
83 case FML_CODE:
84 fpa11->fpreg[Fd].fSingle = float32_mul(rFn,rFm);
85 break;
86
87 case SUF_CODE:
88 fpa11->fpreg[Fd].fSingle = float32_sub(rFn,rFm);
89 break;
90
91 case RSF_CODE:
92 fpa11->fpreg[Fd].fSingle = float32_sub(rFm,rFn);
93 break;
94
95 case DVF_CODE:
96 case FDV_CODE:
97 fpa11->fpreg[Fd].fSingle = float32_div(rFn,rFm);
98 break;
99
100 case RDF_CODE:
101 case FRD_CODE:
102 fpa11->fpreg[Fd].fSingle = float32_div(rFm,rFn);
103 break;
104
105#if 0
106 case POW_CODE:
107 fpa11->fpreg[Fd].fSingle = float32_pow(rFn,rFm);
108 break;
109
110 case RPW_CODE:
111 fpa11->fpreg[Fd].fSingle = float32_pow(rFm,rFn);
112 break;
113#endif
114
115 case RMF_CODE:
116 fpa11->fpreg[Fd].fSingle = float32_rem(rFn,rFm);
117 break;
118
119#if 0
120 case POL_CODE:
121 fpa11->fpreg[Fd].fSingle = float32_pol(rFn,rFm);
122 break;
123#endif
124
125 /* monadic opcodes */
126 case MVF_CODE:
127 fpa11->fpreg[Fd].fSingle = rFm;
128 break;
129
130 case MNF_CODE:
131 rFm ^= 0x80000000;
132 fpa11->fpreg[Fd].fSingle = rFm;
133 break;
134
135 case ABS_CODE:
136 rFm &= 0x7fffffff;
137 fpa11->fpreg[Fd].fSingle = rFm;
138 break;
139
140 case RND_CODE:
141 case URD_CODE:
142 fpa11->fpreg[Fd].fSingle = float32_round_to_int(rFm);
143 break;
144
145 case SQT_CODE:
146 fpa11->fpreg[Fd].fSingle = float32_sqrt(rFm);
147 break;
148
149#if 0
150 case LOG_CODE:
151 fpa11->fpreg[Fd].fSingle = float32_log(rFm);
152 break;
153
154 case LGN_CODE:
155 fpa11->fpreg[Fd].fSingle = float32_ln(rFm);
156 break;
157
158 case EXP_CODE:
159 fpa11->fpreg[Fd].fSingle = float32_exp(rFm);
160 break;
161
162 case SIN_CODE:
163 fpa11->fpreg[Fd].fSingle = float32_sin(rFm);
164 break;
165
166 case COS_CODE:
167 fpa11->fpreg[Fd].fSingle = float32_cos(rFm);
168 break;
169
170 case TAN_CODE:
171 fpa11->fpreg[Fd].fSingle = float32_tan(rFm);
172 break;
173
174 case ASN_CODE:
175 fpa11->fpreg[Fd].fSingle = float32_arcsin(rFm);
176 break;
177
178 case ACS_CODE:
179 fpa11->fpreg[Fd].fSingle = float32_arccos(rFm);
180 break;
181
182 case ATN_CODE:
183 fpa11->fpreg[Fd].fSingle = float32_arctan(rFm);
184 break;
185#endif
186
187 case NRM_CODE:
188 break;
189
190 default:
191 {
192 nRc = 0;
193 }
194 }
195
196 if (0 != nRc) fpa11->fType[Fd] = typeSingle;
197 return nRc;
198}
199
200#if 0
201float32 float32_exp(float32 Fm)
202{
203//series
204}
205
206float32 float32_ln(float32 Fm)
207{
208//series
209}
210
211float32 float32_sin(float32 rFm)
212{
213//series
214}
215
216float32 float32_cos(float32 rFm)
217{
218//series
219}
220
221float32 float32_arcsin(float32 rFm)
222{
223//series
224}
225
226float32 float32_arctan(float32 rFm)
227{
228 //series
229}
230
231float32 float32_arccos(float32 rFm)
232{
233 //return float32_sub(halfPi,float32_arcsin(rFm));
234}
235
236float32 float32_log(float32 rFm)
237{
238 return float32_div(float32_ln(rFm),getSingleConstant(7));
239}
240
241float32 float32_tan(float32 rFm)
242{
243 return float32_div(float32_sin(rFm),float32_cos(rFm));
244}
245
246float32 float32_pow(float32 rFn,float32 rFm)
247{
248 return float32_exp(float32_mul(rFm,float32_ln(rFn)));
249}
250
251float32 float32_pol(float32 rFn,float32 rFm)
252{
253 return float32_arctan(float32_div(rFn,rFm));
254}
255#endif
diff --git a/arch/arm26/nwfpe/softfloat-macros b/arch/arm26/nwfpe/softfloat-macros
deleted file mode 100644
index 5469989f2c5e..000000000000
--- a/arch/arm26/nwfpe/softfloat-macros
+++ /dev/null
@@ -1,740 +0,0 @@
1
2/*
3===============================================================================
4
5This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
6Arithmetic Package, Release 2.
7
8Written by John R. Hauser. This work was made possible in part by the
9International Computer Science Institute, located at Suite 600, 1947 Center
10Street, Berkeley, California 94704. Funding was partially provided by the
11National Science Foundation under grant MIP-9311980. The original version
12of this code was written as part of a project to build a fixed-point vector
13processor in collaboration with the University of California at Berkeley,
14overseen by Profs. Nelson Morgan and John Wawrzynek. More information
15is available through the web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
16arithmetic/softfloat.html'.
17
18THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
19has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
20TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
21PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
22AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
23
24Derivative works are acceptable, even for commercial purposes, so long as
25(1) they include prominent notice that the work is derivative, and (2) they
26include prominent notice akin to these three paragraphs for those parts of
27this code that are retained.
28
29===============================================================================
30*/
31
32/*
33-------------------------------------------------------------------------------
34Shifts `a' right by the number of bits given in `count'. If any nonzero
35bits are shifted off, they are ``jammed'' into the least significant bit of
36the result by setting the least significant bit to 1. The value of `count'
37can be arbitrarily large; in particular, if `count' is greater than 32, the
38result will be either 0 or 1, depending on whether `a' is zero or nonzero.
39The result is stored in the location pointed to by `zPtr'.
40-------------------------------------------------------------------------------
41*/
42INLINE void shift32RightJamming( bits32 a, int16 count, bits32 *zPtr )
43{
44 bits32 z;
45 if ( count == 0 ) {
46 z = a;
47 }
48 else if ( count < 32 ) {
49 z = ( a>>count ) | ( ( a<<( ( - count ) & 31 ) ) != 0 );
50 }
51 else {
52 z = ( a != 0 );
53 }
54 *zPtr = z;
55}
56
57/*
58-------------------------------------------------------------------------------
59Shifts `a' right by the number of bits given in `count'. If any nonzero
60bits are shifted off, they are ``jammed'' into the least significant bit of
61the result by setting the least significant bit to 1. The value of `count'
62can be arbitrarily large; in particular, if `count' is greater than 64, the
63result will be either 0 or 1, depending on whether `a' is zero or nonzero.
64The result is stored in the location pointed to by `zPtr'.
65-------------------------------------------------------------------------------
66*/
67INLINE void shift64RightJamming( bits64 a, int16 count, bits64 *zPtr )
68{
69 bits64 z;
70
71 __asm__("@shift64RightJamming -- start");
72 if ( count == 0 ) {
73 z = a;
74 }
75 else if ( count < 64 ) {
76 z = ( a>>count ) | ( ( a<<( ( - count ) & 63 ) ) != 0 );
77 }
78 else {
79 z = ( a != 0 );
80 }
81 __asm__("@shift64RightJamming -- end");
82 *zPtr = z;
83}
84
85/*
86-------------------------------------------------------------------------------
87Shifts the 128-bit value formed by concatenating `a0' and `a1' right by 64
88_plus_ the number of bits given in `count'. The shifted result is at most
8964 nonzero bits; this is stored at the location pointed to by `z0Ptr'. The
90bits shifted off form a second 64-bit result as follows: The _last_ bit
91shifted off is the most-significant bit of the extra result, and the other
9263 bits of the extra result are all zero if and only if _all_but_the_last_
93bits shifted off were all zero. This extra result is stored in the location
94pointed to by `z1Ptr'. The value of `count' can be arbitrarily large.
95 (This routine makes more sense if `a0' and `a1' are considered to form a
96fixed-point value with binary point between `a0' and `a1'. This fixed-point
97value is shifted right by the number of bits given in `count', and the
98integer part of the result is returned at the location pointed to by
99`z0Ptr'. The fractional part of the result may be slightly corrupted as
100described above, and is returned at the location pointed to by `z1Ptr'.)
101-------------------------------------------------------------------------------
102*/
103INLINE void
104 shift64ExtraRightJamming(
105 bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
106{
107 bits64 z0, z1;
108 int8 negCount = ( - count ) & 63;
109
110 if ( count == 0 ) {
111 z1 = a1;
112 z0 = a0;
113 }
114 else if ( count < 64 ) {
115 z1 = ( a0<<negCount ) | ( a1 != 0 );
116 z0 = a0>>count;
117 }
118 else {
119 if ( count == 64 ) {
120 z1 = a0 | ( a1 != 0 );
121 }
122 else {
123 z1 = ( ( a0 | a1 ) != 0 );
124 }
125 z0 = 0;
126 }
127 *z1Ptr = z1;
128 *z0Ptr = z0;
129
130}
131
132/*
133-------------------------------------------------------------------------------
134Shifts the 128-bit value formed by concatenating `a0' and `a1' right by the
135number of bits given in `count'. Any bits shifted off are lost. The value
136of `count' can be arbitrarily large; in particular, if `count' is greater
137than 128, the result will be 0. The result is broken into two 64-bit pieces
138which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
139-------------------------------------------------------------------------------
140*/
141INLINE void
142 shift128Right(
143 bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
144{
145 bits64 z0, z1;
146 int8 negCount = ( - count ) & 63;
147
148 if ( count == 0 ) {
149 z1 = a1;
150 z0 = a0;
151 }
152 else if ( count < 64 ) {
153 z1 = ( a0<<negCount ) | ( a1>>count );
154 z0 = a0>>count;
155 }
156 else {
157 z1 = ( count < 64 ) ? ( a0>>( count & 63 ) ) : 0;
158 z0 = 0;
159 }
160 *z1Ptr = z1;
161 *z0Ptr = z0;
162
163}
164
165/*
166-------------------------------------------------------------------------------
167Shifts the 128-bit value formed by concatenating `a0' and `a1' right by the
168number of bits given in `count'. If any nonzero bits are shifted off, they
169are ``jammed'' into the least significant bit of the result by setting the
170least significant bit to 1. The value of `count' can be arbitrarily large;
171in particular, if `count' is greater than 128, the result will be either 0
172or 1, depending on whether the concatenation of `a0' and `a1' is zero or
173nonzero. The result is broken into two 64-bit pieces which are stored at
174the locations pointed to by `z0Ptr' and `z1Ptr'.
175-------------------------------------------------------------------------------
176*/
177INLINE void
178 shift128RightJamming(
179 bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
180{
181 bits64 z0, z1;
182 int8 negCount = ( - count ) & 63;
183
184 if ( count == 0 ) {
185 z1 = a1;
186 z0 = a0;
187 }
188 else if ( count < 64 ) {
189 z1 = ( a0<<negCount ) | ( a1>>count ) | ( ( a1<<negCount ) != 0 );
190 z0 = a0>>count;
191 }
192 else {
193 if ( count == 64 ) {
194 z1 = a0 | ( a1 != 0 );
195 }
196 else if ( count < 128 ) {
197 z1 = ( a0>>( count & 63 ) ) | ( ( ( a0<<negCount ) | a1 ) != 0 );
198 }
199 else {
200 z1 = ( ( a0 | a1 ) != 0 );
201 }
202 z0 = 0;
203 }
204 *z1Ptr = z1;
205 *z0Ptr = z0;
206
207}
208
209/*
210-------------------------------------------------------------------------------
211Shifts the 192-bit value formed by concatenating `a0', `a1', and `a2' right
212by 64 _plus_ the number of bits given in `count'. The shifted result is
213at most 128 nonzero bits; these are broken into two 64-bit pieces which are
214stored at the locations pointed to by `z0Ptr' and `z1Ptr'. The bits shifted
215off form a third 64-bit result as follows: The _last_ bit shifted off is
216the most-significant bit of the extra result, and the other 63 bits of the
217extra result are all zero if and only if _all_but_the_last_ bits shifted off
218were all zero. This extra result is stored in the location pointed to by
219`z2Ptr'. The value of `count' can be arbitrarily large.
220 (This routine makes more sense if `a0', `a1', and `a2' are considered
221to form a fixed-point value with binary point between `a1' and `a2'. This
222fixed-point value is shifted right by the number of bits given in `count',
223and the integer part of the result is returned at the locations pointed to
224by `z0Ptr' and `z1Ptr'. The fractional part of the result may be slightly
225corrupted as described above, and is returned at the location pointed to by
226`z2Ptr'.)
227-------------------------------------------------------------------------------
228*/
229INLINE void
230 shift128ExtraRightJamming(
231 bits64 a0,
232 bits64 a1,
233 bits64 a2,
234 int16 count,
235 bits64 *z0Ptr,
236 bits64 *z1Ptr,
237 bits64 *z2Ptr
238 )
239{
240 bits64 z0, z1, z2;
241 int8 negCount = ( - count ) & 63;
242
243 if ( count == 0 ) {
244 z2 = a2;
245 z1 = a1;
246 z0 = a0;
247 }
248 else {
249 if ( count < 64 ) {
250 z2 = a1<<negCount;
251 z1 = ( a0<<negCount ) | ( a1>>count );
252 z0 = a0>>count;
253 }
254 else {
255 if ( count == 64 ) {
256 z2 = a1;
257 z1 = a0;
258 }
259 else {
260 a2 |= a1;
261 if ( count < 128 ) {
262 z2 = a0<<negCount;
263 z1 = a0>>( count & 63 );
264 }
265 else {
266 z2 = ( count == 128 ) ? a0 : ( a0 != 0 );
267 z1 = 0;
268 }
269 }
270 z0 = 0;
271 }
272 z2 |= ( a2 != 0 );
273 }
274 *z2Ptr = z2;
275 *z1Ptr = z1;
276 *z0Ptr = z0;
277
278}
279
280/*
281-------------------------------------------------------------------------------
282Shifts the 128-bit value formed by concatenating `a0' and `a1' left by the
283number of bits given in `count'. Any bits shifted off are lost. The value
284of `count' must be less than 64. The result is broken into two 64-bit
285pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
286-------------------------------------------------------------------------------
287*/
288INLINE void
289 shortShift128Left(
290 bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
291{
292
293 *z1Ptr = a1<<count;
294 *z0Ptr =
295 ( count == 0 ) ? a0 : ( a0<<count ) | ( a1>>( ( - count ) & 63 ) );
296
297}
298
299/*
300-------------------------------------------------------------------------------
301Shifts the 192-bit value formed by concatenating `a0', `a1', and `a2' left
302by the number of bits given in `count'. Any bits shifted off are lost.
303The value of `count' must be less than 64. The result is broken into three
30464-bit pieces which are stored at the locations pointed to by `z0Ptr',
305`z1Ptr', and `z2Ptr'.
306-------------------------------------------------------------------------------
307*/
308INLINE void
309 shortShift192Left(
310 bits64 a0,
311 bits64 a1,
312 bits64 a2,
313 int16 count,
314 bits64 *z0Ptr,
315 bits64 *z1Ptr,
316 bits64 *z2Ptr
317 )
318{
319 bits64 z0, z1, z2;
320 int8 negCount;
321
322 z2 = a2<<count;
323 z1 = a1<<count;
324 z0 = a0<<count;
325 if ( 0 < count ) {
326 negCount = ( ( - count ) & 63 );
327 z1 |= a2>>negCount;
328 z0 |= a1>>negCount;
329 }
330 *z2Ptr = z2;
331 *z1Ptr = z1;
332 *z0Ptr = z0;
333
334}
335
336/*
337-------------------------------------------------------------------------------
338Adds the 128-bit value formed by concatenating `a0' and `a1' to the 128-bit
339value formed by concatenating `b0' and `b1'. Addition is modulo 2^128, so
340any carry out is lost. The result is broken into two 64-bit pieces which
341are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
342-------------------------------------------------------------------------------
343*/
344INLINE void
345 add128(
346 bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 *z0Ptr, bits64 *z1Ptr )
347{
348 bits64 z1;
349
350 z1 = a1 + b1;
351 *z1Ptr = z1;
352 *z0Ptr = a0 + b0 + ( z1 < a1 );
353
354}
355
356/*
357-------------------------------------------------------------------------------
358Adds the 192-bit value formed by concatenating `a0', `a1', and `a2' to the
359192-bit value formed by concatenating `b0', `b1', and `b2'. Addition is
360modulo 2^192, so any carry out is lost. The result is broken into three
36164-bit pieces which are stored at the locations pointed to by `z0Ptr',
362`z1Ptr', and `z2Ptr'.
363-------------------------------------------------------------------------------
364*/
365INLINE void
366 add192(
367 bits64 a0,
368 bits64 a1,
369 bits64 a2,
370 bits64 b0,
371 bits64 b1,
372 bits64 b2,
373 bits64 *z0Ptr,
374 bits64 *z1Ptr,
375 bits64 *z2Ptr
376 )
377{
378 bits64 z0, z1, z2;
379 int8 carry0, carry1;
380
381 z2 = a2 + b2;
382 carry1 = ( z2 < a2 );
383 z1 = a1 + b1;
384 carry0 = ( z1 < a1 );
385 z0 = a0 + b0;
386 z1 += carry1;
387 z0 += ( z1 < carry1 );
388 z0 += carry0;
389 *z2Ptr = z2;
390 *z1Ptr = z1;
391 *z0Ptr = z0;
392
393}
394
395/*
396-------------------------------------------------------------------------------
397Subtracts the 128-bit value formed by concatenating `b0' and `b1' from the
398128-bit value formed by concatenating `a0' and `a1'. Subtraction is modulo
3992^128, so any borrow out (carry out) is lost. The result is broken into two
40064-bit pieces which are stored at the locations pointed to by `z0Ptr' and
401`z1Ptr'.
402-------------------------------------------------------------------------------
403*/
404INLINE void
405 sub128(
406 bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 *z0Ptr, bits64 *z1Ptr )
407{
408
409 *z1Ptr = a1 - b1;
410 *z0Ptr = a0 - b0 - ( a1 < b1 );
411
412}
413
414/*
415-------------------------------------------------------------------------------
416Subtracts the 192-bit value formed by concatenating `b0', `b1', and `b2'
417from the 192-bit value formed by concatenating `a0', `a1', and `a2'.
418Subtraction is modulo 2^192, so any borrow out (carry out) is lost. The
419result is broken into three 64-bit pieces which are stored at the locations
420pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'.
421-------------------------------------------------------------------------------
422*/
423INLINE void
424 sub192(
425 bits64 a0,
426 bits64 a1,
427 bits64 a2,
428 bits64 b0,
429 bits64 b1,
430 bits64 b2,
431 bits64 *z0Ptr,
432 bits64 *z1Ptr,
433 bits64 *z2Ptr
434 )
435{
436 bits64 z0, z1, z2;
437 int8 borrow0, borrow1;
438
439 z2 = a2 - b2;
440 borrow1 = ( a2 < b2 );
441 z1 = a1 - b1;
442 borrow0 = ( a1 < b1 );
443 z0 = a0 - b0;
444 z0 -= ( z1 < borrow1 );
445 z1 -= borrow1;
446 z0 -= borrow0;
447 *z2Ptr = z2;
448 *z1Ptr = z1;
449 *z0Ptr = z0;
450
451}
452
453/*
454-------------------------------------------------------------------------------
455Multiplies `a' by `b' to obtain a 128-bit product. The product is broken
456into two 64-bit pieces which are stored at the locations pointed to by
457`z0Ptr' and `z1Ptr'.
458-------------------------------------------------------------------------------
459*/
460INLINE void mul64To128( bits64 a, bits64 b, bits64 *z0Ptr, bits64 *z1Ptr )
461{
462 bits32 aHigh, aLow, bHigh, bLow;
463 bits64 z0, zMiddleA, zMiddleB, z1;
464
465 aLow = a;
466 aHigh = a>>32;
467 bLow = b;
468 bHigh = b>>32;
469 z1 = ( (bits64) aLow ) * bLow;
470 zMiddleA = ( (bits64) aLow ) * bHigh;
471 zMiddleB = ( (bits64) aHigh ) * bLow;
472 z0 = ( (bits64) aHigh ) * bHigh;
473 zMiddleA += zMiddleB;
474 z0 += ( ( (bits64) ( zMiddleA < zMiddleB ) )<<32 ) + ( zMiddleA>>32 );
475 zMiddleA <<= 32;
476 z1 += zMiddleA;
477 z0 += ( z1 < zMiddleA );
478 *z1Ptr = z1;
479 *z0Ptr = z0;
480
481}
482
483/*
484-------------------------------------------------------------------------------
485Multiplies the 128-bit value formed by concatenating `a0' and `a1' by `b' to
486obtain a 192-bit product. The product is broken into three 64-bit pieces
487which are stored at the locations pointed to by `z0Ptr', `z1Ptr', and
488`z2Ptr'.
489-------------------------------------------------------------------------------
490*/
491INLINE void
492 mul128By64To192(
493 bits64 a0,
494 bits64 a1,
495 bits64 b,
496 bits64 *z0Ptr,
497 bits64 *z1Ptr,
498 bits64 *z2Ptr
499 )
500{
501 bits64 z0, z1, z2, more1;
502
503 mul64To128( a1, b, &z1, &z2 );
504 mul64To128( a0, b, &z0, &more1 );
505 add128( z0, more1, 0, z1, &z0, &z1 );
506 *z2Ptr = z2;
507 *z1Ptr = z1;
508 *z0Ptr = z0;
509
510}
511
512/*
513-------------------------------------------------------------------------------
514Multiplies the 128-bit value formed by concatenating `a0' and `a1' to the
515128-bit value formed by concatenating `b0' and `b1' to obtain a 256-bit
516product. The product is broken into four 64-bit pieces which are stored at
517the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'.
518-------------------------------------------------------------------------------
519*/
520INLINE void
521 mul128To256(
522 bits64 a0,
523 bits64 a1,
524 bits64 b0,
525 bits64 b1,
526 bits64 *z0Ptr,
527 bits64 *z1Ptr,
528 bits64 *z2Ptr,
529 bits64 *z3Ptr
530 )
531{
532 bits64 z0, z1, z2, z3;
533 bits64 more1, more2;
534
535 mul64To128( a1, b1, &z2, &z3 );
536 mul64To128( a1, b0, &z1, &more2 );
537 add128( z1, more2, 0, z2, &z1, &z2 );
538 mul64To128( a0, b0, &z0, &more1 );
539 add128( z0, more1, 0, z1, &z0, &z1 );
540 mul64To128( a0, b1, &more1, &more2 );
541 add128( more1, more2, 0, z2, &more1, &z2 );
542 add128( z0, z1, 0, more1, &z0, &z1 );
543 *z3Ptr = z3;
544 *z2Ptr = z2;
545 *z1Ptr = z1;
546 *z0Ptr = z0;
547
548}
549
550/*
551-------------------------------------------------------------------------------
552Returns an approximation to the 64-bit integer quotient obtained by dividing
553`b' into the 128-bit value formed by concatenating `a0' and `a1'. The
554divisor `b' must be at least 2^63. If q is the exact quotient truncated
555toward zero, the approximation returned lies between q and q + 2 inclusive.
556If the exact quotient q is larger than 64 bits, the maximum positive 64-bit
557unsigned integer is returned.
558-------------------------------------------------------------------------------
559*/
560static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b )
561{
562 bits64 b0, b1;
563 bits64 rem0, rem1, term0, term1;
564 bits64 z;
565 if ( b <= a0 ) return LIT64( 0xFFFFFFFFFFFFFFFF );
566 b0 = b>>32;
567 z = ( b0<<32 <= a0 ) ? LIT64( 0xFFFFFFFF00000000 ) : ( a0 / b0 )<<32;
568 mul64To128( b, z, &term0, &term1 );
569 sub128( a0, a1, term0, term1, &rem0, &rem1 );
570 while ( ( (sbits64) rem0 ) < 0 ) {
571 z -= LIT64( 0x100000000 );
572 b1 = b<<32;
573 add128( rem0, rem1, b0, b1, &rem0, &rem1 );
574 }
575 rem0 = ( rem0<<32 ) | ( rem1>>32 );
576 z |= ( b0<<32 <= rem0 ) ? 0xFFFFFFFF : rem0 / b0;
577 return z;
578
579}
580
581/*
582-------------------------------------------------------------------------------
583Returns an approximation to the square root of the 32-bit significand given
584by `a'. Considered as an integer, `a' must be at least 2^31. If bit 0 of
585`aExp' (the least significant bit) is 1, the integer returned approximates
5862^31*sqrt(`a'/2^31), where `a' is considered an integer. If bit 0 of `aExp'
587is 0, the integer returned approximates 2^31*sqrt(`a'/2^30). In either
588case, the approximation returned lies strictly within +/-2 of the exact
589value.
590-------------------------------------------------------------------------------
591*/
592static bits32 estimateSqrt32( int16 aExp, bits32 a )
593{
594 static const bits16 sqrtOddAdjustments[] = {
595 0x0004, 0x0022, 0x005D, 0x00B1, 0x011D, 0x019F, 0x0236, 0x02E0,
596 0x039C, 0x0468, 0x0545, 0x0631, 0x072B, 0x0832, 0x0946, 0x0A67
597 };
598 static const bits16 sqrtEvenAdjustments[] = {
599 0x0A2D, 0x08AF, 0x075A, 0x0629, 0x051A, 0x0429, 0x0356, 0x029E,
600 0x0200, 0x0179, 0x0109, 0x00AF, 0x0068, 0x0034, 0x0012, 0x0002
601 };
602 int8 index;
603 bits32 z;
604
605 index = ( a>>27 ) & 15;
606 if ( aExp & 1 ) {
607 z = 0x4000 + ( a>>17 ) - sqrtOddAdjustments[ index ];
608 z = ( ( a / z )<<14 ) + ( z<<15 );
609 a >>= 1;
610 }
611 else {
612 z = 0x8000 + ( a>>17 ) - sqrtEvenAdjustments[ index ];
613 z = a / z + z;
614 z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 );
615 if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 );
616 }
617 return ( (bits32) ( ( ( (bits64) a )<<31 ) / z ) ) + ( z>>1 );
618
619}
620
621/*
622-------------------------------------------------------------------------------
623Returns the number of leading 0 bits before the most-significant 1 bit
624of `a'. If `a' is zero, 32 is returned.
625-------------------------------------------------------------------------------
626*/
627static int8 countLeadingZeros32( bits32 a )
628{
629 static const int8 countLeadingZerosHigh[] = {
630 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
631 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
632 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
633 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
634 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
635 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
636 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
637 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
638 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
639 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
640 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
641 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
642 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
643 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
644 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
645 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
646 };
647 int8 shiftCount;
648
649 shiftCount = 0;
650 if ( a < 0x10000 ) {
651 shiftCount += 16;
652 a <<= 16;
653 }
654 if ( a < 0x1000000 ) {
655 shiftCount += 8;
656 a <<= 8;
657 }
658 shiftCount += countLeadingZerosHigh[ a>>24 ];
659 return shiftCount;
660
661}
662
663/*
664-------------------------------------------------------------------------------
665Returns the number of leading 0 bits before the most-significant 1 bit
666of `a'. If `a' is zero, 64 is returned.
667-------------------------------------------------------------------------------
668*/
669static int8 countLeadingZeros64( bits64 a )
670{
671 int8 shiftCount;
672
673 shiftCount = 0;
674 if ( a < ( (bits64) 1 )<<32 ) {
675 shiftCount += 32;
676 }
677 else {
678 a >>= 32;
679 }
680 shiftCount += countLeadingZeros32( a );
681 return shiftCount;
682
683}
684
685/*
686-------------------------------------------------------------------------------
687Returns 1 if the 128-bit value formed by concatenating `a0' and `a1'
688is equal to the 128-bit value formed by concatenating `b0' and `b1'.
689Otherwise, returns 0.
690-------------------------------------------------------------------------------
691*/
692INLINE flag eq128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
693{
694
695 return ( a0 == b0 ) && ( a1 == b1 );
696
697}
698
699/*
700-------------------------------------------------------------------------------
701Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is less
702than or equal to the 128-bit value formed by concatenating `b0' and `b1'.
703Otherwise, returns 0.
704-------------------------------------------------------------------------------
705*/
706INLINE flag le128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
707{
708
709 return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
710
711}
712
713/*
714-------------------------------------------------------------------------------
715Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is less
716than the 128-bit value formed by concatenating `b0' and `b1'. Otherwise,
717returns 0.
718-------------------------------------------------------------------------------
719*/
720INLINE flag lt128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
721{
722
723 return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
724
725}
726
727/*
728-------------------------------------------------------------------------------
729Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is
730not equal to the 128-bit value formed by concatenating `b0' and `b1'.
731Otherwise, returns 0.
732-------------------------------------------------------------------------------
733*/
734INLINE flag ne128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
735{
736
737 return ( a0 != b0 ) || ( a1 != b1 );
738
739}
740
diff --git a/arch/arm26/nwfpe/softfloat-specialize b/arch/arm26/nwfpe/softfloat-specialize
deleted file mode 100644
index acf409144763..000000000000
--- a/arch/arm26/nwfpe/softfloat-specialize
+++ /dev/null
@@ -1,366 +0,0 @@
1
2/*
3===============================================================================
4
5This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
6Arithmetic Package, Release 2.
7
8Written by John R. Hauser. This work was made possible in part by the
9International Computer Science Institute, located at Suite 600, 1947 Center
10Street, Berkeley, California 94704. Funding was partially provided by the
11National Science Foundation under grant MIP-9311980. The original version
12of this code was written as part of a project to build a fixed-point vector
13processor in collaboration with the University of California at Berkeley,
14overseen by Profs. Nelson Morgan and John Wawrzynek. More information
15is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
16arithmetic/softfloat.html'.
17
18THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
19has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
20TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
21PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
22AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
23
24Derivative works are acceptable, even for commercial purposes, so long as
25(1) they include prominent notice that the work is derivative, and (2) they
26include prominent notice akin to these three paragraphs for those parts of
27this code that are retained.
28
29===============================================================================
30*/
31
32/*
33-------------------------------------------------------------------------------
34Underflow tininess-detection mode, statically initialized to default value.
35(The declaration in `softfloat.h' must match the `int8' type here.)
36-------------------------------------------------------------------------------
37*/
38int8 float_detect_tininess = float_tininess_after_rounding;
39
40/*
41-------------------------------------------------------------------------------
42Raises the exceptions specified by `flags'. Floating-point traps can be
43defined here if desired. It is currently not possible for such a trap to
44substitute a result value. If traps are not implemented, this routine
45should be simply `float_exception_flags |= flags;'.
46
47ScottB: November 4, 1998
48Moved this function out of softfloat-specialize into fpmodule.c.
49This effectively isolates all the changes required for integrating with the
50Linux kernel into fpmodule.c. Porting to NetBSD should only require modifying
51fpmodule.c to integrate with the NetBSD kernel (I hope!).
52-------------------------------------------------------------------------------
53void float_raise( int8 flags )
54{
55 float_exception_flags |= flags;
56}
57*/
58
59/*
60-------------------------------------------------------------------------------
61Internal canonical NaN format.
62-------------------------------------------------------------------------------
63*/
64typedef struct {
65 flag sign;
66 bits64 high, low;
67} commonNaNT;
68
69/*
70-------------------------------------------------------------------------------
71The pattern for a default generated single-precision NaN.
72-------------------------------------------------------------------------------
73*/
74#define float32_default_nan 0xFFFFFFFF
75
76/*
77-------------------------------------------------------------------------------
78Returns 1 if the single-precision floating-point value `a' is a NaN;
79otherwise returns 0.
80-------------------------------------------------------------------------------
81*/
82flag float32_is_nan( float32 a )
83{
84
85 return ( 0xFF000000 < (bits32) ( a<<1 ) );
86
87}
88
89/*
90-------------------------------------------------------------------------------
91Returns 1 if the single-precision floating-point value `a' is a signaling
92NaN; otherwise returns 0.
93-------------------------------------------------------------------------------
94*/
95flag float32_is_signaling_nan( float32 a )
96{
97
98 return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF );
99
100}
101
102/*
103-------------------------------------------------------------------------------
104Returns the result of converting the single-precision floating-point NaN
105`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid
106exception is raised.
107-------------------------------------------------------------------------------
108*/
109static commonNaNT float32ToCommonNaN( float32 a )
110{
111 commonNaNT z;
112
113 if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
114 z.sign = a>>31;
115 z.low = 0;
116 z.high = ( (bits64) a )<<41;
117 return z;
118
119}
120
121/*
122-------------------------------------------------------------------------------
123Returns the result of converting the canonical NaN `a' to the single-
124precision floating-point format.
125-------------------------------------------------------------------------------
126*/
127static float32 commonNaNToFloat32( commonNaNT a )
128{
129
130 return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 );
131
132}
133
134/*
135-------------------------------------------------------------------------------
136Takes two single-precision floating-point values `a' and `b', one of which
137is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a
138signaling NaN, the invalid exception is raised.
139-------------------------------------------------------------------------------
140*/
141static float32 propagateFloat32NaN( float32 a, float32 b )
142{
143 flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
144
145 aIsNaN = float32_is_nan( a );
146 aIsSignalingNaN = float32_is_signaling_nan( a );
147 bIsNaN = float32_is_nan( b );
148 bIsSignalingNaN = float32_is_signaling_nan( b );
149 a |= 0x00400000;
150 b |= 0x00400000;
151 if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
152 if ( aIsNaN ) {
153 return ( aIsSignalingNaN & bIsNaN ) ? b : a;
154 }
155 else {
156 return b;
157 }
158
159}
160
161/*
162-------------------------------------------------------------------------------
163The pattern for a default generated double-precision NaN.
164-------------------------------------------------------------------------------
165*/
166#define float64_default_nan LIT64( 0xFFFFFFFFFFFFFFFF )
167
168/*
169-------------------------------------------------------------------------------
170Returns 1 if the double-precision floating-point value `a' is a NaN;
171otherwise returns 0.
172-------------------------------------------------------------------------------
173*/
174flag float64_is_nan( float64 a )
175{
176
177 return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) );
178
179}
180
181/*
182-------------------------------------------------------------------------------
183Returns 1 if the double-precision floating-point value `a' is a signaling
184NaN; otherwise returns 0.
185-------------------------------------------------------------------------------
186*/
187flag float64_is_signaling_nan( float64 a )
188{
189
190 return
191 ( ( ( a>>51 ) & 0xFFF ) == 0xFFE )
192 && ( a & LIT64( 0x0007FFFFFFFFFFFF ) );
193
194}
195
196/*
197-------------------------------------------------------------------------------
198Returns the result of converting the double-precision floating-point NaN
199`a' to the canonical NaN format. If `a' is a signaling NaN, the invalid
200exception is raised.
201-------------------------------------------------------------------------------
202*/
203static commonNaNT float64ToCommonNaN( float64 a )
204{
205 commonNaNT z;
206
207 if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
208 z.sign = a>>63;
209 z.low = 0;
210 z.high = a<<12;
211 return z;
212
213}
214
215/*
216-------------------------------------------------------------------------------
217Returns the result of converting the canonical NaN `a' to the double-
218precision floating-point format.
219-------------------------------------------------------------------------------
220*/
221static float64 commonNaNToFloat64( commonNaNT a )
222{
223
224 return
225 ( ( (bits64) a.sign )<<63 )
226 | LIT64( 0x7FF8000000000000 )
227 | ( a.high>>12 );
228
229}
230
231/*
232-------------------------------------------------------------------------------
233Takes two double-precision floating-point values `a' and `b', one of which
234is a NaN, and returns the appropriate NaN result. If either `a' or `b' is a
235signaling NaN, the invalid exception is raised.
236-------------------------------------------------------------------------------
237*/
238static float64 propagateFloat64NaN( float64 a, float64 b )
239{
240 flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
241
242 aIsNaN = float64_is_nan( a );
243 aIsSignalingNaN = float64_is_signaling_nan( a );
244 bIsNaN = float64_is_nan( b );
245 bIsSignalingNaN = float64_is_signaling_nan( b );
246 a |= LIT64( 0x0008000000000000 );
247 b |= LIT64( 0x0008000000000000 );
248 if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
249 if ( aIsNaN ) {
250 return ( aIsSignalingNaN & bIsNaN ) ? b : a;
251 }
252 else {
253 return b;
254 }
255
256}
257
258#ifdef FLOATX80
259
260/*
261-------------------------------------------------------------------------------
262The pattern for a default generated extended double-precision NaN. The
263`high' and `low' values hold the most- and least-significant bits,
264respectively.
265-------------------------------------------------------------------------------
266*/
267#define floatx80_default_nan_high 0xFFFF
268#define floatx80_default_nan_low LIT64( 0xFFFFFFFFFFFFFFFF )
269
270/*
271-------------------------------------------------------------------------------
272Returns 1 if the extended double-precision floating-point value `a' is a
273NaN; otherwise returns 0.
274-------------------------------------------------------------------------------
275*/
276flag floatx80_is_nan( floatx80 a )
277{
278
279 return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
280
281}
282
283/*
284-------------------------------------------------------------------------------
285Returns 1 if the extended double-precision floating-point value `a' is a
286signaling NaN; otherwise returns 0.
287-------------------------------------------------------------------------------
288*/
289flag floatx80_is_signaling_nan( floatx80 a )
290{
291 //register int lr;
292 bits64 aLow;
293
294 //__asm__("mov %0, lr" : : "g" (lr));
295 //fp_printk("floatx80_is_signalling_nan() called from 0x%08x\n",lr);
296 aLow = a.low & ~ LIT64( 0x4000000000000000 );
297 return
298 ( ( a.high & 0x7FFF ) == 0x7FFF )
299 && (bits64) ( aLow<<1 )
300 && ( a.low == aLow );
301
302}
303
304/*
305-------------------------------------------------------------------------------
306Returns the result of converting the extended double-precision floating-
307point NaN `a' to the canonical NaN format. If `a' is a signaling NaN, the
308invalid exception is raised.
309-------------------------------------------------------------------------------
310*/
311static commonNaNT floatx80ToCommonNaN( floatx80 a )
312{
313 commonNaNT z;
314
315 if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
316 z.sign = a.high>>15;
317 z.low = 0;
318 z.high = a.low<<1;
319 return z;
320
321}
322
323/*
324-------------------------------------------------------------------------------
325Returns the result of converting the canonical NaN `a' to the extended
326double-precision floating-point format.
327-------------------------------------------------------------------------------
328*/
329static floatx80 commonNaNToFloatx80( commonNaNT a )
330{
331 floatx80 z;
332
333 z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 );
334 z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF;
335 return z;
336
337}
338
339/*
340-------------------------------------------------------------------------------
341Takes two extended double-precision floating-point values `a' and `b', one
342of which is a NaN, and returns the appropriate NaN result. If either `a' or
343`b' is a signaling NaN, the invalid exception is raised.
344-------------------------------------------------------------------------------
345*/
346static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b )
347{
348 flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
349
350 aIsNaN = floatx80_is_nan( a );
351 aIsSignalingNaN = floatx80_is_signaling_nan( a );
352 bIsNaN = floatx80_is_nan( b );
353 bIsSignalingNaN = floatx80_is_signaling_nan( b );
354 a.low |= LIT64( 0xC000000000000000 );
355 b.low |= LIT64( 0xC000000000000000 );
356 if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
357 if ( aIsNaN ) {
358 return ( aIsSignalingNaN & bIsNaN ) ? b : a;
359 }
360 else {
361 return b;
362 }
363
364}
365
366#endif
diff --git a/arch/arm26/nwfpe/softfloat.c b/arch/arm26/nwfpe/softfloat.c
deleted file mode 100644
index 26c1b916e527..000000000000
--- a/arch/arm26/nwfpe/softfloat.c
+++ /dev/null
@@ -1,3439 +0,0 @@
1/*
2===============================================================================
3
4This C source file is part of the SoftFloat IEC/IEEE Floating-point
5Arithmetic Package, Release 2.
6
7Written by John R. Hauser. This work was made possible in part by the
8International Computer Science Institute, located at Suite 600, 1947 Center
9Street, Berkeley, California 94704. Funding was partially provided by the
10National Science Foundation under grant MIP-9311980. The original version
11of this code was written as part of a project to build a fixed-point vector
12processor in collaboration with the University of California at Berkeley,
13overseen by Profs. Nelson Morgan and John Wawrzynek. More information
14is available through the web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
15arithmetic/softfloat.html'.
16
17THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
18has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
19TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
20PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
21AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
22
23Derivative works are acceptable, even for commercial purposes, so long as
24(1) they include prominent notice that the work is derivative, and (2) they
25include prominent notice akin to these three paragraphs for those parts of
26this code that are retained.
27
28===============================================================================
29*/
30
31#include "fpa11.h"
32#include "milieu.h"
33#include "softfloat.h"
34
35/*
36-------------------------------------------------------------------------------
37Floating-point rounding mode, extended double-precision rounding precision,
38and exception flags.
39-------------------------------------------------------------------------------
40*/
41int8 float_rounding_mode = float_round_nearest_even;
42int8 floatx80_rounding_precision = 80;
43int8 float_exception_flags;
44
45/*
46-------------------------------------------------------------------------------
47Primitive arithmetic functions, including multi-word arithmetic, and
48division and square root approximations. (Can be specialized to target if
49desired.)
50-------------------------------------------------------------------------------
51*/
52#include "softfloat-macros"
53
54/*
55-------------------------------------------------------------------------------
56Functions and definitions to determine: (1) whether tininess for underflow
57is detected before or after rounding by default, (2) what (if anything)
58happens when exceptions are raised, (3) how signaling NaNs are distinguished
59from quiet NaNs, (4) the default generated quiet NaNs, and (5) how NaNs
60are propagated from function inputs to output. These details are target-
61specific.
62-------------------------------------------------------------------------------
63*/
64#include "softfloat-specialize"
65
66/*
67-------------------------------------------------------------------------------
68Takes a 64-bit fixed-point value `absZ' with binary point between bits 6
69and 7, and returns the properly rounded 32-bit integer corresponding to the
70input. If `zSign' is nonzero, the input is negated before being converted
71to an integer. Bit 63 of `absZ' must be zero. Ordinarily, the fixed-point
72input is simply rounded to an integer, with the inexact exception raised if
73the input cannot be represented exactly as an integer. If the fixed-point
74input is too large, however, the invalid exception is raised and the largest
75positive or negative integer is returned.
76-------------------------------------------------------------------------------
77*/
78static int32 roundAndPackInt32( flag zSign, bits64 absZ )
79{
80 int8 roundingMode;
81 flag roundNearestEven;
82 int8 roundIncrement, roundBits;
83 int32 z;
84
85 roundingMode = float_rounding_mode;
86 roundNearestEven = ( roundingMode == float_round_nearest_even );
87 roundIncrement = 0x40;
88 if ( ! roundNearestEven ) {
89 if ( roundingMode == float_round_to_zero ) {
90 roundIncrement = 0;
91 }
92 else {
93 roundIncrement = 0x7F;
94 if ( zSign ) {
95 if ( roundingMode == float_round_up ) roundIncrement = 0;
96 }
97 else {
98 if ( roundingMode == float_round_down ) roundIncrement = 0;
99 }
100 }
101 }
102 roundBits = absZ & 0x7F;
103 absZ = ( absZ + roundIncrement )>>7;
104 absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
105 z = absZ;
106 if ( zSign ) z = - z;
107 if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
108 float_exception_flags |= float_flag_invalid;
109 return zSign ? 0x80000000 : 0x7FFFFFFF;
110 }
111 if ( roundBits ) float_exception_flags |= float_flag_inexact;
112 return z;
113
114}
115
116/*
117-------------------------------------------------------------------------------
118Returns the fraction bits of the single-precision floating-point value `a'.
119-------------------------------------------------------------------------------
120*/
121INLINE bits32 extractFloat32Frac( float32 a )
122{
123
124 return a & 0x007FFFFF;
125
126}
127
128/*
129-------------------------------------------------------------------------------
130Returns the exponent bits of the single-precision floating-point value `a'.
131-------------------------------------------------------------------------------
132*/
133INLINE int16 extractFloat32Exp( float32 a )
134{
135
136 return ( a>>23 ) & 0xFF;
137
138}
139
140/*
141-------------------------------------------------------------------------------
142Returns the sign bit of the single-precision floating-point value `a'.
143-------------------------------------------------------------------------------
144*/
145INLINE flag extractFloat32Sign( float32 a )
146{
147
148 return a>>31;
149
150}
151
152/*
153-------------------------------------------------------------------------------
154Normalizes the subnormal single-precision floating-point value represented
155by the denormalized significand `aSig'. The normalized exponent and
156significand are stored at the locations pointed to by `zExpPtr' and
157`zSigPtr', respectively.
158-------------------------------------------------------------------------------
159*/
160static void
161 normalizeFloat32Subnormal( bits32 aSig, int16 *zExpPtr, bits32 *zSigPtr )
162{
163 int8 shiftCount;
164
165 shiftCount = countLeadingZeros32( aSig ) - 8;
166 *zSigPtr = aSig<<shiftCount;
167 *zExpPtr = 1 - shiftCount;
168
169}
170
171/*
172-------------------------------------------------------------------------------
173Packs the sign `zSign', exponent `zExp', and significand `zSig' into a
174single-precision floating-point value, returning the result. After being
175shifted into the proper positions, the three fields are simply added
176together to form the result. This means that any integer portion of `zSig'
177will be added into the exponent. Since a properly normalized significand
178will have an integer portion equal to 1, the `zExp' input should be 1 less
179than the desired result exponent whenever `zSig' is a complete, normalized
180significand.
181-------------------------------------------------------------------------------
182*/
183INLINE float32 packFloat32( flag zSign, int16 zExp, bits32 zSig )
184{
185#if 0
186 float32 f;
187 __asm__("@ packFloat32; \n\
188 mov %0, %1, asl #31; \n\
189 orr %0, %2, asl #23; \n\
190 orr %0, %3"
191 : /* no outputs */
192 : "g" (f), "g" (zSign), "g" (zExp), "g" (zSig)
193 : "cc");
194 return f;
195#else
196 return ( ( (bits32) zSign )<<31 ) + ( ( (bits32) zExp )<<23 ) + zSig;
197#endif
198}
199
200/*
201-------------------------------------------------------------------------------
202Takes an abstract floating-point value having sign `zSign', exponent `zExp',
203and significand `zSig', and returns the proper single-precision floating-
204point value corresponding to the abstract input. Ordinarily, the abstract
205value is simply rounded and packed into the single-precision format, with
206the inexact exception raised if the abstract input cannot be represented
207exactly. If the abstract value is too large, however, the overflow and
208inexact exceptions are raised and an infinity or maximal finite value is
209returned. If the abstract value is too small, the input value is rounded to
210a subnormal number, and the underflow and inexact exceptions are raised if
211the abstract input cannot be represented exactly as a subnormal single-
212precision floating-point number.
213 The input significand `zSig' has its binary point between bits 30
214and 29, which is 7 bits to the left of the usual location. This shifted
215significand must be normalized or smaller. If `zSig' is not normalized,
216`zExp' must be 0; in that case, the result returned is a subnormal number,
217and it must not require rounding. In the usual case that `zSig' is
218normalized, `zExp' must be 1 less than the ``true'' floating-point exponent.
219The handling of underflow and overflow follows the IEC/IEEE Standard for
220Binary Floating-point Arithmetic.
221-------------------------------------------------------------------------------
222*/
223static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig )
224{
225 int8 roundingMode;
226 flag roundNearestEven;
227 int8 roundIncrement, roundBits;
228 flag isTiny;
229
230 roundingMode = float_rounding_mode;
231 roundNearestEven = ( roundingMode == float_round_nearest_even );
232 roundIncrement = 0x40;
233 if ( ! roundNearestEven ) {
234 if ( roundingMode == float_round_to_zero ) {
235 roundIncrement = 0;
236 }
237 else {
238 roundIncrement = 0x7F;
239 if ( zSign ) {
240 if ( roundingMode == float_round_up ) roundIncrement = 0;
241 }
242 else {
243 if ( roundingMode == float_round_down ) roundIncrement = 0;
244 }
245 }
246 }
247 roundBits = zSig & 0x7F;
248 if ( 0xFD <= (bits16) zExp ) {
249 if ( ( 0xFD < zExp )
250 || ( ( zExp == 0xFD )
251 && ( (sbits32) ( zSig + roundIncrement ) < 0 ) )
252 ) {
253 float_raise( float_flag_overflow | float_flag_inexact );
254 return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 );
255 }
256 if ( zExp < 0 ) {
257 isTiny =
258 ( float_detect_tininess == float_tininess_before_rounding )
259 || ( zExp < -1 )
260 || ( zSig + roundIncrement < 0x80000000 );
261 shift32RightJamming( zSig, - zExp, &zSig );
262 zExp = 0;
263 roundBits = zSig & 0x7F;
264 if ( isTiny && roundBits ) float_raise( float_flag_underflow );
265 }
266 }
267 if ( roundBits ) float_exception_flags |= float_flag_inexact;
268 zSig = ( zSig + roundIncrement )>>7;
269 zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
270 if ( zSig == 0 ) zExp = 0;
271 return packFloat32( zSign, zExp, zSig );
272
273}
274
275/*
276-------------------------------------------------------------------------------
277Takes an abstract floating-point value having sign `zSign', exponent `zExp',
278and significand `zSig', and returns the proper single-precision floating-
279point value corresponding to the abstract input. This routine is just like
280`roundAndPackFloat32' except that `zSig' does not have to be normalized in
281any way. In all cases, `zExp' must be 1 less than the ``true'' floating-
282point exponent.
283-------------------------------------------------------------------------------
284*/
285static float32
286 normalizeRoundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig )
287{
288 int8 shiftCount;
289
290 shiftCount = countLeadingZeros32( zSig ) - 1;
291 return roundAndPackFloat32( zSign, zExp - shiftCount, zSig<<shiftCount );
292
293}
294
295/*
296-------------------------------------------------------------------------------
297Returns the fraction bits of the double-precision floating-point value `a'.
298-------------------------------------------------------------------------------
299*/
300INLINE bits64 extractFloat64Frac( float64 a )
301{
302
303 return a & LIT64( 0x000FFFFFFFFFFFFF );
304
305}
306
307/*
308-------------------------------------------------------------------------------
309Returns the exponent bits of the double-precision floating-point value `a'.
310-------------------------------------------------------------------------------
311*/
312INLINE int16 extractFloat64Exp( float64 a )
313{
314
315 return ( a>>52 ) & 0x7FF;
316
317}
318
319/*
320-------------------------------------------------------------------------------
321Returns the sign bit of the double-precision floating-point value `a'.
322-------------------------------------------------------------------------------
323*/
324INLINE flag extractFloat64Sign( float64 a )
325{
326
327 return a>>63;
328
329}
330
331/*
332-------------------------------------------------------------------------------
333Normalizes the subnormal double-precision floating-point value represented
334by the denormalized significand `aSig'. The normalized exponent and
335significand are stored at the locations pointed to by `zExpPtr' and
336`zSigPtr', respectively.
337-------------------------------------------------------------------------------
338*/
339static void
340 normalizeFloat64Subnormal( bits64 aSig, int16 *zExpPtr, bits64 *zSigPtr )
341{
342 int8 shiftCount;
343
344 shiftCount = countLeadingZeros64( aSig ) - 11;
345 *zSigPtr = aSig<<shiftCount;
346 *zExpPtr = 1 - shiftCount;
347
348}
349
350/*
351-------------------------------------------------------------------------------
352Packs the sign `zSign', exponent `zExp', and significand `zSig' into a
353double-precision floating-point value, returning the result. After being
354shifted into the proper positions, the three fields are simply added
355together to form the result. This means that any integer portion of `zSig'
356will be added into the exponent. Since a properly normalized significand
357will have an integer portion equal to 1, the `zExp' input should be 1 less
358than the desired result exponent whenever `zSig' is a complete, normalized
359significand.
360-------------------------------------------------------------------------------
361*/
362INLINE float64 packFloat64( flag zSign, int16 zExp, bits64 zSig )
363{
364
365 return ( ( (bits64) zSign )<<63 ) + ( ( (bits64) zExp )<<52 ) + zSig;
366
367}
368
369/*
370-------------------------------------------------------------------------------
371Takes an abstract floating-point value having sign `zSign', exponent `zExp',
372and significand `zSig', and returns the proper double-precision floating-
373point value corresponding to the abstract input. Ordinarily, the abstract
374value is simply rounded and packed into the double-precision format, with
375the inexact exception raised if the abstract input cannot be represented
376exactly. If the abstract value is too large, however, the overflow and
377inexact exceptions are raised and an infinity or maximal finite value is
378returned. If the abstract value is too small, the input value is rounded to
379a subnormal number, and the underflow and inexact exceptions are raised if
380the abstract input cannot be represented exactly as a subnormal double-
381precision floating-point number.
382 The input significand `zSig' has its binary point between bits 62
383and 61, which is 10 bits to the left of the usual location. This shifted
384significand must be normalized or smaller. If `zSig' is not normalized,
385`zExp' must be 0; in that case, the result returned is a subnormal number,
386and it must not require rounding. In the usual case that `zSig' is
387normalized, `zExp' must be 1 less than the ``true'' floating-point exponent.
388The handling of underflow and overflow follows the IEC/IEEE Standard for
389Binary Floating-point Arithmetic.
390-------------------------------------------------------------------------------
391*/
392static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig )
393{
394 int8 roundingMode;
395 flag roundNearestEven;
396 int16 roundIncrement, roundBits;
397 flag isTiny;
398
399 roundingMode = float_rounding_mode;
400 roundNearestEven = ( roundingMode == float_round_nearest_even );
401 roundIncrement = 0x200;
402 if ( ! roundNearestEven ) {
403 if ( roundingMode == float_round_to_zero ) {
404 roundIncrement = 0;
405 }
406 else {
407 roundIncrement = 0x3FF;
408 if ( zSign ) {
409 if ( roundingMode == float_round_up ) roundIncrement = 0;
410 }
411 else {
412 if ( roundingMode == float_round_down ) roundIncrement = 0;
413 }
414 }
415 }
416 roundBits = zSig & 0x3FF;
417 if ( 0x7FD <= (bits16) zExp ) {
418 if ( ( 0x7FD < zExp )
419 || ( ( zExp == 0x7FD )
420 && ( (sbits64) ( zSig + roundIncrement ) < 0 ) )
421 ) {
422 //register int lr = __builtin_return_address(0);
423 //printk("roundAndPackFloat64 called from 0x%08x\n",lr);
424 float_raise( float_flag_overflow | float_flag_inexact );
425 return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
426 }
427 if ( zExp < 0 ) {
428 isTiny =
429 ( float_detect_tininess == float_tininess_before_rounding )
430 || ( zExp < -1 )
431 || ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );
432 shift64RightJamming( zSig, - zExp, &zSig );
433 zExp = 0;
434 roundBits = zSig & 0x3FF;
435 if ( isTiny && roundBits ) float_raise( float_flag_underflow );
436 }
437 }
438 if ( roundBits ) float_exception_flags |= float_flag_inexact;
439 zSig = ( zSig + roundIncrement )>>10;
440 zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
441 if ( zSig == 0 ) zExp = 0;
442 return packFloat64( zSign, zExp, zSig );
443
444}
445
446/*
447-------------------------------------------------------------------------------
448Takes an abstract floating-point value having sign `zSign', exponent `zExp',
449and significand `zSig', and returns the proper double-precision floating-
450point value corresponding to the abstract input. This routine is just like
451`roundAndPackFloat64' except that `zSig' does not have to be normalized in
452any way. In all cases, `zExp' must be 1 less than the ``true'' floating-
453point exponent.
454-------------------------------------------------------------------------------
455*/
456static float64
457 normalizeRoundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig )
458{
459 int8 shiftCount;
460
461 shiftCount = countLeadingZeros64( zSig ) - 1;
462 return roundAndPackFloat64( zSign, zExp - shiftCount, zSig<<shiftCount );
463
464}
465
466#ifdef FLOATX80
467
468/*
469-------------------------------------------------------------------------------
470Returns the fraction bits of the extended double-precision floating-point
471value `a'.
472-------------------------------------------------------------------------------
473*/
474INLINE bits64 extractFloatx80Frac( floatx80 a )
475{
476
477 return a.low;
478
479}
480
481/*
482-------------------------------------------------------------------------------
483Returns the exponent bits of the extended double-precision floating-point
484value `a'.
485-------------------------------------------------------------------------------
486*/
487INLINE int32 extractFloatx80Exp( floatx80 a )
488{
489
490 return a.high & 0x7FFF;
491
492}
493
494/*
495-------------------------------------------------------------------------------
496Returns the sign bit of the extended double-precision floating-point value
497`a'.
498-------------------------------------------------------------------------------
499*/
500INLINE flag extractFloatx80Sign( floatx80 a )
501{
502
503 return a.high>>15;
504
505}
506
507/*
508-------------------------------------------------------------------------------
509Normalizes the subnormal extended double-precision floating-point value
510represented by the denormalized significand `aSig'. The normalized exponent
511and significand are stored at the locations pointed to by `zExpPtr' and
512`zSigPtr', respectively.
513-------------------------------------------------------------------------------
514*/
515static void
516 normalizeFloatx80Subnormal( bits64 aSig, int32 *zExpPtr, bits64 *zSigPtr )
517{
518 int8 shiftCount;
519
520 shiftCount = countLeadingZeros64( aSig );
521 *zSigPtr = aSig<<shiftCount;
522 *zExpPtr = 1 - shiftCount;
523
524}
525
526/*
527-------------------------------------------------------------------------------
528Packs the sign `zSign', exponent `zExp', and significand `zSig' into an
529extended double-precision floating-point value, returning the result.
530-------------------------------------------------------------------------------
531*/
532INLINE floatx80 packFloatx80( flag zSign, int32 zExp, bits64 zSig )
533{
534 floatx80 z;
535
536 z.low = zSig;
537 z.high = ( ( (bits16) zSign )<<15 ) + zExp;
538 return z;
539
540}
541
542/*
543-------------------------------------------------------------------------------
544Takes an abstract floating-point value having sign `zSign', exponent `zExp',
545and extended significand formed by the concatenation of `zSig0' and `zSig1',
546and returns the proper extended double-precision floating-point value
547corresponding to the abstract input. Ordinarily, the abstract value is
548rounded and packed into the extended double-precision format, with the
549inexact exception raised if the abstract input cannot be represented
550exactly. If the abstract value is too large, however, the overflow and
551inexact exceptions are raised and an infinity or maximal finite value is
552returned. If the abstract value is too small, the input value is rounded to
553a subnormal number, and the underflow and inexact exceptions are raised if
554the abstract input cannot be represented exactly as a subnormal extended
555double-precision floating-point number.
556 If `roundingPrecision' is 32 or 64, the result is rounded to the same
557number of bits as single or double precision, respectively. Otherwise, the
558result is rounded to the full precision of the extended double-precision
559format.
560 The input significand must be normalized or smaller. If the input
561significand is not normalized, `zExp' must be 0; in that case, the result
562returned is a subnormal number, and it must not require rounding. The
563handling of underflow and overflow follows the IEC/IEEE Standard for Binary
564Floating-point Arithmetic.
565-------------------------------------------------------------------------------
566*/
567static floatx80
568 roundAndPackFloatx80(
569 int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
570 )
571{
572 int8 roundingMode;
573 flag roundNearestEven, increment, isTiny;
574 int64 roundIncrement, roundMask, roundBits;
575
576 roundingMode = float_rounding_mode;
577 roundNearestEven = ( roundingMode == float_round_nearest_even );
578 if ( roundingPrecision == 80 ) goto precision80;
579 if ( roundingPrecision == 64 ) {
580 roundIncrement = LIT64( 0x0000000000000400 );
581 roundMask = LIT64( 0x00000000000007FF );
582 }
583 else if ( roundingPrecision == 32 ) {
584 roundIncrement = LIT64( 0x0000008000000000 );
585 roundMask = LIT64( 0x000000FFFFFFFFFF );
586 }
587 else {
588 goto precision80;
589 }
590 zSig0 |= ( zSig1 != 0 );
591 if ( ! roundNearestEven ) {
592 if ( roundingMode == float_round_to_zero ) {
593 roundIncrement = 0;
594 }
595 else {
596 roundIncrement = roundMask;
597 if ( zSign ) {
598 if ( roundingMode == float_round_up ) roundIncrement = 0;
599 }
600 else {
601 if ( roundingMode == float_round_down ) roundIncrement = 0;
602 }
603 }
604 }
605 roundBits = zSig0 & roundMask;
606 if ( 0x7FFD <= (bits32) ( zExp - 1 ) ) {
607 if ( ( 0x7FFE < zExp )
608 || ( ( zExp == 0x7FFE ) && ( zSig0 + roundIncrement < zSig0 ) )
609 ) {
610 goto overflow;
611 }
612 if ( zExp <= 0 ) {
613 isTiny =
614 ( float_detect_tininess == float_tininess_before_rounding )
615 || ( zExp < 0 )
616 || ( zSig0 <= zSig0 + roundIncrement );
617 shift64RightJamming( zSig0, 1 - zExp, &zSig0 );
618 zExp = 0;
619 roundBits = zSig0 & roundMask;
620 if ( isTiny && roundBits ) float_raise( float_flag_underflow );
621 if ( roundBits ) float_exception_flags |= float_flag_inexact;
622 zSig0 += roundIncrement;
623 if ( (sbits64) zSig0 < 0 ) zExp = 1;
624 roundIncrement = roundMask + 1;
625 if ( roundNearestEven && ( roundBits<<1 == roundIncrement ) ) {
626 roundMask |= roundIncrement;
627 }
628 zSig0 &= ~ roundMask;
629 return packFloatx80( zSign, zExp, zSig0 );
630 }
631 }
632 if ( roundBits ) float_exception_flags |= float_flag_inexact;
633 zSig0 += roundIncrement;
634 if ( zSig0 < roundIncrement ) {
635 ++zExp;
636 zSig0 = LIT64( 0x8000000000000000 );
637 }
638 roundIncrement = roundMask + 1;
639 if ( roundNearestEven && ( roundBits<<1 == roundIncrement ) ) {
640 roundMask |= roundIncrement;
641 }
642 zSig0 &= ~ roundMask;
643 if ( zSig0 == 0 ) zExp = 0;
644 return packFloatx80( zSign, zExp, zSig0 );
645 precision80:
646 increment = ( (sbits64) zSig1 < 0 );
647 if ( ! roundNearestEven ) {
648 if ( roundingMode == float_round_to_zero ) {
649 increment = 0;
650 }
651 else {
652 if ( zSign ) {
653 increment = ( roundingMode == float_round_down ) && zSig1;
654 }
655 else {
656 increment = ( roundingMode == float_round_up ) && zSig1;
657 }
658 }
659 }
660 if ( 0x7FFD <= (bits32) ( zExp - 1 ) ) {
661 if ( ( 0x7FFE < zExp )
662 || ( ( zExp == 0x7FFE )
663 && ( zSig0 == LIT64( 0xFFFFFFFFFFFFFFFF ) )
664 && increment
665 )
666 ) {
667 roundMask = 0;
668 overflow:
669 float_raise( float_flag_overflow | float_flag_inexact );
670 if ( ( roundingMode == float_round_to_zero )
671 || ( zSign && ( roundingMode == float_round_up ) )
672 || ( ! zSign && ( roundingMode == float_round_down ) )
673 ) {
674 return packFloatx80( zSign, 0x7FFE, ~ roundMask );
675 }
676 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
677 }
678 if ( zExp <= 0 ) {
679 isTiny =
680 ( float_detect_tininess == float_tininess_before_rounding )
681 || ( zExp < 0 )
682 || ! increment
683 || ( zSig0 < LIT64( 0xFFFFFFFFFFFFFFFF ) );
684 shift64ExtraRightJamming( zSig0, zSig1, 1 - zExp, &zSig0, &zSig1 );
685 zExp = 0;
686 if ( isTiny && zSig1 ) float_raise( float_flag_underflow );
687 if ( zSig1 ) float_exception_flags |= float_flag_inexact;
688 if ( roundNearestEven ) {
689 increment = ( (sbits64) zSig1 < 0 );
690 }
691 else {
692 if ( zSign ) {
693 increment = ( roundingMode == float_round_down ) && zSig1;
694 }
695 else {
696 increment = ( roundingMode == float_round_up ) && zSig1;
697 }
698 }
699 if ( increment ) {
700 ++zSig0;
701 zSig0 &= ~ ( ( zSig1 + zSig1 == 0 ) & roundNearestEven );
702 if ( (sbits64) zSig0 < 0 ) zExp = 1;
703 }
704 return packFloatx80( zSign, zExp, zSig0 );
705 }
706 }
707 if ( zSig1 ) float_exception_flags |= float_flag_inexact;
708 if ( increment ) {
709 ++zSig0;
710 if ( zSig0 == 0 ) {
711 ++zExp;
712 zSig0 = LIT64( 0x8000000000000000 );
713 }
714 else {
715 zSig0 &= ~ ( ( zSig1 + zSig1 == 0 ) & roundNearestEven );
716 }
717 }
718 else {
719 if ( zSig0 == 0 ) zExp = 0;
720 }
721
722 return packFloatx80( zSign, zExp, zSig0 );
723}
724
725/*
726-------------------------------------------------------------------------------
727Takes an abstract floating-point value having sign `zSign', exponent
728`zExp', and significand formed by the concatenation of `zSig0' and `zSig1',
729and returns the proper extended double-precision floating-point value
730corresponding to the abstract input. This routine is just like
731`roundAndPackFloatx80' except that the input significand does not have to be
732normalized.
733-------------------------------------------------------------------------------
734*/
735static floatx80
736 normalizeRoundAndPackFloatx80(
737 int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
738 )
739{
740 int8 shiftCount;
741
742 if ( zSig0 == 0 ) {
743 zSig0 = zSig1;
744 zSig1 = 0;
745 zExp -= 64;
746 }
747 shiftCount = countLeadingZeros64( zSig0 );
748 shortShift128Left( zSig0, zSig1, shiftCount, &zSig0, &zSig1 );
749 zExp -= shiftCount;
750 return
751 roundAndPackFloatx80( roundingPrecision, zSign, zExp, zSig0, zSig1 );
752
753}
754
755#endif
756
757/*
758-------------------------------------------------------------------------------
759Returns the result of converting the 32-bit two's complement integer `a' to
760the single-precision floating-point format. The conversion is performed
761according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
762-------------------------------------------------------------------------------
763*/
764float32 int32_to_float32( int32 a )
765{
766 flag zSign;
767
768 if ( a == 0 ) return 0;
769 if ( a == 0x80000000 ) return packFloat32( 1, 0x9E, 0 );
770 zSign = ( a < 0 );
771 return normalizeRoundAndPackFloat32( zSign, 0x9C, zSign ? - a : a );
772
773}
774
775/*
776-------------------------------------------------------------------------------
777Returns the result of converting the 32-bit two's complement integer `a' to
778the double-precision floating-point format. The conversion is performed
779according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
780-------------------------------------------------------------------------------
781*/
782float64 int32_to_float64( int32 a )
783{
784 flag aSign;
785 uint32 absA;
786 int8 shiftCount;
787 bits64 zSig;
788
789 if ( a == 0 ) return 0;
790 aSign = ( a < 0 );
791 absA = aSign ? - a : a;
792 shiftCount = countLeadingZeros32( absA ) + 21;
793 zSig = absA;
794 return packFloat64( aSign, 0x432 - shiftCount, zSig<<shiftCount );
795
796}
797
798#ifdef FLOATX80
799
800/*
801-------------------------------------------------------------------------------
802Returns the result of converting the 32-bit two's complement integer `a'
803to the extended double-precision floating-point format. The conversion
804is performed according to the IEC/IEEE Standard for Binary Floating-point
805Arithmetic.
806-------------------------------------------------------------------------------
807*/
808floatx80 int32_to_floatx80( int32 a )
809{
810 flag zSign;
811 uint32 absA;
812 int8 shiftCount;
813 bits64 zSig;
814
815 if ( a == 0 ) return packFloatx80( 0, 0, 0 );
816 zSign = ( a < 0 );
817 absA = zSign ? - a : a;
818 shiftCount = countLeadingZeros32( absA ) + 32;
819 zSig = absA;
820 return packFloatx80( zSign, 0x403E - shiftCount, zSig<<shiftCount );
821
822}
823
824#endif
825
826/*
827-------------------------------------------------------------------------------
828Returns the result of converting the single-precision floating-point value
829`a' to the 32-bit two's complement integer format. The conversion is
830performed according to the IEC/IEEE Standard for Binary Floating-point
831Arithmetic---which means in particular that the conversion is rounded
832according to the current rounding mode. If `a' is a NaN, the largest
833positive integer is returned. Otherwise, if the conversion overflows, the
834largest integer with the same sign as `a' is returned.
835-------------------------------------------------------------------------------
836*/
837int32 float32_to_int32( float32 a )
838{
839 flag aSign;
840 int16 aExp, shiftCount;
841 bits32 aSig;
842 bits64 zSig;
843
844 aSig = extractFloat32Frac( a );
845 aExp = extractFloat32Exp( a );
846 aSign = extractFloat32Sign( a );
847 if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
848 if ( aExp ) aSig |= 0x00800000;
849 shiftCount = 0xAF - aExp;
850 zSig = aSig;
851 zSig <<= 32;
852 if ( 0 < shiftCount ) shift64RightJamming( zSig, shiftCount, &zSig );
853 return roundAndPackInt32( aSign, zSig );
854
855}
856
857/*
858-------------------------------------------------------------------------------
859Returns the result of converting the single-precision floating-point value
860`a' to the 32-bit two's complement integer format. The conversion is
861performed according to the IEC/IEEE Standard for Binary Floating-point
862Arithmetic, except that the conversion is always rounded toward zero. If
863`a' is a NaN, the largest positive integer is returned. Otherwise, if the
864conversion overflows, the largest integer with the same sign as `a' is
865returned.
866-------------------------------------------------------------------------------
867*/
868int32 float32_to_int32_round_to_zero( float32 a )
869{
870 flag aSign;
871 int16 aExp, shiftCount;
872 bits32 aSig;
873 int32 z;
874
875 aSig = extractFloat32Frac( a );
876 aExp = extractFloat32Exp( a );
877 aSign = extractFloat32Sign( a );
878 shiftCount = aExp - 0x9E;
879 if ( 0 <= shiftCount ) {
880 if ( a == 0xCF000000 ) return 0x80000000;
881 float_raise( float_flag_invalid );
882 if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) return 0x7FFFFFFF;
883 return 0x80000000;
884 }
885 else if ( aExp <= 0x7E ) {
886 if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
887 return 0;
888 }
889 aSig = ( aSig | 0x00800000 )<<8;
890 z = aSig>>( - shiftCount );
891 if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) {
892 float_exception_flags |= float_flag_inexact;
893 }
894 return aSign ? - z : z;
895
896}
897
898/*
899-------------------------------------------------------------------------------
900Returns the result of converting the single-precision floating-point value
901`a' to the double-precision floating-point format. The conversion is
902performed according to the IEC/IEEE Standard for Binary Floating-point
903Arithmetic.
904-------------------------------------------------------------------------------
905*/
906float64 float32_to_float64( float32 a )
907{
908 flag aSign;
909 int16 aExp;
910 bits32 aSig;
911
912 aSig = extractFloat32Frac( a );
913 aExp = extractFloat32Exp( a );
914 aSign = extractFloat32Sign( a );
915 if ( aExp == 0xFF ) {
916 if ( aSig ) return commonNaNToFloat64( float32ToCommonNaN( a ) );
917 return packFloat64( aSign, 0x7FF, 0 );
918 }
919 if ( aExp == 0 ) {
920 if ( aSig == 0 ) return packFloat64( aSign, 0, 0 );
921 normalizeFloat32Subnormal( aSig, &aExp, &aSig );
922 --aExp;
923 }
924 return packFloat64( aSign, aExp + 0x380, ( (bits64) aSig )<<29 );
925
926}
927
928#ifdef FLOATX80
929
930/*
931-------------------------------------------------------------------------------
932Returns the result of converting the single-precision floating-point value
933`a' to the extended double-precision floating-point format. The conversion
934is performed according to the IEC/IEEE Standard for Binary Floating-point
935Arithmetic.
936-------------------------------------------------------------------------------
937*/
938floatx80 float32_to_floatx80( float32 a )
939{
940 flag aSign;
941 int16 aExp;
942 bits32 aSig;
943
944 aSig = extractFloat32Frac( a );
945 aExp = extractFloat32Exp( a );
946 aSign = extractFloat32Sign( a );
947 if ( aExp == 0xFF ) {
948 if ( aSig ) return commonNaNToFloatx80( float32ToCommonNaN( a ) );
949 return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
950 }
951 if ( aExp == 0 ) {
952 if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
953 normalizeFloat32Subnormal( aSig, &aExp, &aSig );
954 }
955 aSig |= 0x00800000;
956 return packFloatx80( aSign, aExp + 0x3F80, ( (bits64) aSig )<<40 );
957
958}
959
960#endif
961
962/*
963-------------------------------------------------------------------------------
964Rounds the single-precision floating-point value `a' to an integer, and
965returns the result as a single-precision floating-point value. The
966operation is performed according to the IEC/IEEE Standard for Binary
967Floating-point Arithmetic.
968-------------------------------------------------------------------------------
969*/
970float32 float32_round_to_int( float32 a )
971{
972 flag aSign;
973 int16 aExp;
974 bits32 lastBitMask, roundBitsMask;
975 int8 roundingMode;
976 float32 z;
977
978 aExp = extractFloat32Exp( a );
979 if ( 0x96 <= aExp ) {
980 if ( ( aExp == 0xFF ) && extractFloat32Frac( a ) ) {
981 return propagateFloat32NaN( a, a );
982 }
983 return a;
984 }
985 if ( aExp <= 0x7E ) {
986 if ( (bits32) ( a<<1 ) == 0 ) return a;
987 float_exception_flags |= float_flag_inexact;
988 aSign = extractFloat32Sign( a );
989 switch ( float_rounding_mode ) {
990 case float_round_nearest_even:
991 if ( ( aExp == 0x7E ) && extractFloat32Frac( a ) ) {
992 return packFloat32( aSign, 0x7F, 0 );
993 }
994 break;
995 case float_round_down:
996 return aSign ? 0xBF800000 : 0;
997 case float_round_up:
998 return aSign ? 0x80000000 : 0x3F800000;
999 }
1000 return packFloat32( aSign, 0, 0 );
1001 }
1002 lastBitMask = 1;
1003 lastBitMask <<= 0x96 - aExp;
1004 roundBitsMask = lastBitMask - 1;
1005 z = a;
1006 roundingMode = float_rounding_mode;
1007 if ( roundingMode == float_round_nearest_even ) {
1008 z += lastBitMask>>1;
1009 if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
1010 }
1011 else if ( roundingMode != float_round_to_zero ) {
1012 if ( extractFloat32Sign( z ) ^ ( roundingMode == float_round_up ) ) {
1013 z += roundBitsMask;
1014 }
1015 }
1016 z &= ~ roundBitsMask;
1017 if ( z != a ) float_exception_flags |= float_flag_inexact;
1018 return z;
1019
1020}
1021
1022/*
1023-------------------------------------------------------------------------------
1024Returns the result of adding the absolute values of the single-precision
1025floating-point values `a' and `b'. If `zSign' is true, the sum is negated
1026before being returned. `zSign' is ignored if the result is a NaN. The
1027addition is performed according to the IEC/IEEE Standard for Binary
1028Floating-point Arithmetic.
1029-------------------------------------------------------------------------------
1030*/
1031static float32 addFloat32Sigs( float32 a, float32 b, flag zSign )
1032{
1033 int16 aExp, bExp, zExp;
1034 bits32 aSig, bSig, zSig;
1035 int16 expDiff;
1036
1037 aSig = extractFloat32Frac( a );
1038 aExp = extractFloat32Exp( a );
1039 bSig = extractFloat32Frac( b );
1040 bExp = extractFloat32Exp( b );
1041 expDiff = aExp - bExp;
1042 aSig <<= 6;
1043 bSig <<= 6;
1044 if ( 0 < expDiff ) {
1045 if ( aExp == 0xFF ) {
1046 if ( aSig ) return propagateFloat32NaN( a, b );
1047 return a;
1048 }
1049 if ( bExp == 0 ) {
1050 --expDiff;
1051 }
1052 else {
1053 bSig |= 0x20000000;
1054 }
1055 shift32RightJamming( bSig, expDiff, &bSig );
1056 zExp = aExp;
1057 }
1058 else if ( expDiff < 0 ) {
1059 if ( bExp == 0xFF ) {
1060 if ( bSig ) return propagateFloat32NaN( a, b );
1061 return packFloat32( zSign, 0xFF, 0 );
1062 }
1063 if ( aExp == 0 ) {
1064 ++expDiff;
1065 }
1066 else {
1067 aSig |= 0x20000000;
1068 }
1069 shift32RightJamming( aSig, - expDiff, &aSig );
1070 zExp = bExp;
1071 }
1072 else {
1073 if ( aExp == 0xFF ) {
1074 if ( aSig | bSig ) return propagateFloat32NaN( a, b );
1075 return a;
1076 }
1077 if ( aExp == 0 ) return packFloat32( zSign, 0, ( aSig + bSig )>>6 );
1078 zSig = 0x40000000 + aSig + bSig;
1079 zExp = aExp;
1080 goto roundAndPack;
1081 }
1082 aSig |= 0x20000000;
1083 zSig = ( aSig + bSig )<<1;
1084 --zExp;
1085 if ( (sbits32) zSig < 0 ) {
1086 zSig = aSig + bSig;
1087 ++zExp;
1088 }
1089 roundAndPack:
1090 return roundAndPackFloat32( zSign, zExp, zSig );
1091
1092}
1093
1094/*
1095-------------------------------------------------------------------------------
1096Returns the result of subtracting the absolute values of the single-
1097precision floating-point values `a' and `b'. If `zSign' is true, the
1098difference is negated before being returned. `zSign' is ignored if the
1099result is a NaN. The subtraction is performed according to the IEC/IEEE
1100Standard for Binary Floating-point Arithmetic.
1101-------------------------------------------------------------------------------
1102*/
1103static float32 subFloat32Sigs( float32 a, float32 b, flag zSign )
1104{
1105 int16 aExp, bExp, zExp;
1106 bits32 aSig, bSig, zSig;
1107 int16 expDiff;
1108
1109 aSig = extractFloat32Frac( a );
1110 aExp = extractFloat32Exp( a );
1111 bSig = extractFloat32Frac( b );
1112 bExp = extractFloat32Exp( b );
1113 expDiff = aExp - bExp;
1114 aSig <<= 7;
1115 bSig <<= 7;
1116 if ( 0 < expDiff ) goto aExpBigger;
1117 if ( expDiff < 0 ) goto bExpBigger;
1118 if ( aExp == 0xFF ) {
1119 if ( aSig | bSig ) return propagateFloat32NaN( a, b );
1120 float_raise( float_flag_invalid );
1121 return float32_default_nan;
1122 }
1123 if ( aExp == 0 ) {
1124 aExp = 1;
1125 bExp = 1;
1126 }
1127 if ( bSig < aSig ) goto aBigger;
1128 if ( aSig < bSig ) goto bBigger;
1129 return packFloat32( float_rounding_mode == float_round_down, 0, 0 );
1130 bExpBigger:
1131 if ( bExp == 0xFF ) {
1132 if ( bSig ) return propagateFloat32NaN( a, b );
1133 return packFloat32( zSign ^ 1, 0xFF, 0 );
1134 }
1135 if ( aExp == 0 ) {
1136 ++expDiff;
1137 }
1138 else {
1139 aSig |= 0x40000000;
1140 }
1141 shift32RightJamming( aSig, - expDiff, &aSig );
1142 bSig |= 0x40000000;
1143 bBigger:
1144 zSig = bSig - aSig;
1145 zExp = bExp;
1146 zSign ^= 1;
1147 goto normalizeRoundAndPack;
1148 aExpBigger:
1149 if ( aExp == 0xFF ) {
1150 if ( aSig ) return propagateFloat32NaN( a, b );
1151 return a;
1152 }
1153 if ( bExp == 0 ) {
1154 --expDiff;
1155 }
1156 else {
1157 bSig |= 0x40000000;
1158 }
1159 shift32RightJamming( bSig, expDiff, &bSig );
1160 aSig |= 0x40000000;
1161 aBigger:
1162 zSig = aSig - bSig;
1163 zExp = aExp;
1164 normalizeRoundAndPack:
1165 --zExp;
1166 return normalizeRoundAndPackFloat32( zSign, zExp, zSig );
1167
1168}
1169
1170/*
1171-------------------------------------------------------------------------------
1172Returns the result of adding the single-precision floating-point values `a'
1173and `b'. The operation is performed according to the IEC/IEEE Standard for
1174Binary Floating-point Arithmetic.
1175-------------------------------------------------------------------------------
1176*/
1177float32 float32_add( float32 a, float32 b )
1178{
1179 flag aSign, bSign;
1180
1181 aSign = extractFloat32Sign( a );
1182 bSign = extractFloat32Sign( b );
1183 if ( aSign == bSign ) {
1184 return addFloat32Sigs( a, b, aSign );
1185 }
1186 else {
1187 return subFloat32Sigs( a, b, aSign );
1188 }
1189
1190}
1191
1192/*
1193-------------------------------------------------------------------------------
1194Returns the result of subtracting the single-precision floating-point values
1195`a' and `b'. The operation is performed according to the IEC/IEEE Standard
1196for Binary Floating-point Arithmetic.
1197-------------------------------------------------------------------------------
1198*/
1199float32 float32_sub( float32 a, float32 b )
1200{
1201 flag aSign, bSign;
1202
1203 aSign = extractFloat32Sign( a );
1204 bSign = extractFloat32Sign( b );
1205 if ( aSign == bSign ) {
1206 return subFloat32Sigs( a, b, aSign );
1207 }
1208 else {
1209 return addFloat32Sigs( a, b, aSign );
1210 }
1211
1212}
1213
1214/*
1215-------------------------------------------------------------------------------
1216Returns the result of multiplying the single-precision floating-point values
1217`a' and `b'. The operation is performed according to the IEC/IEEE Standard
1218for Binary Floating-point Arithmetic.
1219-------------------------------------------------------------------------------
1220*/
1221float32 float32_mul( float32 a, float32 b )
1222{
1223 flag aSign, bSign, zSign;
1224 int16 aExp, bExp, zExp;
1225 bits32 aSig, bSig;
1226 bits64 zSig64;
1227 bits32 zSig;
1228
1229 aSig = extractFloat32Frac( a );
1230 aExp = extractFloat32Exp( a );
1231 aSign = extractFloat32Sign( a );
1232 bSig = extractFloat32Frac( b );
1233 bExp = extractFloat32Exp( b );
1234 bSign = extractFloat32Sign( b );
1235 zSign = aSign ^ bSign;
1236 if ( aExp == 0xFF ) {
1237 if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) {
1238 return propagateFloat32NaN( a, b );
1239 }
1240 if ( ( bExp | bSig ) == 0 ) {
1241 float_raise( float_flag_invalid );
1242 return float32_default_nan;
1243 }
1244 return packFloat32( zSign, 0xFF, 0 );
1245 }
1246 if ( bExp == 0xFF ) {
1247 if ( bSig ) return propagateFloat32NaN( a, b );
1248 if ( ( aExp | aSig ) == 0 ) {
1249 float_raise( float_flag_invalid );
1250 return float32_default_nan;
1251 }
1252 return packFloat32( zSign, 0xFF, 0 );
1253 }
1254 if ( aExp == 0 ) {
1255 if ( aSig == 0 ) return packFloat32( zSign, 0, 0 );
1256 normalizeFloat32Subnormal( aSig, &aExp, &aSig );
1257 }
1258 if ( bExp == 0 ) {
1259 if ( bSig == 0 ) return packFloat32( zSign, 0, 0 );
1260 normalizeFloat32Subnormal( bSig, &bExp, &bSig );
1261 }
1262 zExp = aExp + bExp - 0x7F;
1263 aSig = ( aSig | 0x00800000 )<<7;
1264 bSig = ( bSig | 0x00800000 )<<8;
1265 shift64RightJamming( ( (bits64) aSig ) * bSig, 32, &zSig64 );
1266 zSig = zSig64;
1267 if ( 0 <= (sbits32) ( zSig<<1 ) ) {
1268 zSig <<= 1;
1269 --zExp;
1270 }
1271 return roundAndPackFloat32( zSign, zExp, zSig );
1272
1273}
1274
1275/*
1276-------------------------------------------------------------------------------
1277Returns the result of dividing the single-precision floating-point value `a'
1278by the corresponding value `b'. The operation is performed according to the
1279IEC/IEEE Standard for Binary Floating-point Arithmetic.
1280-------------------------------------------------------------------------------
1281*/
1282float32 float32_div( float32 a, float32 b )
1283{
1284 flag aSign, bSign, zSign;
1285 int16 aExp, bExp, zExp;
1286 bits32 aSig, bSig, zSig;
1287
1288 aSig = extractFloat32Frac( a );
1289 aExp = extractFloat32Exp( a );
1290 aSign = extractFloat32Sign( a );
1291 bSig = extractFloat32Frac( b );
1292 bExp = extractFloat32Exp( b );
1293 bSign = extractFloat32Sign( b );
1294 zSign = aSign ^ bSign;
1295 if ( aExp == 0xFF ) {
1296 if ( aSig ) return propagateFloat32NaN( a, b );
1297 if ( bExp == 0xFF ) {
1298 if ( bSig ) return propagateFloat32NaN( a, b );
1299 float_raise( float_flag_invalid );
1300 return float32_default_nan;
1301 }
1302 return packFloat32( zSign, 0xFF, 0 );
1303 }
1304 if ( bExp == 0xFF ) {
1305 if ( bSig ) return propagateFloat32NaN( a, b );
1306 return packFloat32( zSign, 0, 0 );
1307 }
1308 if ( bExp == 0 ) {
1309 if ( bSig == 0 ) {
1310 if ( ( aExp | aSig ) == 0 ) {
1311 float_raise( float_flag_invalid );
1312 return float32_default_nan;
1313 }
1314 float_raise( float_flag_divbyzero );
1315 return packFloat32( zSign, 0xFF, 0 );
1316 }
1317 normalizeFloat32Subnormal( bSig, &bExp, &bSig );
1318 }
1319 if ( aExp == 0 ) {
1320 if ( aSig == 0 ) return packFloat32( zSign, 0, 0 );
1321 normalizeFloat32Subnormal( aSig, &aExp, &aSig );
1322 }
1323 zExp = aExp - bExp + 0x7D;
1324 aSig = ( aSig | 0x00800000 )<<7;
1325 bSig = ( bSig | 0x00800000 )<<8;
1326 if ( bSig <= ( aSig + aSig ) ) {
1327 aSig >>= 1;
1328 ++zExp;
1329 }
1330 zSig = ( ( (bits64) aSig )<<32 ) / bSig;
1331 if ( ( zSig & 0x3F ) == 0 ) {
1332 zSig |= ( ( (bits64) bSig ) * zSig != ( (bits64) aSig )<<32 );
1333 }
1334 return roundAndPackFloat32( zSign, zExp, zSig );
1335
1336}
1337
1338/*
1339-------------------------------------------------------------------------------
1340Returns the remainder of the single-precision floating-point value `a'
1341with respect to the corresponding value `b'. The operation is performed
1342according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
1343-------------------------------------------------------------------------------
1344*/
1345float32 float32_rem( float32 a, float32 b )
1346{
1347 flag aSign, bSign, zSign;
1348 int16 aExp, bExp, expDiff;
1349 bits32 aSig, bSig;
1350 bits32 q;
1351 bits64 aSig64, bSig64, q64;
1352 bits32 alternateASig;
1353 sbits32 sigMean;
1354
1355 aSig = extractFloat32Frac( a );
1356 aExp = extractFloat32Exp( a );
1357 aSign = extractFloat32Sign( a );
1358 bSig = extractFloat32Frac( b );
1359 bExp = extractFloat32Exp( b );
1360 bSign = extractFloat32Sign( b );
1361 if ( aExp == 0xFF ) {
1362 if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) {
1363 return propagateFloat32NaN( a, b );
1364 }
1365 float_raise( float_flag_invalid );
1366 return float32_default_nan;
1367 }
1368 if ( bExp == 0xFF ) {
1369 if ( bSig ) return propagateFloat32NaN( a, b );
1370 return a;
1371 }
1372 if ( bExp == 0 ) {
1373 if ( bSig == 0 ) {
1374 float_raise( float_flag_invalid );
1375 return float32_default_nan;
1376 }
1377 normalizeFloat32Subnormal( bSig, &bExp, &bSig );
1378 }
1379 if ( aExp == 0 ) {
1380 if ( aSig == 0 ) return a;
1381 normalizeFloat32Subnormal( aSig, &aExp, &aSig );
1382 }
1383 expDiff = aExp - bExp;
1384 aSig |= 0x00800000;
1385 bSig |= 0x00800000;
1386 if ( expDiff < 32 ) {
1387 aSig <<= 8;
1388 bSig <<= 8;
1389 if ( expDiff < 0 ) {
1390 if ( expDiff < -1 ) return a;
1391 aSig >>= 1;
1392 }
1393 q = ( bSig <= aSig );
1394 if ( q ) aSig -= bSig;
1395 if ( 0 < expDiff ) {
1396 q = ( ( (bits64) aSig )<<32 ) / bSig;
1397 q >>= 32 - expDiff;
1398 bSig >>= 2;
1399 aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
1400 }
1401 else {
1402 aSig >>= 2;
1403 bSig >>= 2;
1404 }
1405 }
1406 else {
1407 if ( bSig <= aSig ) aSig -= bSig;
1408 aSig64 = ( (bits64) aSig )<<40;
1409 bSig64 = ( (bits64) bSig )<<40;
1410 expDiff -= 64;
1411 while ( 0 < expDiff ) {
1412 q64 = estimateDiv128To64( aSig64, 0, bSig64 );
1413 q64 = ( 2 < q64 ) ? q64 - 2 : 0;
1414 aSig64 = - ( ( bSig * q64 )<<38 );
1415 expDiff -= 62;
1416 }
1417 expDiff += 64;
1418 q64 = estimateDiv128To64( aSig64, 0, bSig64 );
1419 q64 = ( 2 < q64 ) ? q64 - 2 : 0;
1420 q = q64>>( 64 - expDiff );
1421 bSig <<= 6;
1422 aSig = ( ( aSig64>>33 )<<( expDiff - 1 ) ) - bSig * q;
1423 }
1424 do {
1425 alternateASig = aSig;
1426 ++q;
1427 aSig -= bSig;
1428 } while ( 0 <= (sbits32) aSig );
1429 sigMean = aSig + alternateASig;
1430 if ( ( sigMean < 0 ) || ( ( sigMean == 0 ) && ( q & 1 ) ) ) {
1431 aSig = alternateASig;
1432 }
1433 zSign = ( (sbits32) aSig < 0 );
1434 if ( zSign ) aSig = - aSig;
1435 return normalizeRoundAndPackFloat32( aSign ^ zSign, bExp, aSig );
1436
1437}
1438
1439/*
1440-------------------------------------------------------------------------------
1441Returns the square root of the single-precision floating-point value `a'.
1442The operation is performed according to the IEC/IEEE Standard for Binary
1443Floating-point Arithmetic.
1444-------------------------------------------------------------------------------
1445*/
1446float32 float32_sqrt( float32 a )
1447{
1448 flag aSign;
1449 int16 aExp, zExp;
1450 bits32 aSig, zSig;
1451 bits64 rem, term;
1452
1453 aSig = extractFloat32Frac( a );
1454 aExp = extractFloat32Exp( a );
1455 aSign = extractFloat32Sign( a );
1456 if ( aExp == 0xFF ) {
1457 if ( aSig ) return propagateFloat32NaN( a, 0 );
1458 if ( ! aSign ) return a;
1459 float_raise( float_flag_invalid );
1460 return float32_default_nan;
1461 }
1462 if ( aSign ) {
1463 if ( ( aExp | aSig ) == 0 ) return a;
1464 float_raise( float_flag_invalid );
1465 return float32_default_nan;
1466 }
1467 if ( aExp == 0 ) {
1468 if ( aSig == 0 ) return 0;
1469 normalizeFloat32Subnormal( aSig, &aExp, &aSig );
1470 }
1471 zExp = ( ( aExp - 0x7F )>>1 ) + 0x7E;
1472 aSig = ( aSig | 0x00800000 )<<8;
1473 zSig = estimateSqrt32( aExp, aSig ) + 2;
1474 if ( ( zSig & 0x7F ) <= 5 ) {
1475 if ( zSig < 2 ) {
1476 zSig = 0xFFFFFFFF;
1477 }
1478 else {
1479 aSig >>= aExp & 1;
1480 term = ( (bits64) zSig ) * zSig;
1481 rem = ( ( (bits64) aSig )<<32 ) - term;
1482 while ( (sbits64) rem < 0 ) {
1483 --zSig;
1484 rem += ( ( (bits64) zSig )<<1 ) | 1;
1485 }
1486 zSig |= ( rem != 0 );
1487 }
1488 }
1489 shift32RightJamming( zSig, 1, &zSig );
1490 return roundAndPackFloat32( 0, zExp, zSig );
1491
1492}
1493
1494/*
1495-------------------------------------------------------------------------------
1496Returns 1 if the single-precision floating-point value `a' is equal to the
1497corresponding value `b', and 0 otherwise. The comparison is performed
1498according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
1499-------------------------------------------------------------------------------
1500*/
1501flag float32_eq( float32 a, float32 b )
1502{
1503
1504 if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
1505 || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
1506 ) {
1507 if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
1508 float_raise( float_flag_invalid );
1509 }
1510 return 0;
1511 }
1512 return ( a == b ) || ( (bits32) ( ( a | b )<<1 ) == 0 );
1513
1514}
1515
1516/*
1517-------------------------------------------------------------------------------
1518Returns 1 if the single-precision floating-point value `a' is less than or
1519equal to the corresponding value `b', and 0 otherwise. The comparison is
1520performed according to the IEC/IEEE Standard for Binary Floating-point
1521Arithmetic.
1522-------------------------------------------------------------------------------
1523*/
1524flag float32_le( float32 a, float32 b )
1525{
1526 flag aSign, bSign;
1527
1528 if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
1529 || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
1530 ) {
1531 float_raise( float_flag_invalid );
1532 return 0;
1533 }
1534 aSign = extractFloat32Sign( a );
1535 bSign = extractFloat32Sign( b );
1536 if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 );
1537 return ( a == b ) || ( aSign ^ ( a < b ) );
1538
1539}
1540
1541/*
1542-------------------------------------------------------------------------------
1543Returns 1 if the single-precision floating-point value `a' is less than
1544the corresponding value `b', and 0 otherwise. The comparison is performed
1545according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
1546-------------------------------------------------------------------------------
1547*/
1548flag float32_lt( float32 a, float32 b )
1549{
1550 flag aSign, bSign;
1551
1552 if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
1553 || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
1554 ) {
1555 float_raise( float_flag_invalid );
1556 return 0;
1557 }
1558 aSign = extractFloat32Sign( a );
1559 bSign = extractFloat32Sign( b );
1560 if ( aSign != bSign ) return aSign && ( (bits32) ( ( a | b )<<1 ) != 0 );
1561 return ( a != b ) && ( aSign ^ ( a < b ) );
1562
1563}
1564
1565/*
1566-------------------------------------------------------------------------------
1567Returns 1 if the single-precision floating-point value `a' is equal to the
1568corresponding value `b', and 0 otherwise. The invalid exception is raised
1569if either operand is a NaN. Otherwise, the comparison is performed
1570according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
1571-------------------------------------------------------------------------------
1572*/
1573flag float32_eq_signaling( float32 a, float32 b )
1574{
1575
1576 if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
1577 || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
1578 ) {
1579 float_raise( float_flag_invalid );
1580 return 0;
1581 }
1582 return ( a == b ) || ( (bits32) ( ( a | b )<<1 ) == 0 );
1583
1584}
1585
1586/*
1587-------------------------------------------------------------------------------
1588Returns 1 if the single-precision floating-point value `a' is less than or
1589equal to the corresponding value `b', and 0 otherwise. Quiet NaNs do not
1590cause an exception. Otherwise, the comparison is performed according to the
1591IEC/IEEE Standard for Binary Floating-point Arithmetic.
1592-------------------------------------------------------------------------------
1593*/
1594flag float32_le_quiet( float32 a, float32 b )
1595{
1596 flag aSign, bSign;
1597 //int16 aExp, bExp;
1598
1599 if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
1600 || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
1601 ) {
1602 if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
1603 float_raise( float_flag_invalid );
1604 }
1605 return 0;
1606 }
1607 aSign = extractFloat32Sign( a );
1608 bSign = extractFloat32Sign( b );
1609 if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 );
1610 return ( a == b ) || ( aSign ^ ( a < b ) );
1611
1612}
1613
1614/*
1615-------------------------------------------------------------------------------
1616Returns 1 if the single-precision floating-point value `a' is less than
1617the corresponding value `b', and 0 otherwise. Quiet NaNs do not cause an
1618exception. Otherwise, the comparison is performed according to the IEC/IEEE
1619Standard for Binary Floating-point Arithmetic.
1620-------------------------------------------------------------------------------
1621*/
1622flag float32_lt_quiet( float32 a, float32 b )
1623{
1624 flag aSign, bSign;
1625
1626 if ( ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
1627 || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
1628 ) {
1629 if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
1630 float_raise( float_flag_invalid );
1631 }
1632 return 0;
1633 }
1634 aSign = extractFloat32Sign( a );
1635 bSign = extractFloat32Sign( b );
1636 if ( aSign != bSign ) return aSign && ( (bits32) ( ( a | b )<<1 ) != 0 );
1637 return ( a != b ) && ( aSign ^ ( a < b ) );
1638
1639}
1640
1641/*
1642-------------------------------------------------------------------------------
1643Returns the result of converting the double-precision floating-point value
1644`a' to the 32-bit two's complement integer format. The conversion is
1645performed according to the IEC/IEEE Standard for Binary Floating-point
1646Arithmetic---which means in particular that the conversion is rounded
1647according to the current rounding mode. If `a' is a NaN, the largest
1648positive integer is returned. Otherwise, if the conversion overflows, the
1649largest integer with the same sign as `a' is returned.
1650-------------------------------------------------------------------------------
1651*/
1652int32 float64_to_int32( float64 a )
1653{
1654 flag aSign;
1655 int16 aExp, shiftCount;
1656 bits64 aSig;
1657
1658 aSig = extractFloat64Frac( a );
1659 aExp = extractFloat64Exp( a );
1660 aSign = extractFloat64Sign( a );
1661 if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
1662 if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
1663 shiftCount = 0x42C - aExp;
1664 if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig );
1665 return roundAndPackInt32( aSign, aSig );
1666
1667}
1668
1669/*
1670-------------------------------------------------------------------------------
1671Returns the result of converting the double-precision floating-point value
1672`a' to the 32-bit two's complement integer format. The conversion is
1673performed according to the IEC/IEEE Standard for Binary Floating-point
1674Arithmetic, except that the conversion is always rounded toward zero. If
1675`a' is a NaN, the largest positive integer is returned. Otherwise, if the
1676conversion overflows, the largest integer with the same sign as `a' is
1677returned.
1678-------------------------------------------------------------------------------
1679*/
1680int32 float64_to_int32_round_to_zero( float64 a )
1681{
1682 flag aSign;
1683 int16 aExp, shiftCount;
1684 bits64 aSig, savedASig;
1685 int32 z;
1686
1687 aSig = extractFloat64Frac( a );
1688 aExp = extractFloat64Exp( a );
1689 aSign = extractFloat64Sign( a );
1690 shiftCount = 0x433 - aExp;
1691 if ( shiftCount < 21 ) {
1692 if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
1693 goto invalid;
1694 }
1695 else if ( 52 < shiftCount ) {
1696 if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
1697 return 0;
1698 }
1699 aSig |= LIT64( 0x0010000000000000 );
1700 savedASig = aSig;
1701 aSig >>= shiftCount;
1702 z = aSig;
1703 if ( aSign ) z = - z;
1704 if ( ( z < 0 ) ^ aSign ) {
1705 invalid:
1706 float_exception_flags |= float_flag_invalid;
1707 return aSign ? 0x80000000 : 0x7FFFFFFF;
1708 }
1709 if ( ( aSig<<shiftCount ) != savedASig ) {
1710 float_exception_flags |= float_flag_inexact;
1711 }
1712 return z;
1713
1714}
1715
1716/*
1717-------------------------------------------------------------------------------
1718Returns the result of converting the double-precision floating-point value
1719`a' to the 32-bit two's complement unsigned integer format. The conversion
1720is performed according to the IEC/IEEE Standard for Binary Floating-point
1721Arithmetic---which means in particular that the conversion is rounded
1722according to the current rounding mode. If `a' is a NaN, the largest
1723positive integer is returned. Otherwise, if the conversion overflows, the
1724largest positive integer is returned.
1725-------------------------------------------------------------------------------
1726*/
1727int32 float64_to_uint32( float64 a )
1728{
1729 flag aSign;
1730 int16 aExp, shiftCount;
1731 bits64 aSig;
1732
1733 aSig = extractFloat64Frac( a );
1734 aExp = extractFloat64Exp( a );
1735 aSign = 0; //extractFloat64Sign( a );
1736 //if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
1737 if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
1738 shiftCount = 0x42C - aExp;
1739 if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig );
1740 return roundAndPackInt32( aSign, aSig );
1741}
1742
1743/*
1744-------------------------------------------------------------------------------
1745Returns the result of converting the double-precision floating-point value
1746`a' to the 32-bit two's complement integer format. The conversion is
1747performed according to the IEC/IEEE Standard for Binary Floating-point
1748Arithmetic, except that the conversion is always rounded toward zero. If
1749`a' is a NaN, the largest positive integer is returned. Otherwise, if the
1750conversion overflows, the largest positive integer is returned.
1751-------------------------------------------------------------------------------
1752*/
1753int32 float64_to_uint32_round_to_zero( float64 a )
1754{
1755 flag aSign;
1756 int16 aExp, shiftCount;
1757 bits64 aSig, savedASig;
1758 int32 z;
1759
1760 aSig = extractFloat64Frac( a );
1761 aExp = extractFloat64Exp( a );
1762 aSign = extractFloat64Sign( a );
1763 shiftCount = 0x433 - aExp;
1764 if ( shiftCount < 21 ) {
1765 if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
1766 goto invalid;
1767 }
1768 else if ( 52 < shiftCount ) {
1769 if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
1770 return 0;
1771 }
1772 aSig |= LIT64( 0x0010000000000000 );
1773 savedASig = aSig;
1774 aSig >>= shiftCount;
1775 z = aSig;
1776 if ( aSign ) z = - z;
1777 if ( ( z < 0 ) ^ aSign ) {
1778 invalid:
1779 float_exception_flags |= float_flag_invalid;
1780 return aSign ? 0x80000000 : 0x7FFFFFFF;
1781 }
1782 if ( ( aSig<<shiftCount ) != savedASig ) {
1783 float_exception_flags |= float_flag_inexact;
1784 }
1785 return z;
1786}
1787
1788/*
1789-------------------------------------------------------------------------------
1790Returns the result of converting the double-precision floating-point value
1791`a' to the single-precision floating-point format. The conversion is
1792performed according to the IEC/IEEE Standard for Binary Floating-point
1793Arithmetic.
1794-------------------------------------------------------------------------------
1795*/
1796float32 float64_to_float32( float64 a )
1797{
1798 flag aSign;
1799 int16 aExp;
1800 bits64 aSig;
1801 bits32 zSig;
1802
1803 aSig = extractFloat64Frac( a );
1804 aExp = extractFloat64Exp( a );
1805 aSign = extractFloat64Sign( a );
1806 if ( aExp == 0x7FF ) {
1807 if ( aSig ) return commonNaNToFloat32( float64ToCommonNaN( a ) );
1808 return packFloat32( aSign, 0xFF, 0 );
1809 }
1810 shift64RightJamming( aSig, 22, &aSig );
1811 zSig = aSig;
1812 if ( aExp || zSig ) {
1813 zSig |= 0x40000000;
1814 aExp -= 0x381;
1815 }
1816 return roundAndPackFloat32( aSign, aExp, zSig );
1817
1818}
1819
1820#ifdef FLOATX80
1821
1822/*
1823-------------------------------------------------------------------------------
1824Returns the result of converting the double-precision floating-point value
1825`a' to the extended double-precision floating-point format. The conversion
1826is performed according to the IEC/IEEE Standard for Binary Floating-point
1827Arithmetic.
1828-------------------------------------------------------------------------------
1829*/
1830floatx80 float64_to_floatx80( float64 a )
1831{
1832 flag aSign;
1833 int16 aExp;
1834 bits64 aSig;
1835
1836 aSig = extractFloat64Frac( a );
1837 aExp = extractFloat64Exp( a );
1838 aSign = extractFloat64Sign( a );
1839 if ( aExp == 0x7FF ) {
1840 if ( aSig ) return commonNaNToFloatx80( float64ToCommonNaN( a ) );
1841 return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
1842 }
1843 if ( aExp == 0 ) {
1844 if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
1845 normalizeFloat64Subnormal( aSig, &aExp, &aSig );
1846 }
1847 return
1848 packFloatx80(
1849 aSign, aExp + 0x3C00, ( aSig | LIT64( 0x0010000000000000 ) )<<11 );
1850
1851}
1852
1853#endif
1854
1855/*
1856-------------------------------------------------------------------------------
1857Rounds the double-precision floating-point value `a' to an integer, and
1858returns the result as a double-precision floating-point value. The
1859operation is performed according to the IEC/IEEE Standard for Binary
1860Floating-point Arithmetic.
1861-------------------------------------------------------------------------------
1862*/
1863float64 float64_round_to_int( float64 a )
1864{
1865 flag aSign;
1866 int16 aExp;
1867 bits64 lastBitMask, roundBitsMask;
1868 int8 roundingMode;
1869 float64 z;
1870
1871 aExp = extractFloat64Exp( a );
1872 if ( 0x433 <= aExp ) {
1873 if ( ( aExp == 0x7FF ) && extractFloat64Frac( a ) ) {
1874 return propagateFloat64NaN( a, a );
1875 }
1876 return a;
1877 }
1878 if ( aExp <= 0x3FE ) {
1879 if ( (bits64) ( a<<1 ) == 0 ) return a;
1880 float_exception_flags |= float_flag_inexact;
1881 aSign = extractFloat64Sign( a );
1882 switch ( float_rounding_mode ) {
1883 case float_round_nearest_even:
1884 if ( ( aExp == 0x3FE ) && extractFloat64Frac( a ) ) {
1885 return packFloat64( aSign, 0x3FF, 0 );
1886 }
1887 break;
1888 case float_round_down:
1889 return aSign ? LIT64( 0xBFF0000000000000 ) : 0;
1890 case float_round_up:
1891 return
1892 aSign ? LIT64( 0x8000000000000000 ) : LIT64( 0x3FF0000000000000 );
1893 }
1894 return packFloat64( aSign, 0, 0 );
1895 }
1896 lastBitMask = 1;
1897 lastBitMask <<= 0x433 - aExp;
1898 roundBitsMask = lastBitMask - 1;
1899 z = a;
1900 roundingMode = float_rounding_mode;
1901 if ( roundingMode == float_round_nearest_even ) {
1902 z += lastBitMask>>1;
1903 if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
1904 }
1905 else if ( roundingMode != float_round_to_zero ) {
1906 if ( extractFloat64Sign( z ) ^ ( roundingMode == float_round_up ) ) {
1907 z += roundBitsMask;
1908 }
1909 }
1910 z &= ~ roundBitsMask;
1911 if ( z != a ) float_exception_flags |= float_flag_inexact;
1912 return z;
1913
1914}
1915
1916/*
1917-------------------------------------------------------------------------------
1918Returns the result of adding the absolute values of the double-precision
1919floating-point values `a' and `b'. If `zSign' is true, the sum is negated
1920before being returned. `zSign' is ignored if the result is a NaN. The
1921addition is performed according to the IEC/IEEE Standard for Binary
1922Floating-point Arithmetic.
1923-------------------------------------------------------------------------------
1924*/
1925static float64 addFloat64Sigs( float64 a, float64 b, flag zSign )
1926{
1927 int16 aExp, bExp, zExp;
1928 bits64 aSig, bSig, zSig;
1929 int16 expDiff;
1930
1931 aSig = extractFloat64Frac( a );
1932 aExp = extractFloat64Exp( a );
1933 bSig = extractFloat64Frac( b );
1934 bExp = extractFloat64Exp( b );
1935 expDiff = aExp - bExp;
1936 aSig <<= 9;
1937 bSig <<= 9;
1938 if ( 0 < expDiff ) {
1939 if ( aExp == 0x7FF ) {
1940 if ( aSig ) return propagateFloat64NaN( a, b );
1941 return a;
1942 }
1943 if ( bExp == 0 ) {
1944 --expDiff;
1945 }
1946 else {
1947 bSig |= LIT64( 0x2000000000000000 );
1948 }
1949 shift64RightJamming( bSig, expDiff, &bSig );
1950 zExp = aExp;
1951 }
1952 else if ( expDiff < 0 ) {
1953 if ( bExp == 0x7FF ) {
1954 if ( bSig ) return propagateFloat64NaN( a, b );
1955 return packFloat64( zSign, 0x7FF, 0 );
1956 }
1957 if ( aExp == 0 ) {
1958 ++expDiff;
1959 }
1960 else {
1961 aSig |= LIT64( 0x2000000000000000 );
1962 }
1963 shift64RightJamming( aSig, - expDiff, &aSig );
1964 zExp = bExp;
1965 }
1966 else {
1967 if ( aExp == 0x7FF ) {
1968 if ( aSig | bSig ) return propagateFloat64NaN( a, b );
1969 return a;
1970 }
1971 if ( aExp == 0 ) return packFloat64( zSign, 0, ( aSig + bSig )>>9 );
1972 zSig = LIT64( 0x4000000000000000 ) + aSig + bSig;
1973 zExp = aExp;
1974 goto roundAndPack;
1975 }
1976 aSig |= LIT64( 0x2000000000000000 );
1977 zSig = ( aSig + bSig )<<1;
1978 --zExp;
1979 if ( (sbits64) zSig < 0 ) {
1980 zSig = aSig + bSig;
1981 ++zExp;
1982 }
1983 roundAndPack:
1984 return roundAndPackFloat64( zSign, zExp, zSig );
1985
1986}
1987
1988/*
1989-------------------------------------------------------------------------------
1990Returns the result of subtracting the absolute values of the double-
1991precision floating-point values `a' and `b'. If `zSign' is true, the
1992difference is negated before being returned. `zSign' is ignored if the
1993result is a NaN. The subtraction is performed according to the IEC/IEEE
1994Standard for Binary Floating-point Arithmetic.
1995-------------------------------------------------------------------------------
1996*/
1997static float64 subFloat64Sigs( float64 a, float64 b, flag zSign )
1998{
1999 int16 aExp, bExp, zExp;
2000 bits64 aSig, bSig, zSig;
2001 int16 expDiff;
2002
2003 aSig = extractFloat64Frac( a );
2004 aExp = extractFloat64Exp( a );
2005 bSig = extractFloat64Frac( b );
2006 bExp = extractFloat64Exp( b );
2007 expDiff = aExp - bExp;
2008 aSig <<= 10;
2009 bSig <<= 10;
2010 if ( 0 < expDiff ) goto aExpBigger;
2011 if ( expDiff < 0 ) goto bExpBigger;
2012 if ( aExp == 0x7FF ) {
2013 if ( aSig | bSig ) return propagateFloat64NaN( a, b );
2014 float_raise( float_flag_invalid );
2015 return float64_default_nan;
2016 }
2017 if ( aExp == 0 ) {
2018 aExp = 1;
2019 bExp = 1;
2020 }
2021 if ( bSig < aSig ) goto aBigger;
2022 if ( aSig < bSig ) goto bBigger;
2023 return packFloat64( float_rounding_mode == float_round_down, 0, 0 );
2024 bExpBigger:
2025 if ( bExp == 0x7FF ) {
2026 if ( bSig ) return propagateFloat64NaN( a, b );
2027 return packFloat64( zSign ^ 1, 0x7FF, 0 );
2028 }
2029 if ( aExp == 0 ) {
2030 ++expDiff;
2031 }
2032 else {
2033 aSig |= LIT64( 0x4000000000000000 );
2034 }
2035 shift64RightJamming( aSig, - expDiff, &aSig );
2036 bSig |= LIT64( 0x4000000000000000 );
2037 bBigger:
2038 zSig = bSig - aSig;
2039 zExp = bExp;
2040 zSign ^= 1;
2041 goto normalizeRoundAndPack;
2042 aExpBigger:
2043 if ( aExp == 0x7FF ) {
2044 if ( aSig ) return propagateFloat64NaN( a, b );
2045 return a;
2046 }
2047 if ( bExp == 0 ) {
2048 --expDiff;
2049 }
2050 else {
2051 bSig |= LIT64( 0x4000000000000000 );
2052 }
2053 shift64RightJamming( bSig, expDiff, &bSig );
2054 aSig |= LIT64( 0x4000000000000000 );
2055 aBigger:
2056 zSig = aSig - bSig;
2057 zExp = aExp;
2058 normalizeRoundAndPack:
2059 --zExp;
2060 return normalizeRoundAndPackFloat64( zSign, zExp, zSig );
2061
2062}
2063
2064/*
2065-------------------------------------------------------------------------------
2066Returns the result of adding the double-precision floating-point values `a'
2067and `b'. The operation is performed according to the IEC/IEEE Standard for
2068Binary Floating-point Arithmetic.
2069-------------------------------------------------------------------------------
2070*/
2071float64 float64_add( float64 a, float64 b )
2072{
2073 flag aSign, bSign;
2074
2075 aSign = extractFloat64Sign( a );
2076 bSign = extractFloat64Sign( b );
2077 if ( aSign == bSign ) {
2078 return addFloat64Sigs( a, b, aSign );
2079 }
2080 else {
2081 return subFloat64Sigs( a, b, aSign );
2082 }
2083
2084}
2085
2086/*
2087-------------------------------------------------------------------------------
2088Returns the result of subtracting the double-precision floating-point values
2089`a' and `b'. The operation is performed according to the IEC/IEEE Standard
2090for Binary Floating-point Arithmetic.
2091-------------------------------------------------------------------------------
2092*/
2093float64 float64_sub( float64 a, float64 b )
2094{
2095 flag aSign, bSign;
2096
2097 aSign = extractFloat64Sign( a );
2098 bSign = extractFloat64Sign( b );
2099 if ( aSign == bSign ) {
2100 return subFloat64Sigs( a, b, aSign );
2101 }
2102 else {
2103 return addFloat64Sigs( a, b, aSign );
2104 }
2105
2106}
2107
2108/*
2109-------------------------------------------------------------------------------
2110Returns the result of multiplying the double-precision floating-point values
2111`a' and `b'. The operation is performed according to the IEC/IEEE Standard
2112for Binary Floating-point Arithmetic.
2113-------------------------------------------------------------------------------
2114*/
2115float64 float64_mul( float64 a, float64 b )
2116{
2117 flag aSign, bSign, zSign;
2118 int16 aExp, bExp, zExp;
2119 bits64 aSig, bSig, zSig0, zSig1;
2120
2121 aSig = extractFloat64Frac( a );
2122 aExp = extractFloat64Exp( a );
2123 aSign = extractFloat64Sign( a );
2124 bSig = extractFloat64Frac( b );
2125 bExp = extractFloat64Exp( b );
2126 bSign = extractFloat64Sign( b );
2127 zSign = aSign ^ bSign;
2128 if ( aExp == 0x7FF ) {
2129 if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) {
2130 return propagateFloat64NaN( a, b );
2131 }
2132 if ( ( bExp | bSig ) == 0 ) {
2133 float_raise( float_flag_invalid );
2134 return float64_default_nan;
2135 }
2136 return packFloat64( zSign, 0x7FF, 0 );
2137 }
2138 if ( bExp == 0x7FF ) {
2139 if ( bSig ) return propagateFloat64NaN( a, b );
2140 if ( ( aExp | aSig ) == 0 ) {
2141 float_raise( float_flag_invalid );
2142 return float64_default_nan;
2143 }
2144 return packFloat64( zSign, 0x7FF, 0 );
2145 }
2146 if ( aExp == 0 ) {
2147 if ( aSig == 0 ) return packFloat64( zSign, 0, 0 );
2148 normalizeFloat64Subnormal( aSig, &aExp, &aSig );
2149 }
2150 if ( bExp == 0 ) {
2151 if ( bSig == 0 ) return packFloat64( zSign, 0, 0 );
2152 normalizeFloat64Subnormal( bSig, &bExp, &bSig );
2153 }
2154 zExp = aExp + bExp - 0x3FF;
2155 aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<10;
2156 bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
2157 mul64To128( aSig, bSig, &zSig0, &zSig1 );
2158 zSig0 |= ( zSig1 != 0 );
2159 if ( 0 <= (sbits64) ( zSig0<<1 ) ) {
2160 zSig0 <<= 1;
2161 --zExp;
2162 }
2163 return roundAndPackFloat64( zSign, zExp, zSig0 );
2164
2165}
2166
2167/*
2168-------------------------------------------------------------------------------
2169Returns the result of dividing the double-precision floating-point value `a'
2170by the corresponding value `b'. The operation is performed according to
2171the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2172-------------------------------------------------------------------------------
2173*/
2174float64 float64_div( float64 a, float64 b )
2175{
2176 flag aSign, bSign, zSign;
2177 int16 aExp, bExp, zExp;
2178 bits64 aSig, bSig, zSig;
2179 bits64 rem0, rem1;
2180 bits64 term0, term1;
2181
2182 aSig = extractFloat64Frac( a );
2183 aExp = extractFloat64Exp( a );
2184 aSign = extractFloat64Sign( a );
2185 bSig = extractFloat64Frac( b );
2186 bExp = extractFloat64Exp( b );
2187 bSign = extractFloat64Sign( b );
2188 zSign = aSign ^ bSign;
2189 if ( aExp == 0x7FF ) {
2190 if ( aSig ) return propagateFloat64NaN( a, b );
2191 if ( bExp == 0x7FF ) {
2192 if ( bSig ) return propagateFloat64NaN( a, b );
2193 float_raise( float_flag_invalid );
2194 return float64_default_nan;
2195 }
2196 return packFloat64( zSign, 0x7FF, 0 );
2197 }
2198 if ( bExp == 0x7FF ) {
2199 if ( bSig ) return propagateFloat64NaN( a, b );
2200 return packFloat64( zSign, 0, 0 );
2201 }
2202 if ( bExp == 0 ) {
2203 if ( bSig == 0 ) {
2204 if ( ( aExp | aSig ) == 0 ) {
2205 float_raise( float_flag_invalid );
2206 return float64_default_nan;
2207 }
2208 float_raise( float_flag_divbyzero );
2209 return packFloat64( zSign, 0x7FF, 0 );
2210 }
2211 normalizeFloat64Subnormal( bSig, &bExp, &bSig );
2212 }
2213 if ( aExp == 0 ) {
2214 if ( aSig == 0 ) return packFloat64( zSign, 0, 0 );
2215 normalizeFloat64Subnormal( aSig, &aExp, &aSig );
2216 }
2217 zExp = aExp - bExp + 0x3FD;
2218 aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<10;
2219 bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
2220 if ( bSig <= ( aSig + aSig ) ) {
2221 aSig >>= 1;
2222 ++zExp;
2223 }
2224 zSig = estimateDiv128To64( aSig, 0, bSig );
2225 if ( ( zSig & 0x1FF ) <= 2 ) {
2226 mul64To128( bSig, zSig, &term0, &term1 );
2227 sub128( aSig, 0, term0, term1, &rem0, &rem1 );
2228 while ( (sbits64) rem0 < 0 ) {
2229 --zSig;
2230 add128( rem0, rem1, 0, bSig, &rem0, &rem1 );
2231 }
2232 zSig |= ( rem1 != 0 );
2233 }
2234 return roundAndPackFloat64( zSign, zExp, zSig );
2235
2236}
2237
2238/*
2239-------------------------------------------------------------------------------
2240Returns the remainder of the double-precision floating-point value `a'
2241with respect to the corresponding value `b'. The operation is performed
2242according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2243-------------------------------------------------------------------------------
2244*/
2245float64 float64_rem( float64 a, float64 b )
2246{
2247 flag aSign, bSign, zSign;
2248 int16 aExp, bExp, expDiff;
2249 bits64 aSig, bSig;
2250 bits64 q, alternateASig;
2251 sbits64 sigMean;
2252
2253 aSig = extractFloat64Frac( a );
2254 aExp = extractFloat64Exp( a );
2255 aSign = extractFloat64Sign( a );
2256 bSig = extractFloat64Frac( b );
2257 bExp = extractFloat64Exp( b );
2258 bSign = extractFloat64Sign( b );
2259 if ( aExp == 0x7FF ) {
2260 if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) {
2261 return propagateFloat64NaN( a, b );
2262 }
2263 float_raise( float_flag_invalid );
2264 return float64_default_nan;
2265 }
2266 if ( bExp == 0x7FF ) {
2267 if ( bSig ) return propagateFloat64NaN( a, b );
2268 return a;
2269 }
2270 if ( bExp == 0 ) {
2271 if ( bSig == 0 ) {
2272 float_raise( float_flag_invalid );
2273 return float64_default_nan;
2274 }
2275 normalizeFloat64Subnormal( bSig, &bExp, &bSig );
2276 }
2277 if ( aExp == 0 ) {
2278 if ( aSig == 0 ) return a;
2279 normalizeFloat64Subnormal( aSig, &aExp, &aSig );
2280 }
2281 expDiff = aExp - bExp;
2282 aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<11;
2283 bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
2284 if ( expDiff < 0 ) {
2285 if ( expDiff < -1 ) return a;
2286 aSig >>= 1;
2287 }
2288 q = ( bSig <= aSig );
2289 if ( q ) aSig -= bSig;
2290 expDiff -= 64;
2291 while ( 0 < expDiff ) {
2292 q = estimateDiv128To64( aSig, 0, bSig );
2293 q = ( 2 < q ) ? q - 2 : 0;
2294 aSig = - ( ( bSig>>2 ) * q );
2295 expDiff -= 62;
2296 }
2297 expDiff += 64;
2298 if ( 0 < expDiff ) {
2299 q = estimateDiv128To64( aSig, 0, bSig );
2300 q = ( 2 < q ) ? q - 2 : 0;
2301 q >>= 64 - expDiff;
2302 bSig >>= 2;
2303 aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
2304 }
2305 else {
2306 aSig >>= 2;
2307 bSig >>= 2;
2308 }
2309 do {
2310 alternateASig = aSig;
2311 ++q;
2312 aSig -= bSig;
2313 } while ( 0 <= (sbits64) aSig );
2314 sigMean = aSig + alternateASig;
2315 if ( ( sigMean < 0 ) || ( ( sigMean == 0 ) && ( q & 1 ) ) ) {
2316 aSig = alternateASig;
2317 }
2318 zSign = ( (sbits64) aSig < 0 );
2319 if ( zSign ) aSig = - aSig;
2320 return normalizeRoundAndPackFloat64( aSign ^ zSign, bExp, aSig );
2321
2322}
2323
2324/*
2325-------------------------------------------------------------------------------
2326Returns the square root of the double-precision floating-point value `a'.
2327The operation is performed according to the IEC/IEEE Standard for Binary
2328Floating-point Arithmetic.
2329-------------------------------------------------------------------------------
2330*/
2331float64 float64_sqrt( float64 a )
2332{
2333 flag aSign;
2334 int16 aExp, zExp;
2335 bits64 aSig, zSig;
2336 bits64 rem0, rem1, term0, term1; //, shiftedRem;
2337 //float64 z;
2338
2339 aSig = extractFloat64Frac( a );
2340 aExp = extractFloat64Exp( a );
2341 aSign = extractFloat64Sign( a );
2342 if ( aExp == 0x7FF ) {
2343 if ( aSig ) return propagateFloat64NaN( a, a );
2344 if ( ! aSign ) return a;
2345 float_raise( float_flag_invalid );
2346 return float64_default_nan;
2347 }
2348 if ( aSign ) {
2349 if ( ( aExp | aSig ) == 0 ) return a;
2350 float_raise( float_flag_invalid );
2351 return float64_default_nan;
2352 }
2353 if ( aExp == 0 ) {
2354 if ( aSig == 0 ) return 0;
2355 normalizeFloat64Subnormal( aSig, &aExp, &aSig );
2356 }
2357 zExp = ( ( aExp - 0x3FF )>>1 ) + 0x3FE;
2358 aSig |= LIT64( 0x0010000000000000 );
2359 zSig = estimateSqrt32( aExp, aSig>>21 );
2360 zSig <<= 31;
2361 aSig <<= 9 - ( aExp & 1 );
2362 zSig = estimateDiv128To64( aSig, 0, zSig ) + zSig + 2;
2363 if ( ( zSig & 0x3FF ) <= 5 ) {
2364 if ( zSig < 2 ) {
2365 zSig = LIT64( 0xFFFFFFFFFFFFFFFF );
2366 }
2367 else {
2368 aSig <<= 2;
2369 mul64To128( zSig, zSig, &term0, &term1 );
2370 sub128( aSig, 0, term0, term1, &rem0, &rem1 );
2371 while ( (sbits64) rem0 < 0 ) {
2372 --zSig;
2373 shortShift128Left( 0, zSig, 1, &term0, &term1 );
2374 term1 |= 1;
2375 add128( rem0, rem1, term0, term1, &rem0, &rem1 );
2376 }
2377 zSig |= ( ( rem0 | rem1 ) != 0 );
2378 }
2379 }
2380 shift64RightJamming( zSig, 1, &zSig );
2381 return roundAndPackFloat64( 0, zExp, zSig );
2382
2383}
2384
2385/*
2386-------------------------------------------------------------------------------
2387Returns 1 if the double-precision floating-point value `a' is equal to the
2388corresponding value `b', and 0 otherwise. The comparison is performed
2389according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2390-------------------------------------------------------------------------------
2391*/
2392flag float64_eq( float64 a, float64 b )
2393{
2394
2395 if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2396 || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
2397 ) {
2398 if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
2399 float_raise( float_flag_invalid );
2400 }
2401 return 0;
2402 }
2403 return ( a == b ) || ( (bits64) ( ( a | b )<<1 ) == 0 );
2404
2405}
2406
2407/*
2408-------------------------------------------------------------------------------
2409Returns 1 if the double-precision floating-point value `a' is less than or
2410equal to the corresponding value `b', and 0 otherwise. The comparison is
2411performed according to the IEC/IEEE Standard for Binary Floating-point
2412Arithmetic.
2413-------------------------------------------------------------------------------
2414*/
2415flag float64_le( float64 a, float64 b )
2416{
2417 flag aSign, bSign;
2418
2419 if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2420 || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
2421 ) {
2422 float_raise( float_flag_invalid );
2423 return 0;
2424 }
2425 aSign = extractFloat64Sign( a );
2426 bSign = extractFloat64Sign( b );
2427 if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );
2428 return ( a == b ) || ( aSign ^ ( a < b ) );
2429
2430}
2431
2432/*
2433-------------------------------------------------------------------------------
2434Returns 1 if the double-precision floating-point value `a' is less than
2435the corresponding value `b', and 0 otherwise. The comparison is performed
2436according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2437-------------------------------------------------------------------------------
2438*/
2439flag float64_lt( float64 a, float64 b )
2440{
2441 flag aSign, bSign;
2442
2443 if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2444 || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
2445 ) {
2446 float_raise( float_flag_invalid );
2447 return 0;
2448 }
2449 aSign = extractFloat64Sign( a );
2450 bSign = extractFloat64Sign( b );
2451 if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 );
2452 return ( a != b ) && ( aSign ^ ( a < b ) );
2453
2454}
2455
2456/*
2457-------------------------------------------------------------------------------
2458Returns 1 if the double-precision floating-point value `a' is equal to the
2459corresponding value `b', and 0 otherwise. The invalid exception is raised
2460if either operand is a NaN. Otherwise, the comparison is performed
2461according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2462-------------------------------------------------------------------------------
2463*/
2464flag float64_eq_signaling( float64 a, float64 b )
2465{
2466
2467 if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2468 || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
2469 ) {
2470 float_raise( float_flag_invalid );
2471 return 0;
2472 }
2473 return ( a == b ) || ( (bits64) ( ( a | b )<<1 ) == 0 );
2474
2475}
2476
2477/*
2478-------------------------------------------------------------------------------
2479Returns 1 if the double-precision floating-point value `a' is less than or
2480equal to the corresponding value `b', and 0 otherwise. Quiet NaNs do not
2481cause an exception. Otherwise, the comparison is performed according to the
2482IEC/IEEE Standard for Binary Floating-point Arithmetic.
2483-------------------------------------------------------------------------------
2484*/
2485flag float64_le_quiet( float64 a, float64 b )
2486{
2487 flag aSign, bSign;
2488 //int16 aExp, bExp;
2489
2490 if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2491 || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
2492 ) {
2493 if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
2494 float_raise( float_flag_invalid );
2495 }
2496 return 0;
2497 }
2498 aSign = extractFloat64Sign( a );
2499 bSign = extractFloat64Sign( b );
2500 if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );
2501 return ( a == b ) || ( aSign ^ ( a < b ) );
2502
2503}
2504
2505/*
2506-------------------------------------------------------------------------------
2507Returns 1 if the double-precision floating-point value `a' is less than
2508the corresponding value `b', and 0 otherwise. Quiet NaNs do not cause an
2509exception. Otherwise, the comparison is performed according to the IEC/IEEE
2510Standard for Binary Floating-point Arithmetic.
2511-------------------------------------------------------------------------------
2512*/
2513flag float64_lt_quiet( float64 a, float64 b )
2514{
2515 flag aSign, bSign;
2516
2517 if ( ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
2518 || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
2519 ) {
2520 if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
2521 float_raise( float_flag_invalid );
2522 }
2523 return 0;
2524 }
2525 aSign = extractFloat64Sign( a );
2526 bSign = extractFloat64Sign( b );
2527 if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 );
2528 return ( a != b ) && ( aSign ^ ( a < b ) );
2529
2530}
2531
2532#ifdef FLOATX80
2533
2534/*
2535-------------------------------------------------------------------------------
2536Returns the result of converting the extended double-precision floating-
2537point value `a' to the 32-bit two's complement integer format. The
2538conversion is performed according to the IEC/IEEE Standard for Binary
2539Floating-point Arithmetic---which means in particular that the conversion
2540is rounded according to the current rounding mode. If `a' is a NaN, the
2541largest positive integer is returned. Otherwise, if the conversion
2542overflows, the largest integer with the same sign as `a' is returned.
2543-------------------------------------------------------------------------------
2544*/
2545int32 floatx80_to_int32( floatx80 a )
2546{
2547 flag aSign;
2548 int32 aExp, shiftCount;
2549 bits64 aSig;
2550
2551 aSig = extractFloatx80Frac( a );
2552 aExp = extractFloatx80Exp( a );
2553 aSign = extractFloatx80Sign( a );
2554 if ( ( aExp == 0x7FFF ) && (bits64) ( aSig<<1 ) ) aSign = 0;
2555 shiftCount = 0x4037 - aExp;
2556 if ( shiftCount <= 0 ) shiftCount = 1;
2557 shift64RightJamming( aSig, shiftCount, &aSig );
2558 return roundAndPackInt32( aSign, aSig );
2559
2560}
2561
2562/*
2563-------------------------------------------------------------------------------
2564Returns the result of converting the extended double-precision floating-
2565point value `a' to the 32-bit two's complement integer format. The
2566conversion is performed according to the IEC/IEEE Standard for Binary
2567Floating-point Arithmetic, except that the conversion is always rounded
2568toward zero. If `a' is a NaN, the largest positive integer is returned.
2569Otherwise, if the conversion overflows, the largest integer with the same
2570sign as `a' is returned.
2571-------------------------------------------------------------------------------
2572*/
2573int32 floatx80_to_int32_round_to_zero( floatx80 a )
2574{
2575 flag aSign;
2576 int32 aExp, shiftCount;
2577 bits64 aSig, savedASig;
2578 int32 z;
2579
2580 aSig = extractFloatx80Frac( a );
2581 aExp = extractFloatx80Exp( a );
2582 aSign = extractFloatx80Sign( a );
2583 shiftCount = 0x403E - aExp;
2584 if ( shiftCount < 32 ) {
2585 if ( ( aExp == 0x7FFF ) && (bits64) ( aSig<<1 ) ) aSign = 0;
2586 goto invalid;
2587 }
2588 else if ( 63 < shiftCount ) {
2589 if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
2590 return 0;
2591 }
2592 savedASig = aSig;
2593 aSig >>= shiftCount;
2594 z = aSig;
2595 if ( aSign ) z = - z;
2596 if ( ( z < 0 ) ^ aSign ) {
2597 invalid:
2598 float_exception_flags |= float_flag_invalid;
2599 return aSign ? 0x80000000 : 0x7FFFFFFF;
2600 }
2601 if ( ( aSig<<shiftCount ) != savedASig ) {
2602 float_exception_flags |= float_flag_inexact;
2603 }
2604 return z;
2605
2606}
2607
2608/*
2609-------------------------------------------------------------------------------
2610Returns the result of converting the extended double-precision floating-
2611point value `a' to the single-precision floating-point format. The
2612conversion is performed according to the IEC/IEEE Standard for Binary
2613Floating-point Arithmetic.
2614-------------------------------------------------------------------------------
2615*/
2616float32 floatx80_to_float32( floatx80 a )
2617{
2618 flag aSign;
2619 int32 aExp;
2620 bits64 aSig;
2621
2622 aSig = extractFloatx80Frac( a );
2623 aExp = extractFloatx80Exp( a );
2624 aSign = extractFloatx80Sign( a );
2625 if ( aExp == 0x7FFF ) {
2626 if ( (bits64) ( aSig<<1 ) ) {
2627 return commonNaNToFloat32( floatx80ToCommonNaN( a ) );
2628 }
2629 return packFloat32( aSign, 0xFF, 0 );
2630 }
2631 shift64RightJamming( aSig, 33, &aSig );
2632 if ( aExp || aSig ) aExp -= 0x3F81;
2633 return roundAndPackFloat32( aSign, aExp, aSig );
2634
2635}
2636
2637/*
2638-------------------------------------------------------------------------------
2639Returns the result of converting the extended double-precision floating-
2640point value `a' to the double-precision floating-point format. The
2641conversion is performed according to the IEC/IEEE Standard for Binary
2642Floating-point Arithmetic.
2643-------------------------------------------------------------------------------
2644*/
2645float64 floatx80_to_float64( floatx80 a )
2646{
2647 flag aSign;
2648 int32 aExp;
2649 bits64 aSig, zSig;
2650
2651 aSig = extractFloatx80Frac( a );
2652 aExp = extractFloatx80Exp( a );
2653 aSign = extractFloatx80Sign( a );
2654 if ( aExp == 0x7FFF ) {
2655 if ( (bits64) ( aSig<<1 ) ) {
2656 return commonNaNToFloat64( floatx80ToCommonNaN( a ) );
2657 }
2658 return packFloat64( aSign, 0x7FF, 0 );
2659 }
2660 shift64RightJamming( aSig, 1, &zSig );
2661 if ( aExp || aSig ) aExp -= 0x3C01;
2662 return roundAndPackFloat64( aSign, aExp, zSig );
2663
2664}
2665
2666/*
2667-------------------------------------------------------------------------------
2668Rounds the extended double-precision floating-point value `a' to an integer,
2669and returns the result as an extended quadruple-precision floating-point
2670value. The operation is performed according to the IEC/IEEE Standard for
2671Binary Floating-point Arithmetic.
2672-------------------------------------------------------------------------------
2673*/
2674floatx80 floatx80_round_to_int( floatx80 a )
2675{
2676 flag aSign;
2677 int32 aExp;
2678 bits64 lastBitMask, roundBitsMask;
2679 int8 roundingMode;
2680 floatx80 z;
2681
2682 aExp = extractFloatx80Exp( a );
2683 if ( 0x403E <= aExp ) {
2684 if ( ( aExp == 0x7FFF ) && (bits64) ( extractFloatx80Frac( a )<<1 ) ) {
2685 return propagateFloatx80NaN( a, a );
2686 }
2687 return a;
2688 }
2689 if ( aExp <= 0x3FFE ) {
2690 if ( ( aExp == 0 )
2691 && ( (bits64) ( extractFloatx80Frac( a )<<1 ) == 0 ) ) {
2692 return a;
2693 }
2694 float_exception_flags |= float_flag_inexact;
2695 aSign = extractFloatx80Sign( a );
2696 switch ( float_rounding_mode ) {
2697 case float_round_nearest_even:
2698 if ( ( aExp == 0x3FFE ) && (bits64) ( extractFloatx80Frac( a )<<1 )
2699 ) {
2700 return
2701 packFloatx80( aSign, 0x3FFF, LIT64( 0x8000000000000000 ) );
2702 }
2703 break;
2704 case float_round_down:
2705 return
2706 aSign ?
2707 packFloatx80( 1, 0x3FFF, LIT64( 0x8000000000000000 ) )
2708 : packFloatx80( 0, 0, 0 );
2709 case float_round_up:
2710 return
2711 aSign ? packFloatx80( 1, 0, 0 )
2712 : packFloatx80( 0, 0x3FFF, LIT64( 0x8000000000000000 ) );
2713 }
2714 return packFloatx80( aSign, 0, 0 );
2715 }
2716 lastBitMask = 1;
2717 lastBitMask <<= 0x403E - aExp;
2718 roundBitsMask = lastBitMask - 1;
2719 z = a;
2720 roundingMode = float_rounding_mode;
2721 if ( roundingMode == float_round_nearest_even ) {
2722 z.low += lastBitMask>>1;
2723 if ( ( z.low & roundBitsMask ) == 0 ) z.low &= ~ lastBitMask;
2724 }
2725 else if ( roundingMode != float_round_to_zero ) {
2726 if ( extractFloatx80Sign( z ) ^ ( roundingMode == float_round_up ) ) {
2727 z.low += roundBitsMask;
2728 }
2729 }
2730 z.low &= ~ roundBitsMask;
2731 if ( z.low == 0 ) {
2732 ++z.high;
2733 z.low = LIT64( 0x8000000000000000 );
2734 }
2735 if ( z.low != a.low ) float_exception_flags |= float_flag_inexact;
2736 return z;
2737
2738}
2739
2740/*
2741-------------------------------------------------------------------------------
2742Returns the result of adding the absolute values of the extended double-
2743precision floating-point values `a' and `b'. If `zSign' is true, the sum is
2744negated before being returned. `zSign' is ignored if the result is a NaN.
2745The addition is performed according to the IEC/IEEE Standard for Binary
2746Floating-point Arithmetic.
2747-------------------------------------------------------------------------------
2748*/
2749static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
2750{
2751 int32 aExp, bExp, zExp;
2752 bits64 aSig, bSig, zSig0, zSig1;
2753 int32 expDiff;
2754
2755 aSig = extractFloatx80Frac( a );
2756 aExp = extractFloatx80Exp( a );
2757 bSig = extractFloatx80Frac( b );
2758 bExp = extractFloatx80Exp( b );
2759 expDiff = aExp - bExp;
2760 if ( 0 < expDiff ) {
2761 if ( aExp == 0x7FFF ) {
2762 if ( (bits64) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b );
2763 return a;
2764 }
2765 if ( bExp == 0 ) --expDiff;
2766 shift64ExtraRightJamming( bSig, 0, expDiff, &bSig, &zSig1 );
2767 zExp = aExp;
2768 }
2769 else if ( expDiff < 0 ) {
2770 if ( bExp == 0x7FFF ) {
2771 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
2772 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
2773 }
2774 if ( aExp == 0 ) ++expDiff;
2775 shift64ExtraRightJamming( aSig, 0, - expDiff, &aSig, &zSig1 );
2776 zExp = bExp;
2777 }
2778 else {
2779 if ( aExp == 0x7FFF ) {
2780 if ( (bits64) ( ( aSig | bSig )<<1 ) ) {
2781 return propagateFloatx80NaN( a, b );
2782 }
2783 return a;
2784 }
2785 zSig1 = 0;
2786 zSig0 = aSig + bSig;
2787 if ( aExp == 0 ) {
2788 normalizeFloatx80Subnormal( zSig0, &zExp, &zSig0 );
2789 goto roundAndPack;
2790 }
2791 zExp = aExp;
2792 goto shiftRight1;
2793 }
2794
2795 zSig0 = aSig + bSig;
2796
2797 if ( (sbits64) zSig0 < 0 ) goto roundAndPack;
2798 shiftRight1:
2799 shift64ExtraRightJamming( zSig0, zSig1, 1, &zSig0, &zSig1 );
2800 zSig0 |= LIT64( 0x8000000000000000 );
2801 ++zExp;
2802 roundAndPack:
2803 return
2804 roundAndPackFloatx80(
2805 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
2806
2807}
2808
2809/*
2810-------------------------------------------------------------------------------
2811Returns the result of subtracting the absolute values of the extended
2812double-precision floating-point values `a' and `b'. If `zSign' is true,
2813the difference is negated before being returned. `zSign' is ignored if the
2814result is a NaN. The subtraction is performed according to the IEC/IEEE
2815Standard for Binary Floating-point Arithmetic.
2816-------------------------------------------------------------------------------
2817*/
2818static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
2819{
2820 int32 aExp, bExp, zExp;
2821 bits64 aSig, bSig, zSig0, zSig1;
2822 int32 expDiff;
2823 floatx80 z;
2824
2825 aSig = extractFloatx80Frac( a );
2826 aExp = extractFloatx80Exp( a );
2827 bSig = extractFloatx80Frac( b );
2828 bExp = extractFloatx80Exp( b );
2829 expDiff = aExp - bExp;
2830 if ( 0 < expDiff ) goto aExpBigger;
2831 if ( expDiff < 0 ) goto bExpBigger;
2832 if ( aExp == 0x7FFF ) {
2833 if ( (bits64) ( ( aSig | bSig )<<1 ) ) {
2834 return propagateFloatx80NaN( a, b );
2835 }
2836 float_raise( float_flag_invalid );
2837 z.low = floatx80_default_nan_low;
2838 z.high = floatx80_default_nan_high;
2839 return z;
2840 }
2841 if ( aExp == 0 ) {
2842 aExp = 1;
2843 bExp = 1;
2844 }
2845 zSig1 = 0;
2846 if ( bSig < aSig ) goto aBigger;
2847 if ( aSig < bSig ) goto bBigger;
2848 return packFloatx80( float_rounding_mode == float_round_down, 0, 0 );
2849 bExpBigger:
2850 if ( bExp == 0x7FFF ) {
2851 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
2852 return packFloatx80( zSign ^ 1, 0x7FFF, LIT64( 0x8000000000000000 ) );
2853 }
2854 if ( aExp == 0 ) ++expDiff;
2855 shift128RightJamming( aSig, 0, - expDiff, &aSig, &zSig1 );
2856 bBigger:
2857 sub128( bSig, 0, aSig, zSig1, &zSig0, &zSig1 );
2858 zExp = bExp;
2859 zSign ^= 1;
2860 goto normalizeRoundAndPack;
2861 aExpBigger:
2862 if ( aExp == 0x7FFF ) {
2863 if ( (bits64) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b );
2864 return a;
2865 }
2866 if ( bExp == 0 ) --expDiff;
2867 shift128RightJamming( bSig, 0, expDiff, &bSig, &zSig1 );
2868 aBigger:
2869 sub128( aSig, 0, bSig, zSig1, &zSig0, &zSig1 );
2870 zExp = aExp;
2871 normalizeRoundAndPack:
2872 return
2873 normalizeRoundAndPackFloatx80(
2874 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
2875
2876}
2877
2878/*
2879-------------------------------------------------------------------------------
2880Returns the result of adding the extended double-precision floating-point
2881values `a' and `b'. The operation is performed according to the IEC/IEEE
2882Standard for Binary Floating-point Arithmetic.
2883-------------------------------------------------------------------------------
2884*/
2885floatx80 floatx80_add( floatx80 a, floatx80 b )
2886{
2887 flag aSign, bSign;
2888
2889 aSign = extractFloatx80Sign( a );
2890 bSign = extractFloatx80Sign( b );
2891 if ( aSign == bSign ) {
2892 return addFloatx80Sigs( a, b, aSign );
2893 }
2894 else {
2895 return subFloatx80Sigs( a, b, aSign );
2896 }
2897
2898}
2899
2900/*
2901-------------------------------------------------------------------------------
2902Returns the result of subtracting the extended double-precision floating-
2903point values `a' and `b'. The operation is performed according to the
2904IEC/IEEE Standard for Binary Floating-point Arithmetic.
2905-------------------------------------------------------------------------------
2906*/
2907floatx80 floatx80_sub( floatx80 a, floatx80 b )
2908{
2909 flag aSign, bSign;
2910
2911 aSign = extractFloatx80Sign( a );
2912 bSign = extractFloatx80Sign( b );
2913 if ( aSign == bSign ) {
2914 return subFloatx80Sigs( a, b, aSign );
2915 }
2916 else {
2917 return addFloatx80Sigs( a, b, aSign );
2918 }
2919
2920}
2921
2922/*
2923-------------------------------------------------------------------------------
2924Returns the result of multiplying the extended double-precision floating-
2925point values `a' and `b'. The operation is performed according to the
2926IEC/IEEE Standard for Binary Floating-point Arithmetic.
2927-------------------------------------------------------------------------------
2928*/
2929floatx80 floatx80_mul( floatx80 a, floatx80 b )
2930{
2931 flag aSign, bSign, zSign;
2932 int32 aExp, bExp, zExp;
2933 bits64 aSig, bSig, zSig0, zSig1;
2934 floatx80 z;
2935
2936 aSig = extractFloatx80Frac( a );
2937 aExp = extractFloatx80Exp( a );
2938 aSign = extractFloatx80Sign( a );
2939 bSig = extractFloatx80Frac( b );
2940 bExp = extractFloatx80Exp( b );
2941 bSign = extractFloatx80Sign( b );
2942 zSign = aSign ^ bSign;
2943 if ( aExp == 0x7FFF ) {
2944 if ( (bits64) ( aSig<<1 )
2945 || ( ( bExp == 0x7FFF ) && (bits64) ( bSig<<1 ) ) ) {
2946 return propagateFloatx80NaN( a, b );
2947 }
2948 if ( ( bExp | bSig ) == 0 ) goto invalid;
2949 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
2950 }
2951 if ( bExp == 0x7FFF ) {
2952 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
2953 if ( ( aExp | aSig ) == 0 ) {
2954 invalid:
2955 float_raise( float_flag_invalid );
2956 z.low = floatx80_default_nan_low;
2957 z.high = floatx80_default_nan_high;
2958 return z;
2959 }
2960 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
2961 }
2962 if ( aExp == 0 ) {
2963 if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
2964 normalizeFloatx80Subnormal( aSig, &aExp, &aSig );
2965 }
2966 if ( bExp == 0 ) {
2967 if ( bSig == 0 ) return packFloatx80( zSign, 0, 0 );
2968 normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
2969 }
2970 zExp = aExp + bExp - 0x3FFE;
2971 mul64To128( aSig, bSig, &zSig0, &zSig1 );
2972 if ( 0 < (sbits64) zSig0 ) {
2973 shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 );
2974 --zExp;
2975 }
2976 return
2977 roundAndPackFloatx80(
2978 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
2979
2980}
2981
2982/*
2983-------------------------------------------------------------------------------
2984Returns the result of dividing the extended double-precision floating-point
2985value `a' by the corresponding value `b'. The operation is performed
2986according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
2987-------------------------------------------------------------------------------
2988*/
2989floatx80 floatx80_div( floatx80 a, floatx80 b )
2990{
2991 flag aSign, bSign, zSign;
2992 int32 aExp, bExp, zExp;
2993 bits64 aSig, bSig, zSig0, zSig1;
2994 bits64 rem0, rem1, rem2, term0, term1, term2;
2995 floatx80 z;
2996
2997 aSig = extractFloatx80Frac( a );
2998 aExp = extractFloatx80Exp( a );
2999 aSign = extractFloatx80Sign( a );
3000 bSig = extractFloatx80Frac( b );
3001 bExp = extractFloatx80Exp( b );
3002 bSign = extractFloatx80Sign( b );
3003 zSign = aSign ^ bSign;
3004 if ( aExp == 0x7FFF ) {
3005 if ( (bits64) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b );
3006 if ( bExp == 0x7FFF ) {
3007 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
3008 goto invalid;
3009 }
3010 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
3011 }
3012 if ( bExp == 0x7FFF ) {
3013 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
3014 return packFloatx80( zSign, 0, 0 );
3015 }
3016 if ( bExp == 0 ) {
3017 if ( bSig == 0 ) {
3018 if ( ( aExp | aSig ) == 0 ) {
3019 invalid:
3020 float_raise( float_flag_invalid );
3021 z.low = floatx80_default_nan_low;
3022 z.high = floatx80_default_nan_high;
3023 return z;
3024 }
3025 float_raise( float_flag_divbyzero );
3026 return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
3027 }
3028 normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
3029 }
3030 if ( aExp == 0 ) {
3031 if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
3032 normalizeFloatx80Subnormal( aSig, &aExp, &aSig );
3033 }
3034 zExp = aExp - bExp + 0x3FFE;
3035 rem1 = 0;
3036 if ( bSig <= aSig ) {
3037 shift128Right( aSig, 0, 1, &aSig, &rem1 );
3038 ++zExp;
3039 }
3040 zSig0 = estimateDiv128To64( aSig, rem1, bSig );
3041 mul64To128( bSig, zSig0, &term0, &term1 );
3042 sub128( aSig, rem1, term0, term1, &rem0, &rem1 );
3043 while ( (sbits64) rem0 < 0 ) {
3044 --zSig0;
3045 add128( rem0, rem1, 0, bSig, &rem0, &rem1 );
3046 }
3047 zSig1 = estimateDiv128To64( rem1, 0, bSig );
3048 if ( (bits64) ( zSig1<<1 ) <= 8 ) {
3049 mul64To128( bSig, zSig1, &term1, &term2 );
3050 sub128( rem1, 0, term1, term2, &rem1, &rem2 );
3051 while ( (sbits64) rem1 < 0 ) {
3052 --zSig1;
3053 add128( rem1, rem2, 0, bSig, &rem1, &rem2 );
3054 }
3055 zSig1 |= ( ( rem1 | rem2 ) != 0 );
3056 }
3057 return
3058 roundAndPackFloatx80(
3059 floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
3060
3061}
3062
3063/*
3064-------------------------------------------------------------------------------
3065Returns the remainder of the extended double-precision floating-point value
3066`a' with respect to the corresponding value `b'. The operation is performed
3067according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
3068-------------------------------------------------------------------------------
3069*/
3070floatx80 floatx80_rem( floatx80 a, floatx80 b )
3071{
3072 flag aSign, bSign, zSign;
3073 int32 aExp, bExp, expDiff;
3074 bits64 aSig0, aSig1, bSig;
3075 bits64 q, term0, term1, alternateASig0, alternateASig1;
3076 floatx80 z;
3077
3078 aSig0 = extractFloatx80Frac( a );
3079 aExp = extractFloatx80Exp( a );
3080 aSign = extractFloatx80Sign( a );
3081 bSig = extractFloatx80Frac( b );
3082 bExp = extractFloatx80Exp( b );
3083 bSign = extractFloatx80Sign( b );
3084 if ( aExp == 0x7FFF ) {
3085 if ( (bits64) ( aSig0<<1 )
3086 || ( ( bExp == 0x7FFF ) && (bits64) ( bSig<<1 ) ) ) {
3087 return propagateFloatx80NaN( a, b );
3088 }
3089 goto invalid;
3090 }
3091 if ( bExp == 0x7FFF ) {
3092 if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
3093 return a;
3094 }
3095 if ( bExp == 0 ) {
3096 if ( bSig == 0 ) {
3097 invalid:
3098 float_raise( float_flag_invalid );
3099 z.low = floatx80_default_nan_low;
3100 z.high = floatx80_default_nan_high;
3101 return z;
3102 }
3103 normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
3104 }
3105 if ( aExp == 0 ) {
3106 if ( (bits64) ( aSig0<<1 ) == 0 ) return a;
3107 normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
3108 }
3109 bSig |= LIT64( 0x8000000000000000 );
3110 zSign = aSign;
3111 expDiff = aExp - bExp;
3112 aSig1 = 0;
3113 if ( expDiff < 0 ) {
3114 if ( expDiff < -1 ) return a;
3115 shift128Right( aSig0, 0, 1, &aSig0, &aSig1 );
3116 expDiff = 0;
3117 }
3118 q = ( bSig <= aSig0 );
3119 if ( q ) aSig0 -= bSig;
3120 expDiff -= 64;
3121 while ( 0 < expDiff ) {
3122 q = estimateDiv128To64( aSig0, aSig1, bSig );
3123 q = ( 2 < q ) ? q - 2 : 0;
3124 mul64To128( bSig, q, &term0, &term1 );
3125 sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
3126 shortShift128Left( aSig0, aSig1, 62, &aSig0, &aSig1 );
3127 expDiff -= 62;
3128 }
3129 expDiff += 64;
3130 if ( 0 < expDiff ) {
3131 q = estimateDiv128To64( aSig0, aSig1, bSig );
3132 q = ( 2 < q ) ? q - 2 : 0;
3133 q >>= 64 - expDiff;
3134 mul64To128( bSig, q<<( 64 - expDiff ), &term0, &term1 );
3135 sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
3136 shortShift128Left( 0, bSig, 64 - expDiff, &term0, &term1 );
3137 while ( le128( term0, term1, aSig0, aSig1 ) ) {
3138 ++q;
3139 sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
3140 }
3141 }
3142 else {
3143 term1 = 0;
3144 term0 = bSig;
3145 }
3146 sub128( term0, term1, aSig0, aSig1, &alternateASig0, &alternateASig1 );
3147 if ( lt128( alternateASig0, alternateASig1, aSig0, aSig1 )
3148 || ( eq128( alternateASig0, alternateASig1, aSig0, aSig1 )
3149 && ( q & 1 ) )
3150 ) {
3151 aSig0 = alternateASig0;
3152 aSig1 = alternateASig1;
3153 zSign = ! zSign;
3154 }
3155 return
3156 normalizeRoundAndPackFloatx80(
3157 80, zSign, bExp + expDiff, aSig0, aSig1 );
3158
3159}
3160
3161/*
3162-------------------------------------------------------------------------------
3163Returns the square root of the extended double-precision floating-point
3164value `a'. The operation is performed according to the IEC/IEEE Standard
3165for Binary Floating-point Arithmetic.
3166-------------------------------------------------------------------------------
3167*/
3168floatx80 floatx80_sqrt( floatx80 a )
3169{
3170 flag aSign;
3171 int32 aExp, zExp;
3172 bits64 aSig0, aSig1, zSig0, zSig1;
3173 bits64 rem0, rem1, rem2, rem3, term0, term1, term2, term3;
3174 bits64 shiftedRem0, shiftedRem1;
3175 floatx80 z;
3176
3177 aSig0 = extractFloatx80Frac( a );
3178 aExp = extractFloatx80Exp( a );
3179 aSign = extractFloatx80Sign( a );
3180 if ( aExp == 0x7FFF ) {
3181 if ( (bits64) ( aSig0<<1 ) ) return propagateFloatx80NaN( a, a );
3182 if ( ! aSign ) return a;
3183 goto invalid;
3184 }
3185 if ( aSign ) {
3186 if ( ( aExp | aSig0 ) == 0 ) return a;
3187 invalid:
3188 float_raise( float_flag_invalid );
3189 z.low = floatx80_default_nan_low;
3190 z.high = floatx80_default_nan_high;
3191 return z;
3192 }
3193 if ( aExp == 0 ) {
3194 if ( aSig0 == 0 ) return packFloatx80( 0, 0, 0 );
3195 normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
3196 }
3197 zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFF;
3198 zSig0 = estimateSqrt32( aExp, aSig0>>32 );
3199 zSig0 <<= 31;
3200 aSig1 = 0;
3201 shift128Right( aSig0, 0, ( aExp & 1 ) + 2, &aSig0, &aSig1 );
3202 zSig0 = estimateDiv128To64( aSig0, aSig1, zSig0 ) + zSig0 + 4;
3203 if ( 0 <= (sbits64) zSig0 ) zSig0 = LIT64( 0xFFFFFFFFFFFFFFFF );
3204 shortShift128Left( aSig0, aSig1, 2, &aSig0, &aSig1 );
3205 mul64To128( zSig0, zSig0, &term0, &term1 );
3206 sub128( aSig0, aSig1, term0, term1, &rem0, &rem1 );
3207 while ( (sbits64) rem0 < 0 ) {
3208 --zSig0;
3209 shortShift128Left( 0, zSig0, 1, &term0, &term1 );
3210 term1 |= 1;
3211 add128( rem0, rem1, term0, term1, &rem0, &rem1 );
3212 }
3213 shortShift128Left( rem0, rem1, 63, &shiftedRem0, &shiftedRem1 );
3214 zSig1 = estimateDiv128To64( shiftedRem0, shiftedRem1, zSig0 );
3215 if ( (bits64) ( zSig1<<1 ) <= 10 ) {
3216 if ( zSig1 == 0 ) zSig1 = 1;
3217 mul64To128( zSig0, zSig1, &term1, &term2 );
3218 shortShift128Left( term1, term2, 1, &term1, &term2 );
3219 sub128( rem1, 0, term1, term2, &rem1, &rem2 );
3220 mul64To128( zSig1, zSig1, &term2, &term3 );
3221 sub192( rem1, rem2, 0, 0, term2, term3, &rem1, &rem2, &rem3 );
3222 while ( (sbits64) rem1 < 0 ) {
3223 --zSig1;
3224 shortShift192Left( 0, zSig0, zSig1, 1, &term1, &term2, &term3 );
3225 term3 |= 1;
3226 add192(
3227 rem1, rem2, rem3, term1, term2, term3, &rem1, &rem2, &rem3 );
3228 }
3229 zSig1 |= ( ( rem1 | rem2 | rem3 ) != 0 );
3230 }
3231 return
3232 roundAndPackFloatx80(
3233 floatx80_rounding_precision, 0, zExp, zSig0, zSig1 );
3234
3235}
3236
3237/*
3238-------------------------------------------------------------------------------
3239Returns 1 if the extended double-precision floating-point value `a' is
3240equal to the corresponding value `b', and 0 otherwise. The comparison is
3241performed according to the IEC/IEEE Standard for Binary Floating-point
3242Arithmetic.
3243-------------------------------------------------------------------------------
3244*/
3245flag floatx80_eq( floatx80 a, floatx80 b )
3246{
3247
3248 if ( ( ( extractFloatx80Exp( a ) == 0x7FFF )
3249 && (bits64) ( extractFloatx80Frac( a )<<1 ) )
3250 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3251 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3252 ) {
3253 if ( floatx80_is_signaling_nan( a )
3254 || floatx80_is_signaling_nan( b ) ) {
3255 float_raise( float_flag_invalid );
3256 }
3257 return 0;
3258 }
3259 return
3260 ( a.low == b.low )
3261 && ( ( a.high == b.high )
3262 || ( ( a.low == 0 )
3263 && ( (bits16) ( ( a.high | b.high )<<1 ) == 0 ) )
3264 );
3265
3266}
3267
3268/*
3269-------------------------------------------------------------------------------
3270Returns 1 if the extended double-precision floating-point value `a' is
3271less than or equal to the corresponding value `b', and 0 otherwise. The
3272comparison is performed according to the IEC/IEEE Standard for Binary
3273Floating-point Arithmetic.
3274-------------------------------------------------------------------------------
3275*/
3276flag floatx80_le( floatx80 a, floatx80 b )
3277{
3278 flag aSign, bSign;
3279
3280 if ( ( ( extractFloatx80Exp( a ) == 0x7FFF )
3281 && (bits64) ( extractFloatx80Frac( a )<<1 ) )
3282 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3283 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3284 ) {
3285 float_raise( float_flag_invalid );
3286 return 0;
3287 }
3288 aSign = extractFloatx80Sign( a );
3289 bSign = extractFloatx80Sign( b );
3290 if ( aSign != bSign ) {
3291 return
3292 aSign
3293 || ( ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
3294 == 0 );
3295 }
3296 return
3297 aSign ? le128( b.high, b.low, a.high, a.low )
3298 : le128( a.high, a.low, b.high, b.low );
3299
3300}
3301
3302/*
3303-------------------------------------------------------------------------------
3304Returns 1 if the extended double-precision floating-point value `a' is
3305less than the corresponding value `b', and 0 otherwise. The comparison
3306is performed according to the IEC/IEEE Standard for Binary Floating-point
3307Arithmetic.
3308-------------------------------------------------------------------------------
3309*/
3310flag floatx80_lt( floatx80 a, floatx80 b )
3311{
3312 flag aSign, bSign;
3313
3314 if ( ( ( extractFloatx80Exp( a ) == 0x7FFF )
3315 && (bits64) ( extractFloatx80Frac( a )<<1 ) )
3316 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3317 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3318 ) {
3319 float_raise( float_flag_invalid );
3320 return 0;
3321 }
3322 aSign = extractFloatx80Sign( a );
3323 bSign = extractFloatx80Sign( b );
3324 if ( aSign != bSign ) {
3325 return
3326 aSign
3327 && ( ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
3328 != 0 );
3329 }
3330 return
3331 aSign ? lt128( b.high, b.low, a.high, a.low )
3332 : lt128( a.high, a.low, b.high, b.low );
3333
3334}
3335
3336/*
3337-------------------------------------------------------------------------------
3338Returns 1 if the extended double-precision floating-point value `a' is equal
3339to the corresponding value `b', and 0 otherwise. The invalid exception is
3340raised if either operand is a NaN. Otherwise, the comparison is performed
3341according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
3342-------------------------------------------------------------------------------
3343*/
3344flag floatx80_eq_signaling( floatx80 a, floatx80 b )
3345{
3346
3347 if ( ( ( extractFloatx80Exp( a ) == 0x7FFF )
3348 && (bits64) ( extractFloatx80Frac( a )<<1 ) )
3349 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3350 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3351 ) {
3352 float_raise( float_flag_invalid );
3353 return 0;
3354 }
3355 return
3356 ( a.low == b.low )
3357 && ( ( a.high == b.high )
3358 || ( ( a.low == 0 )
3359 && ( (bits16) ( ( a.high | b.high )<<1 ) == 0 ) )
3360 );
3361
3362}
3363
3364/*
3365-------------------------------------------------------------------------------
3366Returns 1 if the extended double-precision floating-point value `a' is less
3367than or equal to the corresponding value `b', and 0 otherwise. Quiet NaNs
3368do not cause an exception. Otherwise, the comparison is performed according
3369to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
3370-------------------------------------------------------------------------------
3371*/
3372flag floatx80_le_quiet( floatx80 a, floatx80 b )
3373{
3374 flag aSign, bSign;
3375
3376 if ( ( ( extractFloatx80Exp( a ) == 0x7FFF )
3377 && (bits64) ( extractFloatx80Frac( a )<<1 ) )
3378 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3379 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3380 ) {
3381 if ( floatx80_is_signaling_nan( a )
3382 || floatx80_is_signaling_nan( b ) ) {
3383 float_raise( float_flag_invalid );
3384 }
3385 return 0;
3386 }
3387 aSign = extractFloatx80Sign( a );
3388 bSign = extractFloatx80Sign( b );
3389 if ( aSign != bSign ) {
3390 return
3391 aSign
3392 || ( ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
3393 == 0 );
3394 }
3395 return
3396 aSign ? le128( b.high, b.low, a.high, a.low )
3397 : le128( a.high, a.low, b.high, b.low );
3398
3399}
3400
3401/*
3402-------------------------------------------------------------------------------
3403Returns 1 if the extended double-precision floating-point value `a' is less
3404than the corresponding value `b', and 0 otherwise. Quiet NaNs do not cause
3405an exception. Otherwise, the comparison is performed according to the
3406IEC/IEEE Standard for Binary Floating-point Arithmetic.
3407-------------------------------------------------------------------------------
3408*/
3409flag floatx80_lt_quiet( floatx80 a, floatx80 b )
3410{
3411 flag aSign, bSign;
3412
3413 if ( ( ( extractFloatx80Exp( a ) == 0x7FFF )
3414 && (bits64) ( extractFloatx80Frac( a )<<1 ) )
3415 || ( ( extractFloatx80Exp( b ) == 0x7FFF )
3416 && (bits64) ( extractFloatx80Frac( b )<<1 ) )
3417 ) {
3418 if ( floatx80_is_signaling_nan( a )
3419 || floatx80_is_signaling_nan( b ) ) {
3420 float_raise( float_flag_invalid );
3421 }
3422 return 0;
3423 }
3424 aSign = extractFloatx80Sign( a );
3425 bSign = extractFloatx80Sign( b );
3426 if ( aSign != bSign ) {
3427 return
3428 aSign
3429 && ( ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
3430 != 0 );
3431 }
3432 return
3433 aSign ? lt128( b.high, b.low, a.high, a.low )
3434 : lt128( a.high, a.low, b.high, b.low );
3435
3436}
3437
3438#endif
3439
diff --git a/arch/arm26/nwfpe/softfloat.h b/arch/arm26/nwfpe/softfloat.h
deleted file mode 100644
index 22c2193a4997..000000000000
--- a/arch/arm26/nwfpe/softfloat.h
+++ /dev/null
@@ -1,232 +0,0 @@
1
2/*
3===============================================================================
4
5This C header file is part of the SoftFloat IEC/IEEE Floating-point
6Arithmetic Package, Release 2.
7
8Written by John R. Hauser. This work was made possible in part by the
9International Computer Science Institute, located at Suite 600, 1947 Center
10Street, Berkeley, California 94704. Funding was partially provided by the
11National Science Foundation under grant MIP-9311980. The original version
12of this code was written as part of a project to build a fixed-point vector
13processor in collaboration with the University of California at Berkeley,
14overseen by Profs. Nelson Morgan and John Wawrzynek. More information
15is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
16arithmetic/softfloat.html'.
17
18THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
19has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
20TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
21PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
22AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
23
24Derivative works are acceptable, even for commercial purposes, so long as
25(1) they include prominent notice that the work is derivative, and (2) they
26include prominent notice akin to these three paragraphs for those parts of
27this code that are retained.
28
29===============================================================================
30*/
31
32#ifndef __SOFTFLOAT_H__
33#define __SOFTFLOAT_H__
34
35/*
36-------------------------------------------------------------------------------
37The macro `FLOATX80' must be defined to enable the extended double-precision
38floating-point format `floatx80'. If this macro is not defined, the
39`floatx80' type will not be defined, and none of the functions that either
40input or output the `floatx80' type will be defined.
41-------------------------------------------------------------------------------
42*/
43#define FLOATX80
44
45/*
46-------------------------------------------------------------------------------
47Software IEC/IEEE floating-point types.
48-------------------------------------------------------------------------------
49*/
50typedef unsigned long int float32;
51typedef unsigned long long float64;
52typedef struct {
53 unsigned short high;
54 unsigned long long low;
55} floatx80;
56
57/*
58-------------------------------------------------------------------------------
59Software IEC/IEEE floating-point underflow tininess-detection mode.
60-------------------------------------------------------------------------------
61*/
62extern signed char float_detect_tininess;
63enum {
64 float_tininess_after_rounding = 0,
65 float_tininess_before_rounding = 1
66};
67
68/*
69-------------------------------------------------------------------------------
70Software IEC/IEEE floating-point rounding mode.
71-------------------------------------------------------------------------------
72*/
73extern signed char float_rounding_mode;
74enum {
75 float_round_nearest_even = 0,
76 float_round_to_zero = 1,
77 float_round_down = 2,
78 float_round_up = 3
79};
80
81/*
82-------------------------------------------------------------------------------
83Software IEC/IEEE floating-point exception flags.
84-------------------------------------------------------------------------------
85extern signed char float_exception_flags;
86enum {
87 float_flag_inexact = 1,
88 float_flag_underflow = 2,
89 float_flag_overflow = 4,
90 float_flag_divbyzero = 8,
91 float_flag_invalid = 16
92};
93
94ScottB: November 4, 1998
95Changed the enumeration to match the bit order in the FPA11.
96*/
97
98extern signed char float_exception_flags;
99enum {
100 float_flag_invalid = 1,
101 float_flag_divbyzero = 2,
102 float_flag_overflow = 4,
103 float_flag_underflow = 8,
104 float_flag_inexact = 16
105};
106
107/*
108-------------------------------------------------------------------------------
109Routine to raise any or all of the software IEC/IEEE floating-point
110exception flags.
111-------------------------------------------------------------------------------
112*/
113void float_raise( signed char );
114
115/*
116-------------------------------------------------------------------------------
117Software IEC/IEEE integer-to-floating-point conversion routines.
118-------------------------------------------------------------------------------
119*/
120float32 int32_to_float32( signed int );
121float64 int32_to_float64( signed int );
122#ifdef FLOATX80
123floatx80 int32_to_floatx80( signed int );
124#endif
125
126/*
127-------------------------------------------------------------------------------
128Software IEC/IEEE single-precision conversion routines.
129-------------------------------------------------------------------------------
130*/
131signed int float32_to_int32( float32 );
132signed int float32_to_int32_round_to_zero( float32 );
133float64 float32_to_float64( float32 );
134#ifdef FLOATX80
135floatx80 float32_to_floatx80( float32 );
136#endif
137
138/*
139-------------------------------------------------------------------------------
140Software IEC/IEEE single-precision operations.
141-------------------------------------------------------------------------------
142*/
143float32 float32_round_to_int( float32 );
144float32 float32_add( float32, float32 );
145float32 float32_sub( float32, float32 );
146float32 float32_mul( float32, float32 );
147float32 float32_div( float32, float32 );
148float32 float32_rem( float32, float32 );
149float32 float32_sqrt( float32 );
150char float32_eq( float32, float32 );
151char float32_le( float32, float32 );
152char float32_lt( float32, float32 );
153char float32_eq_signaling( float32, float32 );
154char float32_le_quiet( float32, float32 );
155char float32_lt_quiet( float32, float32 );
156char float32_is_signaling_nan( float32 );
157
158/*
159-------------------------------------------------------------------------------
160Software IEC/IEEE double-precision conversion routines.
161-------------------------------------------------------------------------------
162*/
163signed int float64_to_int32( float64 );
164signed int float64_to_int32_round_to_zero( float64 );
165float32 float64_to_float32( float64 );
166#ifdef FLOATX80
167floatx80 float64_to_floatx80( float64 );
168#endif
169
170/*
171-------------------------------------------------------------------------------
172Software IEC/IEEE double-precision operations.
173-------------------------------------------------------------------------------
174*/
175float64 float64_round_to_int( float64 );
176float64 float64_add( float64, float64 );
177float64 float64_sub( float64, float64 );
178float64 float64_mul( float64, float64 );
179float64 float64_div( float64, float64 );
180float64 float64_rem( float64, float64 );
181float64 float64_sqrt( float64 );
182char float64_eq( float64, float64 );
183char float64_le( float64, float64 );
184char float64_lt( float64, float64 );
185char float64_eq_signaling( float64, float64 );
186char float64_le_quiet( float64, float64 );
187char float64_lt_quiet( float64, float64 );
188char float64_is_signaling_nan( float64 );
189
190#ifdef FLOATX80
191
192/*
193-------------------------------------------------------------------------------
194Software IEC/IEEE extended double-precision conversion routines.
195-------------------------------------------------------------------------------
196*/
197signed int floatx80_to_int32( floatx80 );
198signed int floatx80_to_int32_round_to_zero( floatx80 );
199float32 floatx80_to_float32( floatx80 );
200float64 floatx80_to_float64( floatx80 );
201
202/*
203-------------------------------------------------------------------------------
204Software IEC/IEEE extended double-precision rounding precision. Valid
205values are 32, 64, and 80.
206-------------------------------------------------------------------------------
207*/
208extern signed char floatx80_rounding_precision;
209
210/*
211-------------------------------------------------------------------------------
212Software IEC/IEEE extended double-precision operations.
213-------------------------------------------------------------------------------
214*/
215floatx80 floatx80_round_to_int( floatx80 );
216floatx80 floatx80_add( floatx80, floatx80 );
217floatx80 floatx80_sub( floatx80, floatx80 );
218floatx80 floatx80_mul( floatx80, floatx80 );
219floatx80 floatx80_div( floatx80, floatx80 );
220floatx80 floatx80_rem( floatx80, floatx80 );
221floatx80 floatx80_sqrt( floatx80 );
222char floatx80_eq( floatx80, floatx80 );
223char floatx80_le( floatx80, floatx80 );
224char floatx80_lt( floatx80, floatx80 );
225char floatx80_eq_signaling( floatx80, floatx80 );
226char floatx80_le_quiet( floatx80, floatx80 );
227char floatx80_lt_quiet( floatx80, floatx80 );
228char floatx80_is_signaling_nan( floatx80 );
229
230#endif
231
232#endif
diff --git a/arch/frv/mb93090-mb00/pci-vdk.c b/arch/frv/mb93090-mb00/pci-vdk.c
index 0b581e3cf7c7..6d51f133fb23 100644
--- a/arch/frv/mb93090-mb00/pci-vdk.c
+++ b/arch/frv/mb93090-mb00/pci-vdk.c
@@ -400,7 +400,8 @@ int __init pcibios_init(void)
400 __reg_MB86943_pci_sl_mem_base = __region_CS2 + 0x08000000; 400 __reg_MB86943_pci_sl_mem_base = __region_CS2 + 0x08000000;
401 mb(); 401 mb();
402 402
403 *(volatile unsigned long *)(__region_CS2+0x01300014) == 1; 403 /* enable PCI arbitration */
404 __reg_MB86943_pci_arbiter = MB86943_PCIARB_EN;
404 405
405 ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00; 406 ioport_resource.start = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00;
406 ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff; 407 ioport_resource.end = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff;
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig
index 5c8a845a4129..f9524933258a 100644
--- a/arch/i386/Kconfig
+++ b/arch/i386/Kconfig
@@ -458,8 +458,7 @@ config MICROCODE
458 tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support" 458 tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
459 select FW_LOADER 459 select FW_LOADER
460 ---help--- 460 ---help---
461 If you say Y here and also to "/dev file system support" in the 461 If you say Y here, you will be able to update the microcode on
462 'File systems' section, you will be able to update the microcode on
463 Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II, 462 Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II,
464 Pentium III, Pentium 4, Xeon etc. You will obviously need the 463 Pentium III, Pentium 4, Xeon etc. You will obviously need the
465 actual microcode binary data itself which is not shipped with the 464 actual microcode binary data itself which is not shipped with the
diff --git a/arch/i386/boot/code16gcc.h b/arch/i386/boot/code16gcc.h
index 3bd848093b9d..d93e48010b61 100644
--- a/arch/i386/boot/code16gcc.h
+++ b/arch/i386/boot/code16gcc.h
@@ -2,7 +2,7 @@
2 * code16gcc.h 2 * code16gcc.h
3 * 3 *
4 * This file is -include'd when compiling 16-bit C code. 4 * This file is -include'd when compiling 16-bit C code.
5 * Note: this asm() needs to be emitted before gcc omits any code. 5 * Note: this asm() needs to be emitted before gcc emits any code.
6 * Depending on gcc version, this requires -fno-unit-at-a-time or 6 * Depending on gcc version, this requires -fno-unit-at-a-time or
7 * -fno-toplevel-reorder. 7 * -fno-toplevel-reorder.
8 * 8 *
diff --git a/arch/i386/boot/edd.c b/arch/i386/boot/edd.c
index 25a282494f4c..77d92daf7923 100644
--- a/arch/i386/boot/edd.c
+++ b/arch/i386/boot/edd.c
@@ -72,17 +72,18 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
72 u32 mbrsig; 72 u32 mbrsig;
73 u32 buf_base, mbr_base; 73 u32 buf_base, mbr_base;
74 extern char _end[]; 74 extern char _end[];
75 static char mbr_buf[1024];
76 75
77 sector_size = ei->params.bytes_per_sector; 76 sector_size = ei->params.bytes_per_sector;
78 if (!sector_size) 77 if (!sector_size)
79 sector_size = 512; /* Best available guess */ 78 sector_size = 512; /* Best available guess */
80 79
80 /* Produce a naturally aligned buffer on the heap */
81 buf_base = (ds() << 4) + (u32)&_end; 81 buf_base = (ds() << 4) + (u32)&_end;
82 mbr_base = (buf_base+sector_size-1) & ~(sector_size-1); 82 mbr_base = (buf_base+sector_size-1) & ~(sector_size-1);
83 mbrbuf_ptr = mbr_buf + (mbr_base-buf_base); 83 mbrbuf_ptr = _end + (mbr_base-buf_base);
84 mbrbuf_end = mbrbuf_ptr + sector_size; 84 mbrbuf_end = mbrbuf_ptr + sector_size;
85 85
86 /* Make sure we actually have space on the heap... */
86 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP)) 87 if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
87 return 0; 88 return 0;
88 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr) 89 if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
diff --git a/arch/i386/boot/header.S b/arch/i386/boot/header.S
index 6b9923fb6eae..7f4a2c53bd76 100644
--- a/arch/i386/boot/header.S
+++ b/arch/i386/boot/header.S
@@ -225,7 +225,7 @@ start_of_setup:
225 int $0x13 225 int $0x13
226#endif 226#endif
227 227
228# We will have entired with %cs = %ds+0x20, normalize %cs so 228# We will have entered with %cs = %ds+0x20, normalize %cs so
229# it is on par with the other segments. 229# it is on par with the other segments.
230 pushw %ds 230 pushw %ds
231 pushw $setup2 231 pushw $setup2
@@ -280,4 +280,4 @@ die:
280 .section ".initdata", "a" 280 .section ".initdata", "a"
281setup_corrupt: 281setup_corrupt:
282 .byte 7 282 .byte 7
283 .string "No setup signature found..." 283 .string "No setup signature found...\n"
diff --git a/arch/i386/boot/install.sh b/arch/i386/boot/install.sh
index 5e44c736eea8..88d77761d01b 100644
--- a/arch/i386/boot/install.sh
+++ b/arch/i386/boot/install.sh
@@ -51,4 +51,11 @@ fi
51cat $2 > $4/vmlinuz 51cat $2 > $4/vmlinuz
52cp $3 $4/System.map 52cp $3 $4/System.map
53 53
54if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi 54if [ -x /sbin/lilo ]; then
55 /sbin/lilo
56elif [ -x /etc/lilo/install ]; then
57 /etc/lilo/install
58else
59 sync
60 echo "Cannot find LILO."
61fi
diff --git a/arch/i386/boot/pm.c b/arch/i386/boot/pm.c
index 1df025c73261..6be9ca811d17 100644
--- a/arch/i386/boot/pm.c
+++ b/arch/i386/boot/pm.c
@@ -80,7 +80,7 @@ static void move_kernel_around(void)
80 */ 80 */
81static void mask_all_interrupts(void) 81static void mask_all_interrupts(void)
82{ 82{
83 outb(0xff, 0xa1); /* Mask all interrupts on the seconday PIC */ 83 outb(0xff, 0xa1); /* Mask all interrupts on the secondary PIC */
84 io_delay(); 84 io_delay();
85 outb(0xfb, 0x21); /* Mask all but cascade on the primary PIC */ 85 outb(0xfb, 0x21); /* Mask all but cascade on the primary PIC */
86 io_delay(); 86 io_delay();
diff --git a/arch/i386/boot/video-bios.c b/arch/i386/boot/video-bios.c
index afea46c500cc..68e65d95cdfd 100644
--- a/arch/i386/boot/video-bios.c
+++ b/arch/i386/boot/video-bios.c
@@ -44,7 +44,7 @@ static int set_bios_mode(u8 mode)
44 : "+a" (ax) 44 : "+a" (ax)
45 : : "ebx", "ecx", "edx", "esi", "edi"); 45 : : "ebx", "ecx", "edx", "esi", "edi");
46 46
47 do_restore = 1; /* Assume video contents was lost */ 47 do_restore = 1; /* Assume video contents were lost */
48 new_mode = ax & 0x7f; /* Not all BIOSes are clean with the top bit */ 48 new_mode = ax & 0x7f; /* Not all BIOSes are clean with the top bit */
49 49
50 if (new_mode == mode) 50 if (new_mode == mode)
diff --git a/arch/i386/kernel/Makefile b/arch/i386/kernel/Makefile
index dbe5e87e0d66..9d33b00de659 100644
--- a/arch/i386/kernel/Makefile
+++ b/arch/i386/kernel/Makefile
@@ -35,7 +35,6 @@ obj-y += sysenter.o vsyscall.o
35obj-$(CONFIG_ACPI_SRAT) += srat.o 35obj-$(CONFIG_ACPI_SRAT) += srat.o
36obj-$(CONFIG_EFI) += efi.o efi_stub.o 36obj-$(CONFIG_EFI) += efi.o efi_stub.o
37obj-$(CONFIG_DOUBLEFAULT) += doublefault.o 37obj-$(CONFIG_DOUBLEFAULT) += doublefault.o
38obj-$(CONFIG_SERIAL_8250) += legacy_serial.o
39obj-$(CONFIG_VM86) += vm86.o 38obj-$(CONFIG_VM86) += vm86.o
40obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 39obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
41obj-$(CONFIG_HPET_TIMER) += hpet.o 40obj-$(CONFIG_HPET_TIMER) += hpet.o
diff --git a/arch/i386/kernel/apm.c b/arch/i386/kernel/apm.c
index 47001d50a083..f02a8aca826b 100644
--- a/arch/i386/kernel/apm.c
+++ b/arch/i386/kernel/apm.c
@@ -2235,7 +2235,7 @@ static int __init apm_init(void)
2235 apm_info.bios.cseg_16_len = 0; /* 64k */ 2235 apm_info.bios.cseg_16_len = 0; /* 64k */
2236 2236
2237 if (debug) { 2237 if (debug) {
2238 printk(KERN_INFO "apm: entry %x:%lx cseg16 %x dseg %x", 2238 printk(KERN_INFO "apm: entry %x:%x cseg16 %x dseg %x",
2239 apm_info.bios.cseg, apm_info.bios.offset, 2239 apm_info.bios.cseg, apm_info.bios.offset,
2240 apm_info.bios.cseg_16, apm_info.bios.dseg); 2240 apm_info.bios.cseg_16, apm_info.bios.dseg);
2241 if (apm_info.bios.version > 0x100) 2241 if (apm_info.bios.version > 0x100)
diff --git a/arch/i386/kernel/cpu/bugs.c b/arch/i386/kernel/cpu/bugs.c
index 54428a2500f3..59266f03d1cd 100644
--- a/arch/i386/kernel/cpu/bugs.c
+++ b/arch/i386/kernel/cpu/bugs.c
@@ -11,6 +11,7 @@
11 */ 11 */
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/utsname.h> 13#include <linux/utsname.h>
14#include <asm/bugs.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
15#include <asm/i387.h> 16#include <asm/i387.h>
16#include <asm/msr.h> 17#include <asm/msr.h>
diff --git a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
index 6f846bee2103..32d04b083e38 100644
--- a/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -511,7 +511,6 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
511static int acpi_cpufreq_early_init(void) 511static int acpi_cpufreq_early_init(void)
512{ 512{
513 struct acpi_processor_performance *data; 513 struct acpi_processor_performance *data;
514 cpumask_t covered;
515 unsigned int i, j; 514 unsigned int i, j;
516 515
517 dprintk("acpi_cpufreq_early_init\n"); 516 dprintk("acpi_cpufreq_early_init\n");
@@ -520,14 +519,13 @@ static int acpi_cpufreq_early_init(void)
520 data = kzalloc(sizeof(struct acpi_processor_performance), 519 data = kzalloc(sizeof(struct acpi_processor_performance),
521 GFP_KERNEL); 520 GFP_KERNEL);
522 if (!data) { 521 if (!data) {
523 for_each_cpu_mask(j, covered) { 522 for_each_possible_cpu(j) {
524 kfree(acpi_perf_data[j]); 523 kfree(acpi_perf_data[j]);
525 acpi_perf_data[j] = NULL; 524 acpi_perf_data[j] = NULL;
526 } 525 }
527 return -ENOMEM; 526 return -ENOMEM;
528 } 527 }
529 acpi_perf_data[i] = data; 528 acpi_perf_data[i] = data;
530 cpu_set(i, covered);
531 } 529 }
532 530
533 /* Do initialization in ACPI core */ 531 /* Do initialization in ACPI core */
diff --git a/arch/i386/kernel/legacy_serial.c b/arch/i386/kernel/legacy_serial.c
deleted file mode 100644
index 21510118544e..000000000000
--- a/arch/i386/kernel/legacy_serial.c
+++ /dev/null
@@ -1,67 +0,0 @@
1/*
2 * Legacy COM port devices for x86 platforms without PNPBIOS or ACPI.
3 * Data taken from include/asm-i386/serial.h.
4 *
5 * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
6 * Bjorn Helgaas <bjorn.helgaas@hp.com>
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#include <linux/module.h>
13#include <linux/init.h>
14#include <linux/pnp.h>
15#include <linux/serial_8250.h>
16
17/* Standard COM flags (except for COM4, because of the 8514 problem) */
18#ifdef CONFIG_SERIAL_DETECT_IRQ
19#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ)
20#define COM4_FLAGS (UPF_BOOT_AUTOCONF | UPF_AUTO_IRQ)
21#else
22#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
23#define COM4_FLAGS UPF_BOOT_AUTOCONF
24#endif
25
26#define PORT(_base,_irq,_flags) \
27 { \
28 .iobase = _base, \
29 .irq = _irq, \
30 .uartclk = 1843200, \
31 .iotype = UPIO_PORT, \
32 .flags = _flags, \
33 }
34
35static struct plat_serial8250_port x86_com_data[] = {
36 PORT(0x3F8, 4, COM_FLAGS),
37 PORT(0x2F8, 3, COM_FLAGS),
38 PORT(0x3E8, 4, COM_FLAGS),
39 PORT(0x2E8, 3, COM4_FLAGS),
40 { },
41};
42
43static struct platform_device x86_com_device = {
44 .name = "serial8250",
45 .id = PLAT8250_DEV_PLATFORM,
46 .dev = {
47 .platform_data = x86_com_data,
48 },
49};
50
51static int force_legacy_probe;
52module_param_named(force, force_legacy_probe, bool, 0);
53MODULE_PARM_DESC(force, "Force legacy serial port probe");
54
55static int __init serial8250_x86_com_init(void)
56{
57 if (pnp_platform_devices && !force_legacy_probe)
58 return -ENODEV;
59
60 return platform_device_register(&x86_com_device);
61}
62
63module_init(serial8250_x86_com_init);
64
65MODULE_AUTHOR("Bjorn Helgaas");
66MODULE_LICENSE("GPL");
67MODULE_DESCRIPTION("Generic 8250/16x50 legacy probe module");
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index b7133cabdbea..14b8e5a6222b 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -591,13 +591,13 @@ pfm_set_task_notify(struct task_struct *task)
591 struct thread_info *info; 591 struct thread_info *info;
592 592
593 info = (struct thread_info *) ((char *) task + IA64_TASK_SIZE); 593 info = (struct thread_info *) ((char *) task + IA64_TASK_SIZE);
594 set_bit(TIF_NOTIFY_RESUME, &info->flags); 594 set_bit(TIF_PERFMON_WORK, &info->flags);
595} 595}
596 596
597static inline void 597static inline void
598pfm_clear_task_notify(void) 598pfm_clear_task_notify(void)
599{ 599{
600 clear_thread_flag(TIF_NOTIFY_RESUME); 600 clear_thread_flag(TIF_PERFMON_WORK);
601} 601}
602 602
603static inline void 603static inline void
diff --git a/arch/m68knommu/platform/5206e/config.c b/arch/m68knommu/platform/5206e/config.c
index 4ab614f1ecda..425703fb6cee 100644
--- a/arch/m68knommu/platform/5206e/config.c
+++ b/arch/m68knommu/platform/5206e/config.c
@@ -20,7 +20,6 @@
20#include <asm/mcftimer.h> 20#include <asm/mcftimer.h>
21#include <asm/mcfsim.h> 21#include <asm/mcfsim.h>
22#include <asm/mcfdma.h> 22#include <asm/mcfdma.h>
23#include <asm/irq.h>
24 23
25/***************************************************************************/ 24/***************************************************************************/
26 25
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 1e3aeccd7322..3b404b7dfa39 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -15,29 +15,6 @@ choice
15 prompt "System type" 15 prompt "System type"
16 default SGI_IP22 16 default SGI_IP22
17 17
18config LEMOTE_FULONG
19 bool "Lemote Fulong mini-PC"
20 select ARCH_SPARSEMEM_ENABLE
21 select SYS_HAS_CPU_LOONGSON2
22 select DMA_NONCOHERENT
23 select BOOT_ELF32
24 select BOARD_SCACHE
25 select HAVE_STD_PC_SERIAL_PORT
26 select HW_HAS_PCI
27 select I8259
28 select ISA
29 select IRQ_CPU
30 select SYS_SUPPORTS_32BIT_KERNEL
31 select SYS_SUPPORTS_64BIT_KERNEL
32 select SYS_SUPPORTS_LITTLE_ENDIAN
33 select SYS_SUPPORTS_HIGHMEM
34 select SYS_HAS_EARLY_PRINTK
35 select GENERIC_HARDIRQS_NO__DO_IRQ
36 select CPU_HAS_WB
37 help
38 Lemote Fulong mini-PC board based on the Chinese Loongson-2E CPU and
39 an FPGA northbridge
40
41config MACH_ALCHEMY 18config MACH_ALCHEMY
42 bool "Alchemy processor based machines" 19 bool "Alchemy processor based machines"
43 20
@@ -131,6 +108,29 @@ config MACH_JAZZ
131 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and 108 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
132 Olivetti M700-10 workstations. 109 Olivetti M700-10 workstations.
133 110
111config LEMOTE_FULONG
112 bool "Lemote Fulong mini-PC"
113 select ARCH_SPARSEMEM_ENABLE
114 select SYS_HAS_CPU_LOONGSON2
115 select DMA_NONCOHERENT
116 select BOOT_ELF32
117 select BOARD_SCACHE
118 select HAVE_STD_PC_SERIAL_PORT
119 select HW_HAS_PCI
120 select I8259
121 select ISA
122 select IRQ_CPU
123 select SYS_SUPPORTS_32BIT_KERNEL
124 select SYS_SUPPORTS_64BIT_KERNEL
125 select SYS_SUPPORTS_LITTLE_ENDIAN
126 select SYS_SUPPORTS_HIGHMEM
127 select SYS_HAS_EARLY_PRINTK
128 select GENERIC_HARDIRQS_NO__DO_IRQ
129 select CPU_HAS_WB
130 help
131 Lemote Fulong mini-PC board based on the Chinese Loongson-2E CPU and
132 an FPGA northbridge
133
134config MIPS_ATLAS 134config MIPS_ATLAS
135 bool "MIPS Atlas board" 135 bool "MIPS Atlas board"
136 select BOOT_ELF32 136 select BOOT_ELF32
@@ -210,27 +210,6 @@ config MIPS_SEAD
210 This enables support for the MIPS Technologies SEAD evaluation 210 This enables support for the MIPS Technologies SEAD evaluation
211 board. 211 board.
212 212
213config WR_PPMC
214 bool "Wind River PPMC board"
215 select IRQ_CPU
216 select BOOT_ELF32
217 select DMA_NONCOHERENT
218 select HW_HAS_PCI
219 select PCI_GT64XXX_PCI0
220 select SWAP_IO_SPACE
221 select SYS_HAS_CPU_MIPS32_R1
222 select SYS_HAS_CPU_MIPS32_R2
223 select SYS_HAS_CPU_MIPS64_R1
224 select SYS_HAS_CPU_NEVADA
225 select SYS_HAS_CPU_RM7000
226 select SYS_SUPPORTS_32BIT_KERNEL
227 select SYS_SUPPORTS_64BIT_KERNEL
228 select SYS_SUPPORTS_BIG_ENDIAN
229 select SYS_SUPPORTS_LITTLE_ENDIAN
230 help
231 This enables support for the Wind River MIPS32 4KC PPMC evaluation
232 board, which is based on GT64120 bridge chip.
233
234config MIPS_SIM 213config MIPS_SIM
235 bool 'MIPS simulator (MIPSsim)' 214 bool 'MIPS simulator (MIPSsim)'
236 select DMA_NONCOHERENT 215 select DMA_NONCOHERENT
@@ -248,23 +227,24 @@ config MIPS_SIM
248 This option enables support for MIPS Technologies MIPSsim software 227 This option enables support for MIPS Technologies MIPSsim software
249 emulator. 228 emulator.
250 229
251config MOMENCO_OCELOT 230config MARKEINS
252 bool "Momentum Ocelot board" 231 bool "NEC EMMA2RH Mark-eins"
253 select DMA_NONCOHERENT 232 select DMA_NONCOHERENT
254 select HW_HAS_PCI 233 select HW_HAS_PCI
255 select IRQ_CPU 234 select IRQ_CPU
256 select IRQ_CPU_RM7K
257 select PCI_GT64XXX_PCI0
258 select RM7000_CPU_SCACHE
259 select SWAP_IO_SPACE 235 select SWAP_IO_SPACE
260 select SYS_HAS_CPU_RM7000
261 select SYS_SUPPORTS_32BIT_KERNEL 236 select SYS_SUPPORTS_32BIT_KERNEL
262 select SYS_SUPPORTS_64BIT_KERNEL
263 select SYS_SUPPORTS_BIG_ENDIAN 237 select SYS_SUPPORTS_BIG_ENDIAN
264 select SYS_SUPPORTS_KGDB 238 select SYS_SUPPORTS_LITTLE_ENDIAN
239 select SYS_HAS_CPU_R5000
265 help 240 help
266 The Ocelot is a MIPS-based Single Board Computer (SBC) made by 241 This enables support for the R5432-based NEC Mark-eins
267 Momentum Computer <http://www.momenco.com/>. 242 boards with R5500 CPU.
243
244config MACH_VR41XX
245 bool "NEC VR4100 series based machines"
246 select SYS_HAS_CPU_VR41XX
247 select GENERIC_HARDIRQS_NO__DO_IRQ
268 248
269config PNX8550_JBS 249config PNX8550_JBS
270 bool "Philips PNX8550 based JBS board" 250 bool "Philips PNX8550 based JBS board"
@@ -276,31 +256,6 @@ config PNX8550_STB810
276 select PNX8550 256 select PNX8550
277 select SYS_SUPPORTS_LITTLE_ENDIAN 257 select SYS_SUPPORTS_LITTLE_ENDIAN
278 258
279config DDB5477
280 bool "NEC DDB Vrc-5477"
281 select DDB5XXX_COMMON
282 select DMA_NONCOHERENT
283 select HW_HAS_PCI
284 select I8259
285 select IRQ_CPU
286 select SYS_HAS_CPU_R5432
287 select SYS_SUPPORTS_32BIT_KERNEL
288 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
289 select SYS_SUPPORTS_KGDB
290 select SYS_SUPPORTS_KGDB
291 select SYS_SUPPORTS_LITTLE_ENDIAN
292 help
293 This enables support for the R5432-based NEC DDB Vrc-5477,
294 or Rockhopper/SolutionGear boards with R5432/R5500 CPUs.
295
296 Features : kernel debugging, serial terminal, NFS root fs, on-board
297 ether port USB, AC97, PCI, etc.
298
299config MACH_VR41XX
300 bool "NEC VR4100 series based machines"
301 select SYS_HAS_CPU_VR41XX
302 select GENERIC_HARDIRQS_NO__DO_IRQ
303
304config PMC_MSP 259config PMC_MSP
305 bool "PMC-Sierra MSP chipsets" 260 bool "PMC-Sierra MSP chipsets"
306 depends on EXPERIMENTAL 261 depends on EXPERIMENTAL
@@ -367,20 +322,6 @@ config QEMU
367 simulate actual MIPS hardware platforms. More information on Qemu 322 simulate actual MIPS hardware platforms. More information on Qemu
368 can be found at http://www.linux-mips.org/wiki/Qemu. 323 can be found at http://www.linux-mips.org/wiki/Qemu.
369 324
370config MARKEINS
371 bool "NEC EMMA2RH Mark-eins"
372 select DMA_NONCOHERENT
373 select HW_HAS_PCI
374 select IRQ_CPU
375 select SWAP_IO_SPACE
376 select SYS_SUPPORTS_32BIT_KERNEL
377 select SYS_SUPPORTS_BIG_ENDIAN
378 select SYS_SUPPORTS_LITTLE_ENDIAN
379 select SYS_HAS_CPU_R5000
380 help
381 This enables support for the R5432-based NEC Mark-eins
382 boards with R5500 CPU.
383
384config SGI_IP22 325config SGI_IP22
385 bool "SGI IP22 (Indy/Indigo2)" 326 bool "SGI IP22 (Indy/Indigo2)"
386 select ARC 327 select ARC
@@ -443,41 +384,38 @@ config SGI_IP32
443 help 384 help
444 If you want this kernel to run on SGI O2 workstation, say Y here. 385 If you want this kernel to run on SGI O2 workstation, say Y here.
445 386
446config SIBYTE_BIGSUR 387config SIBYTE_CRHINE
447 bool "Sibyte BCM91480B-BigSur" 388 bool "Sibyte BCM91120C-CRhine"
389 depends on EXPERIMENTAL
448 select BOOT_ELF32 390 select BOOT_ELF32
449 select DMA_COHERENT 391 select DMA_COHERENT
450 select NR_CPUS_DEFAULT_4 392 select SIBYTE_BCM1120
451 select PCI_DOMAINS
452 select SIBYTE_BCM1x80
453 select SWAP_IO_SPACE 393 select SWAP_IO_SPACE
454 select SYS_HAS_CPU_SB1 394 select SYS_HAS_CPU_SB1
455 select SYS_SUPPORTS_BIG_ENDIAN 395 select SYS_SUPPORTS_BIG_ENDIAN
456 select SYS_SUPPORTS_LITTLE_ENDIAN 396 select SYS_SUPPORTS_LITTLE_ENDIAN
457 397
458config SIBYTE_SWARM 398config SIBYTE_CARMEL
459 bool "Sibyte BCM91250A-SWARM" 399 bool "Sibyte BCM91120x-Carmel"
400 depends on EXPERIMENTAL
460 select BOOT_ELF32 401 select BOOT_ELF32
461 select DMA_COHERENT 402 select DMA_COHERENT
462 select NR_CPUS_DEFAULT_2 403 select SIBYTE_BCM1120
463 select SIBYTE_SB1250
464 select SWAP_IO_SPACE 404 select SWAP_IO_SPACE
465 select SYS_HAS_CPU_SB1 405 select SYS_HAS_CPU_SB1
466 select SYS_SUPPORTS_BIG_ENDIAN 406 select SYS_SUPPORTS_BIG_ENDIAN
467 select SYS_SUPPORTS_HIGHMEM
468 select SYS_SUPPORTS_KGDB
469 select SYS_SUPPORTS_LITTLE_ENDIAN 407 select SYS_SUPPORTS_LITTLE_ENDIAN
470 408
471config SIBYTE_SENTOSA 409config SIBYTE_CRHONE
472 bool "Sibyte BCM91250E-Sentosa" 410 bool "Sibyte BCM91125C-CRhone"
473 depends on EXPERIMENTAL 411 depends on EXPERIMENTAL
474 select BOOT_ELF32 412 select BOOT_ELF32
475 select DMA_COHERENT 413 select DMA_COHERENT
476 select NR_CPUS_DEFAULT_2 414 select SIBYTE_BCM1125
477 select SIBYTE_SB1250
478 select SWAP_IO_SPACE 415 select SWAP_IO_SPACE
479 select SYS_HAS_CPU_SB1 416 select SYS_HAS_CPU_SB1
480 select SYS_SUPPORTS_BIG_ENDIAN 417 select SYS_SUPPORTS_BIG_ENDIAN
418 select SYS_SUPPORTS_HIGHMEM
481 select SYS_SUPPORTS_LITTLE_ENDIAN 419 select SYS_SUPPORTS_LITTLE_ENDIAN
482 420
483config SIBYTE_RHONE 421config SIBYTE_RHONE
@@ -491,19 +429,21 @@ config SIBYTE_RHONE
491 select SYS_SUPPORTS_BIG_ENDIAN 429 select SYS_SUPPORTS_BIG_ENDIAN
492 select SYS_SUPPORTS_LITTLE_ENDIAN 430 select SYS_SUPPORTS_LITTLE_ENDIAN
493 431
494config SIBYTE_CARMEL 432config SIBYTE_SWARM
495 bool "Sibyte BCM91120x-Carmel" 433 bool "Sibyte BCM91250A-SWARM"
496 depends on EXPERIMENTAL
497 select BOOT_ELF32 434 select BOOT_ELF32
498 select DMA_COHERENT 435 select DMA_COHERENT
499 select SIBYTE_BCM1120 436 select NR_CPUS_DEFAULT_2
437 select SIBYTE_SB1250
500 select SWAP_IO_SPACE 438 select SWAP_IO_SPACE
501 select SYS_HAS_CPU_SB1 439 select SYS_HAS_CPU_SB1
502 select SYS_SUPPORTS_BIG_ENDIAN 440 select SYS_SUPPORTS_BIG_ENDIAN
441 select SYS_SUPPORTS_HIGHMEM
442 select SYS_SUPPORTS_KGDB
503 select SYS_SUPPORTS_LITTLE_ENDIAN 443 select SYS_SUPPORTS_LITTLE_ENDIAN
504 444
505config SIBYTE_PTSWARM 445config SIBYTE_LITTLESUR
506 bool "Sibyte BCM91250PT-PTSWARM" 446 bool "Sibyte BCM91250C2-LittleSur"
507 depends on EXPERIMENTAL 447 depends on EXPERIMENTAL
508 select BOOT_ELF32 448 select BOOT_ELF32
509 select DMA_COHERENT 449 select DMA_COHERENT
@@ -515,8 +455,8 @@ config SIBYTE_PTSWARM
515 select SYS_SUPPORTS_HIGHMEM 455 select SYS_SUPPORTS_HIGHMEM
516 select SYS_SUPPORTS_LITTLE_ENDIAN 456 select SYS_SUPPORTS_LITTLE_ENDIAN
517 457
518config SIBYTE_LITTLESUR 458config SIBYTE_SENTOSA
519 bool "Sibyte BCM91250C2-LittleSur" 459 bool "Sibyte BCM91250E-Sentosa"
520 depends on EXPERIMENTAL 460 depends on EXPERIMENTAL
521 select BOOT_ELF32 461 select BOOT_ELF32
522 select DMA_COHERENT 462 select DMA_COHERENT
@@ -525,30 +465,31 @@ config SIBYTE_LITTLESUR
525 select SWAP_IO_SPACE 465 select SWAP_IO_SPACE
526 select SYS_HAS_CPU_SB1 466 select SYS_HAS_CPU_SB1
527 select SYS_SUPPORTS_BIG_ENDIAN 467 select SYS_SUPPORTS_BIG_ENDIAN
528 select SYS_SUPPORTS_HIGHMEM
529 select SYS_SUPPORTS_LITTLE_ENDIAN 468 select SYS_SUPPORTS_LITTLE_ENDIAN
530 469
531config SIBYTE_CRHINE 470config SIBYTE_PTSWARM
532 bool "Sibyte BCM91120C-CRhine" 471 bool "Sibyte BCM91250PT-PTSWARM"
533 depends on EXPERIMENTAL 472 depends on EXPERIMENTAL
534 select BOOT_ELF32 473 select BOOT_ELF32
535 select DMA_COHERENT 474 select DMA_COHERENT
536 select SIBYTE_BCM1120 475 select NR_CPUS_DEFAULT_2
476 select SIBYTE_SB1250
537 select SWAP_IO_SPACE 477 select SWAP_IO_SPACE
538 select SYS_HAS_CPU_SB1 478 select SYS_HAS_CPU_SB1
539 select SYS_SUPPORTS_BIG_ENDIAN 479 select SYS_SUPPORTS_BIG_ENDIAN
480 select SYS_SUPPORTS_HIGHMEM
540 select SYS_SUPPORTS_LITTLE_ENDIAN 481 select SYS_SUPPORTS_LITTLE_ENDIAN
541 482
542config SIBYTE_CRHONE 483config SIBYTE_BIGSUR
543 bool "Sibyte BCM91125C-CRhone" 484 bool "Sibyte BCM91480B-BigSur"
544 depends on EXPERIMENTAL
545 select BOOT_ELF32 485 select BOOT_ELF32
546 select DMA_COHERENT 486 select DMA_COHERENT
547 select SIBYTE_BCM1125 487 select NR_CPUS_DEFAULT_4
488 select PCI_DOMAINS
489 select SIBYTE_BCM1x80
548 select SWAP_IO_SPACE 490 select SWAP_IO_SPACE
549 select SYS_HAS_CPU_SB1 491 select SYS_HAS_CPU_SB1
550 select SYS_SUPPORTS_BIG_ENDIAN 492 select SYS_SUPPORTS_BIG_ENDIAN
551 select SYS_SUPPORTS_HIGHMEM
552 select SYS_SUPPORTS_LITTLE_ENDIAN 493 select SYS_SUPPORTS_LITTLE_ENDIAN
553 494
554config SNI_RM 495config SNI_RM
@@ -595,7 +536,7 @@ config TOSHIBA_JMR3927
595 select GENERIC_HARDIRQS_NO__DO_IRQ 536 select GENERIC_HARDIRQS_NO__DO_IRQ
596 537
597config TOSHIBA_RBTX4927 538config TOSHIBA_RBTX4927
598 bool "Toshiba TBTX49[23]7 board" 539 bool "Toshiba RBTX49[23]7 board"
599 select DMA_NONCOHERENT 540 select DMA_NONCOHERENT
600 select HAS_TXX9_SERIAL 541 select HAS_TXX9_SERIAL
601 select HW_HAS_PCI 542 select HW_HAS_PCI
@@ -632,10 +573,30 @@ config TOSHIBA_RBTX4938
632 This Toshiba board is based on the TX4938 processor. Say Y here to 573 This Toshiba board is based on the TX4938 processor. Say Y here to
633 support this machine type 574 support this machine type
634 575
576config WR_PPMC
577 bool "Wind River PPMC board"
578 select IRQ_CPU
579 select BOOT_ELF32
580 select DMA_NONCOHERENT
581 select HW_HAS_PCI
582 select PCI_GT64XXX_PCI0
583 select SWAP_IO_SPACE
584 select SYS_HAS_CPU_MIPS32_R1
585 select SYS_HAS_CPU_MIPS32_R2
586 select SYS_HAS_CPU_MIPS64_R1
587 select SYS_HAS_CPU_NEVADA
588 select SYS_HAS_CPU_RM7000
589 select SYS_SUPPORTS_32BIT_KERNEL
590 select SYS_SUPPORTS_64BIT_KERNEL
591 select SYS_SUPPORTS_BIG_ENDIAN
592 select SYS_SUPPORTS_LITTLE_ENDIAN
593 help
594 This enables support for the Wind River MIPS32 4KC PPMC evaluation
595 board, which is based on GT64120 bridge chip.
596
635endchoice 597endchoice
636 598
637source "arch/mips/au1000/Kconfig" 599source "arch/mips/au1000/Kconfig"
638source "arch/mips/ddb5xxx/Kconfig"
639source "arch/mips/jazz/Kconfig" 600source "arch/mips/jazz/Kconfig"
640source "arch/mips/pmc-sierra/Kconfig" 601source "arch/mips/pmc-sierra/Kconfig"
641source "arch/mips/sgi-ip27/Kconfig" 602source "arch/mips/sgi-ip27/Kconfig"
@@ -807,10 +768,6 @@ config IRQ_MSP_SLP
807config IRQ_MSP_CIC 768config IRQ_MSP_CIC
808 bool 769 bool
809 770
810config DDB5XXX_COMMON
811 bool
812 select SYS_SUPPORTS_KGDB
813
814config MIPS_BOARDS_GEN 771config MIPS_BOARDS_GEN
815 bool 772 bool
816 773
@@ -1377,17 +1334,6 @@ config MIPS_MT_SMTC
1377 This is a kernel model which is known a SMTC or lately has been 1334 This is a kernel model which is known a SMTC or lately has been
1378 marketesed into SMVP. 1335 marketesed into SMVP.
1379 1336
1380config MIPS_VPE_LOADER
1381 bool "VPE loader support."
1382 depends on SYS_SUPPORTS_MULTITHREADING
1383 select CPU_MIPSR2_IRQ_VI
1384 select CPU_MIPSR2_IRQ_EI
1385 select CPU_MIPSR2_SRS
1386 select MIPS_MT
1387 help
1388 Includes a loader for loading an elf relocatable object
1389 onto another VPE and running it.
1390
1391endchoice 1337endchoice
1392 1338
1393config MIPS_MT 1339config MIPS_MT
@@ -1398,8 +1344,19 @@ config SYS_SUPPORTS_MULTITHREADING
1398 1344
1399config MIPS_MT_FPAFF 1345config MIPS_MT_FPAFF
1400 bool "Dynamic FPU affinity for FP-intensive threads" 1346 bool "Dynamic FPU affinity for FP-intensive threads"
1401 depends on MIPS_MT
1402 default y 1347 default y
1348 depends on MIPS_MT_SMP || MIPS_MT_SMTC
1349
1350config MIPS_VPE_LOADER
1351 bool "VPE loader support."
1352 depends on SYS_SUPPORTS_MULTITHREADING
1353 select CPU_MIPSR2_IRQ_VI
1354 select CPU_MIPSR2_IRQ_EI
1355 select CPU_MIPSR2_SRS
1356 select MIPS_MT
1357 help
1358 Includes a loader for loading an elf relocatable object
1359 onto another VPE and running it.
1403 1360
1404config MIPS_MT_SMTC_INSTANT_REPLAY 1361config MIPS_MT_SMTC_INSTANT_REPLAY
1405 bool "Low-latency Dispatch of Deferred SMTC IPIs" 1362 bool "Low-latency Dispatch of Deferred SMTC IPIs"
@@ -1772,7 +1729,7 @@ config KEXEC
1772 1729
1773config SECCOMP 1730config SECCOMP
1774 bool "Enable seccomp to safely compute untrusted bytecode" 1731 bool "Enable seccomp to safely compute untrusted bytecode"
1775 depends on PROC_FS && BROKEN 1732 depends on PROC_FS
1776 default y 1733 default y
1777 help 1734 help
1778 This kernel feature is useful for number crunching applications 1735 This kernel feature is useful for number crunching applications
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index a9a987a06daf..32c1c8fb6f98 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -67,6 +67,8 @@ cflags-y += $(call cc-option,-msym32)
67endif 67endif
68endif 68endif
69 69
70all-$(CONFIG_BOOT_ELF32) := $(vmlinux-32)
71all-$(CONFIG_BOOT_ELF64) := $(vmlinux-64)
70 72
71# 73#
72# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel 74# GCC uses -G 0 -mabicalls -fpic as default. We don't want PIC in the kernel
@@ -309,6 +311,7 @@ core-$(CONFIG_MIPS_ATLAS) += arch/mips/mips-boards/atlas/
309cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-atlas 311cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-atlas
310cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-mips 312cflags-$(CONFIG_MIPS_ATLAS) += -Iinclude/asm-mips/mach-mips
311load-$(CONFIG_MIPS_ATLAS) += 0xffffffff80100000 313load-$(CONFIG_MIPS_ATLAS) += 0xffffffff80100000
314all-$(CONFIG_MIPS_ATLAS) := vmlinux.srec
312 315
313# 316#
314# MIPS Malta board 317# MIPS Malta board
@@ -316,6 +319,7 @@ load-$(CONFIG_MIPS_ATLAS) += 0xffffffff80100000
316core-$(CONFIG_MIPS_MALTA) += arch/mips/mips-boards/malta/ 319core-$(CONFIG_MIPS_MALTA) += arch/mips/mips-boards/malta/
317cflags-$(CONFIG_MIPS_MALTA) += -Iinclude/asm-mips/mach-mips 320cflags-$(CONFIG_MIPS_MALTA) += -Iinclude/asm-mips/mach-mips
318load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000 321load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
322all-$(CONFIG_MIPS_MALTA) := vmlinux.srec
319 323
320# 324#
321# MIPS SEAD board 325# MIPS SEAD board
@@ -323,6 +327,7 @@ load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
323core-$(CONFIG_MIPS_SEAD) += arch/mips/mips-boards/sead/ 327core-$(CONFIG_MIPS_SEAD) += arch/mips/mips-boards/sead/
324cflags-$(CONFIG_MIPS_SEAD) += -Iinclude/asm-mips/mach-mips 328cflags-$(CONFIG_MIPS_SEAD) += -Iinclude/asm-mips/mach-mips
325load-$(CONFIG_MIPS_SEAD) += 0xffffffff80100000 329load-$(CONFIG_MIPS_SEAD) += 0xffffffff80100000
330all-$(CONFIG_MIPS_SEAD) := vmlinux.srec
326 331
327# 332#
328# MIPS SIM 333# MIPS SIM
@@ -332,17 +337,6 @@ cflags-$(CONFIG_MIPS_SIM) += -Iinclude/asm-mips/mach-mipssim
332load-$(CONFIG_MIPS_SIM) += 0x80100000 337load-$(CONFIG_MIPS_SIM) += 0x80100000
333 338
334# 339#
335# Momentum Ocelot board
336#
337# The Ocelot setup.o must be linked early - it does the ioremap() for the
338# mips_io_port_base.
339#
340core-$(CONFIG_MOMENCO_OCELOT) += arch/mips/gt64120/common/ \
341 arch/mips/gt64120/momenco_ocelot/
342cflags-$(CONFIG_MOMENCO_OCELOT) += -Iinclude/asm-mips/mach-ocelot
343load-$(CONFIG_MOMENCO_OCELOT) += 0xffffffff80100000
344
345#
346# PMC-Sierra MSP SOCs 340# PMC-Sierra MSP SOCs
347# 341#
348core-$(CONFIG_PMC_MSP) += arch/mips/pmc-sierra/msp71xx/ 342core-$(CONFIG_PMC_MSP) += arch/mips/pmc-sierra/msp71xx/
@@ -363,6 +357,7 @@ load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
363core-$(CONFIG_QEMU) += arch/mips/qemu/ 357core-$(CONFIG_QEMU) += arch/mips/qemu/
364cflags-$(CONFIG_QEMU) += -Iinclude/asm-mips/mach-qemu 358cflags-$(CONFIG_QEMU) += -Iinclude/asm-mips/mach-qemu
365load-$(CONFIG_QEMU) += 0xffffffff80010000 359load-$(CONFIG_QEMU) += 0xffffffff80010000
360all-$(CONFIG_QEMU) := vmlinux.bin
366 361
367# 362#
368# Basler eXcite 363# Basler eXcite
@@ -372,17 +367,6 @@ cflags-$(CONFIG_BASLER_EXCITE) += -Iinclude/asm-mips/mach-excite
372load-$(CONFIG_BASLER_EXCITE) += 0x80100000 367load-$(CONFIG_BASLER_EXCITE) += 0x80100000
373 368
374# 369#
375# NEC DDB
376#
377core-$(CONFIG_DDB5XXX_COMMON) += arch/mips/ddb5xxx/common/
378
379#
380# NEC DDB Vrc-5477
381#
382core-$(CONFIG_DDB5477) += arch/mips/ddb5xxx/ddb5477/
383load-$(CONFIG_DDB5477) += 0xffffffff80100000
384
385#
386# Common VR41xx 370# Common VR41xx
387# 371#
388core-$(CONFIG_MACH_VR41XX) += arch/mips/vr41xx/common/ 372core-$(CONFIG_MACH_VR41XX) += arch/mips/vr41xx/common/
@@ -554,6 +538,7 @@ load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000
554core-$(CONFIG_SNI_RM) += arch/mips/sni/ 538core-$(CONFIG_SNI_RM) += arch/mips/sni/
555cflags-$(CONFIG_SNI_RM) += -Iinclude/asm-mips/mach-rm 539cflags-$(CONFIG_SNI_RM) += -Iinclude/asm-mips/mach-rm
556load-$(CONFIG_SNI_RM) += 0xffffffff80600000 540load-$(CONFIG_SNI_RM) += 0xffffffff80600000
541all-$(CONFIG_SNI_RM) := vmlinux.ecoff
557 542
558# 543#
559# Toshiba JMR-TX3927 board 544# Toshiba JMR-TX3927 board
@@ -647,33 +632,7 @@ vmlinux.64: vmlinux
647 632
648makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1) 633makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
649 634
650ifdef CONFIG_BOOT_ELF32 635all: $(all-y)
651all: $(vmlinux-32)
652endif
653
654ifdef CONFIG_BOOT_ELF64
655all: $(vmlinux-64)
656endif
657
658ifdef CONFIG_MIPS_ATLAS
659all: vmlinux.srec
660endif
661
662ifdef CONFIG_MIPS_MALTA
663all: vmlinux.srec
664endif
665
666ifdef CONFIG_MIPS_SEAD
667all: vmlinux.srec
668endif
669
670ifdef CONFIG_QEMU
671all: vmlinux.bin
672endif
673
674ifdef CONFIG_SNI_RM
675all: vmlinux.ecoff
676endif
677 636
678vmlinux.bin: $(vmlinux-32) 637vmlinux.bin: $(vmlinux-32)
679 +@$(call makeboot,$@) 638 +@$(call makeboot,$@)
@@ -700,6 +659,14 @@ endif
700archclean: 659archclean:
701 @$(MAKE) $(clean)=arch/mips/boot 660 @$(MAKE) $(clean)=arch/mips/boot
702 661
662define archhelp
663 echo ' vmlinux.ecoff - ECOFF boot image'
664 echo ' vmlinux.bin - Raw binary boot image'
665 echo ' vmlinux.srec - SREC boot image'
666 echo
667 echo ' These will be default as apropriate for a configured platform.'
668endef
669
703CLEAN_FILES += vmlinux.32 \ 670CLEAN_FILES += vmlinux.32 \
704 vmlinux.64 \ 671 vmlinux.64 \
705 vmlinux.ecoff 672 vmlinux.ecoff
diff --git a/arch/mips/arc/file.c b/arch/mips/arc/file.c
index a43425b3c838..cb0127cf5bc1 100644
--- a/arch/mips/arc/file.c
+++ b/arch/mips/arc/file.c
@@ -13,63 +13,63 @@
13#include <asm/arc/types.h> 13#include <asm/arc/types.h>
14#include <asm/sgialib.h> 14#include <asm/sgialib.h>
15 15
16LONG __init 16LONG
17ArcGetDirectoryEntry(ULONG FileID, struct linux_vdirent *Buffer, 17ArcGetDirectoryEntry(ULONG FileID, struct linux_vdirent *Buffer,
18 ULONG N, ULONG *Count) 18 ULONG N, ULONG *Count)
19{ 19{
20 return ARC_CALL4(get_vdirent, FileID, Buffer, N, Count); 20 return ARC_CALL4(get_vdirent, FileID, Buffer, N, Count);
21} 21}
22 22
23LONG __init 23LONG
24ArcOpen(CHAR *Path, enum linux_omode OpenMode, ULONG *FileID) 24ArcOpen(CHAR *Path, enum linux_omode OpenMode, ULONG *FileID)
25{ 25{
26 return ARC_CALL3(open, Path, OpenMode, FileID); 26 return ARC_CALL3(open, Path, OpenMode, FileID);
27} 27}
28 28
29LONG __init 29LONG
30ArcClose(ULONG FileID) 30ArcClose(ULONG FileID)
31{ 31{
32 return ARC_CALL1(close, FileID); 32 return ARC_CALL1(close, FileID);
33} 33}
34 34
35LONG __init 35LONG
36ArcRead(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count) 36ArcRead(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count)
37{ 37{
38 return ARC_CALL4(read, FileID, Buffer, N, Count); 38 return ARC_CALL4(read, FileID, Buffer, N, Count);
39} 39}
40 40
41LONG __init 41LONG
42ArcGetReadStatus(ULONG FileID) 42ArcGetReadStatus(ULONG FileID)
43{ 43{
44 return ARC_CALL1(get_rstatus, FileID); 44 return ARC_CALL1(get_rstatus, FileID);
45} 45}
46 46
47LONG __init 47LONG
48ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count) 48ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count)
49{ 49{
50 return ARC_CALL4(write, FileID, Buffer, N, Count); 50 return ARC_CALL4(write, FileID, Buffer, N, Count);
51} 51}
52 52
53LONG __init 53LONG
54ArcSeek(ULONG FileID, struct linux_bigint *Position, enum linux_seekmode SeekMode) 54ArcSeek(ULONG FileID, struct linux_bigint *Position, enum linux_seekmode SeekMode)
55{ 55{
56 return ARC_CALL3(seek, FileID, Position, SeekMode); 56 return ARC_CALL3(seek, FileID, Position, SeekMode);
57} 57}
58 58
59LONG __init 59LONG
60ArcMount(char *name, enum linux_mountops op) 60ArcMount(char *name, enum linux_mountops op)
61{ 61{
62 return ARC_CALL2(mount, name, op); 62 return ARC_CALL2(mount, name, op);
63} 63}
64 64
65LONG __init 65LONG
66ArcGetFileInformation(ULONG FileID, struct linux_finfo *Information) 66ArcGetFileInformation(ULONG FileID, struct linux_finfo *Information)
67{ 67{
68 return ARC_CALL2(get_finfo, FileID, Information); 68 return ARC_CALL2(get_finfo, FileID, Information);
69} 69}
70 70
71LONG __init ArcSetFileInformation(ULONG FileID, ULONG AttributeFlags, 71LONG ArcSetFileInformation(ULONG FileID, ULONG AttributeFlags,
72 ULONG AttributeMask) 72 ULONG AttributeMask)
73{ 73{
74 return ARC_CALL3(set_finfo, FileID, AttributeFlags, AttributeMask); 74 return ARC_CALL3(set_finfo, FileID, AttributeFlags, AttributeMask);
75} 75}
diff --git a/arch/mips/au1000/common/Makefile b/arch/mips/au1000/common/Makefile
index 4c35525edb4f..90e2d7a46e8e 100644
--- a/arch/mips/au1000/common/Makefile
+++ b/arch/mips/au1000/common/Makefile
@@ -12,3 +12,5 @@ obj-y += prom.o irq.o puts.o time.o reset.o \
12 12
13obj-$(CONFIG_KGDB) += dbg_io.o 13obj-$(CONFIG_KGDB) += dbg_io.o
14obj-$(CONFIG_PCI) += pci.o 14obj-$(CONFIG_PCI) += pci.o
15
16EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index 0dc84417bf49..2a209d74f0b4 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -42,10 +42,6 @@ vmlinux.srec: $(VMLINUX)
42$(obj)/addinitrd: $(obj)/addinitrd.c 42$(obj)/addinitrd: $(obj)/addinitrd.c
43 $(HOSTCC) -o $@ $^ 43 $(HOSTCC) -o $@ $^
44 44
45archhelp:
46 @echo '* vmlinux.ecoff - ECOFF boot image'
47 @echo '* vmlinux.srec - SREC boot image'
48
49clean-files += addinitrd \ 45clean-files += addinitrd \
50 elf2ecoff \ 46 elf2ecoff \
51 vmlinux.bin \ 47 vmlinux.bin \
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
index c292f80a8c74..a043f93f7d08 100644
--- a/arch/mips/cobalt/Makefile
+++ b/arch/mips/cobalt/Makefile
@@ -7,3 +7,5 @@ obj-y := buttons.o irq.o reset.o rtc.o serial.o setup.o
7obj-$(CONFIG_PCI) += pci.o 7obj-$(CONFIG_PCI) += pci.o
8obj-$(CONFIG_EARLY_PRINTK) += console.o 8obj-$(CONFIG_EARLY_PRINTK) += console.o
9obj-$(CONFIG_MTD_PHYSMAP) += mtd.o 9obj-$(CONFIG_MTD_PHYSMAP) += mtd.o
10
11EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/cobalt/serial.c b/arch/mips/cobalt/serial.c
index c27116599a5f..08e739704cc9 100644
--- a/arch/mips/cobalt/serial.c
+++ b/arch/mips/cobalt/serial.c
@@ -55,9 +55,9 @@ static __init int cobalt_uart_add(void)
55 int retval; 55 int retval;
56 56
57 /* 57 /*
58 * Cobalt Qube1 and RAQ1 have no UART. 58 * Cobalt Qube1 has no UART.
59 */ 59 */
60 if (cobalt_board_id <= COBALT_BRD_ID_RAQ1) 60 if (cobalt_board_id == COBALT_BRD_ID_QUBE1)
61 return 0; 61 return 0;
62 62
63 pdev = platform_device_alloc("serial8250", -1); 63 pdev = platform_device_alloc("serial8250", -1);
diff --git a/arch/mips/configs/atlas_defconfig b/arch/mips/configs/atlas_defconfig
index 129e2c961fec..62bcc887f2ca 100644
--- a/arch/mips/configs/atlas_defconfig
+++ b/arch/mips/configs/atlas_defconfig
@@ -32,12 +32,9 @@ CONFIG_MIPS_ATLAS=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/bigsur_defconfig b/arch/mips/configs/bigsur_defconfig
index dc3e1bf4e42e..67a80f4c7d87 100644
--- a/arch/mips/configs/bigsur_defconfig
+++ b/arch/mips/configs/bigsur_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/capcella_defconfig b/arch/mips/configs/capcella_defconfig
index 4c7031222e64..4dc3197e2e9f 100644
--- a/arch/mips/configs/capcella_defconfig
+++ b/arch/mips/configs/capcella_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/cobalt_defconfig b/arch/mips/configs/cobalt_defconfig
index c8c05785a86d..6d6a01b9a817 100644
--- a/arch/mips/configs/cobalt_defconfig
+++ b/arch/mips/configs/cobalt_defconfig
@@ -18,10 +18,8 @@ CONFIG_MIPS_COBALT=y
18# CONFIG_MIPS_SEAD is not set 18# CONFIG_MIPS_SEAD is not set
19# CONFIG_WR_PPMC is not set 19# CONFIG_WR_PPMC is not set
20# CONFIG_MIPS_SIM is not set 20# CONFIG_MIPS_SIM is not set
21# CONFIG_MOMENCO_OCELOT is not set
22# CONFIG_PNX8550_JBS is not set 21# CONFIG_PNX8550_JBS is not set
23# CONFIG_PNX8550_STB810 is not set 22# CONFIG_PNX8550_STB810 is not set
24# CONFIG_DDB5477 is not set
25# CONFIG_MACH_VR41XX is not set 23# CONFIG_MACH_VR41XX is not set
26# CONFIG_PMC_YOSEMITE is not set 24# CONFIG_PMC_YOSEMITE is not set
27# CONFIG_QEMU is not set 25# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index ec60beb888b2..885b633647e9 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1000=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index f3c25f08bfad..e3c3a07e8a7c 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1100=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 6d400befbacc..9aa7c3ebfa3f 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1200=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index 82aea6e08823..99240668bca1 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1500=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 82697714a9e3..19992f76c60d 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1550=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
deleted file mode 100644
index a42ab9ae7d4b..000000000000
--- a/arch/mips/configs/ddb5477_defconfig
+++ /dev/null
@@ -1,990 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20
4# Tue Feb 20 21:47:28 2007
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11CONFIG_ZONE_DMA=y
12# CONFIG_MIPS_MTX1 is not set
13# CONFIG_MIPS_BOSPORUS is not set
14# CONFIG_MIPS_PB1000 is not set
15# CONFIG_MIPS_PB1100 is not set
16# CONFIG_MIPS_PB1500 is not set
17# CONFIG_MIPS_PB1550 is not set
18# CONFIG_MIPS_PB1200 is not set
19# CONFIG_MIPS_DB1000 is not set
20# CONFIG_MIPS_DB1100 is not set
21# CONFIG_MIPS_DB1500 is not set
22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set
29# CONFIG_MIPS_ATLAS is not set
30# CONFIG_MIPS_MALTA is not set
31# CONFIG_MIPS_SEAD is not set
32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set
40CONFIG_DDB5477=y
41# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set
44# CONFIG_MARKEINS is not set
45# CONFIG_SGI_IP22 is not set
46# CONFIG_SGI_IP27 is not set
47# CONFIG_SGI_IP32 is not set
48# CONFIG_SIBYTE_BIGSUR is not set
49# CONFIG_SIBYTE_SWARM is not set
50# CONFIG_SIBYTE_SENTOSA is not set
51# CONFIG_SIBYTE_RHONE is not set
52# CONFIG_SIBYTE_CARMEL is not set
53# CONFIG_SIBYTE_PTSWARM is not set
54# CONFIG_SIBYTE_LITTLESUR is not set
55# CONFIG_SIBYTE_CRHINE is not set
56# CONFIG_SIBYTE_CRHONE is not set
57# CONFIG_SNI_RM is not set
58# CONFIG_TOSHIBA_JMR3927 is not set
59# CONFIG_TOSHIBA_RBTX4927 is not set
60# CONFIG_TOSHIBA_RBTX4938 is not set
61CONFIG_DDB5477_BUS_FREQUENCY=0
62CONFIG_RWSEM_GENERIC_SPINLOCK=y
63# CONFIG_ARCH_HAS_ILOG2_U32 is not set
64# CONFIG_ARCH_HAS_ILOG2_U64 is not set
65CONFIG_GENERIC_FIND_NEXT_BIT=y
66CONFIG_GENERIC_HWEIGHT=y
67CONFIG_GENERIC_CALIBRATE_DELAY=y
68CONFIG_GENERIC_TIME=y
69CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
70# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
71CONFIG_DMA_NONCOHERENT=y
72CONFIG_DMA_NEED_PCI_MAP_STATE=y
73CONFIG_I8259=y
74# CONFIG_CPU_BIG_ENDIAN is not set
75CONFIG_CPU_LITTLE_ENDIAN=y
76CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
77CONFIG_IRQ_CPU=y
78CONFIG_DDB5XXX_COMMON=y
79CONFIG_MIPS_L1_CACHE_SHIFT=5
80
81#
82# CPU selection
83#
84# CONFIG_CPU_MIPS32_R1 is not set
85# CONFIG_CPU_MIPS32_R2 is not set
86# CONFIG_CPU_MIPS64_R1 is not set
87# CONFIG_CPU_MIPS64_R2 is not set
88# CONFIG_CPU_R3000 is not set
89# CONFIG_CPU_TX39XX is not set
90# CONFIG_CPU_VR41XX is not set
91# CONFIG_CPU_R4300 is not set
92# CONFIG_CPU_R4X00 is not set
93# CONFIG_CPU_TX49XX is not set
94# CONFIG_CPU_R5000 is not set
95CONFIG_CPU_R5432=y
96# CONFIG_CPU_R6000 is not set
97# CONFIG_CPU_NEVADA is not set
98# CONFIG_CPU_R8000 is not set
99# CONFIG_CPU_R10000 is not set
100# CONFIG_CPU_RM7000 is not set
101# CONFIG_CPU_RM9000 is not set
102# CONFIG_CPU_SB1 is not set
103CONFIG_SYS_HAS_CPU_R5432=y
104CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
105CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
106CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
107CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
108
109#
110# Kernel type
111#
112CONFIG_32BIT=y
113# CONFIG_64BIT is not set
114CONFIG_PAGE_SIZE_4KB=y
115# CONFIG_PAGE_SIZE_8KB is not set
116# CONFIG_PAGE_SIZE_16KB is not set
117# CONFIG_PAGE_SIZE_64KB is not set
118CONFIG_MIPS_MT_DISABLED=y
119# CONFIG_MIPS_MT_SMP is not set
120# CONFIG_MIPS_MT_SMTC is not set
121# CONFIG_MIPS_VPE_LOADER is not set
122CONFIG_CPU_HAS_LLSC=y
123CONFIG_CPU_HAS_SYNC=y
124CONFIG_GENERIC_HARDIRQS=y
125CONFIG_GENERIC_IRQ_PROBE=y
126CONFIG_ARCH_FLATMEM_ENABLE=y
127CONFIG_SELECT_MEMORY_MODEL=y
128CONFIG_FLATMEM_MANUAL=y
129# CONFIG_DISCONTIGMEM_MANUAL is not set
130# CONFIG_SPARSEMEM_MANUAL is not set
131CONFIG_FLATMEM=y
132CONFIG_FLAT_NODE_MEM_MAP=y
133# CONFIG_SPARSEMEM_STATIC is not set
134CONFIG_SPLIT_PTLOCK_CPUS=4
135# CONFIG_RESOURCES_64BIT is not set
136CONFIG_ZONE_DMA_FLAG=1
137# CONFIG_HZ_48 is not set
138# CONFIG_HZ_100 is not set
139# CONFIG_HZ_128 is not set
140# CONFIG_HZ_250 is not set
141# CONFIG_HZ_256 is not set
142CONFIG_HZ_1000=y
143# CONFIG_HZ_1024 is not set
144CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
145CONFIG_HZ=1000
146CONFIG_PREEMPT_NONE=y
147# CONFIG_PREEMPT_VOLUNTARY is not set
148# CONFIG_PREEMPT is not set
149# CONFIG_KEXEC is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153
154#
155# Code maturity level options
156#
157CONFIG_EXPERIMENTAL=y
158CONFIG_BROKEN_ON_SMP=y
159CONFIG_INIT_ENV_ARG_LIMIT=32
160
161#
162# General setup
163#
164CONFIG_LOCALVERSION=""
165CONFIG_LOCALVERSION_AUTO=y
166CONFIG_SWAP=y
167CONFIG_SYSVIPC=y
168# CONFIG_IPC_NS is not set
169CONFIG_SYSVIPC_SYSCTL=y
170# CONFIG_POSIX_MQUEUE is not set
171# CONFIG_BSD_PROCESS_ACCT is not set
172# CONFIG_TASKSTATS is not set
173# CONFIG_UTS_NS is not set
174# CONFIG_AUDIT is not set
175# CONFIG_IKCONFIG is not set
176CONFIG_SYSFS_DEPRECATED=y
177CONFIG_RELAY=y
178# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
179CONFIG_SYSCTL=y
180CONFIG_EMBEDDED=y
181CONFIG_SYSCTL_SYSCALL=y
182CONFIG_KALLSYMS=y
183# CONFIG_KALLSYMS_EXTRA_PASS is not set
184CONFIG_HOTPLUG=y
185CONFIG_PRINTK=y
186CONFIG_BUG=y
187CONFIG_ELF_CORE=y
188CONFIG_BASE_FULL=y
189CONFIG_FUTEX=y
190CONFIG_EPOLL=y
191CONFIG_SHMEM=y
192CONFIG_SLAB=y
193CONFIG_VM_EVENT_COUNTERS=y
194CONFIG_RT_MUTEXES=y
195# CONFIG_TINY_SHMEM is not set
196CONFIG_BASE_SMALL=0
197# CONFIG_SLOB is not set
198
199#
200# Loadable module support
201#
202# CONFIG_MODULES is not set
203
204#
205# Block layer
206#
207CONFIG_BLOCK=y
208# CONFIG_LBD is not set
209# CONFIG_BLK_DEV_IO_TRACE is not set
210# CONFIG_LSF is not set
211
212#
213# IO Schedulers
214#
215CONFIG_IOSCHED_NOOP=y
216CONFIG_IOSCHED_AS=y
217CONFIG_IOSCHED_DEADLINE=y
218CONFIG_IOSCHED_CFQ=y
219CONFIG_DEFAULT_AS=y
220# CONFIG_DEFAULT_DEADLINE is not set
221# CONFIG_DEFAULT_CFQ is not set
222# CONFIG_DEFAULT_NOOP is not set
223CONFIG_DEFAULT_IOSCHED="anticipatory"
224
225#
226# Bus options (PCI, PCMCIA, EISA, ISA, TC)
227#
228CONFIG_HW_HAS_PCI=y
229CONFIG_PCI=y
230CONFIG_MMU=y
231
232#
233# PCCARD (PCMCIA/CardBus) support
234#
235# CONFIG_PCCARD is not set
236
237#
238# PCI Hotplug Support
239#
240# CONFIG_HOTPLUG_PCI is not set
241
242#
243# Executable file formats
244#
245CONFIG_BINFMT_ELF=y
246# CONFIG_BINFMT_MISC is not set
247CONFIG_TRAD_SIGNALS=y
248
249#
250# Power management options
251#
252CONFIG_PM=y
253# CONFIG_PM_LEGACY is not set
254# CONFIG_PM_DEBUG is not set
255# CONFIG_PM_SYSFS_DEPRECATED is not set
256
257#
258# Networking
259#
260CONFIG_NET=y
261
262#
263# Networking options
264#
265# CONFIG_NETDEBUG is not set
266CONFIG_PACKET=y
267# CONFIG_PACKET_MMAP is not set
268CONFIG_UNIX=y
269CONFIG_XFRM=y
270CONFIG_XFRM_USER=y
271# CONFIG_XFRM_SUB_POLICY is not set
272CONFIG_XFRM_MIGRATE=y
273CONFIG_NET_KEY=y
274CONFIG_NET_KEY_MIGRATE=y
275CONFIG_INET=y
276# CONFIG_IP_MULTICAST is not set
277# CONFIG_IP_ADVANCED_ROUTER is not set
278CONFIG_IP_FIB_HASH=y
279CONFIG_IP_PNP=y
280# CONFIG_IP_PNP_DHCP is not set
281CONFIG_IP_PNP_BOOTP=y
282# CONFIG_IP_PNP_RARP is not set
283# CONFIG_NET_IPIP is not set
284# CONFIG_NET_IPGRE is not set
285# CONFIG_ARPD is not set
286# CONFIG_SYN_COOKIES is not set
287# CONFIG_INET_AH is not set
288# CONFIG_INET_ESP is not set
289# CONFIG_INET_IPCOMP is not set
290# CONFIG_INET_XFRM_TUNNEL is not set
291# CONFIG_INET_TUNNEL is not set
292CONFIG_INET_XFRM_MODE_TRANSPORT=y
293CONFIG_INET_XFRM_MODE_TUNNEL=y
294CONFIG_INET_XFRM_MODE_BEET=y
295CONFIG_INET_DIAG=y
296CONFIG_INET_TCP_DIAG=y
297# CONFIG_TCP_CONG_ADVANCED is not set
298CONFIG_TCP_CONG_CUBIC=y
299CONFIG_DEFAULT_TCP_CONG="cubic"
300CONFIG_TCP_MD5SIG=y
301# CONFIG_IPV6 is not set
302# CONFIG_INET6_XFRM_TUNNEL is not set
303# CONFIG_INET6_TUNNEL is not set
304CONFIG_NETWORK_SECMARK=y
305# CONFIG_NETFILTER is not set
306
307#
308# DCCP Configuration (EXPERIMENTAL)
309#
310# CONFIG_IP_DCCP is not set
311
312#
313# SCTP Configuration (EXPERIMENTAL)
314#
315# CONFIG_IP_SCTP is not set
316
317#
318# TIPC Configuration (EXPERIMENTAL)
319#
320# CONFIG_TIPC is not set
321# CONFIG_ATM is not set
322# CONFIG_BRIDGE is not set
323# CONFIG_VLAN_8021Q is not set
324# CONFIG_DECNET is not set
325# CONFIG_LLC2 is not set
326# CONFIG_IPX is not set
327# CONFIG_ATALK is not set
328# CONFIG_X25 is not set
329# CONFIG_LAPB is not set
330# CONFIG_ECONET is not set
331# CONFIG_WAN_ROUTER is not set
332
333#
334# QoS and/or fair queueing
335#
336# CONFIG_NET_SCHED is not set
337
338#
339# Network testing
340#
341# CONFIG_NET_PKTGEN is not set
342# CONFIG_HAMRADIO is not set
343# CONFIG_IRDA is not set
344# CONFIG_BT is not set
345CONFIG_IEEE80211=y
346# CONFIG_IEEE80211_DEBUG is not set
347CONFIG_IEEE80211_CRYPT_WEP=y
348CONFIG_IEEE80211_CRYPT_CCMP=y
349CONFIG_IEEE80211_SOFTMAC=y
350# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
351CONFIG_WIRELESS_EXT=y
352
353#
354# Device Drivers
355#
356
357#
358# Generic Driver Options
359#
360CONFIG_STANDALONE=y
361CONFIG_PREVENT_FIRMWARE_BUILD=y
362CONFIG_FW_LOADER=y
363# CONFIG_SYS_HYPERVISOR is not set
364
365#
366# Connector - unified userspace <-> kernelspace linker
367#
368CONFIG_CONNECTOR=y
369CONFIG_PROC_EVENTS=y
370
371#
372# Memory Technology Devices (MTD)
373#
374# CONFIG_MTD is not set
375
376#
377# Parallel port support
378#
379# CONFIG_PARPORT is not set
380
381#
382# Plug and Play support
383#
384# CONFIG_PNPACPI is not set
385
386#
387# Block devices
388#
389# CONFIG_BLK_CPQ_DA is not set
390# CONFIG_BLK_CPQ_CISS_DA is not set
391# CONFIG_BLK_DEV_DAC960 is not set
392# CONFIG_BLK_DEV_UMEM is not set
393# CONFIG_BLK_DEV_COW_COMMON is not set
394# CONFIG_BLK_DEV_LOOP is not set
395# CONFIG_BLK_DEV_NBD is not set
396# CONFIG_BLK_DEV_SX8 is not set
397# CONFIG_BLK_DEV_RAM is not set
398# CONFIG_BLK_DEV_INITRD is not set
399CONFIG_CDROM_PKTCDVD=y
400CONFIG_CDROM_PKTCDVD_BUFFERS=8
401# CONFIG_CDROM_PKTCDVD_WCACHE is not set
402CONFIG_ATA_OVER_ETH=y
403
404#
405# Misc devices
406#
407CONFIG_SGI_IOC4=y
408# CONFIG_TIFM_CORE is not set
409
410#
411# ATA/ATAPI/MFM/RLL support
412#
413# CONFIG_IDE is not set
414
415#
416# SCSI device support
417#
418CONFIG_RAID_ATTRS=y
419# CONFIG_SCSI is not set
420# CONFIG_SCSI_NETLINK is not set
421
422#
423# Serial ATA (prod) and Parallel ATA (experimental) drivers
424#
425# CONFIG_ATA is not set
426
427#
428# Multi-device support (RAID and LVM)
429#
430# CONFIG_MD is not set
431
432#
433# Fusion MPT device support
434#
435# CONFIG_FUSION is not set
436
437#
438# IEEE 1394 (FireWire) support
439#
440# CONFIG_IEEE1394 is not set
441
442#
443# I2O device support
444#
445# CONFIG_I2O is not set
446
447#
448# Network device support
449#
450CONFIG_NETDEVICES=y
451# CONFIG_DUMMY is not set
452# CONFIG_BONDING is not set
453# CONFIG_EQUALIZER is not set
454# CONFIG_TUN is not set
455
456#
457# ARCnet devices
458#
459# CONFIG_ARCNET is not set
460
461#
462# PHY device support
463#
464CONFIG_PHYLIB=y
465
466#
467# MII PHY device drivers
468#
469CONFIG_MARVELL_PHY=y
470CONFIG_DAVICOM_PHY=y
471CONFIG_QSEMI_PHY=y
472CONFIG_LXT_PHY=y
473CONFIG_CICADA_PHY=y
474CONFIG_VITESSE_PHY=y
475CONFIG_SMSC_PHY=y
476# CONFIG_BROADCOM_PHY is not set
477# CONFIG_FIXED_PHY is not set
478
479#
480# Ethernet (10 or 100Mbit)
481#
482CONFIG_NET_ETHERNET=y
483CONFIG_MII=y
484# CONFIG_HAPPYMEAL is not set
485# CONFIG_SUNGEM is not set
486# CONFIG_CASSINI is not set
487# CONFIG_NET_VENDOR_3COM is not set
488# CONFIG_DM9000 is not set
489
490#
491# Tulip family network device support
492#
493# CONFIG_NET_TULIP is not set
494# CONFIG_HP100 is not set
495CONFIG_NET_PCI=y
496CONFIG_PCNET32=y
497# CONFIG_PCNET32_NAPI is not set
498# CONFIG_AMD8111_ETH is not set
499# CONFIG_ADAPTEC_STARFIRE is not set
500# CONFIG_B44 is not set
501# CONFIG_FORCEDETH is not set
502# CONFIG_DGRS is not set
503# CONFIG_EEPRO100 is not set
504# CONFIG_E100 is not set
505# CONFIG_FEALNX is not set
506# CONFIG_NATSEMI is not set
507# CONFIG_NE2K_PCI is not set
508# CONFIG_8139CP is not set
509# CONFIG_8139TOO is not set
510# CONFIG_SIS900 is not set
511# CONFIG_EPIC100 is not set
512# CONFIG_SUNDANCE is not set
513# CONFIG_TLAN is not set
514# CONFIG_VIA_RHINE is not set
515# CONFIG_SC92031 is not set
516
517#
518# Ethernet (1000 Mbit)
519#
520# CONFIG_ACENIC is not set
521# CONFIG_DL2K is not set
522# CONFIG_E1000 is not set
523# CONFIG_NS83820 is not set
524# CONFIG_HAMACHI is not set
525# CONFIG_YELLOWFIN is not set
526# CONFIG_R8169 is not set
527# CONFIG_SIS190 is not set
528# CONFIG_SKGE is not set
529# CONFIG_SKY2 is not set
530# CONFIG_SK98LIN is not set
531# CONFIG_VIA_VELOCITY is not set
532# CONFIG_TIGON3 is not set
533# CONFIG_BNX2 is not set
534CONFIG_QLA3XXX=y
535# CONFIG_ATL1 is not set
536
537#
538# Ethernet (10000 Mbit)
539#
540# CONFIG_CHELSIO_T1 is not set
541CONFIG_CHELSIO_T3=y
542# CONFIG_IXGB is not set
543# CONFIG_S2IO is not set
544# CONFIG_MYRI10GE is not set
545CONFIG_NETXEN_NIC=y
546
547#
548# Token Ring devices
549#
550# CONFIG_TR is not set
551
552#
553# Wireless LAN (non-hamradio)
554#
555# CONFIG_NET_RADIO is not set
556
557#
558# Wan interfaces
559#
560# CONFIG_WAN is not set
561# CONFIG_FDDI is not set
562# CONFIG_HIPPI is not set
563# CONFIG_PPP is not set
564# CONFIG_SLIP is not set
565# CONFIG_SHAPER is not set
566# CONFIG_NETCONSOLE is not set
567# CONFIG_NETPOLL is not set
568# CONFIG_NET_POLL_CONTROLLER is not set
569
570#
571# ISDN subsystem
572#
573# CONFIG_ISDN is not set
574
575#
576# Telephony Support
577#
578# CONFIG_PHONE is not set
579
580#
581# Input device support
582#
583CONFIG_INPUT=y
584# CONFIG_INPUT_FF_MEMLESS is not set
585
586#
587# Userland interfaces
588#
589CONFIG_INPUT_MOUSEDEV=y
590CONFIG_INPUT_MOUSEDEV_PSAUX=y
591CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
592CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
593# CONFIG_INPUT_JOYDEV is not set
594# CONFIG_INPUT_TSDEV is not set
595# CONFIG_INPUT_EVDEV is not set
596# CONFIG_INPUT_EVBUG is not set
597
598#
599# Input Device Drivers
600#
601# CONFIG_INPUT_KEYBOARD is not set
602# CONFIG_INPUT_MOUSE is not set
603# CONFIG_INPUT_JOYSTICK is not set
604# CONFIG_INPUT_TOUCHSCREEN is not set
605# CONFIG_INPUT_MISC is not set
606
607#
608# Hardware I/O ports
609#
610CONFIG_SERIO=y
611# CONFIG_SERIO_I8042 is not set
612CONFIG_SERIO_SERPORT=y
613# CONFIG_SERIO_PCIPS2 is not set
614# CONFIG_SERIO_LIBPS2 is not set
615CONFIG_SERIO_RAW=y
616# CONFIG_GAMEPORT is not set
617
618#
619# Character devices
620#
621CONFIG_VT=y
622CONFIG_VT_CONSOLE=y
623CONFIG_HW_CONSOLE=y
624CONFIG_VT_HW_CONSOLE_BINDING=y
625# CONFIG_SERIAL_NONSTANDARD is not set
626
627#
628# Serial drivers
629#
630CONFIG_SERIAL_8250=y
631CONFIG_SERIAL_8250_CONSOLE=y
632CONFIG_SERIAL_8250_PCI=y
633CONFIG_SERIAL_8250_NR_UARTS=4
634CONFIG_SERIAL_8250_RUNTIME_UARTS=4
635# CONFIG_SERIAL_8250_EXTENDED is not set
636
637#
638# Non-8250 serial port support
639#
640CONFIG_SERIAL_CORE=y
641CONFIG_SERIAL_CORE_CONSOLE=y
642# CONFIG_SERIAL_JSM is not set
643CONFIG_UNIX98_PTYS=y
644CONFIG_LEGACY_PTYS=y
645CONFIG_LEGACY_PTY_COUNT=256
646
647#
648# IPMI
649#
650# CONFIG_IPMI_HANDLER is not set
651
652#
653# Watchdog Cards
654#
655# CONFIG_WATCHDOG is not set
656# CONFIG_HW_RANDOM is not set
657# CONFIG_RTC is not set
658# CONFIG_GEN_RTC is not set
659# CONFIG_DTLK is not set
660# CONFIG_R3964 is not set
661# CONFIG_APPLICOM is not set
662# CONFIG_DRM is not set
663# CONFIG_RAW_DRIVER is not set
664
665#
666# TPM devices
667#
668# CONFIG_TCG_TPM is not set
669
670#
671# I2C support
672#
673# CONFIG_I2C is not set
674
675#
676# SPI support
677#
678# CONFIG_SPI is not set
679# CONFIG_SPI_MASTER is not set
680
681#
682# Dallas's 1-wire bus
683#
684# CONFIG_W1 is not set
685
686#
687# Hardware Monitoring support
688#
689# CONFIG_HWMON is not set
690# CONFIG_HWMON_VID is not set
691
692#
693# Multimedia devices
694#
695# CONFIG_VIDEO_DEV is not set
696
697#
698# Digital Video Broadcasting Devices
699#
700# CONFIG_DVB is not set
701
702#
703# Graphics support
704#
705# CONFIG_FIRMWARE_EDID is not set
706# CONFIG_FB is not set
707
708#
709# Console display driver support
710#
711# CONFIG_VGA_CONSOLE is not set
712CONFIG_DUMMY_CONSOLE=y
713# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
714
715#
716# Sound
717#
718# CONFIG_SOUND is not set
719
720#
721# HID Devices
722#
723# CONFIG_HID is not set
724
725#
726# USB support
727#
728CONFIG_USB_ARCH_HAS_HCD=y
729CONFIG_USB_ARCH_HAS_OHCI=y
730CONFIG_USB_ARCH_HAS_EHCI=y
731# CONFIG_USB is not set
732
733#
734# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
735#
736
737#
738# USB Gadget Support
739#
740# CONFIG_USB_GADGET is not set
741
742#
743# MMC/SD Card support
744#
745# CONFIG_MMC is not set
746
747#
748# LED devices
749#
750# CONFIG_NEW_LEDS is not set
751
752#
753# LED drivers
754#
755
756#
757# LED Triggers
758#
759
760#
761# InfiniBand support
762#
763# CONFIG_INFINIBAND is not set
764
765#
766# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
767#
768
769#
770# Real Time Clock
771#
772# CONFIG_RTC_CLASS is not set
773
774#
775# DMA Engine support
776#
777# CONFIG_DMA_ENGINE is not set
778
779#
780# DMA Clients
781#
782
783#
784# DMA Devices
785#
786
787#
788# Auxiliary Display support
789#
790
791#
792# Virtualization
793#
794
795#
796# File systems
797#
798CONFIG_EXT2_FS=y
799# CONFIG_EXT2_FS_XATTR is not set
800# CONFIG_EXT2_FS_XIP is not set
801# CONFIG_EXT3_FS is not set
802# CONFIG_EXT4DEV_FS is not set
803# CONFIG_REISERFS_FS is not set
804# CONFIG_JFS_FS is not set
805# CONFIG_FS_POSIX_ACL is not set
806# CONFIG_XFS_FS is not set
807# CONFIG_GFS2_FS is not set
808# CONFIG_OCFS2_FS is not set
809# CONFIG_MINIX_FS is not set
810# CONFIG_ROMFS_FS is not set
811CONFIG_INOTIFY=y
812CONFIG_INOTIFY_USER=y
813# CONFIG_QUOTA is not set
814CONFIG_DNOTIFY=y
815CONFIG_AUTOFS_FS=y
816CONFIG_AUTOFS4_FS=y
817CONFIG_FUSE_FS=y
818
819#
820# CD-ROM/DVD Filesystems
821#
822# CONFIG_ISO9660_FS is not set
823# CONFIG_UDF_FS is not set
824
825#
826# DOS/FAT/NT Filesystems
827#
828# CONFIG_MSDOS_FS is not set
829# CONFIG_VFAT_FS is not set
830# CONFIG_NTFS_FS is not set
831
832#
833# Pseudo filesystems
834#
835CONFIG_PROC_FS=y
836CONFIG_PROC_KCORE=y
837CONFIG_PROC_SYSCTL=y
838CONFIG_SYSFS=y
839# CONFIG_TMPFS is not set
840# CONFIG_HUGETLB_PAGE is not set
841CONFIG_RAMFS=y
842CONFIG_CONFIGFS_FS=y
843
844#
845# Miscellaneous filesystems
846#
847# CONFIG_ADFS_FS is not set
848# CONFIG_AFFS_FS is not set
849# CONFIG_ECRYPT_FS is not set
850# CONFIG_HFS_FS is not set
851# CONFIG_HFSPLUS_FS is not set
852# CONFIG_BEFS_FS is not set
853# CONFIG_BFS_FS is not set
854# CONFIG_EFS_FS is not set
855# CONFIG_CRAMFS is not set
856# CONFIG_VXFS_FS is not set
857# CONFIG_HPFS_FS is not set
858# CONFIG_QNX4FS_FS is not set
859# CONFIG_SYSV_FS is not set
860# CONFIG_UFS_FS is not set
861
862#
863# Network File Systems
864#
865CONFIG_NFS_FS=y
866# CONFIG_NFS_V3 is not set
867# CONFIG_NFS_V4 is not set
868# CONFIG_NFS_DIRECTIO is not set
869CONFIG_NFSD=y
870# CONFIG_NFSD_V3 is not set
871# CONFIG_NFSD_TCP is not set
872CONFIG_ROOT_NFS=y
873CONFIG_LOCKD=y
874CONFIG_EXPORTFS=y
875CONFIG_NFS_COMMON=y
876CONFIG_SUNRPC=y
877# CONFIG_RPCSEC_GSS_KRB5 is not set
878# CONFIG_RPCSEC_GSS_SPKM3 is not set
879# CONFIG_SMB_FS is not set
880# CONFIG_CIFS is not set
881# CONFIG_NCP_FS is not set
882# CONFIG_CODA_FS is not set
883# CONFIG_AFS_FS is not set
884# CONFIG_9P_FS is not set
885
886#
887# Partition Types
888#
889# CONFIG_PARTITION_ADVANCED is not set
890CONFIG_MSDOS_PARTITION=y
891
892#
893# Native Language Support
894#
895# CONFIG_NLS is not set
896
897#
898# Distributed Lock Manager
899#
900CONFIG_DLM=y
901CONFIG_DLM_TCP=y
902# CONFIG_DLM_SCTP is not set
903# CONFIG_DLM_DEBUG is not set
904
905#
906# Profiling support
907#
908# CONFIG_PROFILING is not set
909
910#
911# Kernel hacking
912#
913CONFIG_TRACE_IRQFLAGS_SUPPORT=y
914# CONFIG_PRINTK_TIME is not set
915CONFIG_ENABLE_MUST_CHECK=y
916# CONFIG_MAGIC_SYSRQ is not set
917# CONFIG_UNUSED_SYMBOLS is not set
918# CONFIG_DEBUG_FS is not set
919# CONFIG_HEADERS_CHECK is not set
920# CONFIG_DEBUG_KERNEL is not set
921CONFIG_LOG_BUF_SHIFT=14
922CONFIG_CROSSCOMPILE=y
923CONFIG_CMDLINE="ip=any"
924CONFIG_SYS_SUPPORTS_KGDB=y
925
926#
927# Security options
928#
929CONFIG_KEYS=y
930CONFIG_KEYS_DEBUG_PROC_KEYS=y
931# CONFIG_SECURITY is not set
932
933#
934# Cryptographic options
935#
936CONFIG_CRYPTO=y
937CONFIG_CRYPTO_ALGAPI=y
938CONFIG_CRYPTO_BLKCIPHER=y
939CONFIG_CRYPTO_HASH=y
940CONFIG_CRYPTO_MANAGER=y
941CONFIG_CRYPTO_HMAC=y
942CONFIG_CRYPTO_XCBC=y
943CONFIG_CRYPTO_NULL=y
944CONFIG_CRYPTO_MD4=y
945CONFIG_CRYPTO_MD5=y
946CONFIG_CRYPTO_SHA1=y
947CONFIG_CRYPTO_SHA256=y
948CONFIG_CRYPTO_SHA512=y
949CONFIG_CRYPTO_WP512=y
950CONFIG_CRYPTO_TGR192=y
951CONFIG_CRYPTO_GF128MUL=y
952CONFIG_CRYPTO_ECB=y
953CONFIG_CRYPTO_CBC=y
954CONFIG_CRYPTO_PCBC=y
955CONFIG_CRYPTO_LRW=y
956CONFIG_CRYPTO_DES=y
957CONFIG_CRYPTO_FCRYPT=y
958CONFIG_CRYPTO_BLOWFISH=y
959CONFIG_CRYPTO_TWOFISH=y
960CONFIG_CRYPTO_TWOFISH_COMMON=y
961CONFIG_CRYPTO_SERPENT=y
962CONFIG_CRYPTO_AES=y
963CONFIG_CRYPTO_CAST5=y
964CONFIG_CRYPTO_CAST6=y
965CONFIG_CRYPTO_TEA=y
966CONFIG_CRYPTO_ARC4=y
967CONFIG_CRYPTO_KHAZAD=y
968CONFIG_CRYPTO_ANUBIS=y
969CONFIG_CRYPTO_DEFLATE=y
970CONFIG_CRYPTO_MICHAEL_MIC=y
971CONFIG_CRYPTO_CRC32C=y
972CONFIG_CRYPTO_CAMELLIA=y
973
974#
975# Hardware crypto devices
976#
977
978#
979# Library routines
980#
981CONFIG_BITREVERSE=y
982# CONFIG_CRC_CCITT is not set
983CONFIG_CRC16=y
984CONFIG_CRC32=y
985CONFIG_LIBCRC32C=y
986CONFIG_ZLIB_INFLATE=y
987CONFIG_ZLIB_DEFLATE=y
988CONFIG_PLIST=y
989CONFIG_HAS_IOMEM=y
990CONFIG_HAS_IOPORT=y
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index d6e3fffbc80d..2fb350432669 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -32,12 +32,9 @@ CONFIG_MACH_DECSTATION=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/e55_defconfig b/arch/mips/configs/e55_defconfig
index 78f5004fb721..5467d750b6eb 100644
--- a/arch/mips/configs/e55_defconfig
+++ b/arch/mips/configs/e55_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/emma2rh_defconfig b/arch/mips/configs/emma2rh_defconfig
index b29bff0f56c3..d73d965f7615 100644
--- a/arch/mips/configs/emma2rh_defconfig
+++ b/arch/mips/configs/emma2rh_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/excite_defconfig b/arch/mips/configs/excite_defconfig
index 69810592aa6b..17a866057fd4 100644
--- a/arch/mips/configs/excite_defconfig
+++ b/arch/mips/configs/excite_defconfig
@@ -33,12 +33,9 @@ CONFIG_BASLER_EXCITE=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/fulong_defconfig b/arch/mips/configs/fulong_defconfig
index 6ab94d8cf08b..4ef39a0527cc 100644
--- a/arch/mips/configs/fulong_defconfig
+++ b/arch/mips/configs/fulong_defconfig
@@ -19,10 +19,8 @@ CONFIG_LEMOTE_FULONG=y
19# CONFIG_MIPS_SEAD is not set 19# CONFIG_MIPS_SEAD is not set
20# CONFIG_WR_PPMC is not set 20# CONFIG_WR_PPMC is not set
21# CONFIG_MIPS_SIM is not set 21# CONFIG_MIPS_SIM is not set
22# CONFIG_MOMENCO_OCELOT is not set
23# CONFIG_PNX8550_JBS is not set 22# CONFIG_PNX8550_JBS is not set
24# CONFIG_PNX8550_STB810 is not set 23# CONFIG_PNX8550_STB810 is not set
25# CONFIG_DDB5477 is not set
26# CONFIG_MACH_VR41XX is not set 24# CONFIG_MACH_VR41XX is not set
27# CONFIG_PMC_YOSEMITE is not set 25# CONFIG_PMC_YOSEMITE is not set
28# CONFIG_QEMU is not set 26# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/ip22_defconfig b/arch/mips/configs/ip22_defconfig
index 405c9f505a77..934d8a008936 100644
--- a/arch/mips/configs/ip22_defconfig
+++ b/arch/mips/configs/ip22_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/ip27_defconfig b/arch/mips/configs/ip27_defconfig
index a9dcbcf563cb..eb35f7518d06 100644
--- a/arch/mips/configs/ip27_defconfig
+++ b/arch/mips/configs/ip27_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/ip32_defconfig b/arch/mips/configs/ip32_defconfig
index a040459bec11..47f49b60c5d6 100644
--- a/arch/mips/configs/ip32_defconfig
+++ b/arch/mips/configs/ip32_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/jazz_defconfig b/arch/mips/configs/jazz_defconfig
index 8a0b4ac5283d..fa655e247ecc 100644
--- a/arch/mips/configs/jazz_defconfig
+++ b/arch/mips/configs/jazz_defconfig
@@ -32,12 +32,9 @@ CONFIG_MACH_JAZZ=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/jmr3927_defconfig b/arch/mips/configs/jmr3927_defconfig
index 9a25e770abd8..95a72d2750ef 100644
--- a/arch/mips/configs/jmr3927_defconfig
+++ b/arch/mips/configs/jmr3927_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/malta_defconfig b/arch/mips/configs/malta_defconfig
index 546cb243fd09..fbfa5685887c 100644
--- a/arch/mips/configs/malta_defconfig
+++ b/arch/mips/configs/malta_defconfig
@@ -32,12 +32,9 @@ CONFIG_MIPS_MALTA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/mipssim_defconfig b/arch/mips/configs/mipssim_defconfig
index 6abad6f88313..86dcb7464353 100644
--- a/arch/mips/configs/mipssim_defconfig
+++ b/arch/mips/configs/mipssim_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33CONFIG_MIPS_SIM=y 33CONFIG_MIPS_SIM=y
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/mpc30x_defconfig b/arch/mips/configs/mpc30x_defconfig
index 4981ce425d82..239810b6c88d 100644
--- a/arch/mips/configs/mpc30x_defconfig
+++ b/arch/mips/configs/mpc30x_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/msp71xx_defconfig b/arch/mips/configs/msp71xx_defconfig
index adca5f7ba533..69278999c9a2 100644
--- a/arch/mips/configs/msp71xx_defconfig
+++ b/arch/mips/configs/msp71xx_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42CONFIG_PMC_MSP=y 39CONFIG_PMC_MSP=y
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
deleted file mode 100644
index e1db1fb80cd0..000000000000
--- a/arch/mips/configs/ocelot_defconfig
+++ /dev/null
@@ -1,919 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.20
4# Tue Feb 20 21:47:36 2007
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11CONFIG_ZONE_DMA=y
12# CONFIG_MIPS_MTX1 is not set
13# CONFIG_MIPS_BOSPORUS is not set
14# CONFIG_MIPS_PB1000 is not set
15# CONFIG_MIPS_PB1100 is not set
16# CONFIG_MIPS_PB1500 is not set
17# CONFIG_MIPS_PB1550 is not set
18# CONFIG_MIPS_PB1200 is not set
19# CONFIG_MIPS_DB1000 is not set
20# CONFIG_MIPS_DB1100 is not set
21# CONFIG_MIPS_DB1500 is not set
22# CONFIG_MIPS_DB1550 is not set
23# CONFIG_MIPS_DB1200 is not set
24# CONFIG_MIPS_MIRAGE is not set
25# CONFIG_BASLER_EXCITE is not set
26# CONFIG_MIPS_COBALT is not set
27# CONFIG_MACH_DECSTATION is not set
28# CONFIG_MACH_JAZZ is not set
29# CONFIG_MIPS_ATLAS is not set
30# CONFIG_MIPS_MALTA is not set
31# CONFIG_MIPS_SEAD is not set
32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35CONFIG_MOMENCO_OCELOT=y
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set
44# CONFIG_MARKEINS is not set
45# CONFIG_SGI_IP22 is not set
46# CONFIG_SGI_IP27 is not set
47# CONFIG_SGI_IP32 is not set
48# CONFIG_SIBYTE_BIGSUR is not set
49# CONFIG_SIBYTE_SWARM is not set
50# CONFIG_SIBYTE_SENTOSA is not set
51# CONFIG_SIBYTE_RHONE is not set
52# CONFIG_SIBYTE_CARMEL is not set
53# CONFIG_SIBYTE_PTSWARM is not set
54# CONFIG_SIBYTE_LITTLESUR is not set
55# CONFIG_SIBYTE_CRHINE is not set
56# CONFIG_SIBYTE_CRHONE is not set
57# CONFIG_SNI_RM is not set
58# CONFIG_TOSHIBA_JMR3927 is not set
59# CONFIG_TOSHIBA_RBTX4927 is not set
60# CONFIG_TOSHIBA_RBTX4938 is not set
61CONFIG_RWSEM_GENERIC_SPINLOCK=y
62# CONFIG_ARCH_HAS_ILOG2_U32 is not set
63# CONFIG_ARCH_HAS_ILOG2_U64 is not set
64CONFIG_GENERIC_FIND_NEXT_BIT=y
65CONFIG_GENERIC_HWEIGHT=y
66CONFIG_GENERIC_CALIBRATE_DELAY=y
67CONFIG_GENERIC_TIME=y
68CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
69# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
70CONFIG_DMA_NONCOHERENT=y
71CONFIG_DMA_NEED_PCI_MAP_STATE=y
72CONFIG_CPU_BIG_ENDIAN=y
73# CONFIG_CPU_LITTLE_ENDIAN is not set
74CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
75CONFIG_IRQ_CPU=y
76CONFIG_IRQ_CPU_RM7K=y
77CONFIG_MIPS_GT64120=y
78CONFIG_SWAP_IO_SPACE=y
79# CONFIG_SYSCLK_75 is not set
80# CONFIG_SYSCLK_83 is not set
81CONFIG_SYSCLK_100=y
82CONFIG_MIPS_L1_CACHE_SHIFT=5
83
84#
85# CPU selection
86#
87# CONFIG_CPU_MIPS32_R1 is not set
88# CONFIG_CPU_MIPS32_R2 is not set
89# CONFIG_CPU_MIPS64_R1 is not set
90# CONFIG_CPU_MIPS64_R2 is not set
91# CONFIG_CPU_R3000 is not set
92# CONFIG_CPU_TX39XX is not set
93# CONFIG_CPU_VR41XX is not set
94# CONFIG_CPU_R4300 is not set
95# CONFIG_CPU_R4X00 is not set
96# CONFIG_CPU_TX49XX is not set
97# CONFIG_CPU_R5000 is not set
98# CONFIG_CPU_R5432 is not set
99# CONFIG_CPU_R6000 is not set
100# CONFIG_CPU_NEVADA is not set
101# CONFIG_CPU_R8000 is not set
102# CONFIG_CPU_R10000 is not set
103CONFIG_CPU_RM7000=y
104# CONFIG_CPU_RM9000 is not set
105# CONFIG_CPU_SB1 is not set
106CONFIG_SYS_HAS_CPU_RM7000=y
107CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
108CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
109CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
110CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
111
112#
113# Kernel type
114#
115CONFIG_32BIT=y
116# CONFIG_64BIT is not set
117CONFIG_PAGE_SIZE_4KB=y
118# CONFIG_PAGE_SIZE_8KB is not set
119# CONFIG_PAGE_SIZE_16KB is not set
120# CONFIG_PAGE_SIZE_64KB is not set
121CONFIG_BOARD_SCACHE=y
122CONFIG_RM7000_CPU_SCACHE=y
123CONFIG_CPU_HAS_PREFETCH=y
124CONFIG_MIPS_MT_DISABLED=y
125# CONFIG_MIPS_MT_SMP is not set
126# CONFIG_MIPS_MT_SMTC is not set
127# CONFIG_MIPS_VPE_LOADER is not set
128# CONFIG_64BIT_PHYS_ADDR is not set
129CONFIG_CPU_HAS_LLSC=y
130CONFIG_CPU_HAS_SYNC=y
131CONFIG_GENERIC_HARDIRQS=y
132CONFIG_GENERIC_IRQ_PROBE=y
133CONFIG_CPU_SUPPORTS_HIGHMEM=y
134CONFIG_ARCH_FLATMEM_ENABLE=y
135CONFIG_SELECT_MEMORY_MODEL=y
136CONFIG_FLATMEM_MANUAL=y
137# CONFIG_DISCONTIGMEM_MANUAL is not set
138# CONFIG_SPARSEMEM_MANUAL is not set
139CONFIG_FLATMEM=y
140CONFIG_FLAT_NODE_MEM_MAP=y
141# CONFIG_SPARSEMEM_STATIC is not set
142CONFIG_SPLIT_PTLOCK_CPUS=4
143# CONFIG_RESOURCES_64BIT is not set
144CONFIG_ZONE_DMA_FLAG=1
145# CONFIG_HZ_48 is not set
146# CONFIG_HZ_100 is not set
147# CONFIG_HZ_128 is not set
148# CONFIG_HZ_250 is not set
149# CONFIG_HZ_256 is not set
150CONFIG_HZ_1000=y
151# CONFIG_HZ_1024 is not set
152CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
153CONFIG_HZ=1000
154CONFIG_PREEMPT_NONE=y
155# CONFIG_PREEMPT_VOLUNTARY is not set
156# CONFIG_PREEMPT is not set
157# CONFIG_KEXEC is not set
158CONFIG_LOCKDEP_SUPPORT=y
159CONFIG_STACKTRACE_SUPPORT=y
160CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
161
162#
163# Code maturity level options
164#
165CONFIG_EXPERIMENTAL=y
166CONFIG_BROKEN_ON_SMP=y
167CONFIG_INIT_ENV_ARG_LIMIT=32
168
169#
170# General setup
171#
172CONFIG_LOCALVERSION=""
173CONFIG_LOCALVERSION_AUTO=y
174CONFIG_SWAP=y
175CONFIG_SYSVIPC=y
176# CONFIG_IPC_NS is not set
177CONFIG_SYSVIPC_SYSCTL=y
178# CONFIG_POSIX_MQUEUE is not set
179# CONFIG_BSD_PROCESS_ACCT is not set
180# CONFIG_TASKSTATS is not set
181# CONFIG_UTS_NS is not set
182# CONFIG_AUDIT is not set
183# CONFIG_IKCONFIG is not set
184CONFIG_SYSFS_DEPRECATED=y
185CONFIG_RELAY=y
186# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
187CONFIG_SYSCTL=y
188CONFIG_EMBEDDED=y
189CONFIG_SYSCTL_SYSCALL=y
190CONFIG_KALLSYMS=y
191# CONFIG_KALLSYMS_EXTRA_PASS is not set
192# CONFIG_HOTPLUG is not set
193CONFIG_PRINTK=y
194CONFIG_BUG=y
195CONFIG_ELF_CORE=y
196CONFIG_BASE_FULL=y
197CONFIG_FUTEX=y
198CONFIG_EPOLL=y
199CONFIG_SHMEM=y
200CONFIG_SLAB=y
201CONFIG_VM_EVENT_COUNTERS=y
202CONFIG_RT_MUTEXES=y
203# CONFIG_TINY_SHMEM is not set
204CONFIG_BASE_SMALL=0
205# CONFIG_SLOB is not set
206
207#
208# Loadable module support
209#
210# CONFIG_MODULES is not set
211
212#
213# Block layer
214#
215CONFIG_BLOCK=y
216# CONFIG_LBD is not set
217# CONFIG_BLK_DEV_IO_TRACE is not set
218# CONFIG_LSF is not set
219
220#
221# IO Schedulers
222#
223CONFIG_IOSCHED_NOOP=y
224CONFIG_IOSCHED_AS=y
225CONFIG_IOSCHED_DEADLINE=y
226CONFIG_IOSCHED_CFQ=y
227CONFIG_DEFAULT_AS=y
228# CONFIG_DEFAULT_DEADLINE is not set
229# CONFIG_DEFAULT_CFQ is not set
230# CONFIG_DEFAULT_NOOP is not set
231CONFIG_DEFAULT_IOSCHED="anticipatory"
232
233#
234# Bus options (PCI, PCMCIA, EISA, ISA, TC)
235#
236CONFIG_HW_HAS_PCI=y
237# CONFIG_PCI is not set
238CONFIG_MMU=y
239
240#
241# PCCARD (PCMCIA/CardBus) support
242#
243
244#
245# PCI Hotplug Support
246#
247
248#
249# Executable file formats
250#
251CONFIG_BINFMT_ELF=y
252# CONFIG_BINFMT_MISC is not set
253CONFIG_TRAD_SIGNALS=y
254
255#
256# Power management options
257#
258CONFIG_PM=y
259# CONFIG_PM_LEGACY is not set
260# CONFIG_PM_DEBUG is not set
261# CONFIG_PM_SYSFS_DEPRECATED is not set
262
263#
264# Networking
265#
266CONFIG_NET=y
267
268#
269# Networking options
270#
271# CONFIG_NETDEBUG is not set
272# CONFIG_PACKET is not set
273CONFIG_UNIX=y
274CONFIG_XFRM=y
275CONFIG_XFRM_USER=y
276# CONFIG_XFRM_SUB_POLICY is not set
277CONFIG_XFRM_MIGRATE=y
278CONFIG_NET_KEY=y
279CONFIG_NET_KEY_MIGRATE=y
280CONFIG_INET=y
281# CONFIG_IP_MULTICAST is not set
282# CONFIG_IP_ADVANCED_ROUTER is not set
283CONFIG_IP_FIB_HASH=y
284CONFIG_IP_PNP=y
285# CONFIG_IP_PNP_DHCP is not set
286CONFIG_IP_PNP_BOOTP=y
287# CONFIG_IP_PNP_RARP is not set
288# CONFIG_NET_IPIP is not set
289# CONFIG_NET_IPGRE is not set
290# CONFIG_ARPD is not set
291# CONFIG_SYN_COOKIES is not set
292# CONFIG_INET_AH is not set
293# CONFIG_INET_ESP is not set
294# CONFIG_INET_IPCOMP is not set
295# CONFIG_INET_XFRM_TUNNEL is not set
296# CONFIG_INET_TUNNEL is not set
297CONFIG_INET_XFRM_MODE_TRANSPORT=y
298CONFIG_INET_XFRM_MODE_TUNNEL=y
299CONFIG_INET_XFRM_MODE_BEET=y
300CONFIG_INET_DIAG=y
301CONFIG_INET_TCP_DIAG=y
302# CONFIG_TCP_CONG_ADVANCED is not set
303CONFIG_TCP_CONG_CUBIC=y
304CONFIG_DEFAULT_TCP_CONG="cubic"
305CONFIG_TCP_MD5SIG=y
306# CONFIG_IPV6 is not set
307# CONFIG_INET6_XFRM_TUNNEL is not set
308# CONFIG_INET6_TUNNEL is not set
309CONFIG_NETWORK_SECMARK=y
310# CONFIG_NETFILTER is not set
311
312#
313# DCCP Configuration (EXPERIMENTAL)
314#
315# CONFIG_IP_DCCP is not set
316
317#
318# SCTP Configuration (EXPERIMENTAL)
319#
320# CONFIG_IP_SCTP is not set
321
322#
323# TIPC Configuration (EXPERIMENTAL)
324#
325# CONFIG_TIPC is not set
326# CONFIG_ATM is not set
327# CONFIG_BRIDGE is not set
328# CONFIG_VLAN_8021Q is not set
329# CONFIG_DECNET is not set
330# CONFIG_LLC2 is not set
331# CONFIG_IPX is not set
332# CONFIG_ATALK is not set
333# CONFIG_X25 is not set
334# CONFIG_LAPB is not set
335# CONFIG_ECONET is not set
336# CONFIG_WAN_ROUTER is not set
337
338#
339# QoS and/or fair queueing
340#
341# CONFIG_NET_SCHED is not set
342
343#
344# Network testing
345#
346# CONFIG_NET_PKTGEN is not set
347# CONFIG_HAMRADIO is not set
348# CONFIG_IRDA is not set
349# CONFIG_BT is not set
350CONFIG_IEEE80211=y
351# CONFIG_IEEE80211_DEBUG is not set
352CONFIG_IEEE80211_CRYPT_WEP=y
353CONFIG_IEEE80211_CRYPT_CCMP=y
354CONFIG_IEEE80211_SOFTMAC=y
355# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
356CONFIG_WIRELESS_EXT=y
357
358#
359# Device Drivers
360#
361
362#
363# Generic Driver Options
364#
365CONFIG_STANDALONE=y
366CONFIG_PREVENT_FIRMWARE_BUILD=y
367# CONFIG_SYS_HYPERVISOR is not set
368
369#
370# Connector - unified userspace <-> kernelspace linker
371#
372CONFIG_CONNECTOR=y
373CONFIG_PROC_EVENTS=y
374
375#
376# Memory Technology Devices (MTD)
377#
378# CONFIG_MTD is not set
379
380#
381# Parallel port support
382#
383# CONFIG_PARPORT is not set
384
385#
386# Plug and Play support
387#
388# CONFIG_PNPACPI is not set
389
390#
391# Block devices
392#
393# CONFIG_BLK_DEV_COW_COMMON is not set
394# CONFIG_BLK_DEV_LOOP is not set
395# CONFIG_BLK_DEV_NBD is not set
396# CONFIG_BLK_DEV_RAM is not set
397# CONFIG_BLK_DEV_INITRD is not set
398CONFIG_CDROM_PKTCDVD=y
399CONFIG_CDROM_PKTCDVD_BUFFERS=8
400# CONFIG_CDROM_PKTCDVD_WCACHE is not set
401CONFIG_ATA_OVER_ETH=y
402
403#
404# Misc devices
405#
406
407#
408# ATA/ATAPI/MFM/RLL support
409#
410# CONFIG_IDE is not set
411
412#
413# SCSI device support
414#
415CONFIG_RAID_ATTRS=y
416# CONFIG_SCSI is not set
417# CONFIG_SCSI_NETLINK is not set
418
419#
420# Serial ATA (prod) and Parallel ATA (experimental) drivers
421#
422# CONFIG_ATA is not set
423
424#
425# Multi-device support (RAID and LVM)
426#
427# CONFIG_MD is not set
428
429#
430# Fusion MPT device support
431#
432# CONFIG_FUSION is not set
433
434#
435# IEEE 1394 (FireWire) support
436#
437
438#
439# I2O device support
440#
441
442#
443# Network device support
444#
445CONFIG_NETDEVICES=y
446# CONFIG_DUMMY is not set
447# CONFIG_BONDING is not set
448# CONFIG_EQUALIZER is not set
449# CONFIG_TUN is not set
450
451#
452# PHY device support
453#
454CONFIG_PHYLIB=y
455
456#
457# MII PHY device drivers
458#
459CONFIG_MARVELL_PHY=y
460CONFIG_DAVICOM_PHY=y
461CONFIG_QSEMI_PHY=y
462CONFIG_LXT_PHY=y
463CONFIG_CICADA_PHY=y
464CONFIG_VITESSE_PHY=y
465CONFIG_SMSC_PHY=y
466# CONFIG_BROADCOM_PHY is not set
467# CONFIG_FIXED_PHY is not set
468
469#
470# Ethernet (10 or 100Mbit)
471#
472CONFIG_NET_ETHERNET=y
473# CONFIG_MII is not set
474# CONFIG_DM9000 is not set
475
476#
477# Ethernet (1000 Mbit)
478#
479
480#
481# Ethernet (10000 Mbit)
482#
483
484#
485# Token Ring devices
486#
487
488#
489# Wireless LAN (non-hamradio)
490#
491# CONFIG_NET_RADIO is not set
492
493#
494# Wan interfaces
495#
496# CONFIG_WAN is not set
497# CONFIG_PPP is not set
498# CONFIG_SLIP is not set
499# CONFIG_SHAPER is not set
500# CONFIG_NETCONSOLE is not set
501# CONFIG_NETPOLL is not set
502# CONFIG_NET_POLL_CONTROLLER is not set
503
504#
505# ISDN subsystem
506#
507# CONFIG_ISDN is not set
508
509#
510# Telephony Support
511#
512# CONFIG_PHONE is not set
513
514#
515# Input device support
516#
517CONFIG_INPUT=y
518# CONFIG_INPUT_FF_MEMLESS is not set
519
520#
521# Userland interfaces
522#
523CONFIG_INPUT_MOUSEDEV=y
524CONFIG_INPUT_MOUSEDEV_PSAUX=y
525CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
526CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
527# CONFIG_INPUT_JOYDEV is not set
528# CONFIG_INPUT_TSDEV is not set
529# CONFIG_INPUT_EVDEV is not set
530# CONFIG_INPUT_EVBUG is not set
531
532#
533# Input Device Drivers
534#
535# CONFIG_INPUT_KEYBOARD is not set
536# CONFIG_INPUT_MOUSE is not set
537# CONFIG_INPUT_JOYSTICK is not set
538# CONFIG_INPUT_TOUCHSCREEN is not set
539# CONFIG_INPUT_MISC is not set
540
541#
542# Hardware I/O ports
543#
544CONFIG_SERIO=y
545# CONFIG_SERIO_I8042 is not set
546CONFIG_SERIO_SERPORT=y
547# CONFIG_SERIO_LIBPS2 is not set
548CONFIG_SERIO_RAW=y
549# CONFIG_GAMEPORT is not set
550
551#
552# Character devices
553#
554CONFIG_VT=y
555CONFIG_VT_CONSOLE=y
556CONFIG_HW_CONSOLE=y
557CONFIG_VT_HW_CONSOLE_BINDING=y
558# CONFIG_SERIAL_NONSTANDARD is not set
559
560#
561# Serial drivers
562#
563CONFIG_SERIAL_8250=y
564CONFIG_SERIAL_8250_CONSOLE=y
565CONFIG_SERIAL_8250_NR_UARTS=4
566CONFIG_SERIAL_8250_RUNTIME_UARTS=4
567# CONFIG_SERIAL_8250_EXTENDED is not set
568
569#
570# Non-8250 serial port support
571#
572CONFIG_SERIAL_CORE=y
573CONFIG_SERIAL_CORE_CONSOLE=y
574CONFIG_UNIX98_PTYS=y
575CONFIG_LEGACY_PTYS=y
576CONFIG_LEGACY_PTY_COUNT=256
577
578#
579# IPMI
580#
581# CONFIG_IPMI_HANDLER is not set
582
583#
584# Watchdog Cards
585#
586# CONFIG_WATCHDOG is not set
587# CONFIG_HW_RANDOM is not set
588# CONFIG_RTC is not set
589# CONFIG_GEN_RTC is not set
590# CONFIG_DTLK is not set
591# CONFIG_R3964 is not set
592# CONFIG_RAW_DRIVER is not set
593
594#
595# TPM devices
596#
597# CONFIG_TCG_TPM is not set
598
599#
600# I2C support
601#
602# CONFIG_I2C is not set
603
604#
605# SPI support
606#
607# CONFIG_SPI is not set
608# CONFIG_SPI_MASTER is not set
609
610#
611# Dallas's 1-wire bus
612#
613# CONFIG_W1 is not set
614
615#
616# Hardware Monitoring support
617#
618# CONFIG_HWMON is not set
619# CONFIG_HWMON_VID is not set
620
621#
622# Multimedia devices
623#
624# CONFIG_VIDEO_DEV is not set
625
626#
627# Digital Video Broadcasting Devices
628#
629# CONFIG_DVB is not set
630
631#
632# Graphics support
633#
634# CONFIG_FIRMWARE_EDID is not set
635# CONFIG_FB is not set
636
637#
638# Console display driver support
639#
640# CONFIG_VGA_CONSOLE is not set
641CONFIG_DUMMY_CONSOLE=y
642# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
643
644#
645# Sound
646#
647# CONFIG_SOUND is not set
648
649#
650# HID Devices
651#
652# CONFIG_HID is not set
653
654#
655# USB support
656#
657# CONFIG_USB_ARCH_HAS_HCD is not set
658# CONFIG_USB_ARCH_HAS_OHCI is not set
659# CONFIG_USB_ARCH_HAS_EHCI is not set
660
661#
662# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
663#
664
665#
666# USB Gadget Support
667#
668# CONFIG_USB_GADGET is not set
669
670#
671# MMC/SD Card support
672#
673# CONFIG_MMC is not set
674
675#
676# LED devices
677#
678# CONFIG_NEW_LEDS is not set
679
680#
681# LED drivers
682#
683
684#
685# LED Triggers
686#
687
688#
689# InfiniBand support
690#
691
692#
693# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
694#
695
696#
697# Real Time Clock
698#
699# CONFIG_RTC_CLASS is not set
700
701#
702# DMA Engine support
703#
704# CONFIG_DMA_ENGINE is not set
705
706#
707# DMA Clients
708#
709
710#
711# DMA Devices
712#
713
714#
715# Auxiliary Display support
716#
717
718#
719# Virtualization
720#
721
722#
723# File systems
724#
725CONFIG_EXT2_FS=y
726# CONFIG_EXT2_FS_XATTR is not set
727# CONFIG_EXT2_FS_XIP is not set
728# CONFIG_EXT3_FS is not set
729# CONFIG_EXT4DEV_FS is not set
730# CONFIG_REISERFS_FS is not set
731# CONFIG_JFS_FS is not set
732CONFIG_FS_POSIX_ACL=y
733# CONFIG_XFS_FS is not set
734# CONFIG_GFS2_FS is not set
735# CONFIG_OCFS2_FS is not set
736# CONFIG_MINIX_FS is not set
737# CONFIG_ROMFS_FS is not set
738CONFIG_INOTIFY=y
739CONFIG_INOTIFY_USER=y
740# CONFIG_QUOTA is not set
741CONFIG_DNOTIFY=y
742# CONFIG_AUTOFS_FS is not set
743# CONFIG_AUTOFS4_FS is not set
744CONFIG_FUSE_FS=y
745CONFIG_GENERIC_ACL=y
746
747#
748# CD-ROM/DVD Filesystems
749#
750# CONFIG_ISO9660_FS is not set
751# CONFIG_UDF_FS is not set
752
753#
754# DOS/FAT/NT Filesystems
755#
756# CONFIG_MSDOS_FS is not set
757# CONFIG_VFAT_FS is not set
758# CONFIG_NTFS_FS is not set
759
760#
761# Pseudo filesystems
762#
763CONFIG_PROC_FS=y
764CONFIG_PROC_KCORE=y
765CONFIG_PROC_SYSCTL=y
766CONFIG_SYSFS=y
767CONFIG_TMPFS=y
768CONFIG_TMPFS_POSIX_ACL=y
769# CONFIG_HUGETLB_PAGE is not set
770CONFIG_RAMFS=y
771CONFIG_CONFIGFS_FS=y
772
773#
774# Miscellaneous filesystems
775#
776# CONFIG_ADFS_FS is not set
777# CONFIG_AFFS_FS is not set
778# CONFIG_ECRYPT_FS is not set
779# CONFIG_HFS_FS is not set
780# CONFIG_HFSPLUS_FS is not set
781# CONFIG_BEFS_FS is not set
782# CONFIG_BFS_FS is not set
783# CONFIG_EFS_FS is not set
784# CONFIG_CRAMFS is not set
785# CONFIG_VXFS_FS is not set
786# CONFIG_HPFS_FS is not set
787# CONFIG_QNX4FS_FS is not set
788# CONFIG_SYSV_FS is not set
789# CONFIG_UFS_FS is not set
790
791#
792# Network File Systems
793#
794CONFIG_NFS_FS=y
795# CONFIG_NFS_V3 is not set
796# CONFIG_NFS_V4 is not set
797# CONFIG_NFS_DIRECTIO is not set
798CONFIG_NFSD=y
799# CONFIG_NFSD_V3 is not set
800# CONFIG_NFSD_TCP is not set
801CONFIG_ROOT_NFS=y
802CONFIG_LOCKD=y
803CONFIG_EXPORTFS=y
804CONFIG_NFS_COMMON=y
805CONFIG_SUNRPC=y
806# CONFIG_RPCSEC_GSS_KRB5 is not set
807# CONFIG_RPCSEC_GSS_SPKM3 is not set
808# CONFIG_SMB_FS is not set
809# CONFIG_CIFS is not set
810# CONFIG_NCP_FS is not set
811# CONFIG_CODA_FS is not set
812# CONFIG_AFS_FS is not set
813# CONFIG_9P_FS is not set
814
815#
816# Partition Types
817#
818# CONFIG_PARTITION_ADVANCED is not set
819CONFIG_MSDOS_PARTITION=y
820
821#
822# Native Language Support
823#
824# CONFIG_NLS is not set
825
826#
827# Distributed Lock Manager
828#
829CONFIG_DLM=y
830CONFIG_DLM_TCP=y
831# CONFIG_DLM_SCTP is not set
832# CONFIG_DLM_DEBUG is not set
833
834#
835# Profiling support
836#
837# CONFIG_PROFILING is not set
838
839#
840# Kernel hacking
841#
842CONFIG_TRACE_IRQFLAGS_SUPPORT=y
843# CONFIG_PRINTK_TIME is not set
844CONFIG_ENABLE_MUST_CHECK=y
845# CONFIG_MAGIC_SYSRQ is not set
846# CONFIG_UNUSED_SYMBOLS is not set
847# CONFIG_DEBUG_FS is not set
848# CONFIG_HEADERS_CHECK is not set
849# CONFIG_DEBUG_KERNEL is not set
850CONFIG_LOG_BUF_SHIFT=14
851CONFIG_CROSSCOMPILE=y
852CONFIG_CMDLINE=""
853CONFIG_SYS_SUPPORTS_KGDB=y
854
855#
856# Security options
857#
858CONFIG_KEYS=y
859CONFIG_KEYS_DEBUG_PROC_KEYS=y
860# CONFIG_SECURITY is not set
861
862#
863# Cryptographic options
864#
865CONFIG_CRYPTO=y
866CONFIG_CRYPTO_ALGAPI=y
867CONFIG_CRYPTO_BLKCIPHER=y
868CONFIG_CRYPTO_HASH=y
869CONFIG_CRYPTO_MANAGER=y
870CONFIG_CRYPTO_HMAC=y
871CONFIG_CRYPTO_XCBC=y
872CONFIG_CRYPTO_NULL=y
873CONFIG_CRYPTO_MD4=y
874CONFIG_CRYPTO_MD5=y
875CONFIG_CRYPTO_SHA1=y
876CONFIG_CRYPTO_SHA256=y
877CONFIG_CRYPTO_SHA512=y
878CONFIG_CRYPTO_WP512=y
879CONFIG_CRYPTO_TGR192=y
880CONFIG_CRYPTO_GF128MUL=y
881CONFIG_CRYPTO_ECB=y
882CONFIG_CRYPTO_CBC=y
883CONFIG_CRYPTO_PCBC=y
884CONFIG_CRYPTO_LRW=y
885CONFIG_CRYPTO_DES=y
886CONFIG_CRYPTO_FCRYPT=y
887CONFIG_CRYPTO_BLOWFISH=y
888CONFIG_CRYPTO_TWOFISH=y
889CONFIG_CRYPTO_TWOFISH_COMMON=y
890CONFIG_CRYPTO_SERPENT=y
891CONFIG_CRYPTO_AES=y
892CONFIG_CRYPTO_CAST5=y
893CONFIG_CRYPTO_CAST6=y
894CONFIG_CRYPTO_TEA=y
895CONFIG_CRYPTO_ARC4=y
896CONFIG_CRYPTO_KHAZAD=y
897CONFIG_CRYPTO_ANUBIS=y
898CONFIG_CRYPTO_DEFLATE=y
899CONFIG_CRYPTO_MICHAEL_MIC=y
900CONFIG_CRYPTO_CRC32C=y
901CONFIG_CRYPTO_CAMELLIA=y
902
903#
904# Hardware crypto devices
905#
906
907#
908# Library routines
909#
910CONFIG_BITREVERSE=y
911# CONFIG_CRC_CCITT is not set
912CONFIG_CRC16=y
913CONFIG_CRC32=y
914CONFIG_LIBCRC32C=y
915CONFIG_ZLIB_INFLATE=y
916CONFIG_ZLIB_DEFLATE=y
917CONFIG_PLIST=y
918CONFIG_HAS_IOMEM=y
919CONFIG_HAS_IOPORT=y
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 0028aef0af9d..d53fa8f8e099 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_PB1100=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 8a1d5888739c..dc4aa0c66847 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_PB1500=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index 5581ad2ca411..24428e13002b 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -33,12 +33,9 @@ CONFIG_MIPS_PB1550=y
33# CONFIG_WR_PPMC is not set 33# CONFIG_WR_PPMC is not set
34# CONFIG_MIPS_SIM is not set 34# CONFIG_MIPS_SIM is not set
35# CONFIG_MOMENCO_JAGUAR_ATX is not set 35# CONFIG_MOMENCO_JAGUAR_ATX is not set
36# CONFIG_MOMENCO_OCELOT is not set
37# CONFIG_MOMENCO_OCELOT_G is not set
38# CONFIG_MIPS_XXS1500 is not set 36# CONFIG_MIPS_XXS1500 is not set
39# CONFIG_PNX8550_JBS is not set 37# CONFIG_PNX8550_JBS is not set
40# CONFIG_PNX8550_STB810 is not set 38# CONFIG_PNX8550_STB810 is not set
41# CONFIG_DDB5477 is not set
42# CONFIG_MACH_VR41XX is not set 39# CONFIG_MACH_VR41XX is not set
43# CONFIG_PMC_YOSEMITE is not set 40# CONFIG_PMC_YOSEMITE is not set
44# CONFIG_QEMU is not set 41# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/pnx8550-jbs_defconfig b/arch/mips/configs/pnx8550-jbs_defconfig
index 821c1cee5639..f6906b069e04 100644
--- a/arch/mips/configs/pnx8550-jbs_defconfig
+++ b/arch/mips/configs/pnx8550-jbs_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38CONFIG_PNX8550_JBS=y 36CONFIG_PNX8550_JBS=y
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/pnx8550-stb810_defconfig b/arch/mips/configs/pnx8550-stb810_defconfig
index 0e8bd92b38cf..b741f81696fb 100644
--- a/arch/mips/configs/pnx8550-stb810_defconfig
+++ b/arch/mips/configs/pnx8550-stb810_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39CONFIG_PNX8550_STB810=y 37CONFIG_PNX8550_STB810=y
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/qemu_defconfig b/arch/mips/configs/qemu_defconfig
index 703de002e372..b3caf5125c15 100644
--- a/arch/mips/configs/qemu_defconfig
+++ b/arch/mips/configs/qemu_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43CONFIG_QEMU=y 40CONFIG_QEMU=y
diff --git a/arch/mips/configs/rbhma4200_defconfig b/arch/mips/configs/rbhma4200_defconfig
index 20a38526d483..9913980add21 100644
--- a/arch/mips/configs/rbhma4200_defconfig
+++ b/arch/mips/configs/rbhma4200_defconfig
@@ -30,11 +30,9 @@ CONFIG_MIPS=y
30# CONFIG_MIPS_SEAD is not set 30# CONFIG_MIPS_SEAD is not set
31# CONFIG_WR_PPMC is not set 31# CONFIG_WR_PPMC is not set
32# CONFIG_MIPS_SIM is not set 32# CONFIG_MIPS_SIM is not set
33# CONFIG_MOMENCO_OCELOT is not set
34# CONFIG_MIPS_XXS1500 is not set 33# CONFIG_MIPS_XXS1500 is not set
35# CONFIG_PNX8550_JBS is not set 34# CONFIG_PNX8550_JBS is not set
36# CONFIG_PNX8550_STB810 is not set 35# CONFIG_PNX8550_STB810 is not set
37# CONFIG_DDB5477 is not set
38# CONFIG_MACH_VR41XX is not set 36# CONFIG_MACH_VR41XX is not set
39# CONFIG_PMC_YOSEMITE is not set 37# CONFIG_PMC_YOSEMITE is not set
40# CONFIG_QEMU is not set 38# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/rbhma4500_defconfig b/arch/mips/configs/rbhma4500_defconfig
index 5dbb250f71c7..40453cd7c70e 100644
--- a/arch/mips/configs/rbhma4500_defconfig
+++ b/arch/mips/configs/rbhma4500_defconfig
@@ -20,10 +20,8 @@ CONFIG_ZONE_DMA=y
20# CONFIG_MIPS_SEAD is not set 20# CONFIG_MIPS_SEAD is not set
21# CONFIG_WR_PPMC is not set 21# CONFIG_WR_PPMC is not set
22# CONFIG_MIPS_SIM is not set 22# CONFIG_MIPS_SIM is not set
23# CONFIG_MOMENCO_OCELOT is not set
24# CONFIG_PNX8550_JBS is not set 23# CONFIG_PNX8550_JBS is not set
25# CONFIG_PNX8550_STB810 is not set 24# CONFIG_PNX8550_STB810 is not set
26# CONFIG_DDB5477 is not set
27# CONFIG_MACH_VR41XX is not set 25# CONFIG_MACH_VR41XX is not set
28# CONFIG_PMC_MSP is not set 26# CONFIG_PMC_MSP is not set
29# CONFIG_PMC_YOSEMITE is not set 27# CONFIG_PMC_YOSEMITE is not set
diff --git a/arch/mips/configs/rm200_defconfig b/arch/mips/configs/rm200_defconfig
index a5dc5cb97aae..fc388118b114 100644
--- a/arch/mips/configs/rm200_defconfig
+++ b/arch/mips/configs/rm200_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/sb1250-swarm_defconfig b/arch/mips/configs/sb1250-swarm_defconfig
index 98a914092258..e72fdf36b3fe 100644
--- a/arch/mips/configs/sb1250-swarm_defconfig
+++ b/arch/mips/configs/sb1250-swarm_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/sead_defconfig b/arch/mips/configs/sead_defconfig
index 69c08b24c82a..2b6282d132a8 100644
--- a/arch/mips/configs/sead_defconfig
+++ b/arch/mips/configs/sead_defconfig
@@ -32,12 +32,9 @@ CONFIG_MIPS_SEAD=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/tb0219_defconfig b/arch/mips/configs/tb0219_defconfig
index 5d4fc0e4f729..e9f2cef4c716 100644
--- a/arch/mips/configs/tb0219_defconfig
+++ b/arch/mips/configs/tb0219_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/tb0226_defconfig b/arch/mips/configs/tb0226_defconfig
index 1b92b48de051..aea67568842a 100644
--- a/arch/mips/configs/tb0226_defconfig
+++ b/arch/mips/configs/tb0226_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/tb0287_defconfig b/arch/mips/configs/tb0287_defconfig
index 5b77c7a5d83a..66383ecff200 100644
--- a/arch/mips/configs/tb0287_defconfig
+++ b/arch/mips/configs/tb0287_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/workpad_defconfig b/arch/mips/configs/workpad_defconfig
index 94a4f94a8b24..db6fd4f15719 100644
--- a/arch/mips/configs/workpad_defconfig
+++ b/arch/mips/configs/workpad_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41CONFIG_MACH_VR41XX=y 38CONFIG_MACH_VR41XX=y
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/wrppmc_defconfig b/arch/mips/configs/wrppmc_defconfig
index e38bd9b0eadc..7e410e10fed7 100644
--- a/arch/mips/configs/wrppmc_defconfig
+++ b/arch/mips/configs/wrppmc_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32CONFIG_WR_PPMC=y 32CONFIG_WR_PPMC=y
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/configs/yosemite_defconfig b/arch/mips/configs/yosemite_defconfig
index f342d8c887b8..acaf0e21bb00 100644
--- a/arch/mips/configs/yosemite_defconfig
+++ b/arch/mips/configs/yosemite_defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42CONFIG_PMC_YOSEMITE=y 39CONFIG_PMC_YOSEMITE=y
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/ddb5xxx/Kconfig b/arch/mips/ddb5xxx/Kconfig
deleted file mode 100644
index e9b5de49f4c2..000000000000
--- a/arch/mips/ddb5xxx/Kconfig
+++ /dev/null
@@ -1,4 +0,0 @@
1config DDB5477_BUS_FREQUENCY
2 int "bus frequency (in kHZ, 0 for auto-detect)"
3 depends on DDB5477
4 default 0
diff --git a/arch/mips/ddb5xxx/common/Makefile b/arch/mips/ddb5xxx/common/Makefile
deleted file mode 100644
index bc44e3032711..000000000000
--- a/arch/mips/ddb5xxx/common/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the common code of NEC DDB-Vrc5xxx board
3#
4
5obj-y += nile4.o prom.o rtc_ds1386.o
diff --git a/arch/mips/ddb5xxx/common/nile4.c b/arch/mips/ddb5xxx/common/nile4.c
deleted file mode 100644
index 7ec7d903ba97..000000000000
--- a/arch/mips/ddb5xxx/common/nile4.c
+++ /dev/null
@@ -1,130 +0,0 @@
1/*
2 *
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: jsun@mvista.com or jsun@junsun.net
5 *
6 * arch/mips/ddb5xxx/common/nile4.c
7 * misc low-level routines for vrc-5xxx controllers.
8 *
9 * derived from original code by Geert Uytterhoeven <geert@sonycom.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16#include <linux/types.h>
17#include <linux/kernel.h>
18
19#include <asm/ddb5xxx/ddb5xxx.h>
20
21u32
22ddb_calc_pdar(u32 phys, u32 size, int width,
23 int on_memory_bus, int pci_visible)
24{
25 u32 maskbits;
26 u32 widthbits;
27
28 switch (size) {
29#if 0 /* We don't support 4 GB yet */
30 case 0x100000000: /* 4 GB */
31 maskbits = 4;
32 break;
33#endif
34 case 0x80000000: /* 2 GB */
35 maskbits = 5;
36 break;
37 case 0x40000000: /* 1 GB */
38 maskbits = 6;
39 break;
40 case 0x20000000: /* 512 MB */
41 maskbits = 7;
42 break;
43 case 0x10000000: /* 256 MB */
44 maskbits = 8;
45 break;
46 case 0x08000000: /* 128 MB */
47 maskbits = 9;
48 break;
49 case 0x04000000: /* 64 MB */
50 maskbits = 10;
51 break;
52 case 0x02000000: /* 32 MB */
53 maskbits = 11;
54 break;
55 case 0x01000000: /* 16 MB */
56 maskbits = 12;
57 break;
58 case 0x00800000: /* 8 MB */
59 maskbits = 13;
60 break;
61 case 0x00400000: /* 4 MB */
62 maskbits = 14;
63 break;
64 case 0x00200000: /* 2 MB */
65 maskbits = 15;
66 break;
67 case 0: /* OFF */
68 maskbits = 0;
69 break;
70 default:
71 panic("nile4_set_pdar: unsupported size %p", (void *) size);
72 }
73 switch (width) {
74 case 8:
75 widthbits = 0;
76 break;
77 case 16:
78 widthbits = 1;
79 break;
80 case 32:
81 widthbits = 2;
82 break;
83 case 64:
84 widthbits = 3;
85 break;
86 default:
87 panic("nile4_set_pdar: unsupported width %d", width);
88 }
89
90 return maskbits | (on_memory_bus ? 0x10 : 0) |
91 (pci_visible ? 0x20 : 0) | (widthbits << 6) |
92 (phys & 0xffe00000);
93}
94
95void
96ddb_set_pdar(u32 pdar, u32 phys, u32 size, int width,
97 int on_memory_bus, int pci_visible)
98{
99 u32 temp= ddb_calc_pdar(phys, size, width, on_memory_bus, pci_visible);
100 ddb_out32(pdar, temp);
101 ddb_out32(pdar + 4, 0);
102
103 /*
104 * When programming a PDAR, the register should be read immediately
105 * after writing it. This ensures that address decoders are properly
106 * configured.
107 * [jsun] is this really necessary?
108 */
109 ddb_in32(pdar);
110 ddb_in32(pdar + 4);
111}
112
113/*
114 * routines that mess with PCIINITx registers
115 */
116
117void ddb_set_pmr(u32 pmr, u32 type, u32 addr, u32 options)
118{
119 switch (type) {
120 case DDB_PCICMD_IACK: /* PCI Interrupt Acknowledge */
121 case DDB_PCICMD_IO: /* PCI I/O Space */
122 case DDB_PCICMD_MEM: /* PCI Memory Space */
123 case DDB_PCICMD_CFG: /* PCI Configuration Space */
124 break;
125 default:
126 panic("nile4_set_pmr: invalid type %d", type);
127 }
128 ddb_out32(pmr, (type << 1) | (addr & 0xffe00000) | options );
129 ddb_out32(pmr + 4, 0);
130}
diff --git a/arch/mips/ddb5xxx/common/prom.c b/arch/mips/ddb5xxx/common/prom.c
deleted file mode 100644
index 54a857b5e3ba..000000000000
--- a/arch/mips/ddb5xxx/common/prom.c
+++ /dev/null
@@ -1,132 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/init.h>
11#include <linux/mm.h>
12#include <linux/sched.h>
13#include <linux/bootmem.h>
14
15#include <asm/addrspace.h>
16#include <asm/bootinfo.h>
17#include <asm/ddb5xxx/ddb5xxx.h>
18#include <asm/debug.h>
19
20const char *get_system_type(void)
21{
22 switch (mips_machtype) {
23 case MACH_NEC_DDB5477: return "NEC DDB Vrc-5477";
24 case MACH_NEC_ROCKHOPPER: return "NEC Rockhopper";
25 case MACH_NEC_ROCKHOPPERII: return "NEC RockhopperII";
26 default: return "Unknown NEC board";
27 }
28}
29
30#if defined(CONFIG_DDB5477)
31void ddb5477_runtime_detection(void);
32#endif
33
34/* [jsun@junsun.net] PMON passes arguments in C main() style */
35void __init prom_init(void)
36{
37 int argc = fw_arg0;
38 char **arg = (char**) fw_arg1;
39 int i;
40
41 /* if user passes kernel args, ignore the default one */
42 if (argc > 1)
43 arcs_cmdline[0] = '\0';
44
45 /* arg[0] is "g", the rest is boot parameters */
46 for (i = 1; i < argc; i++) {
47 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
48 >= sizeof(arcs_cmdline))
49 break;
50 strcat(arcs_cmdline, arg[i]);
51 strcat(arcs_cmdline, " ");
52 }
53
54 mips_machgroup = MACH_GROUP_NEC_DDB;
55
56#if defined(CONFIG_DDB5477)
57 ddb5477_runtime_detection();
58 add_memory_region(0, board_ram_size, BOOT_MEM_RAM);
59#endif
60}
61
62void __init prom_free_prom_memory(void)
63{
64}
65
66#if defined(CONFIG_DDB5477)
67
68#define DEFAULT_LCS1_BASE 0x19000000
69#define TESTVAL1 'K'
70#define TESTVAL2 'S'
71
72int board_ram_size;
73void ddb5477_runtime_detection(void)
74{
75 volatile char *test_offset;
76 char saved_test_byte;
77
78 /* Determine if this is a DDB5477 board, or a BSB-VR0300
79 base board. We can tell by checking for the location of
80 the NVRAM. It lives at the beginning of LCS1 on the DDB5477,
81 and the beginning of LCS1 on the BSB-VR0300 is flash memory.
82 The first 2K of the NVRAM are reserved, so don't we'll poke
83 around just after that.
84 */
85
86 /* We can only use the PCI bus to distinquish between
87 the Rockhopper and RockhopperII backplanes and this must
88 wait until ddb5477_board_init() in setup.c after the 5477
89 is initialized. So, until then handle
90 both Rockhopper and RockhopperII backplanes as Rockhopper 1
91 */
92
93 test_offset = (char *)KSEG1ADDR(DEFAULT_LCS1_BASE + 0x800);
94 saved_test_byte = *test_offset;
95
96 *test_offset = TESTVAL1;
97 if (*test_offset != TESTVAL1) {
98 /* We couldn't set our test value, so it must not be NVRAM,
99 so it's a BSB_VR0300 */
100 mips_machtype = MACH_NEC_ROCKHOPPER;
101 } else {
102 /* We may have gotten lucky, and the TESTVAL1 was already
103 stored at the test location, so we must check a second
104 test value */
105 *test_offset = TESTVAL2;
106 if (*test_offset != TESTVAL2) {
107 /* OK, we couldn't set this value either, so it must
108 definately be a BSB_VR0300 */
109 mips_machtype = MACH_NEC_ROCKHOPPER;
110 } else {
111 /* We could change the value twice, so it must be
112 NVRAM, so it's a DDB_VRC5477 */
113 mips_machtype = MACH_NEC_DDB5477;
114 }
115 }
116 /* Restore the original byte */
117 *test_offset = saved_test_byte;
118
119 /* before we know a better way, we will trust PMON for getting
120 * RAM size
121 */
122 board_ram_size = 1 << (36 - (ddb_in32(DDB_SDRAM0) & 0xf));
123
124 db_run(printk("DDB run-time detection : %s, %d MB RAM\n",
125 mips_machtype == MACH_NEC_DDB5477 ?
126 "DDB5477" : "Rockhopper",
127 board_ram_size >> 20));
128
129 /* we can't handle ram size > 128 MB */
130 db_assert(board_ram_size <= (128 << 20));
131}
132#endif
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
deleted file mode 100644
index 5dc34daa7150..000000000000
--- a/arch/mips/ddb5xxx/common/rtc_ds1386.c
+++ /dev/null
@@ -1,170 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/common/rtc_ds1386.c
6 * low-level RTC hookups for s for Dallas 1396 chip.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14
15/*
16 * This file exports a function, rtc_ds1386_init(), which expects an
17 * uncached base address as the argument. It will set the two function
18 * pointers expected by the MIPS generic timer code.
19 */
20
21#include <linux/types.h>
22#include <linux/time.h>
23#include <linux/bcd.h>
24
25#include <asm/time.h>
26#include <asm/addrspace.h>
27
28#include <asm/mc146818rtc.h>
29#include <asm/debug.h>
30
31#define EPOCH 2000
32
33#define READ_RTC(x) *(volatile unsigned char*)(rtc_base+x)
34#define WRITE_RTC(x, y) *(volatile unsigned char*)(rtc_base+x) = y
35
36static unsigned long rtc_base;
37
38static unsigned long
39rtc_ds1386_get_time(void)
40{
41 u8 byte;
42 u8 temp;
43 unsigned int year, month, day, hour, minute, second;
44 unsigned long flags;
45
46 spin_lock_irqsave(&rtc_lock, flags);
47 /* let us freeze external registers */
48 byte = READ_RTC(0xB);
49 byte &= 0x3f;
50 WRITE_RTC(0xB, byte);
51
52 /* read time data */
53 year = BCD2BIN(READ_RTC(0xA)) + EPOCH;
54 month = BCD2BIN(READ_RTC(0x9) & 0x1f);
55 day = BCD2BIN(READ_RTC(0x8));
56 minute = BCD2BIN(READ_RTC(0x2));
57 second = BCD2BIN(READ_RTC(0x1));
58
59 /* hour is special - deal with it later */
60 temp = READ_RTC(0x4);
61
62 /* enable time transfer */
63 byte |= 0x80;
64 WRITE_RTC(0xB, byte);
65 spin_unlock_irqrestore(&rtc_lock, flags);
66
67 /* calc hour */
68 if (temp & 0x40) {
69 /* 12 hour format */
70 hour = BCD2BIN(temp & 0x1f);
71 if (temp & 0x20) hour += 12; /* PM */
72 } else {
73 /* 24 hour format */
74 hour = BCD2BIN(temp & 0x3f);
75 }
76
77 return mktime(year, month, day, hour, minute, second);
78}
79
80static int
81rtc_ds1386_set_time(unsigned long t)
82{
83 struct rtc_time tm;
84 u8 byte;
85 u8 temp;
86 u8 year, month, day, hour, minute, second;
87 unsigned long flags;
88
89 spin_lock_irqsave(&rtc_lock, flags);
90 /* let us freeze external registers */
91 byte = READ_RTC(0xB);
92 byte &= 0x3f;
93 WRITE_RTC(0xB, byte);
94
95 /* convert */
96 to_tm(t, &tm);
97
98
99 /* check each field one by one */
100 year = BIN2BCD(tm.tm_year - EPOCH);
101 if (year != READ_RTC(0xA)) {
102 WRITE_RTC(0xA, year);
103 }
104
105 temp = READ_RTC(0x9);
106 month = BIN2BCD(tm.tm_mon+1); /* tm_mon starts from 0 to 11 */
107 if (month != (temp & 0x1f)) {
108 WRITE_RTC( 0x9,
109 (month & 0x1f) | (temp & ~0x1f) );
110 }
111
112 day = BIN2BCD(tm.tm_mday);
113 if (day != READ_RTC(0x8)) {
114 WRITE_RTC(0x8, day);
115 }
116
117 temp = READ_RTC(0x4);
118 if (temp & 0x40) {
119 /* 12 hour format */
120 hour = 0x40;
121 if (tm.tm_hour > 12) {
122 hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f);
123 } else {
124 hour |= BIN2BCD(tm.tm_hour);
125 }
126 } else {
127 /* 24 hour format */
128 hour = BIN2BCD(tm.tm_hour) & 0x3f;
129 }
130 if (hour != temp) WRITE_RTC(0x4, hour);
131
132 minute = BIN2BCD(tm.tm_min);
133 if (minute != READ_RTC(0x2)) {
134 WRITE_RTC(0x2, minute);
135 }
136
137 second = BIN2BCD(tm.tm_sec);
138 if (second != READ_RTC(0x1)) {
139 WRITE_RTC(0x1, second);
140 }
141 spin_unlock_irqrestore(&rtc_lock, flags);
142
143 return 0;
144}
145
146void
147rtc_ds1386_init(unsigned long base)
148{
149 unsigned char byte;
150
151 /* remember the base */
152 rtc_base = base;
153 db_assert((rtc_base & 0xe0000000) == KSEG1);
154
155 /* turn on RTC if it is not on */
156 byte = READ_RTC(0x9);
157 if (byte & 0x80) {
158 byte &= 0x7f;
159 WRITE_RTC(0x9, byte);
160 }
161
162 /* enable time transfer */
163 byte = READ_RTC(0xB);
164 byte |= 0x80;
165 WRITE_RTC(0xB, byte);
166
167 /* set the function pointers */
168 rtc_mips_get_time = rtc_ds1386_get_time;
169 rtc_mips_set_time = rtc_ds1386_set_time;
170}
diff --git a/arch/mips/ddb5xxx/ddb5477/Makefile b/arch/mips/ddb5xxx/ddb5477/Makefile
deleted file mode 100644
index 4864b8a659c7..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/Makefile
+++ /dev/null
@@ -1,9 +0,0 @@
1#
2# Makefile for NEC DDB-Vrc5477 board
3#
4
5obj-y += ddb5477-platform.o irq.o irq_5477.o setup.o \
6 lcd44780.o
7
8obj-$(CONFIG_RUNTIME_DEBUG) += debug.o
9obj-$(CONFIG_KGDB) += kgdb_io.o
diff --git a/arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c b/arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c
deleted file mode 100644
index c16020ad54c2..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c
+++ /dev/null
@@ -1,49 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7 */
8#include <linux/init.h>
9#include <linux/module.h>
10#include <linux/serial_8250.h>
11
12#include <asm/ddb5xxx/ddb5477.h>
13
14#define DDB_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
15
16#define DDB5477_PORT(base, int) \
17{ \
18 .mapbase = base, \
19 .irq = int, \
20 .uartclk = 1843200, \
21 .iotype = UPIO_MEM, \
22 .flags = DDB_UART_FLAGS, \
23 .regshift = 3, \
24}
25
26static struct plat_serial8250_port uart8250_data[] = {
27 DDB5477_PORT(0xbfa04200, VRC5477_IRQ_UART0),
28 DDB5477_PORT(0xbfa04240, VRC5477_IRQ_UART1),
29 { },
30};
31
32static struct platform_device uart8250_device = {
33 .name = "serial8250",
34 .id = PLAT8250_DEV_PLATFORM,
35 .dev = {
36 .platform_data = uart8250_data,
37 },
38};
39
40static int __init uart8250_init(void)
41{
42 return platform_device_register(&uart8250_device);
43}
44
45module_init(uart8250_init);
46
47MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
48MODULE_LICENSE("GPL");
49MODULE_DESCRIPTION("8250 UART probe driver for the NEC DDB5477");
diff --git a/arch/mips/ddb5xxx/ddb5477/debug.c b/arch/mips/ddb5xxx/ddb5477/debug.c
deleted file mode 100644
index 68919d5f8ffd..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/debug.c
+++ /dev/null
@@ -1,160 +0,0 @@
1/***********************************************************************
2 *
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: jsun@mvista.com or jsun@junsun.net
5 *
6 * arch/mips/ddb5xxx/ddb5477/debug.c
7 * vrc5477 specific debug routines.
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 ***********************************************************************
15 */
16
17#include <linux/kernel.h>
18
19#include <asm/mipsregs.h>
20#include <asm/ddb5xxx/ddb5xxx.h>
21
22typedef struct {
23 const char *regname;
24 unsigned regaddr;
25} Register;
26
27void jsun_show_regs(char *name, Register *regs)
28{
29 int i;
30
31 printk("\nshow regs: %s\n", name);
32 for(i=0;regs[i].regname!= NULL; i++) {
33 printk("%-16s= %08x\t\t(@%08x)\n",
34 regs[i].regname,
35 *(unsigned *)(regs[i].regaddr),
36 regs[i].regaddr);
37 }
38}
39
40static Register int_regs[] = {
41 {"DDB_INTCTRL0", DDB_BASE + DDB_INTCTRL0},
42 {"DDB_INTCTRL1", DDB_BASE + DDB_INTCTRL1},
43 {"DDB_INTCTRL2", DDB_BASE + DDB_INTCTRL2},
44 {"DDB_INTCTRL3", DDB_BASE + DDB_INTCTRL3},
45 {"DDB_INT0STAT", DDB_BASE + DDB_INT0STAT},
46 {"DDB_INT1STAT", DDB_BASE + DDB_INT1STAT},
47 {"DDB_INT2STAT", DDB_BASE + DDB_INT2STAT},
48 {"DDB_INT3STAT", DDB_BASE + DDB_INT3STAT},
49 {"DDB_INT4STAT", DDB_BASE + DDB_INT4STAT},
50 {"DDB_NMISTAT", DDB_BASE + DDB_NMISTAT},
51 {"DDB_INTPPES0", DDB_BASE + DDB_INTPPES0},
52 {"DDB_INTPPES1", DDB_BASE + DDB_INTPPES1},
53 {NULL, 0x0}
54};
55
56void vrc5477_show_int_regs()
57{
58 jsun_show_regs("interrupt registers", int_regs);
59 printk("CPU CAUSE = %08x\n", read_c0_cause());
60 printk("CPU STATUS = %08x\n", read_c0_status());
61}
62static Register pdar_regs[] = {
63 {"DDB_SDRAM0", DDB_BASE + DDB_SDRAM0},
64 {"DDB_SDRAM1", DDB_BASE + DDB_SDRAM1},
65 {"DDB_LCS0", DDB_BASE + DDB_LCS0},
66 {"DDB_LCS1", DDB_BASE + DDB_LCS1},
67 {"DDB_LCS2", DDB_BASE + DDB_LCS2},
68 {"DDB_INTCS", DDB_BASE + DDB_INTCS},
69 {"DDB_BOOTCS", DDB_BASE + DDB_BOOTCS},
70 {"DDB_PCIW0", DDB_BASE + DDB_PCIW0},
71 {"DDB_PCIW1", DDB_BASE + DDB_PCIW1},
72 {"DDB_IOPCIW0", DDB_BASE + DDB_IOPCIW0},
73 {"DDB_IOPCIW1", DDB_BASE + DDB_IOPCIW1},
74 {NULL, 0x0}
75};
76void vrc5477_show_pdar_regs(void)
77{
78 jsun_show_regs("PDAR regs", pdar_regs);
79}
80
81static Register bar_regs[] = {
82 {"DDB_BARC0", DDB_BASE + DDB_BARC0},
83 {"DDB_BARM010", DDB_BASE + DDB_BARM010},
84 {"DDB_BARM230", DDB_BASE + DDB_BARM230},
85 {"DDB_BAR00", DDB_BASE + DDB_BAR00},
86 {"DDB_BAR10", DDB_BASE + DDB_BAR10},
87 {"DDB_BAR20", DDB_BASE + DDB_BAR20},
88 {"DDB_BAR30", DDB_BASE + DDB_BAR30},
89 {"DDB_BAR40", DDB_BASE + DDB_BAR40},
90 {"DDB_BAR50", DDB_BASE + DDB_BAR50},
91 {"DDB_BARB0", DDB_BASE + DDB_BARB0},
92 {"DDB_BARC1", DDB_BASE + DDB_BARC1},
93 {"DDB_BARM011", DDB_BASE + DDB_BARM011},
94 {"DDB_BARM231", DDB_BASE + DDB_BARM231},
95 {"DDB_BAR01", DDB_BASE + DDB_BAR01},
96 {"DDB_BAR11", DDB_BASE + DDB_BAR11},
97 {"DDB_BAR21", DDB_BASE + DDB_BAR21},
98 {"DDB_BAR31", DDB_BASE + DDB_BAR31},
99 {"DDB_BAR41", DDB_BASE + DDB_BAR41},
100 {"DDB_BAR51", DDB_BASE + DDB_BAR51},
101 {"DDB_BARB1", DDB_BASE + DDB_BARB1},
102 {NULL, 0x0}
103};
104void vrc5477_show_bar_regs(void)
105{
106 jsun_show_regs("BAR regs", bar_regs);
107}
108
109static Register pci_regs[] = {
110 {"DDB_PCIW0", DDB_BASE + DDB_PCIW0},
111 {"DDB_PCIW1", DDB_BASE + DDB_PCIW1},
112 {"DDB_PCIINIT00", DDB_BASE + DDB_PCIINIT00},
113 {"DDB_PCIINIT10", DDB_BASE + DDB_PCIINIT10},
114 {"DDB_PCICTL0_L", DDB_BASE + DDB_PCICTL0_L},
115 {"DDB_PCICTL0_H", DDB_BASE + DDB_PCICTL0_H},
116 {"DDB_PCIARB0_L", DDB_BASE + DDB_PCIARB0_L},
117 {"DDB_PCIARB0_H", DDB_BASE + DDB_PCIARB0_H},
118 {"DDB_PCISWP0", DDB_BASE + DDB_PCISWP0},
119 {"DDB_PCIERR0", DDB_BASE + DDB_PCIERR0},
120 {"DDB_IOPCIW0", DDB_BASE + DDB_IOPCIW0},
121 {"DDB_IOPCIW1", DDB_BASE + DDB_IOPCIW1},
122 {"DDB_PCIINIT01", DDB_BASE + DDB_PCIINIT01},
123 {"DDB_PCIINIT11", DDB_BASE + DDB_PCIINIT11},
124 {"DDB_PCICTL1_L", DDB_BASE + DDB_PCICTL1_L},
125 {"DDB_PCICTL1_H", DDB_BASE + DDB_PCICTL1_H},
126 {"DDB_PCIARB1_L", DDB_BASE + DDB_PCIARB1_L},
127 {"DDB_PCIARB1_H", DDB_BASE + DDB_PCIARB1_H},
128 {"DDB_PCISWP1", DDB_BASE + DDB_PCISWP1},
129 {"DDB_PCIERR1", DDB_BASE + DDB_PCIERR1},
130 {NULL, 0x0}
131};
132void vrc5477_show_pci_regs(void)
133{
134 jsun_show_regs("PCI regs", pci_regs);
135}
136
137static Register lb_regs[] = {
138 {"DDB_LCNFG", DDB_BASE + DDB_LCNFG},
139 {"DDB_LCST0", DDB_BASE + DDB_LCST0},
140 {"DDB_LCST1", DDB_BASE + DDB_LCST1},
141 {"DDB_LCST2", DDB_BASE + DDB_LCST2},
142 {"DDB_ERRADR", DDB_BASE + DDB_ERRADR},
143 {"DDB_ERRCS", DDB_BASE + DDB_ERRCS},
144 {"DDB_BTM", DDB_BASE + DDB_BTM},
145 {"DDB_BCST", DDB_BASE + DDB_BCST},
146 {NULL, 0x0}
147};
148void vrc5477_show_lb_regs(void)
149{
150 jsun_show_regs("Local Bus regs", lb_regs);
151}
152
153void vrc5477_show_all_regs(void)
154{
155 vrc5477_show_pdar_regs();
156 vrc5477_show_pci_regs();
157 vrc5477_show_bar_regs();
158 vrc5477_show_int_regs();
159 vrc5477_show_lb_regs();
160}
diff --git a/arch/mips/ddb5xxx/ddb5477/irq.c b/arch/mips/ddb5xxx/ddb5477/irq.c
deleted file mode 100644
index faa4a506bf82..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/irq.c
+++ /dev/null
@@ -1,209 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5477/irq.c
6 * The irq setup and misc routines for DDB5476.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/init.h>
14#include <linux/interrupt.h>
15#include <linux/irq.h>
16#include <linux/types.h>
17#include <linux/ptrace.h>
18
19#include <asm/i8259.h>
20#include <asm/irq_cpu.h>
21#include <asm/system.h>
22#include <asm/mipsregs.h>
23#include <asm/debug.h>
24#include <asm/addrspace.h>
25#include <asm/bootinfo.h>
26
27#include <asm/ddb5xxx/ddb5xxx.h>
28
29
30/*
31 * IRQ mapping
32 *
33 * 0-7: 8 CPU interrupts
34 * 0 - software interrupt 0
35 * 1 - software interrupt 1
36 * 2 - most Vrc5477 interrupts are routed to this pin
37 * 3 - (optional) some other interrupts routed to this pin for debugg
38 * 4 - not used
39 * 5 - not used
40 * 6 - not used
41 * 7 - cpu timer (used by default)
42 *
43 * 8-39: 32 Vrc5477 interrupt sources
44 * (refer to the Vrc5477 manual)
45 */
46
47#define PCI0 DDB_INTPPES0
48#define PCI1 DDB_INTPPES1
49
50#define ACTIVE_LOW 1
51#define ACTIVE_HIGH 0
52
53#define LEVEL_SENSE 2
54#define EDGE_TRIGGER 0
55
56#define INTA 0
57#define INTB 1
58#define INTC 2
59#define INTD 3
60#define INTE 4
61
62static inline void
63set_pci_int_attr(u32 pci, u32 intn, u32 active, u32 trigger)
64{
65 u32 reg_value;
66 u32 reg_bitmask;
67
68 reg_value = ddb_in32(pci);
69 reg_bitmask = 0x3 << (intn * 2);
70
71 reg_value &= ~reg_bitmask;
72 reg_value |= (active | trigger) << (intn * 2);
73 ddb_out32(pci, reg_value);
74}
75
76extern void vrc5477_irq_init(u32 base);
77static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
78
79void __init arch_init_irq(void)
80{
81 /* by default, we disable all interrupts and route all vrc5477
82 * interrupts to pin 0 (irq 2) */
83 ddb_out32(DDB_INTCTRL0, 0);
84 ddb_out32(DDB_INTCTRL1, 0);
85 ddb_out32(DDB_INTCTRL2, 0);
86 ddb_out32(DDB_INTCTRL3, 0);
87
88 clear_c0_status(0xff00);
89 set_c0_status(0x0400);
90
91 /* setup PCI interrupt attributes */
92 set_pci_int_attr(PCI0, INTA, ACTIVE_LOW, LEVEL_SENSE);
93 set_pci_int_attr(PCI0, INTB, ACTIVE_LOW, LEVEL_SENSE);
94 if (mips_machtype == MACH_NEC_ROCKHOPPERII)
95 set_pci_int_attr(PCI0, INTC, ACTIVE_HIGH, LEVEL_SENSE);
96 else
97 set_pci_int_attr(PCI0, INTC, ACTIVE_LOW, LEVEL_SENSE);
98 set_pci_int_attr(PCI0, INTD, ACTIVE_LOW, LEVEL_SENSE);
99 set_pci_int_attr(PCI0, INTE, ACTIVE_LOW, LEVEL_SENSE);
100
101 set_pci_int_attr(PCI1, INTA, ACTIVE_LOW, LEVEL_SENSE);
102 set_pci_int_attr(PCI1, INTB, ACTIVE_LOW, LEVEL_SENSE);
103 set_pci_int_attr(PCI1, INTC, ACTIVE_LOW, LEVEL_SENSE);
104 set_pci_int_attr(PCI1, INTD, ACTIVE_LOW, LEVEL_SENSE);
105 set_pci_int_attr(PCI1, INTE, ACTIVE_LOW, LEVEL_SENSE);
106
107 /*
108 * for debugging purpose, we enable several error interrupts
109 * and route them to pin 1. (IP3)
110 */
111 /* cpu parity check - 0 */
112 ll_vrc5477_irq_route(0, 1); ll_vrc5477_irq_enable(0);
113 /* cpu no-target decode - 1 */
114 ll_vrc5477_irq_route(1, 1); ll_vrc5477_irq_enable(1);
115 /* local bus read time-out - 7 */
116 ll_vrc5477_irq_route(7, 1); ll_vrc5477_irq_enable(7);
117 /* PCI SERR# - 14 */
118 ll_vrc5477_irq_route(14, 1); ll_vrc5477_irq_enable(14);
119 /* PCI internal error - 15 */
120 ll_vrc5477_irq_route(15, 1); ll_vrc5477_irq_enable(15);
121 /* IOPCI SERR# - 30 */
122 ll_vrc5477_irq_route(30, 1); ll_vrc5477_irq_enable(30);
123 /* IOPCI internal error - 31 */
124 ll_vrc5477_irq_route(31, 1); ll_vrc5477_irq_enable(31);
125
126 /* init all controllers */
127 init_i8259_irqs();
128 mips_cpu_irq_init();
129 vrc5477_irq_init(VRC5477_IRQ_BASE);
130
131
132 /* setup cascade interrupts */
133 setup_irq(VRC5477_IRQ_BASE + VRC5477_I8259_CASCADE, &irq_cascade);
134 setup_irq(CPU_IRQ_BASE + CPU_VRC5477_CASCADE, &irq_cascade);
135}
136
137u8 i8259_interrupt_ack(void)
138{
139 u8 irq;
140 u32 reg;
141
142 /* Set window 0 for interrupt acknowledge */
143 reg = ddb_in32(DDB_PCIINIT10);
144
145 ddb_set_pmr(DDB_PCIINIT10, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
146 irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
147 ddb_out32(DDB_PCIINIT10, reg);
148
149 return irq;
150}
151/*
152 * the first level int-handler will jump here if it is a vrc5477 irq
153 */
154#define NUM_5477_IRQS 32
155static void vrc5477_irq_dispatch(void)
156{
157 u32 intStatus;
158 u32 bitmask;
159 u32 i;
160
161 db_assert(ddb_in32(DDB_INT2STAT) == 0);
162 db_assert(ddb_in32(DDB_INT3STAT) == 0);
163 db_assert(ddb_in32(DDB_INT4STAT) == 0);
164 db_assert(ddb_in32(DDB_NMISTAT) == 0);
165
166 if (ddb_in32(DDB_INT1STAT) != 0) {
167#if defined(CONFIG_RUNTIME_DEBUG)
168 vrc5477_show_int_regs();
169#endif
170 panic("error interrupt has happened.");
171 }
172
173 intStatus = ddb_in32(DDB_INT0STAT);
174
175 if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
176 /* check for i8259 interrupts */
177 if (intStatus & (1 << VRC5477_I8259_CASCADE)) {
178 int i8259_irq = i8259_interrupt_ack();
179 do_IRQ(i8259_irq);
180 return;
181 }
182 }
183
184 for (i=0, bitmask=1; i<= NUM_5477_IRQS; bitmask <<=1, i++) {
185 /* do we need to "and" with the int mask? */
186 if (intStatus & bitmask) {
187 do_IRQ(VRC5477_IRQ_BASE + i);
188 return;
189 }
190 }
191}
192
193#define VR5477INTS (STATUSF_IP2|STATUSF_IP3|STATUSF_IP4|STATUSF_IP5|STATUSF_IP6)
194
195asmlinkage void plat_irq_dispatch(void)
196{
197 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
198
199 if (pending & STATUSF_IP7)
200 do_IRQ(CPU_IRQ_BASE + 7);
201 else if (pending & VR5477INTS)
202 vrc5477_irq_dispatch();
203 else if (pending & STATUSF_IP0)
204 do_IRQ(CPU_IRQ_BASE);
205 else if (pending & STATUSF_IP1)
206 do_IRQ(CPU_IRQ_BASE + 1);
207 else
208 spurious_interrupt();
209}
diff --git a/arch/mips/ddb5xxx/ddb5477/irq_5477.c b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
deleted file mode 100644
index 98c3b15eb369..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/irq_5477.c
+++ /dev/null
@@ -1,154 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5477/irq_5477.c
6 * This file defines the irq handler for Vrc5477.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 */
14
15/*
16 * Vrc5477 defines 32 IRQs.
17 *
18 * This file exports one function:
19 * vrc5477_irq_init(u32 irq_base);
20 */
21
22#include <linux/interrupt.h>
23#include <linux/types.h>
24#include <linux/ptrace.h>
25
26#include <asm/debug.h>
27
28#include <asm/ddb5xxx/ddb5xxx.h>
29
30/* number of total irqs supported by Vrc5477 */
31#define NUM_5477_IRQ 32
32
33static int vrc5477_irq_base = -1;
34
35
36static void
37vrc5477_irq_enable(unsigned int irq)
38{
39 db_assert(vrc5477_irq_base != -1);
40 db_assert(irq >= vrc5477_irq_base);
41 db_assert(irq < vrc5477_irq_base+ NUM_5477_IRQ);
42
43 ll_vrc5477_irq_enable(irq - vrc5477_irq_base);
44}
45
46static void
47vrc5477_irq_disable(unsigned int irq)
48{
49 db_assert(vrc5477_irq_base != -1);
50 db_assert(irq >= vrc5477_irq_base);
51 db_assert(irq < vrc5477_irq_base + NUM_5477_IRQ);
52
53 ll_vrc5477_irq_disable(irq - vrc5477_irq_base);
54}
55
56static void
57vrc5477_irq_ack(unsigned int irq)
58{
59 db_assert(vrc5477_irq_base != -1);
60 db_assert(irq >= vrc5477_irq_base);
61 db_assert(irq < vrc5477_irq_base+ NUM_5477_IRQ);
62
63 /* clear the interrupt bit */
64 /* some irqs require the driver to clear the sources */
65 ddb_out32(DDB_INTCLR32, 1 << (irq - vrc5477_irq_base));
66
67 /* disable interrupt - some handler will re-enable the irq
68 * and if the interrupt is leveled, we will have infinite loop
69 */
70 ll_vrc5477_irq_disable(irq - vrc5477_irq_base);
71}
72
73static void
74vrc5477_irq_end(unsigned int irq)
75{
76 db_assert(vrc5477_irq_base != -1);
77 db_assert(irq >= vrc5477_irq_base);
78 db_assert(irq < vrc5477_irq_base + NUM_5477_IRQ);
79
80 if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
81 ll_vrc5477_irq_enable( irq - vrc5477_irq_base);
82}
83
84struct irq_chip vrc5477_irq_controller = {
85 .name = "vrc5477_irq",
86 .ack = vrc5477_irq_ack,
87 .mask = vrc5477_irq_disable,
88 .mask_ack = vrc5477_irq_ack,
89 .unmask = vrc5477_irq_enable,
90 .end = vrc5477_irq_end
91};
92
93void __init vrc5477_irq_init(u32 irq_base)
94{
95 u32 i;
96
97 for (i= irq_base; i< irq_base+ NUM_5477_IRQ; i++)
98 set_irq_chip(i, &vrc5477_irq_controller);
99
100 vrc5477_irq_base = irq_base;
101}
102
103void ll_vrc5477_irq_route(int vrc5477_irq, int ip)
104{
105 u32 reg_value;
106 u32 reg_bitmask;
107 u32 reg_index;
108
109 db_assert(vrc5477_irq >= 0);
110 db_assert(vrc5477_irq < NUM_5477_IRQ);
111 db_assert(ip >= 0);
112 db_assert((ip < 5) || (ip == 6));
113
114 reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
115 reg_value = ddb_in32(reg_index);
116 reg_bitmask = 7 << (vrc5477_irq % 8 * 4);
117 reg_value &= ~reg_bitmask;
118 reg_value |= ip << (vrc5477_irq % 8 * 4);
119 ddb_out32(reg_index, reg_value);
120}
121
122void ll_vrc5477_irq_enable(int vrc5477_irq)
123{
124 u32 reg_value;
125 u32 reg_bitmask;
126 u32 reg_index;
127
128 db_assert(vrc5477_irq >= 0);
129 db_assert(vrc5477_irq < NUM_5477_IRQ);
130
131 reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
132 reg_value = ddb_in32(reg_index);
133 reg_bitmask = 8 << (vrc5477_irq % 8 * 4);
134 db_assert((reg_value & reg_bitmask) == 0);
135 ddb_out32(reg_index, reg_value | reg_bitmask);
136}
137
138void ll_vrc5477_irq_disable(int vrc5477_irq)
139{
140 u32 reg_value;
141 u32 reg_bitmask;
142 u32 reg_index;
143
144 db_assert(vrc5477_irq >= 0);
145 db_assert(vrc5477_irq < NUM_5477_IRQ);
146
147 reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
148 reg_value = ddb_in32(reg_index);
149 reg_bitmask = 8 << (vrc5477_irq % 8 * 4);
150
151 /* we assert that the interrupt is enabled (perhaps over-zealous) */
152 db_assert( (reg_value & reg_bitmask) != 0);
153 ddb_out32(reg_index, reg_value & ~reg_bitmask);
154}
diff --git a/arch/mips/ddb5xxx/ddb5477/kgdb_io.c b/arch/mips/ddb5xxx/ddb5477/kgdb_io.c
deleted file mode 100644
index 385bbdb10170..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/kgdb_io.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * kgdb io functions for DDB5477. We use the second serial port (upper one).
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: jsun@mvista.com or jsun@junsun.net
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14/* ======================= CONFIG ======================== */
15
16/* [jsun] we use the second serial port for kdb */
17#define BASE 0xbfa04240
18#define MAX_BAUD 115200
19
20/* distance in bytes between two serial registers */
21#define REG_OFFSET 8
22
23/*
24 * 0 - kgdb does serial init
25 * 1 - kgdb skip serial init
26 */
27static int remoteDebugInitialized = 0;
28
29/*
30 * the default baud rate *if* kgdb does serial init
31 */
32#define BAUD_DEFAULT UART16550_BAUD_38400
33
34/* ======================= END OF CONFIG ======================== */
35
36typedef unsigned char uint8;
37typedef unsigned int uint32;
38
39#define UART16550_BAUD_2400 2400
40#define UART16550_BAUD_4800 4800
41#define UART16550_BAUD_9600 9600
42#define UART16550_BAUD_19200 19200
43#define UART16550_BAUD_38400 38400
44#define UART16550_BAUD_57600 57600
45#define UART16550_BAUD_115200 115200
46
47#define UART16550_PARITY_NONE 0
48#define UART16550_PARITY_ODD 0x08
49#define UART16550_PARITY_EVEN 0x18
50#define UART16550_PARITY_MARK 0x28
51#define UART16550_PARITY_SPACE 0x38
52
53#define UART16550_DATA_5BIT 0x0
54#define UART16550_DATA_6BIT 0x1
55#define UART16550_DATA_7BIT 0x2
56#define UART16550_DATA_8BIT 0x3
57
58#define UART16550_STOP_1BIT 0x0
59#define UART16550_STOP_2BIT 0x4
60
61/* register offset */
62#define OFS_RCV_BUFFER 0
63#define OFS_TRANS_HOLD 0
64#define OFS_SEND_BUFFER 0
65#define OFS_INTR_ENABLE (1*REG_OFFSET)
66#define OFS_INTR_ID (2*REG_OFFSET)
67#define OFS_DATA_FORMAT (3*REG_OFFSET)
68#define OFS_LINE_CONTROL (3*REG_OFFSET)
69#define OFS_MODEM_CONTROL (4*REG_OFFSET)
70#define OFS_RS232_OUTPUT (4*REG_OFFSET)
71#define OFS_LINE_STATUS (5*REG_OFFSET)
72#define OFS_MODEM_STATUS (6*REG_OFFSET)
73#define OFS_RS232_INPUT (6*REG_OFFSET)
74#define OFS_SCRATCH_PAD (7*REG_OFFSET)
75
76#define OFS_DIVISOR_LSB (0*REG_OFFSET)
77#define OFS_DIVISOR_MSB (1*REG_OFFSET)
78
79
80/* memory-mapped read/write of the port */
81#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
82#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
83
84void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
85{
86 /* disable interrupts */
87 UART16550_WRITE(OFS_INTR_ENABLE, 0);
88
89 /* set up baud rate */
90 {
91 uint32 divisor;
92
93 /* set DIAB bit */
94 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
95
96 /* set divisor */
97 divisor = MAX_BAUD / baud;
98 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
99 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
100
101 /* clear DIAB bit */
102 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
103 }
104
105 /* set data format */
106 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
107}
108
109
110uint8 getDebugChar(void)
111{
112 if (!remoteDebugInitialized) {
113 remoteDebugInitialized = 1;
114 debugInit(BAUD_DEFAULT,
115 UART16550_DATA_8BIT,
116 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
117 }
118
119 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
120 return UART16550_READ(OFS_RCV_BUFFER);
121}
122
123
124int putDebugChar(uint8 byte)
125{
126 if (!remoteDebugInitialized) {
127 remoteDebugInitialized = 1;
128 debugInit(BAUD_DEFAULT,
129 UART16550_DATA_8BIT,
130 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
131 }
132
133 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
134 UART16550_WRITE(OFS_SEND_BUFFER, byte);
135 return 1;
136}
diff --git a/arch/mips/ddb5xxx/ddb5477/lcd44780.c b/arch/mips/ddb5xxx/ddb5477/lcd44780.c
deleted file mode 100644
index 9510b9ae6453..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/lcd44780.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/*
2 * lcd44780.c
3 * Simple "driver" for a memory-mapped 44780-style LCD display.
4 *
5 * Copyright 2001 Bradley D. LaRonde <brad@ltc.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14#define LCD44780_COMMAND ((volatile unsigned char *)0xbe020000)
15#define LCD44780_DATA ((volatile unsigned char *)0xbe020001)
16
17#define LCD44780_4BIT_1LINE 0x20
18#define LCD44780_4BIT_2LINE 0x28
19#define LCD44780_8BIT_1LINE 0x30
20#define LCD44780_8BIT_2LINE 0x38
21#define LCD44780_MODE_DEC 0x04
22#define LCD44780_MODE_DEC_SHIFT 0x05
23#define LCD44780_MODE_INC 0x06
24#define LCD44780_MODE_INC_SHIFT 0x07
25#define LCD44780_SCROLL_LEFT 0x18
26#define LCD44780_SCROLL_RIGHT 0x1e
27#define LCD44780_CURSOR_UNDERLINE 0x0e
28#define LCD44780_CURSOR_BLOCK 0x0f
29#define LCD44780_CURSOR_OFF 0x0c
30#define LCD44780_CLEAR 0x01
31#define LCD44780_BLANK 0x08
32#define LCD44780_RESTORE 0x0c // Same as CURSOR_OFF
33#define LCD44780_HOME 0x02
34#define LCD44780_LEFT 0x10
35#define LCD44780_RIGHT 0x14
36
37void lcd44780_wait(void)
38{
39 int i, j;
40 for(i=0; i < 400; i++)
41 for(j=0; j < 10000; j++);
42}
43
44void lcd44780_command(unsigned char c)
45{
46 *LCD44780_COMMAND = c;
47 lcd44780_wait();
48}
49
50void lcd44780_data(unsigned char c)
51{
52 *LCD44780_DATA = c;
53 lcd44780_wait();
54}
55
56void lcd44780_puts(const char* s)
57{
58 int j;
59 int pos = 0;
60
61 lcd44780_command(LCD44780_CLEAR);
62 while(*s) {
63 lcd44780_data(*s);
64 s++;
65 pos++;
66 if (pos == 8) {
67 /* We must write 32 of spaces to get cursor to 2nd line */
68 for (j=0; j<32; j++) {
69 lcd44780_data(' ');
70 }
71 }
72 if (pos == 16) {
73 /* We have filled all 16 character positions, so stop
74 outputing data */
75 break;
76 }
77 }
78#ifdef LCD44780_PUTS_PAUSE
79 {
80 int i;
81
82 for(i = 1; i < 2000; i++)
83 lcd44780_wait();
84 }
85#endif
86}
87
88void lcd44780_init(void)
89{
90 // The display on the RockHopper is physically a single
91 // 16 char line (two 8 char lines concatenated). bdl
92 lcd44780_command(LCD44780_8BIT_2LINE);
93 lcd44780_command(LCD44780_MODE_INC);
94 lcd44780_command(LCD44780_CURSOR_BLOCK);
95 lcd44780_command(LCD44780_CLEAR);
96}
diff --git a/arch/mips/ddb5xxx/ddb5477/lcd44780.h b/arch/mips/ddb5xxx/ddb5477/lcd44780.h
deleted file mode 100644
index cf2f0f71eee5..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/lcd44780.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * lcd44780.h
3 * Simple "driver" for a memory-mapped 44780-style LCD display.
4 *
5 * Copyright 2001 Bradley D. LaRonde <brad@ltc.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 */
13
14void lcd44780_puts(const char* s);
15void lcd44780_init(void);
diff --git a/arch/mips/ddb5xxx/ddb5477/setup.c b/arch/mips/ddb5xxx/ddb5477/setup.c
deleted file mode 100644
index f0cc0e8a8afa..000000000000
--- a/arch/mips/ddb5xxx/ddb5477/setup.c
+++ /dev/null
@@ -1,399 +0,0 @@
1/*
2 *
3 * Copyright 2001 MontaVista Software Inc.
4 * Author: jsun@mvista.com or jsun@junsun.net
5 *
6 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
7 *
8 * arch/mips/ddb5xxx/ddb5477/setup.c
9 * Setup file for DDB5477.
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 */
16#include <linux/init.h>
17#include <linux/kernel.h>
18#include <linux/types.h>
19#include <linux/sched.h>
20#include <linux/pci.h>
21#include <linux/ide.h>
22#include <linux/irq.h>
23#include <linux/fs.h>
24#include <linux/ioport.h>
25#include <linux/param.h> /* for HZ */
26#include <linux/major.h>
27#include <linux/kdev_t.h>
28#include <linux/root_dev.h>
29#include <linux/pm.h>
30
31#include <asm/cpu.h>
32#include <asm/bootinfo.h>
33#include <asm/addrspace.h>
34#include <asm/time.h>
35#include <asm/bcache.h>
36#include <asm/irq.h>
37#include <asm/reboot.h>
38#include <asm/gdb-stub.h>
39#include <asm/traps.h>
40#include <asm/debug.h>
41
42#include <asm/ddb5xxx/ddb5xxx.h>
43
44#include "lcd44780.h"
45
46
47#define USE_CPU_COUNTER_TIMER /* whether we use cpu counter */
48
49#define SP_TIMER_BASE DDB_SPT1CTRL_L
50#define SP_TIMER_IRQ VRC5477_IRQ_SPT1
51
52static int bus_frequency = CONFIG_DDB5477_BUS_FREQUENCY*1000;
53
54static void ddb_machine_restart(char *command)
55{
56 static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
57
58 u32 t;
59
60 /* PCI cold reset */
61 ddb_pci_reset_bus();
62
63 /* CPU cold reset */
64 t = ddb_in32(DDB_CPUSTAT);
65 db_assert((t&1));
66 ddb_out32(DDB_CPUSTAT, t);
67
68 /* Call the PROM */
69 back_to_prom();
70}
71
72static void ddb_machine_halt(void)
73{
74 printk("DDB Vrc-5477 halted.\n");
75 while (1);
76}
77
78static void ddb_machine_power_off(void)
79{
80 printk("DDB Vrc-5477 halted. Please turn off the power.\n");
81 while (1);
82}
83
84extern void rtc_ds1386_init(unsigned long base);
85
86static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
87{
88 unsigned int freq;
89 unsigned char c;
90 unsigned int t1, t2;
91 unsigned i;
92
93 ddb_out32(SP_TIMER_BASE, 0xffffffff);
94 ddb_out32(SP_TIMER_BASE+4, 0x1);
95 ddb_out32(SP_TIMER_BASE+8, 0xffffffff);
96
97 /* check if rtc is running */
98 c= *(volatile unsigned char*)rtc_base;
99 for(i=0; (c == *(volatile unsigned char*)rtc_base) && (i<100000000); i++);
100 if (c == *(volatile unsigned char*)rtc_base) {
101 printk("Failed to detect bus frequency. Use default 83.3MHz.\n");
102 return 83333000;
103 }
104
105 c= *(volatile unsigned char*)rtc_base;
106 while (c == *(volatile unsigned char*)rtc_base);
107 /* we are now at the turn of 1/100th second, if no error. */
108 t1 = ddb_in32(SP_TIMER_BASE+8);
109
110 for (i=0; i< 10; i++) {
111 c= *(volatile unsigned char*)rtc_base;
112 while (c == *(volatile unsigned char*)rtc_base);
113 /* we are now at the turn of another 1/100th second */
114 t2 = ddb_in32(SP_TIMER_BASE+8);
115 }
116
117 ddb_out32(SP_TIMER_BASE+4, 0x0); /* disable it again */
118
119 freq = (t1 - t2)*10;
120 printk("DDB bus frequency detection : %u \n", freq);
121 return freq;
122}
123
124static void __init ddb_time_init(void)
125{
126 unsigned long rtc_base;
127 unsigned int i;
128
129 /* we have ds1396 RTC chip */
130 if (mips_machtype == MACH_NEC_ROCKHOPPER
131 || mips_machtype == MACH_NEC_ROCKHOPPERII) {
132 rtc_base = KSEG1ADDR(DDB_LCS2_BASE);
133 } else {
134 rtc_base = KSEG1ADDR(DDB_LCS1_BASE);
135 }
136 rtc_ds1386_init(rtc_base);
137
138 /* do we need to do run-time detection of bus speed? */
139 if (bus_frequency == 0) {
140 bus_frequency = detect_bus_frequency(rtc_base);
141 }
142
143 /* mips_hpt_frequency is 1/2 of the cpu core freq */
144 i = (read_c0_config() >> 28 ) & 7;
145 if ((current_cpu_data.cputype == CPU_R5432) && (i == 3))
146 i = 4;
147 mips_hpt_frequency = bus_frequency*(i+4)/4;
148}
149
150void __init plat_timer_setup(struct irqaction *irq)
151{
152#if defined(USE_CPU_COUNTER_TIMER)
153
154 /* we are using the cpu counter for timer interrupts */
155 setup_irq(CPU_IRQ_BASE + 7, irq);
156
157#else
158
159 /* if we use Special purpose timer 1 */
160 ddb_out32(SP_TIMER_BASE, bus_frequency/HZ);
161 ddb_out32(SP_TIMER_BASE+4, 0x1);
162 setup_irq(SP_TIMER_IRQ, irq);
163
164#endif
165}
166
167static void ddb5477_board_init(void);
168
169extern struct pci_controller ddb5477_ext_controller;
170extern struct pci_controller ddb5477_io_controller;
171
172void __init plat_mem_setup(void)
173{
174 /* initialize board - we don't trust the loader */
175 ddb5477_board_init();
176
177 set_io_port_base(KSEG1ADDR(DDB_PCI_IO_BASE));
178
179 board_time_init = ddb_time_init;
180
181 _machine_restart = ddb_machine_restart;
182 _machine_halt = ddb_machine_halt;
183 pm_power_off = ddb_machine_power_off;
184
185 /* setup resource limits */
186 ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1;
187 iomem_resource.end = 0xffffffff;
188
189 /* Reboot on panic */
190 panic_timeout = 180;
191
192 register_pci_controller (&ddb5477_ext_controller);
193 register_pci_controller (&ddb5477_io_controller);
194}
195
196static void __init ddb5477_board_init(void)
197{
198 /* ----------- setup PDARs ------------ */
199
200 /* SDRAM should have been set */
201 db_assert(ddb_in32(DDB_SDRAM0) ==
202 ddb_calc_pdar(DDB_SDRAM_BASE, board_ram_size, 32, 0, 1));
203
204 /* SDRAM1 should be turned off. What is this for anyway ? */
205 db_assert( (ddb_in32(DDB_SDRAM1) & 0xf) == 0);
206
207 /* Setup local bus. */
208
209 /* Flash U12 PDAR and timing. */
210 ddb_set_pdar(DDB_LCS0, DDB_LCS0_BASE, DDB_LCS0_SIZE, 16, 0, 0);
211 ddb_out32(DDB_LCST0, 0x00090842);
212
213 /* We need to setup LCS1 and LCS2 differently based on the
214 board_version */
215 if (mips_machtype == MACH_NEC_ROCKHOPPER) {
216 /* Flash U13 PDAR and timing. */
217 ddb_set_pdar(DDB_LCS1, DDB_LCS1_BASE, DDB_LCS1_SIZE, 16, 0, 0);
218 ddb_out32(DDB_LCST1, 0x00090842);
219
220 /* EPLD (NVRAM, switch, LCD, and mezzanie). */
221 ddb_set_pdar(DDB_LCS2, DDB_LCS2_BASE, DDB_LCS2_SIZE, 8, 0, 0);
222 } else {
223 /* misc */
224 ddb_set_pdar(DDB_LCS1, DDB_LCS1_BASE, DDB_LCS1_SIZE, 8, 0, 0);
225 /* mezzanie (?) */
226 ddb_set_pdar(DDB_LCS2, DDB_LCS2_BASE, DDB_LCS2_SIZE, 16, 0, 0);
227 }
228
229 /* verify VRC5477 base addr */
230 db_assert(ddb_in32(DDB_VRC5477) ==
231 ddb_calc_pdar(DDB_VRC5477_BASE, DDB_VRC5477_SIZE, 32, 0, 1));
232
233 /* verify BOOT ROM addr */
234 db_assert(ddb_in32(DDB_BOOTCS) ==
235 ddb_calc_pdar(DDB_BOOTCS_BASE, DDB_BOOTCS_SIZE, 8, 0, 0));
236
237 /* setup PCI windows - window0 for MEM/config, window1 for IO */
238 ddb_set_pdar(DDB_PCIW0, DDB_PCI0_MEM_BASE, DDB_PCI0_MEM_SIZE, 32, 0, 1);
239 ddb_set_pdar(DDB_PCIW1, DDB_PCI0_IO_BASE, DDB_PCI0_IO_SIZE, 32, 0, 1);
240 ddb_set_pdar(DDB_IOPCIW0, DDB_PCI1_MEM_BASE, DDB_PCI1_MEM_SIZE, 32, 0, 1);
241 ddb_set_pdar(DDB_IOPCIW1, DDB_PCI1_IO_BASE, DDB_PCI1_IO_SIZE, 32, 0, 1);
242
243 /* ------------ reset PCI bus and BARs ----------------- */
244 ddb_pci_reset_bus();
245
246 ddb_out32(DDB_BARM010, 0x00000008);
247 ddb_out32(DDB_BARM011, 0x00000008);
248
249 ddb_out32(DDB_BARC0, 0xffffffff);
250 ddb_out32(DDB_BARM230, 0xffffffff);
251 ddb_out32(DDB_BAR00, 0xffffffff);
252 ddb_out32(DDB_BAR10, 0xffffffff);
253 ddb_out32(DDB_BAR20, 0xffffffff);
254 ddb_out32(DDB_BAR30, 0xffffffff);
255 ddb_out32(DDB_BAR40, 0xffffffff);
256 ddb_out32(DDB_BAR50, 0xffffffff);
257 ddb_out32(DDB_BARB0, 0xffffffff);
258
259 ddb_out32(DDB_BARC1, 0xffffffff);
260 ddb_out32(DDB_BARM231, 0xffffffff);
261 ddb_out32(DDB_BAR01, 0xffffffff);
262 ddb_out32(DDB_BAR11, 0xffffffff);
263 ddb_out32(DDB_BAR21, 0xffffffff);
264 ddb_out32(DDB_BAR31, 0xffffffff);
265 ddb_out32(DDB_BAR41, 0xffffffff);
266 ddb_out32(DDB_BAR51, 0xffffffff);
267 ddb_out32(DDB_BARB1, 0xffffffff);
268
269 /*
270 * We use pci master register 0 for memory space / config space
271 * And we use register 1 for IO space.
272 * Note that for memory space, we bump up the pci base address
273 * so that we have 1:1 mapping between PCI memory and cpu physical.
274 * For PCI IO space, it starts from 0 in PCI IO space but with
275 * DDB_xx_IO_BASE in CPU physical address space.
276 */
277 ddb_set_pmr(DDB_PCIINIT00, DDB_PCICMD_MEM, DDB_PCI0_MEM_BASE,
278 DDB_PCI_ACCESS_32);
279 ddb_set_pmr(DDB_PCIINIT10, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
280
281 ddb_set_pmr(DDB_PCIINIT01, DDB_PCICMD_MEM, DDB_PCI1_MEM_BASE,
282 DDB_PCI_ACCESS_32);
283 ddb_set_pmr(DDB_PCIINIT11, DDB_PCICMD_IO, DDB_PCI0_IO_SIZE,
284 DDB_PCI_ACCESS_32);
285
286
287 /* PCI cross window should be set properly */
288 ddb_set_pdar(DDB_BARP00, DDB_PCI1_MEM_BASE, DDB_PCI1_MEM_SIZE, 32, 0, 1);
289 ddb_set_pdar(DDB_BARP10, DDB_PCI1_IO_BASE, DDB_PCI1_IO_SIZE, 32, 0, 1);
290 ddb_set_pdar(DDB_BARP01, DDB_PCI0_MEM_BASE, DDB_PCI0_MEM_SIZE, 32, 0, 1);
291 ddb_set_pdar(DDB_BARP11, DDB_PCI0_IO_BASE, DDB_PCI0_IO_SIZE, 32, 0, 1);
292
293 if (mips_machtype == MACH_NEC_ROCKHOPPER
294 || mips_machtype == MACH_NEC_ROCKHOPPERII) {
295 /* Disable bus diagnostics. */
296 ddb_out32(DDB_PCICTL0_L, 0);
297 ddb_out32(DDB_PCICTL0_H, 0);
298 ddb_out32(DDB_PCICTL1_L, 0);
299 ddb_out32(DDB_PCICTL1_H, 0);
300 }
301
302 if (mips_machtype == MACH_NEC_ROCKHOPPER) {
303 u16 vid;
304 struct pci_bus bus;
305 struct pci_dev dev_m1533;
306 extern struct pci_ops ddb5477_ext_pci_ops;
307
308 bus.parent = NULL; /* we scan the top level only */
309 bus.ops = &ddb5477_ext_pci_ops;
310 dev_m1533.bus = &bus;
311 dev_m1533.sysdata = NULL;
312 dev_m1533.devfn = 7*8; // slot 7: M1533 SouthBridge.
313 pci_read_config_word(&dev_m1533, 0, &vid);
314 if (vid == PCI_VENDOR_ID_AL) {
315 printk("Changing mips_machtype to MACH_NEC_ROCKHOPPERII\n");
316 mips_machtype = MACH_NEC_ROCKHOPPERII;
317 }
318 }
319
320 /* enable USB input buffers */
321 ddb_out32(DDB_PIBMISC, 0x00000007);
322
323 /* For dual-function pins, make them all non-GPIO */
324 ddb_out32(DDB_GIUFUNSEL, 0x0);
325 // ddb_out32(DDB_GIUFUNSEL, 0xfe0fcfff); /* NEC recommanded value */
326
327 if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
328
329 /* enable IDE controller on Ali chip (south bridge) */
330 u8 temp8;
331 struct pci_bus bus;
332 struct pci_dev dev_m1533;
333 struct pci_dev dev_m5229;
334 extern struct pci_ops ddb5477_ext_pci_ops;
335
336 /* Setup M1535 registers */
337 bus.parent = NULL; /* we scan the top level only */
338 bus.ops = &ddb5477_ext_pci_ops;
339 dev_m1533.bus = &bus;
340 dev_m1533.sysdata = NULL;
341 dev_m1533.devfn = 7*8; // slot 7: M1533 SouthBridge.
342
343 /* setup IDE controller
344 * enable IDE controller (bit 6 - 1)
345 * IDE IDSEL to be addr:A15 (bit 4:5 - 11)
346 * disable IDE ATA Secondary Bus Signal Pad Control (bit 3 - 0)
347 * enable IDE ATA Primary Bus Signal Pad Control (bit 2 - 1)
348 */
349 pci_write_config_byte(&dev_m1533, 0x58, 0x74);
350
351 /*
352 * positive decode (bit6 -0)
353 * enable IDE controler interrupt (bit 4 -1)
354 * setup SIRQ to point to IRQ 14 (bit 3:0 - 1101)
355 */
356 pci_write_config_byte(&dev_m1533, 0x44, 0x1d);
357
358 /* Setup M5229 registers */
359 dev_m5229.bus = &bus;
360 dev_m5229.sysdata = NULL;
361 dev_m5229.devfn = 4*8; // slot 4 (AD15): M5229 IDE
362
363 /*
364 * enable IDE in the M5229 config register 0x50 (bit 0 - 1)
365 * M5229 IDSEL is addr:15; see above setting
366 */
367 pci_read_config_byte(&dev_m5229, 0x50, &temp8);
368 pci_write_config_byte(&dev_m5229, 0x50, temp8 | 0x1);
369
370 /*
371 * enable bus master (bit 2) and IO decoding (bit 0)
372 */
373 pci_read_config_byte(&dev_m5229, 0x04, &temp8);
374 pci_write_config_byte(&dev_m5229, 0x04, temp8 | 0x5);
375
376 /*
377 * enable native, copied from arch/ppc/k2boot/head.S
378 * TODO - need volatile, need to be portable
379 */
380 pci_write_config_byte(&dev_m5229, 0x09, 0xef);
381
382 /* Set Primary Channel Command Block Timing */
383 pci_write_config_byte(&dev_m5229, 0x59, 0x31);
384
385 /*
386 * Enable primary channel 40-pin cable
387 * M5229 register 0x4a (bit 0)
388 */
389 pci_read_config_byte(&dev_m5229, 0x4a, &temp8);
390 pci_write_config_byte(&dev_m5229, 0x4a, temp8 | 0x1);
391 }
392
393 if (mips_machtype == MACH_NEC_ROCKHOPPER
394 || mips_machtype == MACH_NEC_ROCKHOPPERII) {
395 printk("lcd44780: initializing\n");
396 lcd44780_init();
397 lcd44780_puts("MontaVista Linux");
398 }
399}
diff --git a/arch/mips/dec/Makefile b/arch/mips/dec/Makefile
index 9eb2f9c036aa..c530208ee154 100644
--- a/arch/mips/dec/Makefile
+++ b/arch/mips/dec/Makefile
@@ -8,3 +8,5 @@ obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
8obj-$(CONFIG_PROM_CONSOLE) += promcon.o 8obj-$(CONFIG_PROM_CONSOLE) += promcon.o
9obj-$(CONFIG_TC) += tc.o 9obj-$(CONFIG_TC) += tc.o
10obj-$(CONFIG_CPU_HAS_WB) += wbflush.o 10obj-$(CONFIG_CPU_HAS_WB) += wbflush.o
11
12EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/defconfig b/arch/mips/defconfig
index b3b6e58058f6..d3d81fb2765a 100644
--- a/arch/mips/defconfig
+++ b/arch/mips/defconfig
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
32# CONFIG_WR_PPMC is not set 32# CONFIG_WR_PPMC is not set
33# CONFIG_MIPS_SIM is not set 33# CONFIG_MIPS_SIM is not set
34# CONFIG_MOMENCO_JAGUAR_ATX is not set 34# CONFIG_MOMENCO_JAGUAR_ATX is not set
35# CONFIG_MOMENCO_OCELOT is not set
36# CONFIG_MOMENCO_OCELOT_G is not set
37# CONFIG_MIPS_XXS1500 is not set 35# CONFIG_MIPS_XXS1500 is not set
38# CONFIG_PNX8550_JBS is not set 36# CONFIG_PNX8550_JBS is not set
39# CONFIG_PNX8550_STB810 is not set 37# CONFIG_PNX8550_STB810 is not set
40# CONFIG_DDB5477 is not set
41# CONFIG_MACH_VR41XX is not set 38# CONFIG_MACH_VR41XX is not set
42# CONFIG_PMC_YOSEMITE is not set 39# CONFIG_PMC_YOSEMITE is not set
43# CONFIG_QEMU is not set 40# CONFIG_QEMU is not set
diff --git a/arch/mips/gt64120/common/Makefile b/arch/mips/gt64120/common/Makefile
deleted file mode 100644
index 1ef676e22ab4..000000000000
--- a/arch/mips/gt64120/common/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for common code of gt64120-based boards.
3#
4
5obj-y += time.o
diff --git a/arch/mips/gt64120/common/time.c b/arch/mips/gt64120/common/time.c
deleted file mode 100644
index c47eeb768192..000000000000
--- a/arch/mips/gt64120/common/time.c
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * Galileo Technology chip interrupt handler
8 */
9#include <linux/interrupt.h>
10#include <linux/kernel.h>
11#include <linux/sched.h>
12#include <linux/kernel_stat.h>
13#include <asm/irq_regs.h>
14#include <asm/gt64120.h>
15
16/*
17 * These are interrupt handlers for the GT on-chip interrupts. They all come
18 * in to the MIPS on a single interrupt line, and have to be handled and ack'ed
19 * differently than other MIPS interrupts.
20 */
21
22static irqreturn_t gt64120_irq(int irq, void *dev_id)
23{
24 unsigned int irq_src, int_high_src, irq_src_mask, int_high_src_mask;
25 int handled = 0;
26
27 irq_src = GT_READ(GT_INTRCAUSE_OFS);
28 irq_src_mask = GT_READ(GT_INTRMASK_OFS);
29 int_high_src = GT_READ(GT_HINTRCAUSE_OFS);
30 int_high_src_mask = GT_READ(GT_HINTRMASK_OFS);
31 irq_src = irq_src & irq_src_mask;
32 int_high_src = int_high_src & int_high_src_mask;
33
34 if (irq_src & 0x00000800) { /* Check for timer interrupt */
35 handled = 1;
36 irq_src &= ~0x00000800;
37 do_timer(1);
38#ifndef CONFIG_SMP
39 update_process_times(user_mode(get_irq_regs()));
40#endif
41 }
42
43 GT_WRITE(GT_INTRCAUSE_OFS, 0);
44 GT_WRITE(GT_HINTRCAUSE_OFS, 0);
45
46 return IRQ_HANDLED;
47}
48
49/*
50 * Initializes timer using galileo's built in timer.
51 */
52#ifdef CONFIG_SYSCLK_100
53#define Sys_clock (100 * 1000000) // 100 MHz
54#endif
55#ifdef CONFIG_SYSCLK_83
56#define Sys_clock (83.333 * 1000000) // 83.333 MHz
57#endif
58#ifdef CONFIG_SYSCLK_75
59#define Sys_clock (75 * 1000000) // 75 MHz
60#endif
61
62/*
63 * This will ignore the standard MIPS timer interrupt handler that is passed in
64 * as *irq (=irq0 in ../kernel/time.c). We will do our own timer interrupt
65 * handling.
66 */
67void __init plat_timer_setup(struct irqaction *irq)
68{
69 static struct irqaction timer;
70
71 /* Disable timer first */
72 GT_WRITE(GT_TC_CONTROL_OFS, 0);
73 /* Load timer value for 100 Hz */
74 GT_WRITE(GT_TC3_OFS, Sys_clock / HZ);
75
76 /*
77 * Create the IRQ structure entry for the timer. Since we're too early
78 * in the boot process to use the "request_irq()" call, we'll hard-code
79 * the values to the correct interrupt line.
80 */
81 timer.handler = gt64120_irq;
82 timer.flags = IRQF_SHARED | IRQF_DISABLED;
83 timer.name = "timer";
84 timer.dev_id = NULL;
85 timer.next = NULL;
86 timer.mask = CPU_MASK_NONE;
87 irq_desc[GT_TIMER].action = &timer;
88
89 enable_irq(GT_TIMER);
90
91 /* Enable timer ints */
92 GT_WRITE(GT_TC_CONTROL_OFS, 0xc0);
93 /* clear Cause register first */
94 GT_WRITE(GT_INTRCAUSE_OFS, 0x0);
95 /* Unmask timer int */
96 GT_WRITE(GT_INTRMASK_OFS, 0x800);
97 /* Clear High int register */
98 GT_WRITE(GT_HINTRCAUSE_OFS, 0x0);
99 /* Mask All interrupts at High cause interrupt */
100 GT_WRITE(GT_HINTRMASK_OFS, 0x0);
101}
diff --git a/arch/mips/gt64120/momenco_ocelot/Makefile b/arch/mips/gt64120/momenco_ocelot/Makefile
deleted file mode 100644
index 1df5fe23c642..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/Makefile
+++ /dev/null
@@ -1,7 +0,0 @@
1#
2# Makefile for Momentum's Ocelot board.
3#
4
5obj-y += irq.o ocelot-platform.o prom.o reset.o setup.o
6
7obj-$(CONFIG_KGDB) += dbg_io.o
diff --git a/arch/mips/gt64120/momenco_ocelot/dbg_io.c b/arch/mips/gt64120/momenco_ocelot/dbg_io.c
deleted file mode 100644
index 32d6fb4ee679..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/dbg_io.c
+++ /dev/null
@@ -1,121 +0,0 @@
1
2#include <asm/serial.h> /* For the serial port location and base baud */
3
4/* --- CONFIG --- */
5
6typedef unsigned char uint8;
7typedef unsigned int uint32;
8
9/* --- END OF CONFIG --- */
10
11#define UART16550_BAUD_2400 2400
12#define UART16550_BAUD_4800 4800
13#define UART16550_BAUD_9600 9600
14#define UART16550_BAUD_19200 19200
15#define UART16550_BAUD_38400 38400
16#define UART16550_BAUD_57600 57600
17#define UART16550_BAUD_115200 115200
18
19#define UART16550_PARITY_NONE 0
20#define UART16550_PARITY_ODD 0x08
21#define UART16550_PARITY_EVEN 0x18
22#define UART16550_PARITY_MARK 0x28
23#define UART16550_PARITY_SPACE 0x38
24
25#define UART16550_DATA_5BIT 0x0
26#define UART16550_DATA_6BIT 0x1
27#define UART16550_DATA_7BIT 0x2
28#define UART16550_DATA_8BIT 0x3
29
30#define UART16550_STOP_1BIT 0x0
31#define UART16550_STOP_2BIT 0x4
32
33/* ----------------------------------------------------- */
34
35/* === CONFIG === */
36
37/* [jsun] we use the second serial port for kdb */
38#define BASE OCELOT_SERIAL1_BASE
39#define MAX_BAUD OCELOT_BASE_BAUD
40
41/* === END OF CONFIG === */
42
43#define REG_OFFSET 4
44
45/* register offset */
46#define OFS_RCV_BUFFER 0
47#define OFS_TRANS_HOLD 0
48#define OFS_SEND_BUFFER 0
49#define OFS_INTR_ENABLE (1*REG_OFFSET)
50#define OFS_INTR_ID (2*REG_OFFSET)
51#define OFS_DATA_FORMAT (3*REG_OFFSET)
52#define OFS_LINE_CONTROL (3*REG_OFFSET)
53#define OFS_MODEM_CONTROL (4*REG_OFFSET)
54#define OFS_RS232_OUTPUT (4*REG_OFFSET)
55#define OFS_LINE_STATUS (5*REG_OFFSET)
56#define OFS_MODEM_STATUS (6*REG_OFFSET)
57#define OFS_RS232_INPUT (6*REG_OFFSET)
58#define OFS_SCRATCH_PAD (7*REG_OFFSET)
59
60#define OFS_DIVISOR_LSB (0*REG_OFFSET)
61#define OFS_DIVISOR_MSB (1*REG_OFFSET)
62
63
64/* memory-mapped read/write of the port */
65#define UART16550_READ(y) (*((volatile uint8*)(BASE + y)))
66#define UART16550_WRITE(y, z) ((*((volatile uint8*)(BASE + y))) = z)
67
68void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
69{
70 /* disable interrupts */
71 UART16550_WRITE(OFS_INTR_ENABLE, 0);
72
73 /* set up baud rate */
74 {
75 uint32 divisor;
76
77 /* set DIAB bit */
78 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
79
80 /* set divisor */
81 divisor = MAX_BAUD / baud;
82 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
83 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
84
85 /* clear DIAB bit */
86 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
87 }
88
89 /* set data format */
90 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
91}
92
93static int remoteDebugInitialized = 0;
94
95uint8 getDebugChar(void)
96{
97 if (!remoteDebugInitialized) {
98 remoteDebugInitialized = 1;
99 debugInit(UART16550_BAUD_38400,
100 UART16550_DATA_8BIT,
101 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
102 }
103
104 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
105 return UART16550_READ(OFS_RCV_BUFFER);
106}
107
108
109int putDebugChar(uint8 byte)
110{
111 if (!remoteDebugInitialized) {
112 remoteDebugInitialized = 1;
113 debugInit(UART16550_BAUD_38400,
114 UART16550_DATA_8BIT,
115 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
116 }
117
118 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
119 UART16550_WRITE(OFS_SEND_BUFFER, byte);
120 return 1;
121}
diff --git a/arch/mips/gt64120/momenco_ocelot/irq.c b/arch/mips/gt64120/momenco_ocelot/irq.c
deleted file mode 100644
index 2585d9dbda33..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/irq.c
+++ /dev/null
@@ -1,95 +0,0 @@
1/*
2 * Copyright (C) 2000 RidgeRun, Inc.
3 * Author: RidgeRun, Inc.
4 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
8 * Copyright (C) 2000, 2001, 2003 Ralf Baechle (ralf@gnu.org)
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 *
30 */
31#include <linux/errno.h>
32#include <linux/init.h>
33#include <linux/kernel_stat.h>
34#include <linux/module.h>
35#include <linux/signal.h>
36#include <linux/sched.h>
37#include <linux/types.h>
38#include <linux/interrupt.h>
39#include <linux/ioport.h>
40#include <linux/timex.h>
41#include <linux/slab.h>
42#include <linux/random.h>
43#include <linux/bitops.h>
44#include <asm/bootinfo.h>
45#include <asm/io.h>
46#include <asm/irq.h>
47#include <asm/irq_cpu.h>
48#include <asm/mipsregs.h>
49#include <asm/system.h>
50
51asmlinkage void plat_irq_dispatch(void)
52{
53 unsigned int pending = read_c0_status() & read_c0_cause();
54
55 if (pending & STATUSF_IP2) /* int0 hardware line */
56 do_IRQ(2);
57 else if (pending & STATUSF_IP3) /* int1 hardware line */
58 do_IRQ(3);
59 else if (pending & STATUSF_IP4) /* int2 hardware line */
60 do_IRQ(4);
61 else if (pending & STATUSF_IP5) /* int3 hardware line */
62 do_IRQ(5);
63 else if (pending & STATUSF_IP6) /* int4 hardware line */
64 do_IRQ(6);
65 else if (pending & STATUSF_IP7) /* cpu timer */
66 do_IRQ(7);
67 else {
68 /*
69 * Now look at the extended interrupts
70 */
71 pending = (read_c0_cause() & (read_c0_intcontrol() << 8)) >> 16;
72
73 if (pending & STATUSF_IP8) /* int6 hardware line */
74 do_IRQ(8);
75 else if (pending & STATUSF_IP9) /* int7 hardware line */
76 do_IRQ(9);
77 else if (pending & STATUSF_IP10) /* int8 hardware line */
78 do_IRQ(10);
79 else if (pending & STATUSF_IP11) /* int9 hardware line */
80 do_IRQ(11);
81 }
82}
83
84void __init arch_init_irq(void)
85{
86 /*
87 * Clear all of the interrupts while we change the able around a bit.
88 * int-handler is not on bootstrap
89 */
90 clear_c0_status(ST0_IM);
91 local_irq_disable();
92
93 mips_cpu_irq_init();
94 rm7k_cpu_irq_init();
95}
diff --git a/arch/mips/gt64120/momenco_ocelot/ocelot-platform.c b/arch/mips/gt64120/momenco_ocelot/ocelot-platform.c
deleted file mode 100644
index 81d9031a5a2a..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/ocelot-platform.c
+++ /dev/null
@@ -1,46 +0,0 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
7 *
8 * A NS16552 DUART with a 20MHz crystal.
9 *
10 */
11#include <linux/module.h>
12#include <linux/init.h>
13#include <linux/serial_8250.h>
14
15#define OCELOT_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
16
17static struct plat_serial8250_port uart8250_data[] = {
18 {
19 .mapbase = 0xe0001020,
20 .irq = 4,
21 .uartclk = 20000000,
22 .iotype = UPIO_MEM,
23 .flags = OCELOT_UART_FLAGS,
24 .regshift = 2,
25 },
26 { },
27};
28
29static struct platform_device uart8250_device = {
30 .name = "serial8250",
31 .id = PLAT8250_DEV_PLATFORM,
32 .dev = {
33 .platform_data = uart8250_data,
34 },
35};
36
37static int __init uart8250_init(void)
38{
39 return platform_device_register(&uart8250_device);
40}
41
42module_init(uart8250_init);
43
44MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
45MODULE_LICENSE("GPL");
46MODULE_DESCRIPTION("8250 UART probe driver for the Momenco Ocelot");
diff --git a/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h b/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h
deleted file mode 100644
index 11f02c402b2a..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * Ocelot Board Register Definitions
3 *
4 * (C) 2001 Red Hat, Inc.
5 *
6 * GPL'd
7 */
8#ifndef __MOMENCO_OCELOT_PLD_H__
9#define __MOMENCO_OCELOT_PLD_H__
10
11#define OCELOT_CS0_ADDR (0xe0020000)
12
13#define OCELOT_REG_BOARDREV (0)
14#define OCELOT_REG_PLD1_ID (1)
15#define OCELOT_REG_PLD2_ID (2)
16#define OCELOT_REG_RESET_STATUS (3)
17#define OCELOT_REG_BOARD_STATUS (4)
18#define OCELOT_REG_CPCI_ID (5)
19#define OCELOT_REG_I2C_CTRL (8)
20#define OCELOT_REG_EEPROM_MODE (9)
21#define OCELOT_REG_INTMASK (10)
22#define OCELOT_REG_INTSTATUS (11)
23#define OCELOT_REG_INTSET (12)
24#define OCELOT_REG_INTCLR (13)
25
26#define OCELOT_PLD_WRITE(x, y) writeb(x, OCELOT_CS0_ADDR + OCELOT_REG_##y)
27#define OCELOT_PLD_READ(x) readb(OCELOT_CS0_ADDR + OCELOT_REG_##x)
28
29
30#endif /* __MOMENCO_OCELOT_PLD_H__ */
diff --git a/arch/mips/gt64120/momenco_ocelot/prom.c b/arch/mips/gt64120/momenco_ocelot/prom.c
deleted file mode 100644
index c71c85276c74..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/prom.c
+++ /dev/null
@@ -1,71 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: jsun@mvista.com or jsun@junsun.net
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 */
10#include <linux/init.h>
11#include <linux/mm.h>
12#include <linux/sched.h>
13#include <linux/bootmem.h>
14
15#include <asm/addrspace.h>
16#include <asm/bootinfo.h>
17#include <asm/pmon.h>
18
19struct callvectors* debug_vectors;
20
21extern unsigned long gt64120_base;
22
23const char *get_system_type(void)
24{
25 return "Momentum Ocelot";
26}
27
28/* [jsun@junsun.net] PMON passes arguments in C main() style */
29void __init prom_init(void)
30{
31 int argc = fw_arg0;
32 char **arg = (char **) fw_arg1;
33 char **env = (char **) fw_arg2;
34 struct callvectors *cv = (struct callvectors *) fw_arg3;
35 int i;
36
37 /* save the PROM vectors for debugging use */
38 debug_vectors = cv;
39
40 /* arg[0] is "g", the rest is boot parameters */
41 arcs_cmdline[0] = '\0';
42 for (i = 1; i < argc; i++) {
43 if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
44 >= sizeof(arcs_cmdline))
45 break;
46 strcat(arcs_cmdline, arg[i]);
47 strcat(arcs_cmdline, " ");
48 }
49
50 mips_machgroup = MACH_GROUP_MOMENCO;
51 mips_machtype = MACH_MOMENCO_OCELOT;
52
53 while (*env) {
54 if (strncmp("gtbase", *env, 6) == 0) {
55 gt64120_base = simple_strtol(*env + strlen("gtbase="),
56 NULL, 16);
57 break;
58 }
59 *env++;
60 }
61
62 debug_vectors->printf("Booting Linux kernel...\n");
63
64 /* All the boards have at least 64MiB. If there's more, we
65 detect and register it later */
66 add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
67}
68
69void __init prom_free_prom_memory(void)
70{
71}
diff --git a/arch/mips/gt64120/momenco_ocelot/reset.c b/arch/mips/gt64120/momenco_ocelot/reset.c
deleted file mode 100644
index 3fd499adf4cf..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/reset.c
+++ /dev/null
@@ -1,47 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License as published by the
4 * Free Software Foundation; either version 2 of the License, or (at your
5 * option) any later version.
6 *
7 * Copyright (C) 1997, 2001 Ralf Baechle
8 * Copyright 2001 MontaVista Software Inc.
9 * Author: jsun@mvista.com or jsun@junsun.net
10 */
11#include <linux/sched.h>
12#include <linux/mm.h>
13#include <asm/io.h>
14#include <asm/pgtable.h>
15#include <asm/processor.h>
16#include <asm/reboot.h>
17#include <asm/system.h>
18#include <linux/delay.h>
19
20void momenco_ocelot_restart(char *command)
21{
22 void *nvram = ioremap_nocache(0x2c807000, 0x1000);
23
24 if (!nvram) {
25 printk(KERN_NOTICE "ioremap of reset register failed\n");
26 return;
27 }
28 writeb(0x84, nvram + 0xff7); /* Ask the NVRAM/RTC/watchdog chip to
29 assert reset in 1/16 second */
30 mdelay(10+(1000/16));
31 iounmap(nvram);
32 printk(KERN_NOTICE "Watchdog reset failed\n");
33}
34
35void momenco_ocelot_halt(void)
36{
37 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
38 while (1)
39 __asm__(".set\tmips3\n\t"
40 "wait\n\t"
41 ".set\tmips0");
42}
43
44void momenco_ocelot_power_off(void)
45{
46 momenco_ocelot_halt();
47}
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
deleted file mode 100644
index 98b6fb38096d..000000000000
--- a/arch/mips/gt64120/momenco_ocelot/setup.c
+++ /dev/null
@@ -1,365 +0,0 @@
1/*
2 * setup.c
3 *
4 * BRIEF MODULE DESCRIPTION
5 * Momentum Computer Ocelot (CP7000) - board dependent boot routines
6 *
7 * Copyright (C) 1996, 1997, 2001, 06 Ralf Baechle (ralf@linux-mips.org)
8 * Copyright (C) 2000 RidgeRun, Inc.
9 * Copyright (C) 2001 Red Hat, Inc.
10 * Copyright (C) 2002 Momentum Computer
11 *
12 * Author: RidgeRun, Inc.
13 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
14 *
15 * Copyright 2001 MontaVista Software Inc.
16 * Author: jsun@mvista.com or jsun@junsun.net
17 *
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 2 of the License, or (at your
21 * option) any later version.
22 *
23 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
26 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
29 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * You should have received a copy of the GNU General Public License along
35 * with this program; if not, write to the Free Software Foundation, Inc.,
36 * 675 Mass Ave, Cambridge, MA 02139, USA.
37 *
38 */
39#include <linux/init.h>
40#include <linux/kernel.h>
41#include <linux/types.h>
42#include <linux/mm.h>
43#include <linux/swap.h>
44#include <linux/ioport.h>
45#include <linux/sched.h>
46#include <linux/interrupt.h>
47#include <linux/pci.h>
48#include <linux/timex.h>
49#include <linux/vmalloc.h>
50#include <linux/pm.h>
51
52#include <asm/time.h>
53#include <asm/bootinfo.h>
54#include <asm/page.h>
55#include <asm/io.h>
56#include <asm/irq.h>
57#include <asm/pci.h>
58#include <asm/processor.h>
59#include <asm/reboot.h>
60#include <asm/traps.h>
61#include <linux/bootmem.h>
62#include <linux/initrd.h>
63#include <asm/gt64120.h>
64#include "ocelot_pld.h"
65
66unsigned long gt64120_base = KSEG1ADDR(GT_DEF_BASE);
67
68/* These functions are used for rebooting or halting the machine*/
69extern void momenco_ocelot_restart(char *command);
70extern void momenco_ocelot_halt(void);
71extern void momenco_ocelot_power_off(void);
72
73extern void momenco_ocelot_irq_setup(void);
74
75static char reset_reason;
76
77#define ENTRYLO(x) ((pte_val(pfn_pte((x) >> PAGE_SHIFT, PAGE_KERNEL_UNCACHED)) >> 6)|1)
78
79static void __init setup_l3cache(unsigned long size);
80
81/* setup code for a handoff from a version 1 PMON 2000 PROM */
82static void PMON_v1_setup(void)
83{
84 /* A wired TLB entry for the GT64120A and the serial port. The
85 GT64120A is going to be hit on every IRQ anyway - there's
86 absolutely no point in letting it be a random TLB entry, as
87 it'll just cause needless churning of the TLB. And we use
88 the other half for the serial port, which is just a PITA
89 otherwise :)
90
91 Device Physical Virtual
92 GT64120 Internal Regs 0x24000000 0xe0000000
93 UARTs (CS2) 0x2d000000 0xe0001000
94 */
95 add_wired_entry(ENTRYLO(0x24000000), ENTRYLO(0x2D000000), 0xe0000000, PM_4K);
96
97 /* Also a temporary entry to let us talk to the Ocelot PLD and NVRAM
98 in the CS[012] region. We can't use ioremap() yet. The NVRAM
99 is a ST M48T37Y, which includes NVRAM, RTC, and Watchdog functions.
100
101 Ocelot PLD (CS0) 0x2c000000 0xe0020000
102 NVRAM 0x2c800000 0xe0030000
103 */
104
105 add_temporary_entry(ENTRYLO(0x2C000000), ENTRYLO(0x2d000000), 0xe0020000, PM_64K);
106
107 /* Relocate the CS3/BootCS region */
108 GT_WRITE(GT_CS3BOOTLD_OFS, 0x2f000000 >> 21);
109
110 /* Relocate CS[012] */
111 GT_WRITE(GT_CS20LD_OFS, 0x2c000000 >> 21);
112
113 /* Relocate the GT64120A itself... */
114 GT_WRITE(GT_ISD_OFS, 0x24000000 >> 21);
115 mb();
116 gt64120_base = 0xe0000000;
117
118 /* ...and the PCI0 view of it. */
119 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000020);
120 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x24000000);
121 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000024);
122 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x24000001);
123}
124
125/* setup code for a handoff from a version 2 PMON 2000 PROM */
126void PMON_v2_setup()
127{
128 /* A wired TLB entry for the GT64120A and the serial port. The
129 GT64120A is going to be hit on every IRQ anyway - there's
130 absolutely no point in letting it be a random TLB entry, as
131 it'll just cause needless churning of the TLB. And we use
132 the other half for the serial port, which is just a PITA
133 otherwise :)
134
135 Device Physical Virtual
136 GT64120 Internal Regs 0xf4000000 0xe0000000
137 UARTs (CS2) 0xfd000000 0xe0001000
138 */
139 add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xfD000000), 0xe0000000, PM_4K);
140
141 /* Also a temporary entry to let us talk to the Ocelot PLD and NVRAM
142 in the CS[012] region. We can't use ioremap() yet. The NVRAM
143 is a ST M48T37Y, which includes NVRAM, RTC, and Watchdog functions.
144
145 Ocelot PLD (CS0) 0xfc000000 0xe0020000
146 NVRAM 0xfc800000 0xe0030000
147 */
148 add_temporary_entry(ENTRYLO(0xfC000000), ENTRYLO(0xfd000000), 0xe0020000, PM_64K);
149
150 gt64120_base = 0xe0000000;
151}
152
153void __init plat_mem_setup(void)
154{
155 void (*l3func)(unsigned long)=KSEG1ADDR(&setup_l3cache);
156 unsigned int tmpword;
157
158 _machine_restart = momenco_ocelot_restart;
159 _machine_halt = momenco_ocelot_halt;
160 pm_power_off = momenco_ocelot_power_off;
161
162 /*
163 * initrd_start = (unsigned long)ocelot_initrd_start;
164 * initrd_end = (unsigned long)ocelot_initrd_start + (ulong)ocelot_initrd_size;
165 * initrd_below_start_ok = 1;
166 */
167
168 /* do handoff reconfiguration */
169 if (gt64120_base == KSEG1ADDR(GT_DEF_BASE))
170 PMON_v1_setup();
171 else
172 PMON_v2_setup();
173
174 /* Turn off the Bit-Error LED */
175 OCELOT_PLD_WRITE(0x80, INTCLR);
176
177 /* Relocate all the PCI1 stuff, not that we use it */
178 GT_WRITE(GT_PCI1IOLD_OFS, 0x30000000 >> 21);
179 GT_WRITE(GT_PCI1M0LD_OFS, 0x32000000 >> 21);
180 GT_WRITE(GT_PCI1M1LD_OFS, 0x34000000 >> 21);
181
182 /* Relocate PCI0 I/O and Mem0 */
183 GT_WRITE(GT_PCI0IOLD_OFS, 0x20000000 >> 21);
184 GT_WRITE(GT_PCI0M0LD_OFS, 0x22000000 >> 21);
185
186 /* Relocate PCI0 Mem1 */
187 GT_WRITE(GT_PCI0M1LD_OFS, 0x36000000 >> 21);
188
189 /* For the initial programming, we assume 512MB configuration */
190 /* Relocate the CPU's view of the RAM... */
191 GT_WRITE(GT_SCS10LD_OFS, 0);
192 GT_WRITE(GT_SCS10HD_OFS, 0x0fe00000 >> 21);
193 GT_WRITE(GT_SCS32LD_OFS, 0x10000000 >> 21);
194 GT_WRITE(GT_SCS32HD_OFS, 0x0fe00000 >> 21);
195
196 GT_WRITE(GT_SCS1LD_OFS, 0xff);
197 GT_WRITE(GT_SCS1HD_OFS, 0x00);
198 GT_WRITE(GT_SCS0LD_OFS, 0);
199 GT_WRITE(GT_SCS0HD_OFS, 0xff);
200 GT_WRITE(GT_SCS3LD_OFS, 0xff);
201 GT_WRITE(GT_SCS3HD_OFS, 0x00);
202 GT_WRITE(GT_SCS2LD_OFS, 0);
203 GT_WRITE(GT_SCS2HD_OFS, 0xff);
204
205 /* ...and the PCI0 view of it. */
206 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000010);
207 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x00000000);
208 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
209 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x10000000);
210 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x0ffff000);
211 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x0ffff000);
212
213 tmpword = OCELOT_PLD_READ(BOARDREV);
214 if (tmpword < 26)
215 printk("Momenco Ocelot: Board Assembly Rev. %c\n", 'A'+tmpword);
216 else
217 printk("Momenco Ocelot: Board Assembly Revision #0x%x\n", tmpword);
218
219 tmpword = OCELOT_PLD_READ(PLD1_ID);
220 printk("PLD 1 ID: %d.%d\n", tmpword>>4, tmpword&15);
221 tmpword = OCELOT_PLD_READ(PLD2_ID);
222 printk("PLD 2 ID: %d.%d\n", tmpword>>4, tmpword&15);
223 tmpword = OCELOT_PLD_READ(RESET_STATUS);
224 printk("Reset reason: 0x%x\n", tmpword);
225 reset_reason = tmpword;
226 OCELOT_PLD_WRITE(0xff, RESET_STATUS);
227
228 tmpword = OCELOT_PLD_READ(BOARD_STATUS);
229 printk("Board Status register: 0x%02x\n", tmpword);
230 printk(" - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
231 printk(" - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
232 printk(" - Tulip PHY %s connected\n", (tmpword&0x10)?"is":"not");
233 printk(" - L3 Cache size: %d MiB\n", (1<<((tmpword&12) >> 2))&~1);
234 printk(" - SDRAM size: %d MiB\n", 1<<(6+(tmpword&3)));
235
236 if (tmpword&12)
237 l3func((1<<(((tmpword&12) >> 2)+20)));
238
239 switch(tmpword &3) {
240 case 3:
241 /* 512MiB */
242 /* Decoders are allready set -- just add the
243 * appropriate region */
244 add_memory_region( 0x40<<20, 0xC0<<20, BOOT_MEM_RAM);
245 add_memory_region(0x100<<20, 0x100<<20, BOOT_MEM_RAM);
246 break;
247 case 2:
248 /* 256MiB -- two banks of 128MiB */
249 GT_WRITE(GT_SCS10HD_OFS, 0x07e00000 >> 21);
250 GT_WRITE(GT_SCS32LD_OFS, 0x08000000 >> 21);
251 GT_WRITE(GT_SCS32HD_OFS, 0x0fe00000 >> 21);
252
253 GT_WRITE(GT_SCS0HD_OFS, 0x7f);
254 GT_WRITE(GT_SCS2LD_OFS, 0x80);
255 GT_WRITE(GT_SCS2HD_OFS, 0xff);
256
257 /* reconfigure the PCI0 interface view of memory */
258 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
259 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x08000000);
260 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x0ffff000);
261 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x0ffff000);
262
263 add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
264 add_memory_region(0x80<<20, 0x80<<20, BOOT_MEM_RAM);
265 break;
266 case 1:
267 /* 128MiB -- 64MiB per bank */
268 GT_WRITE(GT_SCS10HD_OFS, 0x03e00000 >> 21);
269 GT_WRITE(GT_SCS32LD_OFS, 0x04000000 >> 21);
270 GT_WRITE(GT_SCS32HD_OFS, 0x07e00000 >> 21);
271
272 GT_WRITE(GT_SCS0HD_OFS, 0x3f);
273 GT_WRITE(GT_SCS2LD_OFS, 0x40);
274 GT_WRITE(GT_SCS2HD_OFS, 0x7f);
275
276 /* reconfigure the PCI0 interface view of memory */
277 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
278 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x04000000);
279 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x03fff000);
280 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x03fff000);
281
282 /* add the appropriate region */
283 add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
284 break;
285 case 0:
286 /* 64MiB */
287 GT_WRITE(GT_SCS10HD_OFS, 0x01e00000 >> 21);
288 GT_WRITE(GT_SCS32LD_OFS, 0x02000000 >> 21);
289 GT_WRITE(GT_SCS32HD_OFS, 0x03e00000 >> 21);
290
291 GT_WRITE(GT_SCS0HD_OFS, 0x1f);
292 GT_WRITE(GT_SCS2LD_OFS, 0x20);
293 GT_WRITE(GT_SCS2HD_OFS, 0x3f);
294
295 /* reconfigure the PCI0 interface view of memory */
296 GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
297 GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x04000000);
298 GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x01fff000);
299 GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x01fff000);
300
301 break;
302 }
303
304 /* Fix up the DiskOnChip mapping */
305 GT_WRITE(GT_DEV_B3_OFS, 0xfef73);
306}
307
308extern int rm7k_tcache_enabled;
309/*
310 * This runs in KSEG1. See the verbiage in rm7k.c::probe_scache()
311 */
312#define Page_Invalidate_T 0x16
313static void __init setup_l3cache(unsigned long size)
314{
315 int register i;
316 unsigned long tmp;
317
318 printk("Enabling L3 cache...");
319
320 /* Enable the L3 cache in the GT64120A's CPU Configuration register */
321 tmp = GT_READ(GT_CPU_OFS);
322 GT_WRITE(GT_CPU_OFS, tmp | (1<<14));
323
324 /* Enable the L3 cache in the CPU */
325 set_c0_config(1<<12 /* CONF_TE */);
326
327 /* Clear the cache */
328 write_c0_taglo(0);
329 write_c0_taghi(0);
330
331 for (i=0; i < size; i+= 4096) {
332 __asm__ __volatile__ (
333 ".set noreorder\n\t"
334 ".set mips3\n\t"
335 "cache %1, (%0)\n\t"
336 ".set mips0\n\t"
337 ".set reorder"
338 :
339 : "r" (KSEG0ADDR(i)),
340 "i" (Page_Invalidate_T));
341 }
342
343 /* Let the RM7000 MM code know that the tertiary cache is enabled */
344 rm7k_tcache_enabled = 1;
345
346 printk("Done\n");
347}
348
349
350/* This needs to be one of the first initcalls, because no I/O port access
351 can work before this */
352
353static int io_base_ioremap(void)
354{
355 void *io_remap_range = ioremap(GT_PCI_IO_BASE, GT_PCI_IO_SIZE);
356
357 if (!io_remap_range) {
358 panic("Could not ioremap I/O port range");
359 }
360 set_io_port_base(io_remap_range - GT_PCI_IO_BASE);
361
362 return 0;
363}
364
365module_init(io_base_ioremap);
diff --git a/arch/mips/gt64120/wrppmc/Makefile b/arch/mips/gt64120/wrppmc/Makefile
index e4250435ad89..bef15c90ae15 100644
--- a/arch/mips/gt64120/wrppmc/Makefile
+++ b/arch/mips/gt64120/wrppmc/Makefile
@@ -10,3 +10,5 @@
10# 10#
11 11
12obj-y += irq.o reset.o setup.o time.o pci.o 12obj-y += irq.o reset.o setup.o time.o pci.o
13
14EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/jazz/Makefile b/arch/mips/jazz/Makefile
index ae4c402b5004..575a9442bc82 100644
--- a/arch/mips/jazz/Makefile
+++ b/arch/mips/jazz/Makefile
@@ -3,3 +3,5 @@
3# 3#
4 4
5obj-y := irq.o jazzdma.o jazz-platform.o reset.o setup.o 5obj-y := irq.o jazzdma.o jazz-platform.o reset.o setup.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/jmr3927/common/Makefile b/arch/mips/jmr3927/common/Makefile
index 01e7db19bcbe..8fd4fcccf10e 100644
--- a/arch/mips/jmr3927/common/Makefile
+++ b/arch/mips/jmr3927/common/Makefile
@@ -3,3 +3,5 @@
3# 3#
4 4
5obj-y += prom.o puts.o 5obj-y += prom.o puts.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/jmr3927/rbhma3100/Makefile b/arch/mips/jmr3927/rbhma3100/Makefile
index 8d00ba460cef..d86e30dca8f3 100644
--- a/arch/mips/jmr3927/rbhma3100/Makefile
+++ b/arch/mips/jmr3927/rbhma3100/Makefile
@@ -4,3 +4,5 @@
4 4
5obj-y += init.o irq.o setup.o 5obj-y += init.o irq.o setup.o
6obj-$(CONFIG_KGDB) += kgdb_io.o 6obj-$(CONFIG_KGDB) += kgdb_io.o
7
8EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 5c8085b6d7ab..07344cb37596 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -71,3 +71,5 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
71CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi) 71CFLAGS_cpu-bugs64.o = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
72 72
73obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o 73obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
74
75EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index 3b27309d54b1..013327286c26 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -132,7 +132,6 @@ void output_thread_defines(void)
132 offset("#define THREAD_ECODE ", struct task_struct, \ 132 offset("#define THREAD_ECODE ", struct task_struct, \
133 thread.error_code); 133 thread.error_code);
134 offset("#define THREAD_TRAPNO ", struct task_struct, thread.trap_no); 134 offset("#define THREAD_TRAPNO ", struct task_struct, thread.trap_no);
135 offset("#define THREAD_MFLAGS ", struct task_struct, thread.mflags);
136 offset("#define THREAD_TRAMP ", struct task_struct, \ 135 offset("#define THREAD_TRAMP ", struct task_struct, \
137 thread.irix_trampoline); 136 thread.irix_trampoline);
138 offset("#define THREAD_OLDCTX ", struct task_struct, \ 137 offset("#define THREAD_OLDCTX ", struct task_struct, \
diff --git a/arch/mips/kernel/head.S b/arch/mips/kernel/head.S
index c15bbc436bbd..e46782b0ebc8 100644
--- a/arch/mips/kernel/head.S
+++ b/arch/mips/kernel/head.S
@@ -138,7 +138,6 @@
138 .fill 0x400 138 .fill 0x400
139#endif 139#endif
140 140
141EXPORT(stext) # used for profiling
142EXPORT(_stext) 141EXPORT(_stext)
143 142
144#ifndef CONFIG_BOOT_RAW 143#ifndef CONFIG_BOOT_RAW
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c
index c6580018c94b..cb9a14a1ca5b 100644
--- a/arch/mips/kernel/kspd.c
+++ b/arch/mips/kernel/kspd.c
@@ -89,7 +89,7 @@ static int sp_stopping = 0;
89#define MTSP_O_EXCL 0x0800 89#define MTSP_O_EXCL 0x0800
90#define MTSP_O_BINARY 0x8000 90#define MTSP_O_BINARY 0x8000
91 91
92#define SP_VPE 1 92extern int tclimit;
93 93
94struct apsp_table { 94struct apsp_table {
95 int sp; 95 int sp;
@@ -225,8 +225,8 @@ void sp_work_handle_request(void)
225 /* Run the syscall at the priviledge of the user who loaded the 225 /* Run the syscall at the priviledge of the user who loaded the
226 SP program */ 226 SP program */
227 227
228 if (vpe_getuid(SP_VPE)) 228 if (vpe_getuid(tclimit))
229 sp_setfsuidgid( vpe_getuid(SP_VPE), vpe_getgid(SP_VPE)); 229 sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
230 230
231 switch (sc.cmd) { 231 switch (sc.cmd) {
232 /* needs the flags argument translating from SDE kit to 232 /* needs the flags argument translating from SDE kit to
@@ -245,7 +245,7 @@ void sp_work_handle_request(void)
245 245
246 case MTSP_SYSCALL_EXIT: 246 case MTSP_SYSCALL_EXIT:
247 list_for_each_entry(n, &kspd_notifylist, list) 247 list_for_each_entry(n, &kspd_notifylist, list)
248 n->kspd_sp_exit(SP_VPE); 248 n->kspd_sp_exit(tclimit);
249 sp_stopping = 1; 249 sp_stopping = 1;
250 250
251 printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n", 251 printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n",
@@ -255,7 +255,7 @@ void sp_work_handle_request(void)
255 case MTSP_SYSCALL_OPEN: 255 case MTSP_SYSCALL_OPEN:
256 generic.arg1 = translate_open_flags(generic.arg1); 256 generic.arg1 = translate_open_flags(generic.arg1);
257 257
258 vcwd = vpe_getcwd(SP_VPE); 258 vcwd = vpe_getcwd(tclimit);
259 259
260 /* change to the cwd of the process that loaded the SP program */ 260 /* change to the cwd of the process that loaded the SP program */
261 old_fs = get_fs(); 261 old_fs = get_fs();
@@ -283,7 +283,7 @@ void sp_work_handle_request(void)
283 break; 283 break;
284 } /* switch */ 284 } /* switch */
285 285
286 if (vpe_getuid(SP_VPE)) 286 if (vpe_getuid(tclimit))
287 sp_setfsuidgid( 0, 0); 287 sp_setfsuidgid( 0, 0);
288 288
289 old_fs = get_fs(); 289 old_fs = get_fs();
@@ -364,10 +364,9 @@ static void startwork(int vpe)
364 } 364 }
365 365
366 INIT_WORK(&work, sp_work); 366 INIT_WORK(&work, sp_work);
367 queue_work(workqueue, &work); 367 }
368 } else
369 queue_work(workqueue, &work);
370 368
369 queue_work(workqueue, &work);
371} 370}
372 371
373static void stopwork(int vpe) 372static void stopwork(int vpe)
@@ -389,7 +388,7 @@ static int kspd_module_init(void)
389 388
390 notify.start = startwork; 389 notify.start = startwork;
391 notify.stop = stopwork; 390 notify.stop = stopwork;
392 vpe_notify(SP_VPE, &notify); 391 vpe_notify(tclimit, &notify);
393 392
394 return 0; 393 return 0;
395} 394}
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index c37568d6fb55..135d9a5fe337 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -566,6 +566,13 @@ asmlinkage long sys32_fadvise64_64(int fd, int __pad,
566 flags); 566 flags);
567} 567}
568 568
569asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
570 unsigned offset_a3, unsigned len_a4, unsigned len_a5)
571{
572 return sys_fallocate(fd, mode, merge_64(offset_a2, offset_a3),
573 merge_64(len_a4, len_a5));
574}
575
569save_static_function(sys32_clone); 576save_static_function(sys32_clone);
570static int noinline __used 577static int noinline __used
571_sys32_clone(nabi_no_regargs struct pt_regs regs) 578_sys32_clone(nabi_no_regargs struct pt_regs regs)
diff --git a/arch/mips/kernel/machine_kexec.c b/arch/mips/kernel/machine_kexec.c
index 8f42fa85ac9e..22960d67cf07 100644
--- a/arch/mips/kernel/machine_kexec.c
+++ b/arch/mips/kernel/machine_kexec.c
@@ -14,7 +14,7 @@
14#include <asm/page.h> 14#include <asm/page.h>
15 15
16extern const unsigned char relocate_new_kernel[]; 16extern const unsigned char relocate_new_kernel[];
17extern const unsigned int relocate_new_kernel_size; 17extern const size_t relocate_new_kernel_size;
18 18
19extern unsigned long kexec_start_address; 19extern unsigned long kexec_start_address;
20extern unsigned long kexec_indirection_page; 20extern unsigned long kexec_indirection_page;
@@ -40,6 +40,8 @@ machine_crash_shutdown(struct pt_regs *regs)
40{ 40{
41} 41}
42 42
43typedef void (*noretfun_t)(void) __attribute__((noreturn));
44
43void 45void
44machine_kexec(struct kimage *image) 46machine_kexec(struct kimage *image)
45{ 47{
@@ -51,7 +53,8 @@ machine_kexec(struct kimage *image)
51 (unsigned long)page_address(image->control_code_page); 53 (unsigned long)page_address(image->control_code_page);
52 54
53 kexec_start_address = image->start; 55 kexec_start_address = image->start;
54 kexec_indirection_page = phys_to_virt(image->head & PAGE_MASK); 56 kexec_indirection_page =
57 (unsigned long) phys_to_virt(image->head & PAGE_MASK);
55 58
56 memcpy((void*)reboot_code_buffer, relocate_new_kernel, 59 memcpy((void*)reboot_code_buffer, relocate_new_kernel,
57 relocate_new_kernel_size); 60 relocate_new_kernel_size);
@@ -67,7 +70,7 @@ machine_kexec(struct kimage *image)
67 phys_to_virt(entry & PAGE_MASK) : ptr + 1) { 70 phys_to_virt(entry & PAGE_MASK) : ptr + 1) {
68 if (*ptr & IND_SOURCE || *ptr & IND_INDIRECTION || 71 if (*ptr & IND_SOURCE || *ptr & IND_INDIRECTION ||
69 *ptr & IND_DESTINATION) 72 *ptr & IND_DESTINATION)
70 *ptr = phys_to_virt(*ptr); 73 *ptr = (unsigned long) phys_to_virt(*ptr);
71 } 74 }
72 75
73 /* 76 /*
@@ -78,8 +81,8 @@ machine_kexec(struct kimage *image)
78 flush_icache_range(reboot_code_buffer, 81 flush_icache_range(reboot_code_buffer,
79 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE); 82 reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
80 83
81 printk("Will call new kernel at %08x\n", image->start); 84 printk("Will call new kernel at %08lx\n", image->start);
82 printk("Bye ...\n"); 85 printk("Bye ...\n");
83 flush_cache_all(); 86 flush_cache_all();
84 ((void (*)(void))reboot_code_buffer)(); 87 ((noretfun_t) reboot_code_buffer)();
85} 88}
diff --git a/arch/mips/kernel/mips-mt-fpaff.c b/arch/mips/kernel/mips-mt-fpaff.c
index ede5d73d652e..892665bb12b1 100644
--- a/arch/mips/kernel/mips-mt-fpaff.c
+++ b/arch/mips/kernel/mips-mt-fpaff.c
@@ -50,6 +50,7 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
50 cpumask_t effective_mask; 50 cpumask_t effective_mask;
51 int retval; 51 int retval;
52 struct task_struct *p; 52 struct task_struct *p;
53 struct thread_info *ti;
53 54
54 if (len < sizeof(new_mask)) 55 if (len < sizeof(new_mask))
55 return -EINVAL; 56 return -EINVAL;
@@ -93,16 +94,16 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
93 read_unlock(&tasklist_lock); 94 read_unlock(&tasklist_lock);
94 95
95 /* Compute new global allowed CPU set if necessary */ 96 /* Compute new global allowed CPU set if necessary */
96 if ((p->thread.mflags & MF_FPUBOUND) 97 ti = task_thread_info(p);
97 && cpus_intersects(new_mask, mt_fpu_cpumask)) { 98 if (test_ti_thread_flag(ti, TIF_FPUBOUND) &&
99 cpus_intersects(new_mask, mt_fpu_cpumask)) {
98 cpus_and(effective_mask, new_mask, mt_fpu_cpumask); 100 cpus_and(effective_mask, new_mask, mt_fpu_cpumask);
99 retval = set_cpus_allowed(p, effective_mask); 101 retval = set_cpus_allowed(p, effective_mask);
100 } else { 102 } else {
101 p->thread.mflags &= ~MF_FPUBOUND; 103 clear_ti_thread_flag(ti, TIF_FPUBOUND);
102 retval = set_cpus_allowed(p, new_mask); 104 retval = set_cpus_allowed(p, new_mask);
103 } 105 }
104 106
105
106out_unlock: 107out_unlock:
107 put_task_struct(p); 108 put_task_struct(p);
108 unlock_cpu_hotplug(); 109 unlock_cpu_hotplug();
diff --git a/arch/mips/kernel/mips-mt.c b/arch/mips/kernel/mips-mt.c
index 1a7d89231299..7169a4db37b8 100644
--- a/arch/mips/kernel/mips-mt.c
+++ b/arch/mips/kernel/mips-mt.c
@@ -21,6 +21,28 @@
21#include <asm/r4kcache.h> 21#include <asm/r4kcache.h>
22#include <asm/cacheflush.h> 22#include <asm/cacheflush.h>
23 23
24int vpelimit;
25
26static int __init maxvpes(char *str)
27{
28 get_option(&str, &vpelimit);
29
30 return 1;
31}
32
33__setup("maxvpes=", maxvpes);
34
35int tclimit;
36
37static int __init maxtcs(char *str)
38{
39 get_option(&str, &tclimit);
40
41 return 1;
42}
43
44__setup("maxtcs=", maxtcs);
45
24/* 46/*
25 * Dump new MIPS MT state for the core. Does not leave TCs halted. 47 * Dump new MIPS MT state for the core. Does not leave TCs halted.
26 * Takes an argument which taken to be a pre-call MVPControl value. 48 * Takes an argument which taken to be a pre-call MVPControl value.
diff --git a/arch/mips/kernel/process.c b/arch/mips/kernel/process.c
index bd05f5a927ea..e6ce943099a0 100644
--- a/arch/mips/kernel/process.c
+++ b/arch/mips/kernel/process.c
@@ -77,7 +77,7 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
77 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|KU_MASK); 77 status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|KU_MASK);
78#ifdef CONFIG_64BIT 78#ifdef CONFIG_64BIT
79 status &= ~ST0_FR; 79 status &= ~ST0_FR;
80 status |= (current->thread.mflags & MF_32BIT_REGS) ? 0 : ST0_FR; 80 status |= test_thread_flag(TIF_32BIT_REGS) ? 0 : ST0_FR;
81#endif 81#endif
82 status |= KU_USER; 82 status |= KU_USER;
83 regs->cp0_status = status; 83 regs->cp0_status = status;
diff --git a/arch/mips/kernel/ptrace.c b/arch/mips/kernel/ptrace.c
index 893e7bccf226..bbd57b20b43e 100644
--- a/arch/mips/kernel/ptrace.c
+++ b/arch/mips/kernel/ptrace.c
@@ -20,11 +20,11 @@
20#include <linux/mm.h> 20#include <linux/mm.h>
21#include <linux/errno.h> 21#include <linux/errno.h>
22#include <linux/ptrace.h> 22#include <linux/ptrace.h>
23#include <linux/audit.h>
24#include <linux/smp.h> 23#include <linux/smp.h>
25#include <linux/user.h> 24#include <linux/user.h>
26#include <linux/security.h> 25#include <linux/security.h>
27#include <linux/signal.h> 26#include <linux/audit.h>
27#include <linux/seccomp.h>
28 28
29#include <asm/byteorder.h> 29#include <asm/byteorder.h>
30#include <asm/cpu.h> 30#include <asm/cpu.h>
@@ -470,12 +470,17 @@ static inline int audit_arch(void)
470 */ 470 */
471asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit) 471asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
472{ 472{
473 /* do the secure computing check first */
474 if (!entryexit)
475 secure_computing(regs->regs[0]);
476
473 if (unlikely(current->audit_context) && entryexit) 477 if (unlikely(current->audit_context) && entryexit)
474 audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]), 478 audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]),
475 regs->regs[2]); 479 regs->regs[2]);
476 480
477 if (!(current->ptrace & PT_PTRACED)) 481 if (!(current->ptrace & PT_PTRACED))
478 goto out; 482 goto out;
483
479 if (!test_thread_flag(TIF_SYSCALL_TRACE)) 484 if (!test_thread_flag(TIF_SYSCALL_TRACE))
480 goto out; 485 goto out;
481 486
@@ -493,9 +498,10 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
493 send_sig(current->exit_code, current, 1); 498 send_sig(current->exit_code, current, 1);
494 current->exit_code = 0; 499 current->exit_code = 0;
495 } 500 }
496 out: 501
502out:
497 if (unlikely(current->audit_context) && !entryexit) 503 if (unlikely(current->audit_context) && !entryexit)
498 audit_syscall_entry(audit_arch(), regs->regs[2], 504 audit_syscall_entry(audit_arch(), regs->regs[0],
499 regs->regs[4], regs->regs[5], 505 regs->regs[4], regs->regs[5],
500 regs->regs[6], regs->regs[7]); 506 regs->regs[6], regs->regs[7]);
501} 507}
diff --git a/arch/mips/kernel/relocate_kernel.S b/arch/mips/kernel/relocate_kernel.S
index a3f0d00c1334..87481f916a61 100644
--- a/arch/mips/kernel/relocate_kernel.S
+++ b/arch/mips/kernel/relocate_kernel.S
@@ -14,67 +14,69 @@
14#include <asm/stackframe.h> 14#include <asm/stackframe.h>
15#include <asm/addrspace.h> 15#include <asm/addrspace.h>
16 16
17 .globl relocate_new_kernel 17LEAF(relocate_new_kernel)
18relocate_new_kernel: 18 PTR_L s0, kexec_indirection_page
19 19 PTR_L s1, kexec_start_address
20 PTR_L s0, kexec_indirection_page
21 PTR_L s1, kexec_start_address
22 20
23process_entry: 21process_entry:
24 PTR_L s2, (s0) 22 PTR_L s2, (s0)
25 PTR_ADD s0, s0, SZREG 23 PTR_ADD s0, s0, SZREG
26 24
27 /* destination page */ 25 /* destination page */
28 and s3, s2, 0x1 26 and s3, s2, 0x1
29 beq s3, zero, 1f 27 beq s3, zero, 1f
30 and s4, s2, ~0x1 /* store destination addr in s4 */ 28 and s4, s2, ~0x1 /* store destination addr in s4 */
31 move a0, s4 29 move a0, s4
32 b process_entry 30 b process_entry
33 31
341: 321:
35 /* indirection page, update s0 */ 33 /* indirection page, update s0 */
36 and s3, s2, 0x2 34 and s3, s2, 0x2
37 beq s3, zero, 1f 35 beq s3, zero, 1f
38 and s0, s2, ~0x2 36 and s0, s2, ~0x2
39 b process_entry 37 b process_entry
40 38
411: 391:
42 /* done page */ 40 /* done page */
43 and s3, s2, 0x4 41 and s3, s2, 0x4
44 beq s3, zero, 1f 42 beq s3, zero, 1f
45 b done 43 b done
461: 441:
47 /* source page */ 45 /* source page */
48 and s3, s2, 0x8 46 and s3, s2, 0x8
49 beq s3, zero, process_entry 47 beq s3, zero, process_entry
50 and s2, s2, ~0x8 48 and s2, s2, ~0x8
51 li s6, (1 << PAGE_SHIFT) / SZREG 49 li s6, (1 << PAGE_SHIFT) / SZREG
52 50
53copy_word: 51copy_word:
54 /* copy page word by word */ 52 /* copy page word by word */
55 REG_L s5, (s2) 53 REG_L s5, (s2)
56 REG_S s5, (s4) 54 REG_S s5, (s4)
57 INT_ADD s4, s4, SZREG 55 PTR_ADD s4, s4, SZREG
58 INT_ADD s2, s2, SZREG 56 PTR_ADD s2, s2, SZREG
59 INT_SUB s6, s6, 1 57 LONG_SUB s6, s6, 1
60 beq s6, zero, process_entry 58 beq s6, zero, process_entry
61 b copy_word 59 b copy_word
62 b process_entry 60 b process_entry
63 61
64done: 62done:
65 /* jump to kexec_start_address */ 63 /* jump to kexec_start_address */
66 j s1 64 j s1
65 END(relocate_new_kernel)
67 66
68 .globl kexec_start_address
69kexec_start_address: 67kexec_start_address:
70 .long 0x0 68 EXPORT(kexec_start_address)
69 PTR 0x0
70 .size kexec_start_address, PTRSIZE
71 71
72 .globl kexec_indirection_page
73kexec_indirection_page: 72kexec_indirection_page:
74 .long 0x0 73 EXPORT(kexec_indirection_page)
74 PTR 0
75 .size kexec_indirection_page, PTRSIZE
75 76
76relocate_new_kernel_end: 77relocate_new_kernel_end:
77 78
78 .globl relocate_new_kernel_size
79relocate_new_kernel_size: 79relocate_new_kernel_size:
80 .long relocate_new_kernel_end - relocate_new_kernel 80 EXPORT(relocate_new_kernel_size)
81 PTR relocate_new_kernel_end - relocate_new_kernel
82 .size relocate_new_kernel_size, PTRSIZE
diff --git a/arch/mips/kernel/rtlx.c b/arch/mips/kernel/rtlx.c
index 8cf24d716d41..aab89e97abb5 100644
--- a/arch/mips/kernel/rtlx.c
+++ b/arch/mips/kernel/rtlx.c
@@ -40,12 +40,11 @@
40#include <asm/atomic.h> 40#include <asm/atomic.h>
41#include <asm/cpu.h> 41#include <asm/cpu.h>
42#include <asm/processor.h> 42#include <asm/processor.h>
43#include <asm/mips_mt.h>
43#include <asm/system.h> 44#include <asm/system.h>
44#include <asm/vpe.h> 45#include <asm/vpe.h>
45#include <asm/rtlx.h> 46#include <asm/rtlx.h>
46 47
47#define RTLX_TARG_VPE 1
48
49static struct rtlx_info *rtlx; 48static struct rtlx_info *rtlx;
50static int major; 49static int major;
51static char module_name[] = "rtlx"; 50static char module_name[] = "rtlx";
@@ -165,10 +164,10 @@ int rtlx_open(int index, int can_sleep)
165 } 164 }
166 165
167 if (rtlx == NULL) { 166 if (rtlx == NULL) {
168 if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) { 167 if( (p = vpe_get_shared(tclimit)) == NULL) {
169 if (can_sleep) { 168 if (can_sleep) {
170 __wait_event_interruptible(channel_wqs[index].lx_queue, 169 __wait_event_interruptible(channel_wqs[index].lx_queue,
171 (p = vpe_get_shared(RTLX_TARG_VPE)), 170 (p = vpe_get_shared(tclimit)),
172 ret); 171 ret);
173 if (ret) 172 if (ret)
174 goto out_fail; 173 goto out_fail;
@@ -472,11 +471,24 @@ static int rtlx_irq_num = MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ;
472static char register_chrdev_failed[] __initdata = 471static char register_chrdev_failed[] __initdata =
473 KERN_ERR "rtlx_module_init: unable to register device\n"; 472 KERN_ERR "rtlx_module_init: unable to register device\n";
474 473
475static int rtlx_module_init(void) 474static int __init rtlx_module_init(void)
476{ 475{
477 struct device *dev; 476 struct device *dev;
478 int i, err; 477 int i, err;
479 478
479 if (!cpu_has_mipsmt) {
480 printk("VPE loader: not a MIPS MT capable processor\n");
481 return -ENODEV;
482 }
483
484 if (tclimit == 0) {
485 printk(KERN_WARNING "No TCs reserved for AP/SP, not "
486 "initializing RTLX.\nPass maxtcs=<n> argument as kernel "
487 "argument\n");
488
489 return -ENODEV;
490 }
491
480 major = register_chrdev(0, module_name, &rtlx_fops); 492 major = register_chrdev(0, module_name, &rtlx_fops);
481 if (major < 0) { 493 if (major < 0) {
482 printk(register_chrdev_failed); 494 printk(register_chrdev_failed);
@@ -501,7 +513,7 @@ static int rtlx_module_init(void)
501 /* set up notifiers */ 513 /* set up notifiers */
502 notify.start = starting; 514 notify.start = starting;
503 notify.stop = stopping; 515 notify.stop = stopping;
504 vpe_notify(RTLX_TARG_VPE, &notify); 516 vpe_notify(tclimit, &notify);
505 517
506 if (cpu_has_vint) 518 if (cpu_has_vint)
507 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch); 519 set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
diff --git a/arch/mips/kernel/scall32-o32.S b/arch/mips/kernel/scall32-o32.S
index ae985d1fcca1..82480a1717d8 100644
--- a/arch/mips/kernel/scall32-o32.S
+++ b/arch/mips/kernel/scall32-o32.S
@@ -662,6 +662,7 @@ einval: li v0, -EINVAL
662 sys sys_signalfd 3 662 sys sys_signalfd 3
663 sys sys_timerfd 4 663 sys sys_timerfd 4
664 sys sys_eventfd 1 664 sys sys_eventfd 1
665 sys sys_fallocate 6 /* 4320 */
665 .endm 666 .endm
666 667
667 /* We pre-compute the number of _instruction_ bytes needed to 668 /* We pre-compute the number of _instruction_ bytes needed to
diff --git a/arch/mips/kernel/scall64-64.S b/arch/mips/kernel/scall64-64.S
index 7bcd5a1a85f5..c2c10876da2e 100644
--- a/arch/mips/kernel/scall64-64.S
+++ b/arch/mips/kernel/scall64-64.S
@@ -477,4 +477,5 @@ sys_call_table:
477 PTR sys_signalfd 477 PTR sys_signalfd
478 PTR sys_timerfd 478 PTR sys_timerfd
479 PTR sys_eventfd 479 PTR sys_eventfd
480 PTR sys_fallocate
480 .size sys_call_table,.-sys_call_table 481 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index 532a2f3b42fc..53d7a977193c 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -403,4 +403,5 @@ EXPORT(sysn32_call_table)
403 PTR compat_sys_signalfd /* 5280 */ 403 PTR compat_sys_signalfd /* 5280 */
404 PTR compat_sys_timerfd 404 PTR compat_sys_timerfd
405 PTR sys_eventfd 405 PTR sys_eventfd
406 PTR sys_fallocate
406 .size sysn32_call_table,.-sysn32_call_table 407 .size sysn32_call_table,.-sysn32_call_table
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 6bbe0f4ed8ba..b3ed731a24c6 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -525,4 +525,5 @@ sys_call_table:
525 PTR compat_sys_signalfd 525 PTR compat_sys_signalfd
526 PTR compat_sys_timerfd 526 PTR compat_sys_timerfd
527 PTR sys_eventfd 527 PTR sys_eventfd
528 PTR sys_fallocate /* 4320 */
528 .size sys_call_table,.-sys_call_table 529 .size sys_call_table,.-sys_call_table
diff --git a/arch/mips/kernel/signal32.c b/arch/mips/kernel/signal32.c
index 486b8e5f52d0..64b612a0a622 100644
--- a/arch/mips/kernel/signal32.c
+++ b/arch/mips/kernel/signal32.c
@@ -18,7 +18,6 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/wait.h> 19#include <linux/wait.h>
20#include <linux/ptrace.h> 20#include <linux/ptrace.h>
21#include <linux/compat.h>
22#include <linux/suspend.h> 21#include <linux/suspend.h>
23#include <linux/compiler.h> 22#include <linux/compiler.h>
24#include <linux/uaccess.h> 23#include <linux/uaccess.h>
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 04bbbd8d91ab..73b0dab02668 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -194,6 +194,61 @@ void smp_call_function_interrupt(void)
194 } 194 }
195} 195}
196 196
197int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
198 int retry, int wait)
199{
200 struct call_data_struct data;
201 int me;
202
203 /*
204 * Can die spectacularly if this CPU isn't yet marked online
205 */
206 if (!cpu_online(cpu))
207 return 0;
208
209 me = get_cpu();
210 BUG_ON(!cpu_online(me));
211
212 if (cpu == me) {
213 local_irq_disable();
214 func(info);
215 local_irq_enable();
216 put_cpu();
217 return 0;
218 }
219
220 /* Can deadlock when called with interrupts disabled */
221 WARN_ON(irqs_disabled());
222
223 data.func = func;
224 data.info = info;
225 atomic_set(&data.started, 0);
226 data.wait = wait;
227 if (wait)
228 atomic_set(&data.finished, 0);
229
230 spin_lock(&smp_call_lock);
231 call_data = &data;
232 smp_mb();
233
234 /* Send a message to the other CPU */
235 core_send_ipi(cpu, SMP_CALL_FUNCTION);
236
237 /* Wait for response */
238 /* FIXME: lock-up detection, backtrace on lock-up */
239 while (atomic_read(&data.started) != 1)
240 barrier();
241
242 if (wait)
243 while (atomic_read(&data.finished) != 1)
244 barrier();
245 call_data = NULL;
246 spin_unlock(&smp_call_lock);
247
248 put_cpu();
249 return 0;
250}
251
197static void stop_this_cpu(void *dummy) 252static void stop_this_cpu(void *dummy)
198{ 253{
199 /* 254 /*
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index 342d873b2ecc..16aa5d37117c 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -86,25 +86,11 @@ unsigned int smtc_status = 0;
86 86
87/* Boot command line configuration overrides */ 87/* Boot command line configuration overrides */
88 88
89static int vpelimit = 0;
90static int tclimit = 0;
91static int ipibuffers = 0; 89static int ipibuffers = 0;
92static int nostlb = 0; 90static int nostlb = 0;
93static int asidmask = 0; 91static int asidmask = 0;
94unsigned long smtc_asid_mask = 0xff; 92unsigned long smtc_asid_mask = 0xff;
95 93
96static int __init maxvpes(char *str)
97{
98 get_option(&str, &vpelimit);
99 return 1;
100}
101
102static int __init maxtcs(char *str)
103{
104 get_option(&str, &tclimit);
105 return 1;
106}
107
108static int __init ipibufs(char *str) 94static int __init ipibufs(char *str)
109{ 95{
110 get_option(&str, &ipibuffers); 96 get_option(&str, &ipibuffers);
@@ -137,8 +123,6 @@ static int __init asidmask_set(char *str)
137 return 1; 123 return 1;
138} 124}
139 125
140__setup("maxvpes=", maxvpes);
141__setup("maxtcs=", maxtcs);
142__setup("ipibufs=", ipibufs); 126__setup("ipibufs=", ipibufs);
143__setup("nostlb", stlb_disable); 127__setup("nostlb", stlb_disable);
144__setup("asidmask=", asidmask_set); 128__setup("asidmask=", asidmask_set);
@@ -168,9 +152,9 @@ static int __init tintq(char *str)
168 152
169__setup("tintq=", tintq); 153__setup("tintq=", tintq);
170 154
171int imstuckcount[2][8]; 155static int imstuckcount[2][8];
172/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */ 156/* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */
173int vpemask[2][8] = { 157static int vpemask[2][8] = {
174 {0, 0, 1, 0, 0, 0, 0, 1}, 158 {0, 0, 1, 0, 0, 0, 0, 1},
175 {0, 0, 0, 0, 0, 0, 0, 1} 159 {0, 0, 0, 0, 0, 0, 0, 1}
176}; 160};
@@ -540,7 +524,7 @@ void mipsmt_prepare_cpus(void)
540 * (unsigned long)idle->thread_info the gp 524 * (unsigned long)idle->thread_info the gp
541 * 525 *
542 */ 526 */
543void smtc_boot_secondary(int cpu, struct task_struct *idle) 527void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
544{ 528{
545 extern u32 kernelsp[NR_CPUS]; 529 extern u32 kernelsp[NR_CPUS];
546 long flags; 530 long flags;
@@ -876,7 +860,7 @@ void deferred_smtc_ipi(void)
876 * Send clock tick to all TCs except the one executing the funtion 860 * Send clock tick to all TCs except the one executing the funtion
877 */ 861 */
878 862
879void smtc_timer_broadcast(int vpe) 863void smtc_timer_broadcast(void)
880{ 864{
881 int cpu; 865 int cpu;
882 int myTC = cpu_data[smp_processor_id()].tc_id; 866 int myTC = cpu_data[smp_processor_id()].tc_id;
@@ -975,7 +959,12 @@ static void ipi_irq_dispatch(void)
975 do_IRQ(cpu_ipi_irq); 959 do_IRQ(cpu_ipi_irq);
976} 960}
977 961
978static struct irqaction irq_ipi; 962static struct irqaction irq_ipi = {
963 .handler = ipi_interrupt,
964 .flags = IRQF_DISABLED,
965 .name = "SMTC_IPI",
966 .flags = IRQF_PERCPU
967};
979 968
980static void setup_cross_vpe_interrupts(unsigned int nvpe) 969static void setup_cross_vpe_interrupts(unsigned int nvpe)
981{ 970{
@@ -987,13 +976,8 @@ static void setup_cross_vpe_interrupts(unsigned int nvpe)
987 976
988 set_vi_handler(MIPS_CPU_IPI_IRQ, ipi_irq_dispatch); 977 set_vi_handler(MIPS_CPU_IPI_IRQ, ipi_irq_dispatch);
989 978
990 irq_ipi.handler = ipi_interrupt;
991 irq_ipi.flags = IRQF_DISABLED;
992 irq_ipi.name = "SMTC_IPI";
993
994 setup_irq_smtc(cpu_ipi_irq, &irq_ipi, (0x100 << MIPS_CPU_IPI_IRQ)); 979 setup_irq_smtc(cpu_ipi_irq, &irq_ipi, (0x100 << MIPS_CPU_IPI_IRQ));
995 980
996 irq_desc[cpu_ipi_irq].status |= IRQ_PER_CPU;
997 set_irq_handler(cpu_ipi_irq, handle_percpu_irq); 981 set_irq_handler(cpu_ipi_irq, handle_percpu_irq);
998} 982}
999 983
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index 541b5005957e..7c800ec3ff55 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -281,16 +281,24 @@ asmlinkage int sys_set_thread_area(unsigned long addr)
281 281
282asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3) 282asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
283{ 283{
284 int tmp; 284 switch (cmd) {
285
286 switch(cmd) {
287 case MIPS_ATOMIC_SET: 285 case MIPS_ATOMIC_SET:
288 printk(KERN_CRIT "How did I get here?\n"); 286 printk(KERN_CRIT "How did I get here?\n");
289 return -EINVAL; 287 return -EINVAL;
290 288
291 case MIPS_FIXADE: 289 case MIPS_FIXADE:
292 tmp = current->thread.mflags & ~3; 290 if (arg1 & ~3)
293 current->thread.mflags = tmp | (arg1 & 3); 291 return -EINVAL;
292
293 if (arg1 & 1)
294 set_thread_flag(TIF_FIXADE);
295 else
296 clear_thread_flag(TIF_FIXADE);
297 if (arg1 & 2)
298 set_thread_flag(TIF_LOGADE);
299 else
300 clear_thread_flag(TIF_FIXADE);
301
294 return 0; 302 return 0;
295 303
296 case FLUSH_CACHE: 304 case FLUSH_CACHE:
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index ce277cb34dd0..c8e291c83057 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -775,7 +775,7 @@ static void mt_ase_fp_affinity(void)
775 cpus_and(tmask, current->thread.user_cpus_allowed, 775 cpus_and(tmask, current->thread.user_cpus_allowed,
776 mt_fpu_cpumask); 776 mt_fpu_cpumask);
777 set_cpus_allowed(current, tmask); 777 set_cpus_allowed(current, tmask);
778 current->thread.mflags |= MF_FPUBOUND; 778 set_thread_flag(TIF_FPUBOUND);
779 } 779 }
780 } 780 }
781#endif /* CONFIG_MIPS_MT_FPAFF */ 781#endif /* CONFIG_MIPS_MT_FPAFF */
diff --git a/arch/mips/kernel/unaligned.c b/arch/mips/kernel/unaligned.c
index 8b9c34ffae18..d34b1fb3665d 100644
--- a/arch/mips/kernel/unaligned.c
+++ b/arch/mips/kernel/unaligned.c
@@ -101,16 +101,14 @@ static u32 unaligned_action;
101#endif 101#endif
102extern void show_registers(struct pt_regs *regs); 102extern void show_registers(struct pt_regs *regs);
103 103
104static inline int emulate_load_store_insn(struct pt_regs *regs, 104static void emulate_load_store_insn(struct pt_regs *regs,
105 void __user *addr, unsigned int __user *pc, 105 void __user *addr, unsigned int __user *pc)
106 unsigned long **regptr, unsigned long *newvalue)
107{ 106{
108 union mips_instruction insn; 107 union mips_instruction insn;
109 unsigned long value; 108 unsigned long value;
110 unsigned int res; 109 unsigned int res;
111 110
112 regs->regs[0] = 0; 111 regs->regs[0] = 0;
113 *regptr=NULL;
114 112
115 /* 113 /*
116 * This load never faults. 114 * This load never faults.
@@ -179,8 +177,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
179 : "r" (addr), "i" (-EFAULT)); 177 : "r" (addr), "i" (-EFAULT));
180 if (res) 178 if (res)
181 goto fault; 179 goto fault;
182 *newvalue = value; 180 compute_return_epc(regs);
183 *regptr = &regs->regs[insn.i_format.rt]; 181 regs->regs[insn.i_format.rt] = value;
184 break; 182 break;
185 183
186 case lw_op: 184 case lw_op:
@@ -209,8 +207,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
209 : "r" (addr), "i" (-EFAULT)); 207 : "r" (addr), "i" (-EFAULT));
210 if (res) 208 if (res)
211 goto fault; 209 goto fault;
212 *newvalue = value; 210 compute_return_epc(regs);
213 *regptr = &regs->regs[insn.i_format.rt]; 211 regs->regs[insn.i_format.rt] = value;
214 break; 212 break;
215 213
216 case lhu_op: 214 case lhu_op:
@@ -243,8 +241,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
243 : "r" (addr), "i" (-EFAULT)); 241 : "r" (addr), "i" (-EFAULT));
244 if (res) 242 if (res)
245 goto fault; 243 goto fault;
246 *newvalue = value; 244 compute_return_epc(regs);
247 *regptr = &regs->regs[insn.i_format.rt]; 245 regs->regs[insn.i_format.rt] = value;
248 break; 246 break;
249 247
250 case lwu_op: 248 case lwu_op:
@@ -283,8 +281,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
283 : "r" (addr), "i" (-EFAULT)); 281 : "r" (addr), "i" (-EFAULT));
284 if (res) 282 if (res)
285 goto fault; 283 goto fault;
286 *newvalue = value; 284 compute_return_epc(regs);
287 *regptr = &regs->regs[insn.i_format.rt]; 285 regs->regs[insn.i_format.rt] = value;
288 break; 286 break;
289#endif /* CONFIG_64BIT */ 287#endif /* CONFIG_64BIT */
290 288
@@ -325,8 +323,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
325 : "r" (addr), "i" (-EFAULT)); 323 : "r" (addr), "i" (-EFAULT));
326 if (res) 324 if (res)
327 goto fault; 325 goto fault;
328 *newvalue = value; 326 compute_return_epc(regs);
329 *regptr = &regs->regs[insn.i_format.rt]; 327 regs->regs[insn.i_format.rt] = value;
330 break; 328 break;
331#endif /* CONFIG_64BIT */ 329#endif /* CONFIG_64BIT */
332 330
@@ -367,6 +365,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
367 : "r" (value), "r" (addr), "i" (-EFAULT)); 365 : "r" (value), "r" (addr), "i" (-EFAULT));
368 if (res) 366 if (res)
369 goto fault; 367 goto fault;
368 compute_return_epc(regs);
370 break; 369 break;
371 370
372 case sw_op: 371 case sw_op:
@@ -397,6 +396,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
397 : "r" (value), "r" (addr), "i" (-EFAULT)); 396 : "r" (value), "r" (addr), "i" (-EFAULT));
398 if (res) 397 if (res)
399 goto fault; 398 goto fault;
399 compute_return_epc(regs);
400 break; 400 break;
401 401
402 case sd_op: 402 case sd_op:
@@ -435,6 +435,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
435 : "r" (value), "r" (addr), "i" (-EFAULT)); 435 : "r" (value), "r" (addr), "i" (-EFAULT));
436 if (res) 436 if (res)
437 goto fault; 437 goto fault;
438 compute_return_epc(regs);
438 break; 439 break;
439#endif /* CONFIG_64BIT */ 440#endif /* CONFIG_64BIT */
440 441
@@ -473,34 +474,31 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
473 unaligned_instructions++; 474 unaligned_instructions++;
474#endif 475#endif
475 476
476 return 0; 477 return;
477 478
478fault: 479fault:
479 /* Did we have an exception handler installed? */ 480 /* Did we have an exception handler installed? */
480 if (fixup_exception(regs)) 481 if (fixup_exception(regs))
481 return 1; 482 return;
482 483
483 die_if_kernel ("Unhandled kernel unaligned access", regs); 484 die_if_kernel ("Unhandled kernel unaligned access", regs);
484 send_sig(SIGSEGV, current, 1); 485 send_sig(SIGSEGV, current, 1);
485 486
486 return 0; 487 return;
487 488
488sigbus: 489sigbus:
489 die_if_kernel("Unhandled kernel unaligned access", regs); 490 die_if_kernel("Unhandled kernel unaligned access", regs);
490 send_sig(SIGBUS, current, 1); 491 send_sig(SIGBUS, current, 1);
491 492
492 return 0; 493 return;
493 494
494sigill: 495sigill:
495 die_if_kernel("Unhandled kernel unaligned access or invalid instruction", regs); 496 die_if_kernel("Unhandled kernel unaligned access or invalid instruction", regs);
496 send_sig(SIGILL, current, 1); 497 send_sig(SIGILL, current, 1);
497
498 return 0;
499} 498}
500 499
501asmlinkage void do_ade(struct pt_regs *regs) 500asmlinkage void do_ade(struct pt_regs *regs)
502{ 501{
503 unsigned long *regptr, newval;
504 extern int do_dsemulret(struct pt_regs *); 502 extern int do_dsemulret(struct pt_regs *);
505 unsigned int __user *pc; 503 unsigned int __user *pc;
506 mm_segment_t seg; 504 mm_segment_t seg;
@@ -524,7 +522,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
524 goto sigbus; 522 goto sigbus;
525 523
526 pc = (unsigned int __user *) exception_epc(regs); 524 pc = (unsigned int __user *) exception_epc(regs);
527 if (user_mode(regs) && (current->thread.mflags & MF_FIXADE) == 0) 525 if (user_mode(regs) && !test_thread_flag(TIF_FIXADE))
528 goto sigbus; 526 goto sigbus;
529 if (unaligned_action == UNALIGNED_ACTION_SIGNAL) 527 if (unaligned_action == UNALIGNED_ACTION_SIGNAL)
530 goto sigbus; 528 goto sigbus;
@@ -538,16 +536,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
538 seg = get_fs(); 536 seg = get_fs();
539 if (!user_mode(regs)) 537 if (!user_mode(regs))
540 set_fs(KERNEL_DS); 538 set_fs(KERNEL_DS);
541 if (!emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc, 539 emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);
542 &regptr, &newval)) {
543 compute_return_epc(regs);
544 /*
545 * Now that branch is evaluated, update the dest
546 * register if necessary
547 */
548 if (regptr)
549 *regptr = newval;
550 }
551 set_fs(seg); 540 set_fs(seg);
552 541
553 return; 542 return;
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index a2bee10f04cf..3c09b9785f4c 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -27,7 +27,6 @@
27 * To load and run, simply cat a SP 'program file' to /dev/vpe1. 27 * To load and run, simply cat a SP 'program file' to /dev/vpe1.
28 * i.e cat spapp >/dev/vpe1. 28 * i.e cat spapp >/dev/vpe1.
29 */ 29 */
30
31#include <linux/kernel.h> 30#include <linux/kernel.h>
32#include <linux/device.h> 31#include <linux/device.h>
33#include <linux/module.h> 32#include <linux/module.h>
@@ -54,6 +53,7 @@
54#include <asm/system.h> 53#include <asm/system.h>
55#include <asm/vpe.h> 54#include <asm/vpe.h>
56#include <asm/kspd.h> 55#include <asm/kspd.h>
56#include <asm/mips_mt.h>
57 57
58typedef void *vpe_handle; 58typedef void *vpe_handle;
59 59
@@ -64,6 +64,10 @@ typedef void *vpe_handle;
64/* If this is set, the section belongs in the init part of the module */ 64/* If this is set, the section belongs in the init part of the module */
65#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1)) 65#define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
66 66
67/*
68 * The number of TCs and VPEs physically available on the core
69 */
70static int hw_tcs, hw_vpes;
67static char module_name[] = "vpe"; 71static char module_name[] = "vpe";
68static int major; 72static int major;
69static const int minor = 1; /* fixed for now */ 73static const int minor = 1; /* fixed for now */
@@ -126,20 +130,17 @@ struct vpe {
126 130
127 /* the list of who wants to know when something major happens */ 131 /* the list of who wants to know when something major happens */
128 struct list_head notify; 132 struct list_head notify;
133
134 unsigned int ntcs;
129}; 135};
130 136
131struct tc { 137struct tc {
132 enum tc_state state; 138 enum tc_state state;
133 int index; 139 int index;
134 140
135 /* parent VPE */ 141 struct vpe *pvpe; /* parent VPE */
136 struct vpe *pvpe; 142 struct list_head tc; /* The list of TC's with this VPE */
137 143 struct list_head list; /* The global list of tc's */
138 /* The list of TC's with this VPE */
139 struct list_head tc;
140
141 /* The global list of tc's */
142 struct list_head list;
143}; 144};
144 145
145struct { 146struct {
@@ -217,18 +218,17 @@ struct vpe *alloc_vpe(int minor)
217/* allocate a tc. At startup only tc0 is running, all other can be halted. */ 218/* allocate a tc. At startup only tc0 is running, all other can be halted. */
218struct tc *alloc_tc(int index) 219struct tc *alloc_tc(int index)
219{ 220{
220 struct tc *t; 221 struct tc *tc;
221 222
222 if ((t = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) { 223 if ((tc = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL)
223 return NULL; 224 goto out;
224 }
225
226 INIT_LIST_HEAD(&t->tc);
227 list_add_tail(&t->list, &vpecontrol.tc_list);
228 225
229 t->index = index; 226 INIT_LIST_HEAD(&tc->tc);
227 tc->index = index;
228 list_add_tail(&tc->list, &vpecontrol.tc_list);
230 229
231 return t; 230out:
231 return tc;
232} 232}
233 233
234/* clean up and free everything */ 234/* clean up and free everything */
@@ -663,66 +663,48 @@ static void dump_elfsymbols(Elf_Shdr * sechdrs, unsigned int symindex,
663} 663}
664#endif 664#endif
665 665
666static void dump_tc(struct tc *t)
667{
668 unsigned long val;
669
670 settc(t->index);
671 printk(KERN_DEBUG "VPE loader: TC index %d targtc %ld "
672 "TCStatus 0x%lx halt 0x%lx\n",
673 t->index, read_c0_vpecontrol() & VPECONTROL_TARGTC,
674 read_tc_c0_tcstatus(), read_tc_c0_tchalt());
675
676 printk(KERN_DEBUG " tcrestart 0x%lx\n", read_tc_c0_tcrestart());
677 printk(KERN_DEBUG " tcbind 0x%lx\n", read_tc_c0_tcbind());
678
679 val = read_c0_vpeconf0();
680 printk(KERN_DEBUG " VPEConf0 0x%lx MVP %ld\n", val,
681 (val & VPECONF0_MVP) >> VPECONF0_MVP_SHIFT);
682
683 printk(KERN_DEBUG " c0 status 0x%lx\n", read_vpe_c0_status());
684 printk(KERN_DEBUG " c0 cause 0x%lx\n", read_vpe_c0_cause());
685
686 printk(KERN_DEBUG " c0 badvaddr 0x%lx\n", read_vpe_c0_badvaddr());
687 printk(KERN_DEBUG " c0 epc 0x%lx\n", read_vpe_c0_epc());
688}
689
690static void dump_tclist(void)
691{
692 struct tc *t;
693
694 list_for_each_entry(t, &vpecontrol.tc_list, list) {
695 dump_tc(t);
696 }
697}
698
699/* We are prepared so configure and start the VPE... */ 666/* We are prepared so configure and start the VPE... */
700static int vpe_run(struct vpe * v) 667static int vpe_run(struct vpe * v)
701{ 668{
669 unsigned long flags, val, dmt_flag;
702 struct vpe_notifications *n; 670 struct vpe_notifications *n;
703 unsigned long val, dmt_flag; 671 unsigned int vpeflags;
704 struct tc *t; 672 struct tc *t;
705 673
706 /* check we are the Master VPE */ 674 /* check we are the Master VPE */
675 local_irq_save(flags);
707 val = read_c0_vpeconf0(); 676 val = read_c0_vpeconf0();
708 if (!(val & VPECONF0_MVP)) { 677 if (!(val & VPECONF0_MVP)) {
709 printk(KERN_WARNING 678 printk(KERN_WARNING
710 "VPE loader: only Master VPE's are allowed to configure MT\n"); 679 "VPE loader: only Master VPE's are allowed to configure MT\n");
680 local_irq_restore(flags);
681
711 return -1; 682 return -1;
712 } 683 }
713 684
714 /* disable MT (using dvpe) */ 685 dmt_flag = dmt();
715 dvpe(); 686 vpeflags = dvpe();
716 687
717 if (!list_empty(&v->tc)) { 688 if (!list_empty(&v->tc)) {
718 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) { 689 if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {
719 printk(KERN_WARNING "VPE loader: TC %d is already in use.\n", 690 evpe(vpeflags);
720 t->index); 691 emt(dmt_flag);
692 local_irq_restore(flags);
693
694 printk(KERN_WARNING
695 "VPE loader: TC %d is already in use.\n",
696 t->index);
721 return -ENOEXEC; 697 return -ENOEXEC;
722 } 698 }
723 } else { 699 } else {
724 printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n", 700 evpe(vpeflags);
701 emt(dmt_flag);
702 local_irq_restore(flags);
703
704 printk(KERN_WARNING
705 "VPE loader: No TC's associated with VPE %d\n",
725 v->minor); 706 v->minor);
707
726 return -ENOEXEC; 708 return -ENOEXEC;
727 } 709 }
728 710
@@ -733,21 +715,20 @@ static int vpe_run(struct vpe * v)
733 715
734 /* should check it is halted, and not activated */ 716 /* should check it is halted, and not activated */
735 if ((read_tc_c0_tcstatus() & TCSTATUS_A) || !(read_tc_c0_tchalt() & TCHALT_H)) { 717 if ((read_tc_c0_tcstatus() & TCSTATUS_A) || !(read_tc_c0_tchalt() & TCHALT_H)) {
736 printk(KERN_WARNING "VPE loader: TC %d is already doing something!\n", 718 evpe(vpeflags);
719 emt(dmt_flag);
720 local_irq_restore(flags);
721
722 printk(KERN_WARNING "VPE loader: TC %d is already active!\n",
737 t->index); 723 t->index);
738 dump_tclist(); 724
739 return -ENOEXEC; 725 return -ENOEXEC;
740 } 726 }
741 727
742 /*
743 * Disable multi-threaded execution whilst we activate, clear the
744 * halt bit and bound the tc to the other VPE...
745 */
746 dmt_flag = dmt();
747
748 /* Write the address we want it to start running from in the TCPC register. */ 728 /* Write the address we want it to start running from in the TCPC register. */
749 write_tc_c0_tcrestart((unsigned long)v->__start); 729 write_tc_c0_tcrestart((unsigned long)v->__start);
750 write_tc_c0_tccontext((unsigned long)0); 730 write_tc_c0_tccontext((unsigned long)0);
731
751 /* 732 /*
752 * Mark the TC as activated, not interrupt exempt and not dynamically 733 * Mark the TC as activated, not interrupt exempt and not dynamically
753 * allocatable 734 * allocatable
@@ -763,15 +744,15 @@ static int vpe_run(struct vpe * v)
763 * here... Or set $a3 to zero and define DFLT_STACK_SIZE and 744 * here... Or set $a3 to zero and define DFLT_STACK_SIZE and
764 * DFLT_HEAP_SIZE when you compile your program 745 * DFLT_HEAP_SIZE when you compile your program
765 */ 746 */
766 mttgpr(7, physical_memsize); 747 mttgpr(6, v->ntcs);
767 748 mttgpr(7, physical_memsize);
768 749
769 /* set up VPE1 */ 750 /* set up VPE1 */
770 /* 751 /*
771 * bind the TC to VPE 1 as late as possible so we only have the final 752 * bind the TC to VPE 1 as late as possible so we only have the final
772 * VPE registers to set up, and so an EJTAG probe can trigger on it 753 * VPE registers to set up, and so an EJTAG probe can trigger on it
773 */ 754 */
774 write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | v->minor); 755 write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | 1);
775 756
776 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~(VPECONF0_VPA)); 757 write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~(VPECONF0_VPA));
777 758
@@ -793,15 +774,16 @@ static int vpe_run(struct vpe * v)
793 /* take system out of configuration state */ 774 /* take system out of configuration state */
794 clear_c0_mvpcontrol(MVPCONTROL_VPC); 775 clear_c0_mvpcontrol(MVPCONTROL_VPC);
795 776
796 /* now safe to re-enable multi-threading */ 777#ifdef CONFIG_SMP
797 emt(dmt_flag);
798
799 /* set it running */
800 evpe(EVPE_ENABLE); 778 evpe(EVPE_ENABLE);
779#else
780 evpe(vpeflags);
781#endif
782 emt(dmt_flag);
783 local_irq_restore(flags);
801 784
802 list_for_each_entry(n, &v->notify, list) { 785 list_for_each_entry(n, &v->notify, list)
803 n->start(v->minor); 786 n->start(minor);
804 }
805 787
806 return 0; 788 return 0;
807} 789}
@@ -1023,23 +1005,15 @@ static int vpe_elfload(struct vpe * v)
1023 return 0; 1005 return 0;
1024} 1006}
1025 1007
1026void __used dump_vpe(struct vpe * v)
1027{
1028 struct tc *t;
1029
1030 settc(v->minor);
1031
1032 printk(KERN_DEBUG "VPEControl 0x%lx\n", read_vpe_c0_vpecontrol());
1033 printk(KERN_DEBUG "VPEConf0 0x%lx\n", read_vpe_c0_vpeconf0());
1034
1035 list_for_each_entry(t, &vpecontrol.tc_list, list)
1036 dump_tc(t);
1037}
1038
1039static void cleanup_tc(struct tc *tc) 1008static void cleanup_tc(struct tc *tc)
1040{ 1009{
1010 unsigned long flags;
1011 unsigned int mtflags, vpflags;
1041 int tmp; 1012 int tmp;
1042 1013
1014 local_irq_save(flags);
1015 mtflags = dmt();
1016 vpflags = dvpe();
1043 /* Put MVPE's into 'configuration state' */ 1017 /* Put MVPE's into 'configuration state' */
1044 set_c0_mvpcontrol(MVPCONTROL_VPC); 1018 set_c0_mvpcontrol(MVPCONTROL_VPC);
1045 1019
@@ -1054,9 +1028,12 @@ static void cleanup_tc(struct tc *tc)
1054 write_tc_c0_tchalt(TCHALT_H); 1028 write_tc_c0_tchalt(TCHALT_H);
1055 1029
1056 /* bind it to anything other than VPE1 */ 1030 /* bind it to anything other than VPE1 */
1057 write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE 1031// write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
1058 1032
1059 clear_c0_mvpcontrol(MVPCONTROL_VPC); 1033 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1034 evpe(vpflags);
1035 emt(mtflags);
1036 local_irq_restore(flags);
1060} 1037}
1061 1038
1062static int getcwd(char *buff, int size) 1039static int getcwd(char *buff, int size)
@@ -1077,36 +1054,32 @@ static int getcwd(char *buff, int size)
1077/* checks VPE is unused and gets ready to load program */ 1054/* checks VPE is unused and gets ready to load program */
1078static int vpe_open(struct inode *inode, struct file *filp) 1055static int vpe_open(struct inode *inode, struct file *filp)
1079{ 1056{
1080 int minor, ret;
1081 enum vpe_state state; 1057 enum vpe_state state;
1082 struct vpe *v;
1083 struct vpe_notifications *not; 1058 struct vpe_notifications *not;
1059 struct vpe *v;
1060 int ret;
1084 1061
1085 /* assume only 1 device at the mo. */ 1062 if (minor != iminor(inode)) {
1086 if ((minor = iminor(inode)) != 1) { 1063 /* assume only 1 device at the moment. */
1087 printk(KERN_WARNING "VPE loader: only vpe1 is supported\n"); 1064 printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
1088 return -ENODEV; 1065 return -ENODEV;
1089 } 1066 }
1090 1067
1091 if ((v = get_vpe(minor)) == NULL) { 1068 if ((v = get_vpe(tclimit)) == NULL) {
1092 printk(KERN_WARNING "VPE loader: unable to get vpe\n"); 1069 printk(KERN_WARNING "VPE loader: unable to get vpe\n");
1093 return -ENODEV; 1070 return -ENODEV;
1094 } 1071 }
1095 1072
1096 state = xchg(&v->state, VPE_STATE_INUSE); 1073 state = xchg(&v->state, VPE_STATE_INUSE);
1097 if (state != VPE_STATE_UNUSED) { 1074 if (state != VPE_STATE_UNUSED) {
1098 dvpe();
1099
1100 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n"); 1075 printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n");
1101 1076
1102 dump_tc(get_tc(minor));
1103
1104 list_for_each_entry(not, &v->notify, list) { 1077 list_for_each_entry(not, &v->notify, list) {
1105 not->stop(minor); 1078 not->stop(tclimit);
1106 } 1079 }
1107 1080
1108 release_progmem(v->load_addr); 1081 release_progmem(v->load_addr);
1109 cleanup_tc(get_tc(minor)); 1082 cleanup_tc(get_tc(tclimit));
1110 } 1083 }
1111 1084
1112 /* this of-course trashes what was there before... */ 1085 /* this of-course trashes what was there before... */
@@ -1133,26 +1106,25 @@ static int vpe_open(struct inode *inode, struct file *filp)
1133 1106
1134 v->shared_ptr = NULL; 1107 v->shared_ptr = NULL;
1135 v->__start = 0; 1108 v->__start = 0;
1109
1136 return 0; 1110 return 0;
1137} 1111}
1138 1112
1139static int vpe_release(struct inode *inode, struct file *filp) 1113static int vpe_release(struct inode *inode, struct file *filp)
1140{ 1114{
1141 int minor, ret = 0;
1142 struct vpe *v; 1115 struct vpe *v;
1143 Elf_Ehdr *hdr; 1116 Elf_Ehdr *hdr;
1117 int ret = 0;
1144 1118
1145 minor = iminor(inode); 1119 v = get_vpe(tclimit);
1146 if ((v = get_vpe(minor)) == NULL) 1120 if (v == NULL)
1147 return -ENODEV; 1121 return -ENODEV;
1148 1122
1149 // simple case of fire and forget, so tell the VPE to run...
1150
1151 hdr = (Elf_Ehdr *) v->pbuffer; 1123 hdr = (Elf_Ehdr *) v->pbuffer;
1152 if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) { 1124 if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) {
1153 if (vpe_elfload(v) >= 0) 1125 if (vpe_elfload(v) >= 0) {
1154 vpe_run(v); 1126 vpe_run(v);
1155 else { 1127 } else {
1156 printk(KERN_WARNING "VPE loader: ELF load failed.\n"); 1128 printk(KERN_WARNING "VPE loader: ELF load failed.\n");
1157 ret = -ENOEXEC; 1129 ret = -ENOEXEC;
1158 } 1130 }
@@ -1179,12 +1151,14 @@ static int vpe_release(struct inode *inode, struct file *filp)
1179static ssize_t vpe_write(struct file *file, const char __user * buffer, 1151static ssize_t vpe_write(struct file *file, const char __user * buffer,
1180 size_t count, loff_t * ppos) 1152 size_t count, loff_t * ppos)
1181{ 1153{
1182 int minor;
1183 size_t ret = count; 1154 size_t ret = count;
1184 struct vpe *v; 1155 struct vpe *v;
1185 1156
1186 minor = iminor(file->f_path.dentry->d_inode); 1157 if (iminor(file->f_path.dentry->d_inode) != minor)
1187 if ((v = get_vpe(minor)) == NULL) 1158 return -ENODEV;
1159
1160 v = get_vpe(tclimit);
1161 if (v == NULL)
1188 return -ENODEV; 1162 return -ENODEV;
1189 1163
1190 if (v->pbuffer == NULL) { 1164 if (v->pbuffer == NULL) {
@@ -1366,62 +1340,173 @@ static void kspd_sp_exit( int sp_id)
1366} 1340}
1367#endif 1341#endif
1368 1342
1369static struct device *vpe_dev; 1343static ssize_t store_kill(struct class_device *dev, const char *buf, size_t len)
1344{
1345 struct vpe *vpe = get_vpe(tclimit);
1346 struct vpe_notifications *not;
1347
1348 list_for_each_entry(not, &vpe->notify, list) {
1349 not->stop(tclimit);
1350 }
1351
1352 release_progmem(vpe->load_addr);
1353 cleanup_tc(get_tc(tclimit));
1354 vpe_stop(vpe);
1355 vpe_free(vpe);
1356
1357 return len;
1358}
1359
1360static ssize_t show_ntcs(struct class_device *cd, char *buf)
1361{
1362 struct vpe *vpe = get_vpe(tclimit);
1363
1364 return sprintf(buf, "%d\n", vpe->ntcs);
1365}
1366
1367static ssize_t store_ntcs(struct class_device *dev, const char *buf, size_t len)
1368{
1369 struct vpe *vpe = get_vpe(tclimit);
1370 unsigned long new;
1371 char *endp;
1372
1373 new = simple_strtoul(buf, &endp, 0);
1374 if (endp == buf)
1375 goto out_einval;
1376
1377 if (new == 0 || new > (hw_tcs - tclimit))
1378 goto out_einval;
1379
1380 vpe->ntcs = new;
1381
1382 return len;
1383
1384out_einval:
1385 return -EINVAL;;
1386}
1387
1388static struct class_device_attribute vpe_class_attributes[] = {
1389 __ATTR(kill, S_IWUSR, NULL, store_kill),
1390 __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs),
1391 {}
1392};
1393
1394static void vpe_class_device_release(struct class_device *cd)
1395{
1396 kfree(cd);
1397}
1398
1399struct class vpe_class = {
1400 .name = "vpe",
1401 .owner = THIS_MODULE,
1402 .release = vpe_class_device_release,
1403 .class_dev_attrs = vpe_class_attributes,
1404};
1405
1406struct class_device vpe_device;
1370 1407
1371static int __init vpe_module_init(void) 1408static int __init vpe_module_init(void)
1372{ 1409{
1410 unsigned int mtflags, vpflags;
1411 unsigned long flags, val;
1373 struct vpe *v = NULL; 1412 struct vpe *v = NULL;
1374 struct device *dev;
1375 struct tc *t; 1413 struct tc *t;
1376 unsigned long val; 1414 int tc, err;
1377 int i, err;
1378 1415
1379 if (!cpu_has_mipsmt) { 1416 if (!cpu_has_mipsmt) {
1380 printk("VPE loader: not a MIPS MT capable processor\n"); 1417 printk("VPE loader: not a MIPS MT capable processor\n");
1381 return -ENODEV; 1418 return -ENODEV;
1382 } 1419 }
1383 1420
1421 if (vpelimit == 0) {
1422 printk(KERN_WARNING "No VPEs reserved for AP/SP, not "
1423 "initializing VPE loader.\nPass maxvpes=<n> argument as "
1424 "kernel argument\n");
1425
1426 return -ENODEV;
1427 }
1428
1429 if (tclimit == 0) {
1430 printk(KERN_WARNING "No TCs reserved for AP/SP, not "
1431 "initializing VPE loader.\nPass maxtcs=<n> argument as "
1432 "kernel argument\n");
1433
1434 return -ENODEV;
1435 }
1436
1384 major = register_chrdev(0, module_name, &vpe_fops); 1437 major = register_chrdev(0, module_name, &vpe_fops);
1385 if (major < 0) { 1438 if (major < 0) {
1386 printk("VPE loader: unable to register character device\n"); 1439 printk("VPE loader: unable to register character device\n");
1387 return major; 1440 return major;
1388 } 1441 }
1389 1442
1390 dev = device_create(mt_class, NULL, MKDEV(major, minor), 1443 err = class_register(&vpe_class);
1391 "tc%d", minor); 1444 if (err) {
1392 if (IS_ERR(dev)) { 1445 printk(KERN_ERR "vpe_class registration failed\n");
1393 err = PTR_ERR(dev);
1394 goto out_chrdev; 1446 goto out_chrdev;
1395 } 1447 }
1396 vpe_dev = dev;
1397 1448
1398 dmt(); 1449 class_device_initialize(&vpe_device);
1399 dvpe(); 1450 vpe_device.class = &vpe_class,
1451 vpe_device.parent = NULL,
1452 strlcpy(vpe_device.class_id, "vpe1", BUS_ID_SIZE);
1453 vpe_device.devt = MKDEV(major, minor);
1454 err = class_device_add(&vpe_device);
1455 if (err) {
1456 printk(KERN_ERR "Adding vpe_device failed\n");
1457 goto out_class;
1458 }
1459
1460 local_irq_save(flags);
1461 mtflags = dmt();
1462 vpflags = dvpe();
1400 1463
1401 /* Put MVPE's into 'configuration state' */ 1464 /* Put MVPE's into 'configuration state' */
1402 set_c0_mvpcontrol(MVPCONTROL_VPC); 1465 set_c0_mvpcontrol(MVPCONTROL_VPC);
1403 1466
1404 /* dump_mtregs(); */ 1467 /* dump_mtregs(); */
1405 1468
1406
1407 val = read_c0_mvpconf0(); 1469 val = read_c0_mvpconf0();
1408 for (i = 0; i < ((val & MVPCONF0_PTC) + 1); i++) { 1470 hw_tcs = (val & MVPCONF0_PTC) + 1;
1409 t = alloc_tc(i); 1471 hw_vpes = ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
1472
1473 for (tc = tclimit; tc < hw_tcs; tc++) {
1474 /*
1475 * Must re-enable multithreading temporarily or in case we
1476 * reschedule send IPIs or similar we might hang.
1477 */
1478 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1479 evpe(vpflags);
1480 emt(mtflags);
1481 local_irq_restore(flags);
1482 t = alloc_tc(tc);
1483 if (!t) {
1484 err = -ENOMEM;
1485 goto out;
1486 }
1487
1488 local_irq_save(flags);
1489 mtflags = dmt();
1490 vpflags = dvpe();
1491 set_c0_mvpcontrol(MVPCONTROL_VPC);
1410 1492
1411 /* VPE's */ 1493 /* VPE's */
1412 if (i < ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1) { 1494 if (tc < hw_tcs) {
1413 settc(i); 1495 settc(tc);
1414 1496
1415 if ((v = alloc_vpe(i)) == NULL) { 1497 if ((v = alloc_vpe(tc)) == NULL) {
1416 printk(KERN_WARNING "VPE: unable to allocate VPE\n"); 1498 printk(KERN_WARNING "VPE: unable to allocate VPE\n");
1417 return -ENODEV; 1499
1500 goto out_reenable;
1418 } 1501 }
1419 1502
1503 v->ntcs = hw_tcs - tclimit;
1504
1420 /* add the tc to the list of this vpe's tc's. */ 1505 /* add the tc to the list of this vpe's tc's. */
1421 list_add(&t->tc, &v->tc); 1506 list_add(&t->tc, &v->tc);
1422 1507
1423 /* deactivate all but vpe0 */ 1508 /* deactivate all but vpe0 */
1424 if (i != 0) { 1509 if (tc >= tclimit) {
1425 unsigned long tmp = read_vpe_c0_vpeconf0(); 1510 unsigned long tmp = read_vpe_c0_vpeconf0();
1426 1511
1427 tmp &= ~VPECONF0_VPA; 1512 tmp &= ~VPECONF0_VPA;
@@ -1434,7 +1519,7 @@ static int __init vpe_module_init(void)
1434 /* disable multi-threading with TC's */ 1519 /* disable multi-threading with TC's */
1435 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() & ~VPECONTROL_TE); 1520 write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() & ~VPECONTROL_TE);
1436 1521
1437 if (i != 0) { 1522 if (tc >= vpelimit) {
1438 /* 1523 /*
1439 * Set config to be the same as vpe0, 1524 * Set config to be the same as vpe0,
1440 * particularly kseg0 coherency alg 1525 * particularly kseg0 coherency alg
@@ -1446,10 +1531,10 @@ static int __init vpe_module_init(void)
1446 /* TC's */ 1531 /* TC's */
1447 t->pvpe = v; /* set the parent vpe */ 1532 t->pvpe = v; /* set the parent vpe */
1448 1533
1449 if (i != 0) { 1534 if (tc >= tclimit) {
1450 unsigned long tmp; 1535 unsigned long tmp;
1451 1536
1452 settc(i); 1537 settc(tc);
1453 1538
1454 /* Any TC that is bound to VPE0 gets left as is - in case 1539 /* Any TC that is bound to VPE0 gets left as is - in case
1455 we are running SMTC on VPE0. A TC that is bound to any 1540 we are running SMTC on VPE0. A TC that is bound to any
@@ -1479,17 +1564,25 @@ static int __init vpe_module_init(void)
1479 } 1564 }
1480 } 1565 }
1481 1566
1567out_reenable:
1482 /* release config state */ 1568 /* release config state */
1483 clear_c0_mvpcontrol(MVPCONTROL_VPC); 1569 clear_c0_mvpcontrol(MVPCONTROL_VPC);
1484 1570
1571 evpe(vpflags);
1572 emt(mtflags);
1573 local_irq_restore(flags);
1574
1485#ifdef CONFIG_MIPS_APSP_KSPD 1575#ifdef CONFIG_MIPS_APSP_KSPD
1486 kspd_events.kspd_sp_exit = kspd_sp_exit; 1576 kspd_events.kspd_sp_exit = kspd_sp_exit;
1487#endif 1577#endif
1488 return 0; 1578 return 0;
1489 1579
1580out_class:
1581 class_unregister(&vpe_class);
1490out_chrdev: 1582out_chrdev:
1491 unregister_chrdev(major, module_name); 1583 unregister_chrdev(major, module_name);
1492 1584
1585out:
1493 return err; 1586 return err;
1494} 1587}
1495 1588
@@ -1503,7 +1596,7 @@ static void __exit vpe_module_exit(void)
1503 } 1596 }
1504 } 1597 }
1505 1598
1506 device_destroy(mt_class, MKDEV(major, minor)); 1599 class_device_del(&vpe_device);
1507 unregister_chrdev(major, module_name); 1600 unregister_chrdev(major, module_name);
1508} 1601}
1509 1602
diff --git a/arch/mips/lemote/lm2e/Makefile b/arch/mips/lemote/lm2e/Makefile
index fb1b48c48cb3..dcaf6f4c3a37 100644
--- a/arch/mips/lemote/lm2e/Makefile
+++ b/arch/mips/lemote/lm2e/Makefile
@@ -3,5 +3,6 @@
3# 3#
4 4
5obj-y += setup.o prom.o reset.o irq.o pci.o bonito-irq.o dbg_io.o mem.o 5obj-y += setup.o prom.o reset.o irq.o pci.o bonito-irq.o dbg_io.o mem.o
6EXTRA_AFLAGS := $(CFLAGS)
7 6
7EXTRA_AFLAGS := $(CFLAGS)
8EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/lemote/lm2e/irq.c b/arch/mips/lemote/lm2e/irq.c
index 05693bceaeaf..3e0b7beb1009 100644
--- a/arch/mips/lemote/lm2e/irq.c
+++ b/arch/mips/lemote/lm2e/irq.c
@@ -25,7 +25,6 @@
25 */ 25 */
26#include <linux/delay.h> 26#include <linux/delay.h>
27#include <linux/io.h> 27#include <linux/io.h>
28#include <linux/irq.h>
29#include <linux/init.h> 28#include <linux/init.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
31#include <linux/irq.h> 30#include <linux/irq.h>
diff --git a/arch/mips/lemote/lm2e/prom.c b/arch/mips/lemote/lm2e/prom.c
index 67312d7acf2a..3efb1cf111f2 100644
--- a/arch/mips/lemote/lm2e/prom.c
+++ b/arch/mips/lemote/lm2e/prom.c
@@ -15,15 +15,11 @@
15 * option) any later version. 15 * option) any later version.
16 */ 16 */
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/mm.h>
19#include <linux/sched.h>
20#include <linux/bootmem.h> 18#include <linux/bootmem.h>
21
22#include <asm/addrspace.h>
23#include <asm/bootinfo.h> 19#include <asm/bootinfo.h>
24 20
25extern unsigned long bus_clock; 21extern unsigned long bus_clock;
26extern unsigned long cpu_clock; 22extern unsigned long cpu_clock_freq;
27extern unsigned int memsize, highmemsize; 23extern unsigned int memsize, highmemsize;
28extern int putDebugChar(unsigned char byte); 24extern int putDebugChar(unsigned char byte);
29 25
@@ -81,7 +77,7 @@ do { \
81 l = (long)*env; 77 l = (long)*env;
82 while (l != 0) { 78 while (l != 0) {
83 parse_even_earlier(bus_clock, "busclock", l); 79 parse_even_earlier(bus_clock, "busclock", l);
84 parse_even_earlier(cpu_clock, "cpuclock", l); 80 parse_even_earlier(cpu_clock_freq, "cpuclock", l);
85 parse_even_earlier(memsize, "memsize", l); 81 parse_even_earlier(memsize, "memsize", l);
86 parse_even_earlier(highmemsize, "highmemsize", l); 82 parse_even_earlier(highmemsize, "highmemsize", l);
87 env++; 83 env++;
@@ -91,7 +87,7 @@ do { \
91 memsize = 256; 87 memsize = 256;
92 88
93 pr_info("busclock=%ld, cpuclock=%ld,memsize=%d,highmemsize=%d\n", 89 pr_info("busclock=%ld, cpuclock=%ld,memsize=%d,highmemsize=%d\n",
94 bus_clock, cpu_clock, memsize, highmemsize); 90 bus_clock, cpu_clock_freq, memsize, highmemsize);
95} 91}
96 92
97void __init prom_free_prom_memory(void) 93void __init prom_free_prom_memory(void)
diff --git a/arch/mips/lemote/lm2e/setup.c b/arch/mips/lemote/lm2e/setup.c
index 0e4d1fa572b5..f34350a4f271 100644
--- a/arch/mips/lemote/lm2e/setup.c
+++ b/arch/mips/lemote/lm2e/setup.c
@@ -28,17 +28,7 @@
28 */ 28 */
29#include <linux/bootmem.h> 29#include <linux/bootmem.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/io.h>
32#include <linux/ioport.h>
33#include <linux/interrupt.h>
34#include <linux/irq.h> 31#include <linux/irq.h>
35#include <linux/kernel.h>
36#include <linux/mc146818rtc.h>
37#include <linux/mm.h>
38#include <linux/module.h>
39#include <linux/pci.h>
40#include <linux/tty.h>
41#include <linux/types.h>
42 32
43#include <asm/bootinfo.h> 33#include <asm/bootinfo.h>
44#include <asm/mc146818-time.h> 34#include <asm/mc146818-time.h>
@@ -58,7 +48,7 @@ extern void mips_reboot_setup(void);
58#define PTR_PAD(p) (p) 48#define PTR_PAD(p) (p)
59#endif 49#endif
60 50
61unsigned long cpu_clock; 51unsigned long cpu_clock_freq;
62unsigned long bus_clock; 52unsigned long bus_clock;
63unsigned int memsize; 53unsigned int memsize;
64unsigned int highmemsize = 0; 54unsigned int highmemsize = 0;
@@ -71,7 +61,7 @@ void __init plat_timer_setup(struct irqaction *irq)
71static void __init loongson2e_time_init(void) 61static void __init loongson2e_time_init(void)
72{ 62{
73 /* setup mips r4k timer */ 63 /* setup mips r4k timer */
74 mips_hpt_frequency = cpu_clock / 2; 64 mips_hpt_frequency = cpu_clock_freq / 2;
75} 65}
76 66
77static unsigned long __init mips_rtc_get_time(void) 67static unsigned long __init mips_rtc_get_time(void)
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile
index 121a848a3594..d547efdeedc2 100644
--- a/arch/mips/math-emu/Makefile
+++ b/arch/mips/math-emu/Makefile
@@ -9,3 +9,5 @@ obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
9 sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \ 9 sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
10 sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ 10 sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
11 dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o 11 dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mips-boards/atlas/Makefile b/arch/mips/mips-boards/atlas/Makefile
index d8dab75906bf..f71c2dd1041a 100644
--- a/arch/mips/mips-boards/atlas/Makefile
+++ b/arch/mips/mips-boards/atlas/Makefile
@@ -18,3 +18,5 @@
18 18
19obj-y := atlas_int.o atlas_setup.o 19obj-y := atlas_int.o atlas_setup.o
20obj-$(CONFIG_KGDB) += atlas_gdb.o 20obj-$(CONFIG_KGDB) += atlas_gdb.o
21
22EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mips-boards/atlas/atlas_int.c b/arch/mips/mips-boards/atlas/atlas_int.c
index 6c8f0255e85d..3c692abc2553 100644
--- a/arch/mips/mips-boards/atlas/atlas_int.c
+++ b/arch/mips/mips-boards/atlas/atlas_int.c
@@ -245,6 +245,7 @@ void __init arch_init_irq(void)
245 case MIPS_REVISION_CORID_CORE_MSC: 245 case MIPS_REVISION_CORID_CORE_MSC:
246 case MIPS_REVISION_CORID_CORE_FPGA2: 246 case MIPS_REVISION_CORID_CORE_FPGA2:
247 case MIPS_REVISION_CORID_CORE_FPGA3: 247 case MIPS_REVISION_CORID_CORE_FPGA3:
248 case MIPS_REVISION_CORID_CORE_FPGA4:
248 case MIPS_REVISION_CORID_CORE_24K: 249 case MIPS_REVISION_CORID_CORE_24K:
249 case MIPS_REVISION_CORID_CORE_EMUL_MSC: 250 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
250 if (cpu_has_veic) 251 if (cpu_has_veic)
diff --git a/arch/mips/mips-boards/generic/Makefile b/arch/mips/mips-boards/generic/Makefile
index aade36d78787..b31d8dfed1be 100644
--- a/arch/mips/mips-boards/generic/Makefile
+++ b/arch/mips/mips-boards/generic/Makefile
@@ -24,3 +24,5 @@ obj-y := reset.o display.o init.o memory.o \
24obj-$(CONFIG_EARLY_PRINTK) += console.o 24obj-$(CONFIG_EARLY_PRINTK) += console.o
25obj-$(CONFIG_PCI) += pci.o 25obj-$(CONFIG_PCI) += pci.o
26obj-$(CONFIG_KGDB) += gdb_hook.o 26obj-$(CONFIG_KGDB) += gdb_hook.o
27
28EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mips-boards/generic/init.c b/arch/mips/mips-boards/generic/init.c
index 4eabc1eadd23..e2c7147fedf7 100644
--- a/arch/mips/mips-boards/generic/init.c
+++ b/arch/mips/mips-boards/generic/init.c
@@ -294,6 +294,7 @@ void __init prom_init(void)
294 case MIPS_REVISION_CORID_CORE_MSC: 294 case MIPS_REVISION_CORID_CORE_MSC:
295 case MIPS_REVISION_CORID_CORE_FPGA2: 295 case MIPS_REVISION_CORID_CORE_FPGA2:
296 case MIPS_REVISION_CORID_CORE_FPGA3: 296 case MIPS_REVISION_CORID_CORE_FPGA3:
297 case MIPS_REVISION_CORID_CORE_FPGA4:
297 case MIPS_REVISION_CORID_CORE_24K: 298 case MIPS_REVISION_CORID_CORE_24K:
298 case MIPS_REVISION_CORID_CORE_EMUL_MSC: 299 case MIPS_REVISION_CORID_CORE_EMUL_MSC:
299 mips_revision_sconid = MIPS_REVISION_SCON_SOCIT; 300 mips_revision_sconid = MIPS_REVISION_SCON_SOCIT;
diff --git a/arch/mips/mips-boards/generic/time.c b/arch/mips/mips-boards/generic/time.c
index c45d556aa96b..d7bff9ca5356 100644
--- a/arch/mips/mips-boards/generic/time.c
+++ b/arch/mips/mips-boards/generic/time.c
@@ -55,7 +55,7 @@ unsigned long cpu_khz;
55 55
56static int mips_cpu_timer_irq; 56static int mips_cpu_timer_irq;
57extern int cp0_perfcount_irq; 57extern int cp0_perfcount_irq;
58extern void smtc_timer_broadcast(int); 58extern void smtc_timer_broadcast(void);
59 59
60static void mips_timer_dispatch(void) 60static void mips_timer_dispatch(void)
61{ 61{
@@ -131,7 +131,7 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
131 (mips_hpt_frequency/HZ)); 131 (mips_hpt_frequency/HZ));
132 local_timer_interrupt(irq, dev_id); 132 local_timer_interrupt(irq, dev_id);
133 } 133 }
134 smtc_timer_broadcast(cpu_data[cpu].vpe_id); 134 smtc_timer_broadcast();
135 } 135 }
136#else /* CONFIG_MIPS_MT_SMTC */ 136#else /* CONFIG_MIPS_MT_SMTC */
137 int r2 = cpu_has_mips_r2; 137 int r2 = cpu_has_mips_r2;
diff --git a/arch/mips/mips-boards/malta/Makefile b/arch/mips/mips-boards/malta/Makefile
index a242b0fc377d..931ca4600a63 100644
--- a/arch/mips/mips-boards/malta/Makefile
+++ b/arch/mips/mips-boards/malta/Makefile
@@ -23,3 +23,5 @@ obj-y := malta_int.o malta_platform.o malta_setup.o
23 23
24obj-$(CONFIG_MTD) += malta_mtd.o 24obj-$(CONFIG_MTD) += malta_mtd.o
25obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o 25obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o
26
27EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mips-boards/malta/malta_int.c b/arch/mips/mips-boards/malta/malta_int.c
index c78d48349600..97aeb8c4e601 100644
--- a/arch/mips/mips-boards/malta/malta_int.c
+++ b/arch/mips/mips-boards/malta/malta_int.c
@@ -330,6 +330,18 @@ void __init arch_init_irq(void)
330 (0x100 << MIPSCPU_INT_I8259A)); 330 (0x100 << MIPSCPU_INT_I8259A));
331 setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, 331 setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
332 &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI)); 332 &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI));
333 /*
334 * Temporary hack to ensure that the subsidiary device
335 * interrupts coing in via the i8259A, but associated
336 * with low IRQ numbers, will restore the Status.IM
337 * value associated with the i8259A.
338 */
339 {
340 int i;
341
342 for (i = 0; i < 16; i++)
343 irq_hwmask[i] = (0x100 << MIPSCPU_INT_I8259A);
344 }
333#else /* Not SMTC */ 345#else /* Not SMTC */
334 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq); 346 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq);
335 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction); 347 setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
diff --git a/arch/mips/mips-boards/malta/malta_smtc.c b/arch/mips/mips-boards/malta/malta_smtc.c
index d1c80f631100..0fb4c269901c 100644
--- a/arch/mips/mips-boards/malta/malta_smtc.c
+++ b/arch/mips/mips-boards/malta/malta_smtc.c
@@ -58,7 +58,7 @@ void prom_init_secondary(void)
58 * but it may be multithreaded. 58 * but it may be multithreaded.
59 */ 59 */
60 60
61void plat_smp_setup(void) 61void __cpuinit plat_smp_setup(void)
62{ 62{
63 if (read_c0_config3() & (1<<2)) 63 if (read_c0_config3() & (1<<2))
64 mipsmt_build_cpu_map(0); 64 mipsmt_build_cpu_map(0);
diff --git a/arch/mips/mips-boards/sead/Makefile b/arch/mips/mips-boards/sead/Makefile
index 224bb848f16b..3682fe217bd5 100644
--- a/arch/mips/mips-boards/sead/Makefile
+++ b/arch/mips/mips-boards/sead/Makefile
@@ -24,3 +24,5 @@
24# 24#
25 25
26obj-y := sead_int.o sead_setup.o 26obj-y := sead_int.o sead_setup.o
27
28EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mipssim/Makefile b/arch/mips/mipssim/Makefile
index dc0bfda11427..75568b584df4 100644
--- a/arch/mips/mipssim/Makefile
+++ b/arch/mips/mipssim/Makefile
@@ -22,3 +22,5 @@ obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o \
22 22
23obj-$(CONFIG_EARLY_PRINTK) += sim_console.o 23obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
24obj-$(CONFIG_SMP) += sim_smp.o 24obj-$(CONFIG_SMP) += sim_smp.o
25
26EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mipssim/sim_setup.c b/arch/mips/mipssim/sim_setup.c
index 17819b594105..d012719c4d24 100644
--- a/arch/mips/mipssim/sim_setup.c
+++ b/arch/mips/mipssim/sim_setup.c
@@ -22,7 +22,6 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/ioport.h> 24#include <linux/ioport.h>
25#include <linux/serial.h>
26#include <linux/tty.h> 25#include <linux/tty.h>
27#include <linux/serial.h> 26#include <linux/serial.h>
28#include <linux/serial_core.h> 27#include <linux/serial_core.h>
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index 19a0e544c4e9..43e4810dcaa8 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -32,3 +32,5 @@ obj-$(CONFIG_IP22_CPU_SCACHE) += sc-ip22.o
32obj-$(CONFIG_R5000_CPU_SCACHE) += sc-r5k.o 32obj-$(CONFIG_R5000_CPU_SCACHE) += sc-r5k.o
33obj-$(CONFIG_RM7000_CPU_SCACHE) += sc-rm7k.o 33obj-$(CONFIG_RM7000_CPU_SCACHE) += sc-rm7k.o
34obj-$(CONFIG_MIPS_CPU_SCACHE) += sc-mips.o 34obj-$(CONFIG_MIPS_CPU_SCACHE) += sc-mips.o
35
36EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c
index be96231dccb6..bad571971bf6 100644
--- a/arch/mips/mm/c-r4k.c
+++ b/arch/mips/mm/c-r4k.c
@@ -23,6 +23,7 @@
23#include <asm/page.h> 23#include <asm/page.h>
24#include <asm/pgtable.h> 24#include <asm/pgtable.h>
25#include <asm/r4kcache.h> 25#include <asm/r4kcache.h>
26#include <asm/sections.h>
26#include <asm/system.h> 27#include <asm/system.h>
27#include <asm/mmu_context.h> 28#include <asm/mmu_context.h>
28#include <asm/war.h> 29#include <asm/war.h>
@@ -1010,7 +1011,6 @@ static void __init probe_pcache(void)
1010 */ 1011 */
1011static int __init probe_scache(void) 1012static int __init probe_scache(void)
1012{ 1013{
1013 extern unsigned long stext;
1014 unsigned long flags, addr, begin, end, pow2; 1014 unsigned long flags, addr, begin, end, pow2;
1015 unsigned int config = read_c0_config(); 1015 unsigned int config = read_c0_config();
1016 struct cpuinfo_mips *c = &current_cpu_data; 1016 struct cpuinfo_mips *c = &current_cpu_data;
@@ -1019,7 +1019,7 @@ static int __init probe_scache(void)
1019 if (config & CONF_SC) 1019 if (config & CONF_SC)
1020 return 0; 1020 return 0;
1021 1021
1022 begin = (unsigned long) &stext; 1022 begin = (unsigned long) &_stext;
1023 begin &= ~((4 * 1024 * 1024) - 1); 1023 begin &= ~((4 * 1024 * 1024) - 1);
1024 end = begin + (4 * 1024 * 1024); 1024 end = begin + (4 * 1024 * 1024);
1025 1025
diff --git a/arch/mips/oprofile/op_model_rm9000.c b/arch/mips/oprofile/op_model_rm9000.c
index 7dc9bf6f1321..d29040a56aea 100644
--- a/arch/mips/oprofile/op_model_rm9000.c
+++ b/arch/mips/oprofile/op_model_rm9000.c
@@ -83,6 +83,7 @@ static void rm9000_cpu_stop(void *args)
83static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id) 83static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id)
84{ 84{
85 unsigned int control = read_c0_perfcontrol(); 85 unsigned int control = read_c0_perfcontrol();
86 struct pt_regs *regs = get_irq_regs();
86 uint32_t counter1, counter2; 87 uint32_t counter1, counter2;
87 uint64_t counters; 88 uint64_t counters;
88 89
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index c58bd3d036f4..4ee6800e67e6 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -19,7 +19,6 @@ obj-$(CONFIG_MARKEINS) += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
19# These are still pretty much in the old state, watch, go blind. 19# These are still pretty much in the old state, watch, go blind.
20# 20#
21obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o 21obj-$(CONFIG_BASLER_EXCITE) += ops-titan.o pci-excite.o fixup-excite.o
22obj-$(CONFIG_DDB5477) += fixup-ddb5477.o pci-ddb5477.o ops-ddb5477.o
23obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o 22obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o
24obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o 23obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
25obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o 24obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o
@@ -27,7 +26,6 @@ obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o
27obj-$(CONFIG_SOC_PNX8550) += fixup-pnx8550.o ops-pnx8550.o 26obj-$(CONFIG_SOC_PNX8550) += fixup-pnx8550.o ops-pnx8550.o
28obj-$(CONFIG_LEMOTE_FULONG) += fixup-lm2e.o ops-bonito64.o 27obj-$(CONFIG_LEMOTE_FULONG) += fixup-lm2e.o ops-bonito64.o
29obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o 28obj-$(CONFIG_MIPS_MALTA) += fixup-malta.o
30obj-$(CONFIG_MOMENCO_OCELOT) += fixup-ocelot.o pci-ocelot.o
31obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o 29obj-$(CONFIG_PMC_MSP7120_GW) += fixup-pmcmsp.o ops-pmcmsp.o
32obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o 30obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
33obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o 31obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o
diff --git a/arch/mips/pci/fixup-ddb5477.c b/arch/mips/pci/fixup-ddb5477.c
deleted file mode 100644
index 2f1444e60654..000000000000
--- a/arch/mips/pci/fixup-ddb5477.c
+++ /dev/null
@@ -1,78 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Board specific pci fixups.
5 *
6 * Copyright 2001, 2002, 2003 MontaVista Software Inc.
7 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29
30#include <linux/types.h>
31#include <linux/pci.h>
32#include <linux/kernel.h>
33#include <linux/init.h>
34
35static void ddb5477_fixup(struct pci_dev *dev)
36{
37 u8 old;
38
39 printk(KERN_NOTICE "Enabling ALI M1533/35 PS2 keyboard/mouse.\n");
40 pci_read_config_byte(dev, 0x41, &old);
41 pci_write_config_byte(dev, 0x41, old | 0xd0);
42}
43
44DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
45 ddb5477_fixup);
46DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535,
47 ddb5477_fixup);
48
49/*
50 * Fixup baseboard AMD chip so that tx does not underflow.
51 * bcr_18 |= 0x0800
52 * This sets NOUFLO bit which makes tx not start until whole pkt
53 * is fetched to the chip.
54 */
55#define PCNET32_WIO_RDP 0x10
56#define PCNET32_WIO_RAP 0x12
57#define PCNET32_WIO_RESET 0x14
58#define PCNET32_WIO_BDP 0x16
59
60static void ddb5477_amd_lance_fixup(struct pci_dev *dev)
61{
62 unsigned long ioaddr;
63 u16 temp;
64
65 ioaddr = pci_resource_start(dev, 0);
66
67 inw(ioaddr + PCNET32_WIO_RESET); /* reset chip */
68
69 /* bcr_18 |= 0x0800 */
70 outw(18, ioaddr + PCNET32_WIO_RAP);
71 temp = inw(ioaddr + PCNET32_WIO_BDP);
72 temp |= 0x0800;
73 outw(18, ioaddr + PCNET32_WIO_RAP);
74 outw(temp, ioaddr + PCNET32_WIO_BDP);
75}
76
77DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE,
78 ddb5477_amd_lance_fixup);
diff --git a/arch/mips/pci/fixup-ocelot.c b/arch/mips/pci/fixup-ocelot.c
deleted file mode 100644
index 99629bd047ce..000000000000
--- a/arch/mips/pci/fixup-ocelot.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/gt64120/momenco_ocelot/pci.c
6 * Board-specific PCI routines for gt64120 controller.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13#include <linux/types.h>
14#include <linux/pci.h>
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <asm/pci.h>
18
19
20void __devinit pcibios_fixup_bus(struct pci_bus *bus)
21{
22 struct pci_bus *current_bus = bus;
23 struct pci_dev *devices;
24 struct list_head *devices_link;
25 u16 cmd;
26
27 list_for_each(devices_link, &(current_bus->devices)) {
28
29 devices = pci_dev_b(devices_link);
30 if (devices == NULL)
31 continue;
32
33 if (PCI_SLOT(devices->devfn) == 1) {
34 /*
35 * Slot 1 is primary ether port, i82559
36 * we double-check against that assumption
37 */
38 if ((devices->vendor != 0x8086) ||
39 (devices->device != 0x1209)) {
40 panic("pcibios_fixup_bus: found "
41 "unexpected PCI device in slot 1.");
42 }
43 devices->irq = 2; /* irq_nr is 2 for INT0 */
44 } else if (PCI_SLOT(devices->devfn) == 2) {
45 /*
46 * Slot 2 is secondary ether port, i21143
47 * we double-check against that assumption
48 */
49 if ((devices->vendor != 0x1011) ||
50 (devices->device != 0x19)) {
51 panic("galileo_pcibios_fixup_bus: "
52 "found unexpected PCI device in slot 2.");
53 }
54 devices->irq = 3; /* irq_nr is 3 for INT1 */
55 } else if (PCI_SLOT(devices->devfn) == 4) {
56 /* PMC Slot 1 */
57 devices->irq = 8; /* irq_nr is 8 for INT6 */
58 } else if (PCI_SLOT(devices->devfn) == 5) {
59 /* PMC Slot 1 */
60 devices->irq = 9; /* irq_nr is 9 for INT7 */
61 } else {
62 /* We don't have assign interrupts for other devices. */
63 devices->irq = 0xff;
64 }
65
66 /* Assign an interrupt number for the device */
67 bus->ops->write_byte(devices, PCI_INTERRUPT_LINE,
68 devices->irq);
69
70 /* enable master */
71 bus->ops->read_word(devices, PCI_COMMAND, &cmd);
72 cmd |= PCI_COMMAND_MASTER;
73 bus->ops->write_word(devices, PCI_COMMAND, cmd);
74 }
75}
diff --git a/arch/mips/pci/fixup-rbtx4927.c b/arch/mips/pci/fixup-rbtx4927.c
index 3cdbecb8e714..7450c335b387 100644
--- a/arch/mips/pci/fixup-rbtx4927.c
+++ b/arch/mips/pci/fixup-rbtx4927.c
@@ -79,7 +79,7 @@ static unsigned char backplane_pci_irq[4][4] = {
79 TX4927_IRQ_IOC_PCIC} 79 TX4927_IRQ_IOC_PCIC}
80}; 80};
81 81
82int pci_get_irq(struct pci_dev *dev, int pin) 82static int pci_get_irq(const struct pci_dev *dev, int pin)
83{ 83{
84 unsigned char irq = pin; 84 unsigned char irq = pin;
85 85
diff --git a/arch/mips/pci/fixup-tx4938.c b/arch/mips/pci/fixup-tx4938.c
index 2485f47dfe6f..f2ba06ee0c10 100644
--- a/arch/mips/pci/fixup-tx4938.c
+++ b/arch/mips/pci/fixup-tx4938.c
@@ -18,7 +18,7 @@
18 18
19extern struct pci_controller tx4938_pci_controller[]; 19extern struct pci_controller tx4938_pci_controller[];
20 20
21int pci_get_irq(struct pci_dev *dev, int pin) 21static int pci_get_irq(const struct pci_dev *dev, int pin)
22{ 22{
23 int irq = pin; 23 int irq = pin;
24 u8 slot = PCI_SLOT(dev->devfn); 24 u8 slot = PCI_SLOT(dev->devfn);
diff --git a/arch/mips/pci/ops-ddb5477.c b/arch/mips/pci/ops-ddb5477.c
deleted file mode 100644
index 8e57d4c5d90f..000000000000
--- a/arch/mips/pci/ops-ddb5477.c
+++ /dev/null
@@ -1,278 +0,0 @@
1/***********************************************************************
2 * Copyright 2001 MontaVista Software Inc.
3 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
4 *
5 * arch/mips/ddb5xxx/ddb5477/pci_ops.c
6 * Define the pci_ops for DB5477.
7 *
8 * Much of the code is derived from the original DDB5074 port by
9 * Geert Uytterhoeven <geert@sonycom.com>
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 ***********************************************************************
16 */
17
18/*
19 * DDB5477 has two PCI channels, external PCI and IOPIC (internal)
20 * Therefore we provide two sets of pci_ops.
21 */
22#include <linux/pci.h>
23#include <linux/kernel.h>
24#include <linux/types.h>
25
26#include <asm/addrspace.h>
27#include <asm/debug.h>
28
29#include <asm/ddb5xxx/ddb5xxx.h>
30
31/*
32 * config_swap structure records what set of pdar/pmr are used
33 * to access pci config space. It also provides a place hold the
34 * original values for future restoring.
35 */
36struct pci_config_swap {
37 u32 pdar;
38 u32 pmr;
39 u32 config_base;
40 u32 config_size;
41 u32 pdar_backup;
42 u32 pmr_backup;
43};
44
45/*
46 * On DDB5477, we have two sets of swap registers, for ext PCI and IOPCI.
47 */
48struct pci_config_swap ext_pci_swap = {
49 DDB_PCIW0,
50 DDB_PCIINIT00,
51 DDB_PCI0_CONFIG_BASE,
52 DDB_PCI0_CONFIG_SIZE
53};
54struct pci_config_swap io_pci_swap = {
55 DDB_IOPCIW0,
56 DDB_PCIINIT01,
57 DDB_PCI1_CONFIG_BASE,
58 DDB_PCI1_CONFIG_SIZE
59};
60
61
62/*
63 * access config space
64 */
65static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus, /* 0 means top level bus */
66 u32 slot_num)
67{
68 u32 pci_addr = 0;
69 u32 pciinit_offset = 0;
70 u32 virt_addr;
71 u32 option;
72
73 /* minimum pdar (window) size is 2MB */
74 db_assert(swap->config_size >= (2 << 20));
75
76 db_assert(slot_num < (1 << 5));
77 db_assert(bus < (1 << 8));
78
79 /* backup registers */
80 swap->pdar_backup = ddb_in32(swap->pdar);
81 swap->pmr_backup = ddb_in32(swap->pmr);
82
83 /* set the pdar (pci window) register */
84 ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32, /* 32 bit wide */
85 0, /* not on local memory bus */
86 0); /* not visible from PCI bus (N/A) */
87
88 /*
89 * calcuate the absolute pci config addr;
90 * according to the spec, we start scanning from adr:11 (0x800)
91 */
92 if (bus == 0) {
93 /* type 0 config */
94 pci_addr = 0x800 << slot_num;
95 } else {
96 /* type 1 config */
97 pci_addr = (bus << 16) | (slot_num << 11);
98 }
99
100 /*
101 * if pci_addr is less than pci config window size, we set
102 * pciinit_offset to 0 and adjust the virt_address.
103 * Otherwise we will try to adjust pciinit_offset.
104 */
105 if (pci_addr < swap->config_size) {
106 virt_addr = KSEG1ADDR(swap->config_base + pci_addr);
107 pciinit_offset = 0;
108 } else {
109 db_assert((pci_addr & (swap->config_size - 1)) == 0);
110 virt_addr = KSEG1ADDR(swap->config_base);
111 pciinit_offset = pci_addr;
112 }
113
114 /* set the pmr register */
115 option = DDB_PCI_ACCESS_32;
116 if (bus != 0)
117 option |= DDB_PCI_CFGTYPE1;
118 ddb_set_pmr(swap->pmr, DDB_PCICMD_CFG, pciinit_offset, option);
119
120 return virt_addr;
121}
122
123static inline void ddb_close_config_base(struct pci_config_swap *swap)
124{
125 ddb_out32(swap->pdar, swap->pdar_backup);
126 ddb_out32(swap->pmr, swap->pmr_backup);
127}
128
129static int read_config_dword(struct pci_config_swap *swap,
130 struct pci_bus *bus, u32 devfn, u32 where,
131 u32 * val)
132{
133 u32 bus_num, slot_num, func_num;
134 u32 base;
135
136 db_assert((where & 3) == 0);
137 db_assert(where < (1 << 8));
138
139 /* check if the bus is top-level */
140 if (bus->parent != NULL) {
141 bus_num = bus->number;
142 db_assert(bus_num != 0);
143 } else {
144 bus_num = 0;
145 }
146
147 slot_num = PCI_SLOT(devfn);
148 func_num = PCI_FUNC(devfn);
149 base = ddb_access_config_base(swap, bus_num, slot_num);
150 *val = *(volatile u32 *) (base + (func_num << 8) + where);
151 ddb_close_config_base(swap);
152 return PCIBIOS_SUCCESSFUL;
153}
154
155static int read_config_word(struct pci_config_swap *swap,
156 struct pci_bus *bus, u32 devfn, u32 where,
157 u16 * val)
158{
159 int status;
160 u32 result;
161
162 db_assert((where & 1) == 0);
163
164 status = read_config_dword(swap, bus, devfn, where & ~3, &result);
165 if (where & 2)
166 result >>= 16;
167 *val = result & 0xffff;
168 return status;
169}
170
171static int read_config_byte(struct pci_config_swap *swap,
172 struct pci_bus *bus, u32 devfn, u32 where,
173 u8 * val)
174{
175 int status;
176 u32 result;
177
178 status = read_config_dword(swap, bus, devfn, where & ~3, &result);
179 if (where & 1)
180 result >>= 8;
181 if (where & 2)
182 result >>= 16;
183 *val = result & 0xff;
184
185 return status;
186}
187
188static int write_config_dword(struct pci_config_swap *swap,
189 struct pci_bus *bus, u32 devfn, u32 where,
190 u32 val)
191{
192 u32 bus_num, slot_num, func_num;
193 u32 base;
194
195 db_assert((where & 3) == 0);
196 db_assert(where < (1 << 8));
197
198 /* check if the bus is top-level */
199 if (bus->parent != NULL) {
200 bus_num = bus->number;
201 db_assert(bus_num != 0);
202 } else {
203 bus_num = 0;
204 }
205
206 slot_num = PCI_SLOT(devfn);
207 func_num = PCI_FUNC(devfn);
208 base = ddb_access_config_base(swap, bus_num, slot_num);
209 *(volatile u32 *) (base + (func_num << 8) + where) = val;
210 ddb_close_config_base(swap);
211 return PCIBIOS_SUCCESSFUL;
212}
213
214static int write_config_word(struct pci_config_swap *swap,
215 struct pci_bus *bus, u32 devfn, u32 where, u16 val)
216{
217 int status, shift = 0;
218 u32 result;
219
220 db_assert((where & 1) == 0);
221
222 status = read_config_dword(swap, bus, devfn, where & ~3, &result);
223 if (status != PCIBIOS_SUCCESSFUL)
224 return status;
225
226 if (where & 2)
227 shift += 16;
228 result &= ~(0xffff << shift);
229 result |= val << shift;
230 return write_config_dword(swap, bus, devfn, where & ~3, result);
231}
232
233static int write_config_byte(struct pci_config_swap *swap,
234 struct pci_bus *bus, u32 devfn, u32 where, u8 val)
235{
236 int status, shift = 0;
237 u32 result;
238
239 status = read_config_dword(swap, bus, devfn, where & ~3, &result);
240 if (status != PCIBIOS_SUCCESSFUL)
241 return status;
242
243 if (where & 2)
244 shift += 16;
245 if (where & 1)
246 shift += 8;
247 result &= ~(0xff << shift);
248 result |= val << shift;
249 return write_config_dword(swap, bus, devfn, where & ~3, result);
250}
251
252#define MAKE_PCI_OPS(prefix, rw, pciswap, star) \
253static int prefix##_##rw##_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 star val) \
254{ \
255 if (size == 1) \
256 return rw##_config_byte(pciswap, bus, devfn, where, (u8 star)val); \
257 else if (size == 2) \
258 return rw##_config_word(pciswap, bus, devfn, where, (u16 star)val); \
259 /* Size must be 4 */ \
260 return rw##_config_dword(pciswap, bus, devfn, where, val); \
261}
262
263MAKE_PCI_OPS(extpci, read, &ext_pci_swap, *)
264MAKE_PCI_OPS(extpci, write, &ext_pci_swap,)
265
266MAKE_PCI_OPS(iopci, read, &io_pci_swap, *)
267MAKE_PCI_OPS(iopci, write, &io_pci_swap,)
268
269struct pci_ops ddb5477_ext_pci_ops = {
270 .read = extpci_read_config,
271 .write = extpci_write_config
272};
273
274
275struct pci_ops ddb5477_io_pci_ops = {
276 .read = iopci_read_config,
277 .write = iopci_write_config
278};
diff --git a/arch/mips/pci/ops-emma2rh.c b/arch/mips/pci/ops-emma2rh.c
index 38f181625e10..d31bfc6d4150 100644
--- a/arch/mips/pci/ops-emma2rh.c
+++ b/arch/mips/pci/ops-emma2rh.c
@@ -45,7 +45,7 @@ static int check_args(struct pci_bus *bus, u32 devfn, u32 * bus_num)
45 /* check if the bus is top-level */ 45 /* check if the bus is top-level */
46 if (bus->parent != NULL) { 46 if (bus->parent != NULL) {
47 *bus_num = bus->number; 47 *bus_num = bus->number;
48 db_assert(bus_num != 0); 48 db_assert(bus_num != NULL);
49 } else 49 } else
50 *bus_num = 0; 50 *bus_num = 0;
51 51
diff --git a/arch/mips/pci/ops-pnx8550.c b/arch/mips/pci/ops-pnx8550.c
index f556b7a8dccd..d61064652498 100644
--- a/arch/mips/pci/ops-pnx8550.c
+++ b/arch/mips/pci/ops-pnx8550.c
@@ -117,7 +117,7 @@ read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 * val)
117 unsigned int data = 0; 117 unsigned int data = 0;
118 int err; 118 int err;
119 119
120 if (bus == 0) 120 if (bus == NULL)
121 return -1; 121 return -1;
122 122
123 err = config_access(PCI_CMD_CONFIG_READ, bus, devfn, where, ~(1 << (where & 3)), &data); 123 err = config_access(PCI_CMD_CONFIG_READ, bus, devfn, where, ~(1 << (where & 3)), &data);
@@ -145,7 +145,7 @@ read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 * val)
145 unsigned int data = 0; 145 unsigned int data = 0;
146 int err; 146 int err;
147 147
148 if (bus == 0) 148 if (bus == NULL)
149 return -1; 149 return -1;
150 150
151 if (where & 0x01) 151 if (where & 0x01)
@@ -168,7 +168,7 @@ static int
168read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 * val) 168read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 * val)
169{ 169{
170 int err; 170 int err;
171 if (bus == 0) 171 if (bus == NULL)
172 return -1; 172 return -1;
173 173
174 if (where & 0x03) 174 if (where & 0x03)
@@ -185,7 +185,7 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val)
185 unsigned int data = (unsigned int)val; 185 unsigned int data = (unsigned int)val;
186 int err; 186 int err;
187 187
188 if (bus == 0) 188 if (bus == NULL)
189 return -1; 189 return -1;
190 190
191 switch (where & 0x03) { 191 switch (where & 0x03) {
@@ -213,7 +213,7 @@ write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val)
213 unsigned int data = (unsigned int)val; 213 unsigned int data = (unsigned int)val;
214 int err; 214 int err;
215 215
216 if (bus == 0) 216 if (bus == NULL)
217 return -1; 217 return -1;
218 218
219 if (where & 0x01) 219 if (where & 0x01)
@@ -235,7 +235,7 @@ static int
235write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val) 235write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val)
236{ 236{
237 int err; 237 int err;
238 if (bus == 0) 238 if (bus == NULL)
239 return -1; 239 return -1;
240 240
241 if (where & 0x03) 241 if (where & 0x03)
diff --git a/arch/mips/pci/pci-ddb5477.c b/arch/mips/pci/pci-ddb5477.c
deleted file mode 100644
index 7363e1877842..000000000000
--- a/arch/mips/pci/pci-ddb5477.c
+++ /dev/null
@@ -1,207 +0,0 @@
1/*
2 * PCI code for DDB5477.
3 *
4 * Copyright (C) 2001 MontaVista Software Inc.
5 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
6 *
7 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 */
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/types.h>
17#include <linux/pci.h>
18
19#include <asm/bootinfo.h>
20#include <asm/debug.h>
21
22#include <asm/ddb5xxx/ddb5xxx.h>
23
24static struct resource extpci_io_resource = {
25 .start = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000,
26 .end = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE - 1,
27 .name = "ext pci IO space",
28 .flags = IORESOURCE_IO
29};
30
31static struct resource extpci_mem_resource = {
32 .start = DDB_PCI0_MEM_BASE + 0x100000,
33 .end = DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE - 1,
34 .name = "ext pci memory space",
35 .flags = IORESOURCE_MEM
36};
37
38static struct resource iopci_io_resource = {
39 .start = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE,
40 .end = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE - 1,
41 .name = "io pci IO space",
42 .flags = IORESOURCE_IO
43};
44
45static struct resource iopci_mem_resource = {
46 .start = DDB_PCI1_MEM_BASE,
47 .end = DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE - 1,
48 .name = "ext pci memory space",
49 .flags = IORESOURCE_MEM
50};
51
52extern struct pci_ops ddb5477_ext_pci_ops;
53extern struct pci_ops ddb5477_io_pci_ops;
54
55struct pci_controller ddb5477_ext_controller = {
56 .pci_ops = &ddb5477_ext_pci_ops,
57 .io_resource = &extpci_io_resource,
58 .mem_resource = &extpci_mem_resource
59};
60
61struct pci_controller ddb5477_io_controller = {
62 .pci_ops = &ddb5477_io_pci_ops,
63 .io_resource = &iopci_io_resource,
64 .mem_resource = &iopci_mem_resource
65};
66
67
68
69/*
70 * we fix up irqs based on the slot number.
71 * The first entry is at AD:11.
72 * Fortunately this works because, although we have two pci buses,
73 * they all have different slot numbers (except for rockhopper slot 20
74 * which is handled below).
75 *
76 */
77
78/*
79 * irq mapping : device -> pci int # -> vrc4377 irq# ,
80 * ddb5477 board manual page 4 and vrc5477 manual page 46
81 */
82
83/*
84 * based on ddb5477 manual page 11
85 */
86#define MAX_SLOT_NUM 21
87static unsigned char irq_map[MAX_SLOT_NUM] = {
88 /* SLOT: 0, AD:11 */ 0xff,
89 /* SLOT: 1, AD:12 */ 0xff,
90 /* SLOT: 2, AD:13 */ 0xff,
91 /* SLOT: 3, AD:14 */ 0xff,
92 /* SLOT: 4, AD:15 */ VRC5477_IRQ_INTA, /* onboard tulip */
93 /* SLOT: 5, AD:16 */ VRC5477_IRQ_INTB, /* slot 1 */
94 /* SLOT: 6, AD:17 */ VRC5477_IRQ_INTC, /* slot 2 */
95 /* SLOT: 7, AD:18 */ VRC5477_IRQ_INTD, /* slot 3 */
96 /* SLOT: 8, AD:19 */ VRC5477_IRQ_INTE, /* slot 4 */
97 /* SLOT: 9, AD:20 */ 0xff,
98 /* SLOT: 10, AD:21 */ 0xff,
99 /* SLOT: 11, AD:22 */ 0xff,
100 /* SLOT: 12, AD:23 */ 0xff,
101 /* SLOT: 13, AD:24 */ 0xff,
102 /* SLOT: 14, AD:25 */ 0xff,
103 /* SLOT: 15, AD:26 */ 0xff,
104 /* SLOT: 16, AD:27 */ 0xff,
105 /* SLOT: 17, AD:28 */ 0xff,
106 /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */
107 /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */
108 /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */
109};
110static unsigned char rockhopperII_irq_map[MAX_SLOT_NUM] = {
111 /* SLOT: 0, AD:11 */ 0xff,
112 /* SLOT: 1, AD:12 */ VRC5477_IRQ_INTB, /* onboard AMD PCNET */
113 /* SLOT: 2, AD:13 */ 0xff,
114 /* SLOT: 3, AD:14 */ 0xff,
115 /* SLOT: 4, AD:15 */ 14, /* M5229 ide ISA irq */
116 /* SLOT: 5, AD:16 */ VRC5477_IRQ_INTD, /* slot 3 */
117 /* SLOT: 6, AD:17 */ VRC5477_IRQ_INTA, /* slot 4 */
118 /* SLOT: 7, AD:18 */ VRC5477_IRQ_INTD, /* slot 5 */
119 /* SLOT: 8, AD:19 */ 0, /* M5457 modem nop */
120 /* SLOT: 9, AD:20 */ VRC5477_IRQ_INTA, /* slot 2 */
121 /* SLOT: 10, AD:21 */ 0xff,
122 /* SLOT: 11, AD:22 */ 0xff,
123 /* SLOT: 12, AD:23 */ 0xff,
124 /* SLOT: 13, AD:24 */ 0xff,
125 /* SLOT: 14, AD:25 */ 0xff,
126 /* SLOT: 15, AD:26 */ 0xff,
127 /* SLOT: 16, AD:27 */ 0xff,
128 /* SLOT: 17, AD:28 */ 0, /* M7101 PMU nop */
129 /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */
130 /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */
131 /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */
132};
133
134int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
135{
136 int slot_num;
137 unsigned char *slot_irq_map;
138 unsigned char irq;
139
140 /*
141 * We ignore the swizzled slot and pin values. The original
142 * pci_fixup_irq() codes largely base irq number on the dev slot
143 * numbers because except for one case they are unique even
144 * though there are multiple pci buses.
145 */
146
147 if (mips_machtype == MACH_NEC_ROCKHOPPERII)
148 slot_irq_map = rockhopperII_irq_map;
149 else
150 slot_irq_map = irq_map;
151
152 slot_num = PCI_SLOT(dev->devfn);
153 irq = slot_irq_map[slot_num];
154
155 db_assert(slot_num < MAX_SLOT_NUM);
156
157 db_assert(irq != 0xff);
158
159 pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
160
161 if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
162 /* hack to distinquish overlapping slot 20s, one
163 * on bus 0 (ALI USB on the M1535 on the backplane),
164 * and one on bus 2 (NEC USB controller on the CPU board)
165 * Make the M1535 USB - ISA IRQ number 9.
166 */
167 if (slot_num == 20 && dev->bus->number == 0) {
168 pci_write_config_byte(dev,
169 PCI_INTERRUPT_LINE,
170 9);
171 irq = 9;
172 }
173
174 }
175
176 return irq;
177}
178
179/* Do platform specific device initialization at pci_enable_device() time */
180int pcibios_plat_dev_init(struct pci_dev *dev)
181{
182 return 0;
183}
184
185void ddb_pci_reset_bus(void)
186{
187 u32 temp;
188
189 /*
190 * I am not sure about the "official" procedure, the following
191 * steps work as far as I know:
192 * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
193 * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
194 * The same is true for both PCI channels.
195 */
196 temp = ddb_in32(DDB_PCICTL0_H);
197 temp |= 0x80000000;
198 ddb_out32(DDB_PCICTL0_H, temp);
199 temp &= ~0xc0000000;
200 ddb_out32(DDB_PCICTL0_H, temp);
201
202 temp = ddb_in32(DDB_PCICTL1_H);
203 temp |= 0x80000000;
204 ddb_out32(DDB_PCICTL1_H, temp);
205 temp &= ~0xc0000000;
206 ddb_out32(DDB_PCICTL1_H, temp);
207}
diff --git a/arch/mips/pci/pci-ocelot.c b/arch/mips/pci/pci-ocelot.c
deleted file mode 100644
index 1421d34535ef..000000000000
--- a/arch/mips/pci/pci-ocelot.c
+++ /dev/null
@@ -1,107 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Galileo Evaluation Boards PCI support.
4 *
5 * The general-purpose functions to read/write and configure the GT64120A's
6 * PCI registers (function names start with pci0 or pci1) are either direct
7 * copies of functions written by Galileo Technology, or are modifications
8 * of their functions to work with Linux 2.4 vs Linux 2.2. These functions
9 * are Copyright - Galileo Technology.
10 *
11 * Other functions are derived from other MIPS PCI implementations, or were
12 * written by RidgeRun, Inc, Copyright (C) 2000 RidgeRun, Inc.
13 * glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
14 *
15 * Copyright 2001 MontaVista Software Inc.
16 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
17 *
18 * This program is free software; you can redistribute it and/or modify it
19 * under the terms of the GNU General Public License as published by the
20 * Free Software Foundation; either version 2 of the License, or (at your
21 * option) any later version.
22 *
23 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
24 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
26 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
27 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
28 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
29 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
30 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *
34 * You should have received a copy of the GNU General Public License along
35 * with this program; if not, write to the Free Software Foundation, Inc.,
36 * 675 Mass Ave, Cambridge, MA 02139, USA.
37 */
38#include <linux/init.h>
39#include <linux/types.h>
40#include <linux/pci.h>
41#include <linux/kernel.h>
42#include <linux/slab.h>
43#include <linux/cache.h>
44#include <asm/pci.h>
45#include <asm/io.h>
46#include <asm/gt64120.h>
47
48static inline unsigned int pci0ReadConfigReg(unsigned int offset)
49{
50 unsigned int DataForRegCf8;
51 unsigned int data;
52
53 DataForRegCf8 = ((PCI_SLOT(device->devfn) << 11) |
54 (PCI_FUNC(device->devfn) << 8) |
55 (offset & ~0x3)) | 0x80000000;
56 GT_WRITE(GT_PCI0_CFGADDR_OFS, DataForRegCf8);
57 GT_READ(GT_PCI0_CFGDATA_OFS, &data);
58
59 return data;
60}
61
62static inline void pci0WriteConfigReg(unsigned int offset, unsigned int data)
63{
64 unsigned int DataForRegCf8;
65
66 DataForRegCf8 = ((PCI_SLOT(device->devfn) << 11) |
67 (PCI_FUNC(device->devfn) << 8) |
68 (offset & ~0x3)) | 0x80000000;
69 GT_WRITE(GT_PCI0_CFGADDR_OFS, DataForRegCf8);
70 GT_WRITE(GT_PCI0_CFGDATA_OFS, data);
71}
72
73static struct resource ocelot_mem_resource = {
74 .start = GT_PCI_MEM_BASE,
75 .end = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1,
76};
77
78static struct resource ocelot_io_resource = {
79 .start = GT_PCI_IO_BASE,
80 .end = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1,
81};
82
83static struct pci_controller ocelot_pci_controller = {
84 .pci_ops = gt64xxx_pci0_ops,
85 .mem_resource = &ocelot_mem_resource,
86 .io_resource = &ocelot_io_resource,
87};
88
89static int __init ocelot_pcibios_init(void)
90{
91 u32 tmp;
92
93 GT_READ(GT_PCI0_CMD_OFS, &tmp);
94 GT_READ(GT_PCI0_BARE_OFS, &tmp);
95
96 /*
97 * You have to enable bus mastering to configure any other
98 * card on the bus.
99 */
100 tmp = pci0ReadConfigReg(PCI_COMMAND);
101 tmp |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_SERR;
102 pci0WriteConfigReg(PCI_COMMAND, tmp);
103
104 register_pci_controller(&ocelot_pci_controller);
105}
106
107arch_initcall(ocelot_pcibios_init);
diff --git a/arch/mips/philips/pnx8550/common/Makefile b/arch/mips/philips/pnx8550/common/Makefile
index b7c638166e9f..31cc1a5cec3b 100644
--- a/arch/mips/philips/pnx8550/common/Makefile
+++ b/arch/mips/philips/pnx8550/common/Makefile
@@ -25,3 +25,5 @@
25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o 25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o
26obj-$(CONFIG_PCI) += pci.o 26obj-$(CONFIG_PCI) += pci.o
27obj-$(CONFIG_KGDB) += gdb_hook.o 27obj-$(CONFIG_KGDB) += gdb_hook.o
28
29EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/pmc-sierra/yosemite/Makefile b/arch/mips/pmc-sierra/yosemite/Makefile
index e931e0d44229..8fd9a04e3534 100644
--- a/arch/mips/pmc-sierra/yosemite/Makefile
+++ b/arch/mips/pmc-sierra/yosemite/Makefile
@@ -2,7 +2,9 @@
2# Makefile for the PMC-Sierra Titan 2# Makefile for the PMC-Sierra Titan
3# 3#
4 4
5obj-y += irq.o i2c-yosemite.o prom.o py-console.o setup.o 5obj-y += irq.o prom.o py-console.o setup.o
6 6
7obj-$(CONFIG_KGDB) += dbg_io.o 7obj-$(CONFIG_KGDB) += dbg_io.o
8obj-$(CONFIG_SMP) += smp.o 8obj-$(CONFIG_SMP) += smp.o
9
10EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c
deleted file mode 100644
index 85b14c73c226..000000000000
--- a/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c
+++ /dev/null
@@ -1,188 +0,0 @@
1/*
2 * Copyright (C) 2003 PMC-Sierra Inc.
3 * Author: Manish Lachwani (lachwani@pmc-sierra.com)
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
11 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
13 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
14 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
15 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
16 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
17 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
18 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
19 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 *
21 * You should have received a copy of the GNU General Public License along
22 * with this program; if not, write to the Free Software Foundation, Inc.,
23 * 675 Mass Ave, Cambridge, MA 02139, USA.
24 */
25
26/*
27 * Detailed Description:
28 *
29 * This block implements the I2C interface to the slave devices like the
30 * Atmel 24C32 EEPROM and the MAX 1619 Sensors device. The I2C Master interface
31 * can be controlled by the SCMB block. And the SCMB block kicks in only when
32 * using the Ethernet Mode of operation and __not__ the SysAD mode
33 *
34 * The SCMB controls the two modes: MDIO and the I2C. The MDIO mode is used to
35 * communicate with the Quad-PHY from Marvel. The I2C is used to communicate
36 * with the I2C slave devices. It seems that the driver does not explicitly
37 * deal with the control of SDA and SCL serial lines. So, the driver will set
38 * the slave address, drive the command and then the data. The SCMB will then
39 * control the two serial lines as required.
40 *
41 * It seems the documents are very unclear abt this. Hence, I took some time
42 * out to write the desciption to have an idea of how the I2C can actually
43 * work. Currently, this Linux driver wont be integrated into the generic Linux
44 * I2C framework. And finally, the I2C interface is also known as the 2BI
45 * interface. 2BI means 2-bit interface referring to SDA and SCL serial lines
46 * respectively.
47 *
48 * - Manish Lachwani (12/09/2003)
49 */
50
51#include "i2c-yosemite.h"
52
53/*
54 * Poll the I2C interface for the BUSY bit.
55 */
56static int titan_i2c_poll(void)
57{
58 int i = 0;
59 unsigned long val = 0;
60
61 for (i = 0; i < TITAN_I2C_MAX_POLL; i++) {
62 val = TITAN_I2C_READ(TITAN_I2C_COMMAND);
63
64 if (!(val & 0x8000))
65 return 0;
66 }
67
68 return TITAN_I2C_ERR_TIMEOUT;
69}
70
71/*
72 * Execute the I2C command
73 */
74int titan_i2c_xfer(unsigned int slave_addr, titan_i2c_command * cmd,
75 int size, unsigned int *addr)
76{
77 int loop, bytes = 0, i;
78 unsigned int *write_data, data, *read_data;
79 unsigned long reg_val, val;
80
81 write_data = cmd->data;
82 read_data = addr;
83
84 TITAN_I2C_WRITE(TITAN_I2C_SLAVE_ADDRESS, slave_addr);
85
86 if (cmd->type == TITAN_I2C_CMD_WRITE)
87 loop = cmd->write_size;
88 else
89 loop = size;
90
91 while (loop > 0) {
92 if ((cmd->type == TITAN_I2C_CMD_WRITE) ||
93 (cmd->type == TITAN_I2C_CMD_READ_WRITE)) {
94
95 reg_val = TITAN_I2C_DATA;
96 for (i = 0; i < TITAN_I2C_MAX_WORDS_PER_RW;
97 ++i, write_data += 2, reg_val += 4) {
98 if (bytes < cmd->write_size) {
99 data = write_data[0];
100 ++data;
101 }
102
103 if (bytes < cmd->write_size) {
104 data = write_data[1];
105 ++data;
106 }
107
108 TITAN_I2C_WRITE(reg_val, data);
109 }
110 }
111
112 TITAN_I2C_WRITE(TITAN_I2C_COMMAND,
113 (unsigned int) (cmd->type << 13));
114 if (titan_i2c_poll() != TITAN_I2C_ERR_OK)
115 return TITAN_I2C_ERR_TIMEOUT;
116
117 if ((cmd->type == TITAN_I2C_CMD_READ) ||
118 (cmd->type == TITAN_I2C_CMD_READ_WRITE)) {
119
120 reg_val = TITAN_I2C_DATA;
121 for (i = 0; i < TITAN_I2C_MAX_WORDS_PER_RW;
122 ++i, read_data += 2, reg_val += 4) {
123 data = TITAN_I2C_READ(reg_val);
124
125 if (bytes < size) {
126 read_data[0] = data & 0xff;
127 ++bytes;
128 }
129
130 if (bytes < size) {
131 read_data[1] =
132 ((data >> 8) & 0xff);
133 ++bytes;
134 }
135 }
136 }
137
138 loop -= (TITAN_I2C_MAX_WORDS_PER_RW * 2);
139 }
140
141 /*
142 * Read the Interrupt status and then return the appropriate error code
143 */
144
145 val = TITAN_I2C_READ(TITAN_I2C_INTERRUPTS);
146 if (val & 0x0020)
147 return TITAN_I2C_ERR_ARB_LOST;
148
149 if (val & 0x0040)
150 return TITAN_I2C_ERR_NO_RESP;
151
152 if (val & 0x0080)
153 return TITAN_I2C_ERR_DATA_COLLISION;
154
155 return TITAN_I2C_ERR_OK;
156}
157
158/*
159 * Init the I2C subsystem of the PMC-Sierra Yosemite board
160 */
161int titan_i2c_init(titan_i2c_config * config)
162{
163 unsigned int val;
164
165 /*
166 * Reset the SCMB and program into the I2C mode
167 */
168 TITAN_I2C_WRITE(TITAN_I2C_SCMB_CONTROL, 0xA000);
169 TITAN_I2C_WRITE(TITAN_I2C_SCMB_CONTROL, 0x2000);
170
171 /*
172 * Configure the filtera and clka values
173 */
174 val = TITAN_I2C_READ(TITAN_I2C_SCMB_CLOCK_A);
175 val |= ((val & ~(0xF000)) | ((config->filtera << 12) & 0xF000));
176 val |= ((val & ~(0x03FF)) | (config->clka & 0x03FF));
177 TITAN_I2C_WRITE(TITAN_I2C_SCMB_CLOCK_A, val);
178
179 /*
180 * Configure the filterb and clkb values
181 */
182 val = TITAN_I2C_READ(TITAN_I2C_SCMB_CLOCK_B);
183 val |= ((val & ~(0xF000)) | ((config->filterb << 12) & 0xF000));
184 val |= ((val & ~(0x03FF)) | (config->clkb & 0x03FF));
185 TITAN_I2C_WRITE(TITAN_I2C_SCMB_CLOCK_B, val);
186
187 return TITAN_I2C_ERR_OK;
188}
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
index 428d1f45a287..4decc2807867 100644
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -56,6 +56,9 @@
56#define HYPERTRANSPORT_INTC 0x7a /* INTC# */ 56#define HYPERTRANSPORT_INTC 0x7a /* INTC# */
57#define HYPERTRANSPORT_INTD 0x7b /* INTD# */ 57#define HYPERTRANSPORT_INTD 0x7b /* INTD# */
58 58
59extern void titan_mailbox_irq(void);
60
61#ifdef CONFIG_HYPERTRANSPORT
59/* 62/*
60 * Handle hypertransport & SMP interrupts. The interrupt lines are scarce. 63 * Handle hypertransport & SMP interrupts. The interrupt lines are scarce.
61 * For interprocessor interrupts, the best thing to do is to use the INTMSG 64 * For interprocessor interrupts, the best thing to do is to use the INTMSG
@@ -107,6 +110,7 @@ static void ll_ht_smp_irq_handler(int irq)
107 110
108 do_IRQ(irq); 111 do_IRQ(irq);
109} 112}
113#endif
110 114
111asmlinkage void plat_irq_dispatch(void) 115asmlinkage void plat_irq_dispatch(void)
112{ 116{
diff --git a/arch/mips/pmc-sierra/yosemite/prom.c b/arch/mips/pmc-sierra/yosemite/prom.c
index 1e1685e415a4..0cd78f0f5f2d 100644
--- a/arch/mips/pmc-sierra/yosemite/prom.c
+++ b/arch/mips/pmc-sierra/yosemite/prom.c
@@ -34,7 +34,7 @@ extern void prom_grab_secondary(void);
34struct callvectors *debug_vectors; 34struct callvectors *debug_vectors;
35 35
36extern unsigned long yosemite_base; 36extern unsigned long yosemite_base;
37extern unsigned long cpu_clock; 37extern unsigned long cpu_clock_freq;
38 38
39const char *get_system_type(void) 39const char *get_system_type(void)
40{ 40{
@@ -119,7 +119,7 @@ void __init prom_init(void)
119 16); 119 16);
120 120
121 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0) 121 if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
122 cpu_clock = 122 cpu_clock_freq =
123 simple_strtol(*env + strlen("cpuclock="), NULL, 123 simple_strtol(*env + strlen("cpuclock="), NULL,
124 10); 124 10);
125 125
diff --git a/arch/mips/pmc-sierra/yosemite/setup.c b/arch/mips/pmc-sierra/yosemite/setup.c
index f7f93ae24c34..58862c8d1d00 100644
--- a/arch/mips/pmc-sierra/yosemite/setup.c
+++ b/arch/mips/pmc-sierra/yosemite/setup.c
@@ -59,7 +59,7 @@ unsigned char titan_ge_mac_addr_base[6] = {
59 0x00, 0xe0, 0x04, 0x00, 0x00, 0x21 59 0x00, 0xe0, 0x04, 0x00, 0x00, 0x21
60}; 60};
61 61
62unsigned long cpu_clock; 62unsigned long cpu_clock_freq;
63unsigned long yosemite_base; 63unsigned long yosemite_base;
64 64
65static struct m48t37_rtc *m48t37_base; 65static struct m48t37_rtc *m48t37_base;
@@ -140,7 +140,7 @@ void __init plat_timer_setup(struct irqaction *irq)
140 140
141void yosemite_time_init(void) 141void yosemite_time_init(void)
142{ 142{
143 mips_hpt_frequency = cpu_clock / 2; 143 mips_hpt_frequency = cpu_clock_freq / 2;
144mips_hpt_frequency = 33000000 * 3 * 5; 144mips_hpt_frequency = 33000000 * 3 * 5;
145} 145}
146 146
diff --git a/arch/mips/pmc-sierra/yosemite/smp.c b/arch/mips/pmc-sierra/yosemite/smp.c
index d83c4ada14f3..1c852d6a7654 100644
--- a/arch/mips/pmc-sierra/yosemite/smp.c
+++ b/arch/mips/pmc-sierra/yosemite/smp.c
@@ -106,23 +106,28 @@ void prom_smp_finish(void)
106{ 106{
107} 107}
108 108
109asmlinkage void titan_mailbox_irq(void) 109void titan_mailbox_irq(void)
110{ 110{
111 int cpu = smp_processor_id(); 111 int cpu = smp_processor_id();
112 unsigned long status; 112 unsigned long status;
113 113
114 if (cpu == 0) { 114 switch (cpu) {
115 case 0:
115 status = OCD_READ(RM9000x2_OCD_INTP0STATUS3); 116 status = OCD_READ(RM9000x2_OCD_INTP0STATUS3);
116 OCD_WRITE(RM9000x2_OCD_INTP0CLEAR3, status); 117 OCD_WRITE(RM9000x2_OCD_INTP0CLEAR3, status);
117 }
118 118
119 if (cpu == 1) { 119 if (status & 0x2)
120 smp_call_function_interrupt();
121 break;
122
123 case 1:
120 status = OCD_READ(RM9000x2_OCD_INTP1STATUS3); 124 status = OCD_READ(RM9000x2_OCD_INTP1STATUS3);
121 OCD_WRITE(RM9000x2_OCD_INTP1CLEAR3, status); 125 OCD_WRITE(RM9000x2_OCD_INTP1CLEAR3, status);
122 }
123 126
124 if (status & 0x2) 127 if (status & 0x2)
125 smp_call_function_interrupt(); 128 smp_call_function_interrupt();
129 break;
130 }
126} 131}
127 132
128/* 133/*
diff --git a/arch/mips/qemu/Makefile b/arch/mips/qemu/Makefile
index 078cd3029c9f..cec24c117f6e 100644
--- a/arch/mips/qemu/Makefile
+++ b/arch/mips/qemu/Makefile
@@ -5,3 +5,5 @@
5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o 5obj-y = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o
6 6
7obj-$(CONFIG_SMP) += q-smp.o 7obj-$(CONFIG_SMP) += q-smp.o
8
9EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile
index 7ce76e20beb9..e0a6871d56e4 100644
--- a/arch/mips/sgi-ip27/Makefile
+++ b/arch/mips/sgi-ip27/Makefile
@@ -9,3 +9,5 @@ obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o 9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
10obj-$(CONFIG_KGDB) += ip27-dbgio.o 10obj-$(CONFIG_KGDB) += ip27-dbgio.o
11obj-$(CONFIG_SMP) += ip27-smp.o 11obj-$(CONFIG_SMP) += ip27-smp.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip27/ip27-klnuma.c b/arch/mips/sgi-ip27/ip27-klnuma.c
index f9f404a8ddad..f10d9839006d 100644
--- a/arch/mips/sgi-ip27/ip27-klnuma.c
+++ b/arch/mips/sgi-ip27/ip27-klnuma.c
@@ -28,8 +28,6 @@ static cpumask_t ktext_repmask;
28 */ 28 */
29void __init setup_replication_mask(void) 29void __init setup_replication_mask(void)
30{ 30{
31 cnodeid_t cnode;
32
33 /* Set only the master cnode's bit. The master cnode is always 0. */ 31 /* Set only the master cnode's bit. The master cnode is always 0. */
34 cpus_clear(ktext_repmask); 32 cpus_clear(ktext_repmask);
35 cpu_set(0, ktext_repmask); 33 cpu_set(0, ktext_repmask);
@@ -38,11 +36,15 @@ void __init setup_replication_mask(void)
38#ifndef CONFIG_MAPPED_KERNEL 36#ifndef CONFIG_MAPPED_KERNEL
39#error Kernel replication works with mapped kernel support. No calias support. 37#error Kernel replication works with mapped kernel support. No calias support.
40#endif 38#endif
41 for_each_online_node(cnode) { 39 {
42 if (cnode == 0) 40 cnodeid_t cnode;
43 continue; 41
44 /* Advertise that we have a copy of the kernel */ 42 for_each_online_node(cnode) {
45 cpu_set(cnode, ktext_repmask); 43 if (cnode == 0)
44 continue;
45 /* Advertise that we have a copy of the kernel */
46 cpu_set(cnode, ktext_repmask);
47 }
46 } 48 }
47#endif 49#endif
48 /* Set up a GDA pointer to the replication mask. */ 50 /* Set up a GDA pointer to the replication mask. */
diff --git a/arch/mips/sgi-ip27/ip27-smp.c b/arch/mips/sgi-ip27/ip27-smp.c
index 09fa7f5216f0..08e79141b47c 100644
--- a/arch/mips/sgi-ip27/ip27-smp.c
+++ b/arch/mips/sgi-ip27/ip27-smp.c
@@ -181,7 +181,7 @@ void __init prom_boot_secondary(int cpu, struct task_struct *idle)
181 0, (void *) sp, (void *) gp); 181 0, (void *) sp, (void *) gp);
182} 182}
183 183
184void prom_init_secondary(void) 184void __cpuinit prom_init_secondary(void)
185{ 185{
186 per_cpu_init(); 186 per_cpu_init();
187 local_irq_enable(); 187 local_irq_enable();
diff --git a/arch/mips/sgi-ip32/Makefile b/arch/mips/sgi-ip32/Makefile
index 60f0227425e7..31c9aa1bcb40 100644
--- a/arch/mips/sgi-ip32/Makefile
+++ b/arch/mips/sgi-ip32/Makefile
@@ -5,3 +5,5 @@
5 5
6obj-y += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \ 6obj-y += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \
7 crime.o ip32-memory.o 7 crime.o ip32-memory.o
8
9EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip32/ip32-reset.c b/arch/mips/sgi-ip32/ip32-reset.c
index db8084411538..624bbdbff2a8 100644
--- a/arch/mips/sgi-ip32/ip32-reset.c
+++ b/arch/mips/sgi-ip32/ip32-reset.c
@@ -195,7 +195,8 @@ static __init int ip32_reboot_setup(void)
195 blink_timer.function = blink_timeout; 195 blink_timer.function = blink_timeout;
196 atomic_notifier_chain_register(&panic_notifier_list, &panic_block); 196 atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
197 197
198 request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL); 198 if (request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL))
199 panic("Can't allocate MACEISA RTC IRQ");
199 200
200 return 0; 201 return 0;
201} 202}
diff --git a/arch/mips/sibyte/bcm1480/Makefile b/arch/mips/sibyte/bcm1480/Makefile
index cdc4c56c3e29..f292f7df0cfb 100644
--- a/arch/mips/sibyte/bcm1480/Makefile
+++ b/arch/mips/sibyte/bcm1480/Makefile
@@ -1,3 +1,5 @@
1obj-y := setup.o irq.o time.o 1obj-y := setup.o irq.o time.o
2 2
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4
5EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sibyte/bcm1480/setup.c b/arch/mips/sibyte/bcm1480/setup.c
index 89f29233cae1..bb28f28e8042 100644
--- a/arch/mips/sibyte/bcm1480/setup.c
+++ b/arch/mips/sibyte/bcm1480/setup.c
@@ -16,6 +16,7 @@
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 */ 17 */
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/module.h>
19#include <linux/reboot.h> 20#include <linux/reboot.h>
20#include <linux/string.h> 21#include <linux/string.h>
21 22
diff --git a/arch/mips/sibyte/common/Makefile b/arch/mips/sibyte/common/Makefile
index 8a06a4fb5212..f8ae30066a05 100644
--- a/arch/mips/sibyte/common/Makefile
+++ b/arch/mips/sibyte/common/Makefile
@@ -3,3 +3,4 @@ obj-y :=
3obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o 3obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o
4 4
5EXTRA_AFLAGS := $(CFLAGS) 5EXTRA_AFLAGS := $(CFLAGS)
6EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sibyte/sb1250/Makefile b/arch/mips/sibyte/sb1250/Makefile
index df662c61473a..697793783a25 100644
--- a/arch/mips/sibyte/sb1250/Makefile
+++ b/arch/mips/sibyte/sb1250/Makefile
@@ -3,3 +3,5 @@ obj-y := setup.o irq.o time.o
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_SIBYTE_STANDALONE) += prom.o 4obj-$(CONFIG_SIBYTE_STANDALONE) += prom.o
5obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o 5obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sni/Makefile b/arch/mips/sni/Makefile
index 471418e4f446..3a99cd62c0bd 100644
--- a/arch/mips/sni/Makefile
+++ b/arch/mips/sni/Makefile
@@ -4,3 +4,5 @@
4 4
5obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o 5obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o
6obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o 6obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o
7
8EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/tx4927/common/tx4927_irq.c b/arch/mips/tx4927/common/tx4927_irq.c
index 3d25d010f3d5..00b0b975f349 100644
--- a/arch/mips/tx4927/common/tx4927_irq.c
+++ b/arch/mips/tx4927/common/tx4927_irq.c
@@ -43,6 +43,9 @@
43#include <asm/mipsregs.h> 43#include <asm/mipsregs.h>
44#include <asm/system.h> 44#include <asm/system.h>
45#include <asm/tx4927/tx4927.h> 45#include <asm/tx4927/tx4927.h>
46#ifdef CONFIG_TOSHIBA_RBTX4927
47#include <asm/tx4927/toshiba_rbtx4927.h>
48#endif
46 49
47/* 50/*
48 * DEBUG 51 * DEBUG
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
index 5cc30c10e746..e265fcd31b60 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
@@ -262,8 +262,6 @@ u32 bit2num(u32 num)
262int toshiba_rbtx4927_irq_nested(int sw_irq) 262int toshiba_rbtx4927_irq_nested(int sw_irq)
263{ 263{
264 u32 level3; 264 u32 level3;
265 u32 level4;
266 u32 level5;
267 265
268 level3 = reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f; 266 level3 = reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;
269 if (level3) { 267 if (level3) {
@@ -275,6 +273,8 @@ int toshiba_rbtx4927_irq_nested(int sw_irq)
275#ifdef CONFIG_TOSHIBA_FPCIB0 273#ifdef CONFIG_TOSHIBA_FPCIB0
276 { 274 {
277 if (tx4927_using_backplane) { 275 if (tx4927_using_backplane) {
276 u32 level4;
277 u32 level5;
278 outb(0x0A, 0x20); 278 outb(0x0A, 0x20);
279 level4 = inb(0x20) & 0xff; 279 level4 = inb(0x20) & 0xff;
280 if (level4) { 280 if (level4) {
diff --git a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
index ab72292a172e..ea5a70b252a0 100644
--- a/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
+++ b/arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
@@ -159,58 +159,6 @@ int tx4927_pci66 = 0; /* 0:auto */
159char *toshiba_name = ""; 159char *toshiba_name = "";
160 160
161#ifdef CONFIG_PCI 161#ifdef CONFIG_PCI
162static void tx4927_pcierr_interrupt(int irq, void *dev_id)
163{
164#ifdef CONFIG_BLK_DEV_IDEPCI
165 /* ignore MasterAbort for ide probing... */
166 if (irq == TX4927_IRQ_IRC_PCIERR &&
167 ((tx4927_pcicptr->pcistatus >> 16) & 0xf900) ==
168 PCI_STATUS_REC_MASTER_ABORT) {
169 tx4927_pcicptr->pcistatus =
170 (tx4927_pcicptr->
171 pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT
172 << 16);
173
174 return;
175 }
176#endif
177 printk("PCI error interrupt (irq 0x%x).\n", irq);
178
179 printk("pcistat:%04x, g2pstatus:%08lx, pcicstatus:%08lx\n",
180 (unsigned short) (tx4927_pcicptr->pcistatus >> 16),
181 tx4927_pcicptr->g2pstatus, tx4927_pcicptr->pcicstatus);
182 printk("ccfg:%08lx, tear:%02lx_%08lx\n",
183 (unsigned long) tx4927_ccfgptr->ccfg,
184 (unsigned long) (tx4927_ccfgptr->tear >> 32),
185 (unsigned long) tx4927_ccfgptr->tear);
186 show_regs(get_irq_regs());
187}
188
189void __init toshiba_rbtx4927_pci_irq_init(void)
190{
191 return;
192}
193
194void tx4927_reset_pci_pcic(void)
195{
196 /* Reset PCI Bus */
197 *tx4927_pcireset_ptr = 1;
198 /* Reset PCIC */
199 tx4927_ccfgptr->clkctr |= TX4927_CLKCTR_PCIRST;
200 udelay(10000);
201 /* clear PCIC reset */
202 tx4927_ccfgptr->clkctr &= ~TX4927_CLKCTR_PCIRST;
203 *tx4927_pcireset_ptr = 0;
204}
205#endif /* CONFIG_PCI */
206
207#ifdef CONFIG_PCI
208void print_pci_status(void)
209{
210 printk("PCI STATUS %lx\n", tx4927_pcicptr->pcistatus);
211 printk("PCIC STATUS %lx\n", tx4927_pcicptr->pcicstatus);
212}
213
214extern struct pci_controller tx4927_controller; 162extern struct pci_controller tx4927_controller;
215 163
216static struct pci_dev *fake_pci_dev(struct pci_controller *hose, 164static struct pci_dev *fake_pci_dev(struct pci_controller *hose,
@@ -239,10 +187,8 @@ static int early_##rw##_config_##size(struct pci_controller *hose, \
239} 187}
240 188
241EARLY_PCI_OP(read, byte, u8 *) 189EARLY_PCI_OP(read, byte, u8 *)
242EARLY_PCI_OP(read, word, u16 *)
243EARLY_PCI_OP(read, dword, u32 *) 190EARLY_PCI_OP(read, dword, u32 *)
244EARLY_PCI_OP(write, byte, u8) 191EARLY_PCI_OP(write, byte, u8)
245EARLY_PCI_OP(write, word, u16)
246EARLY_PCI_OP(write, dword, u32) 192EARLY_PCI_OP(write, dword, u32)
247 193
248static int __init tx4927_pcibios_init(void) 194static int __init tx4927_pcibios_init(void)
@@ -269,7 +215,9 @@ static int __init tx4927_pcibios_init(void)
269 u8 v08_64; 215 u8 v08_64;
270 u32 v32_b0; 216 u32 v32_b0;
271 u8 v08_e1; 217 u8 v08_e1;
218#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
272 char *s = " sb/isa --"; 219 char *s = " sb/isa --";
220#endif
273 221
274 TOSHIBA_RBTX4927_SETUP_DPRINTK 222 TOSHIBA_RBTX4927_SETUP_DPRINTK
275 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n", 223 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
@@ -354,7 +302,9 @@ static int __init tx4927_pcibios_init(void)
354 u8 v08_41; 302 u8 v08_41;
355 u8 v08_43; 303 u8 v08_43;
356 u8 v08_5c; 304 u8 v08_5c;
305#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
357 char *s = " sb/ide --"; 306 char *s = " sb/ide --";
307#endif
358 308
359 TOSHIBA_RBTX4927_SETUP_DPRINTK 309 TOSHIBA_RBTX4927_SETUP_DPRINTK
360 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n", 310 (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
diff --git a/arch/mips/tx4938/toshiba_rbtx4938/setup.c b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
index 6ed39a5aea72..f9ad482749e4 100644
--- a/arch/mips/tx4938/toshiba_rbtx4938/setup.c
+++ b/arch/mips/tx4938/toshiba_rbtx4938/setup.c
@@ -657,7 +657,7 @@ void __init tx4938_board_setup(void)
657 657
658 /* clocks */ 658 /* clocks */
659 if (txx9_master_clock) { 659 if (txx9_master_clock) {
660 /* calculate gbus_clock and cpu_clock from master_clock */ 660 /* calculate gbus_clock and cpu_clock_freq from master_clock */
661 divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK; 661 divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK;
662 switch (divmode) { 662 switch (divmode) {
663 case TX4938_CCFG_DIVMODE_8: 663 case TX4938_CCFG_DIVMODE_8:
@@ -691,7 +691,7 @@ void __init tx4938_board_setup(void)
691 if (txx9_cpu_clock == 0) { 691 if (txx9_cpu_clock == 0) {
692 txx9_cpu_clock = 300000000; /* 300MHz */ 692 txx9_cpu_clock = 300000000; /* 300MHz */
693 } 693 }
694 /* calculate gbus_clock and master_clock from cpu_clock */ 694 /* calculate gbus_clock and master_clock from cpu_clock_freq */
695 cpuclk = txx9_cpu_clock; 695 cpuclk = txx9_cpu_clock;
696 divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK; 696 divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK;
697 switch (divmode) { 697 switch (divmode) {
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
index d0d84ec8d63d..7d5d83b8c582 100644
--- a/arch/mips/vr41xx/common/Makefile
+++ b/arch/mips/vr41xx/common/Makefile
@@ -3,3 +3,5 @@
3# 3#
4 4
5obj-y += bcu.o cmu.o giu.o icu.o init.o irq.o pmu.o rtc.o siu.o type.o 5obj-y += bcu.o cmu.o giu.o icu.o init.o irq.o pmu.o rtc.o siu.o type.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/powerpc/boot/dts/prpmc2800.dts b/arch/powerpc/boot/dts/prpmc2800.dts
index 699d0df574d5..5300b50cdc2f 100644
--- a/arch/powerpc/boot/dts/prpmc2800.dts
+++ b/arch/powerpc/boot/dts/prpmc2800.dts
@@ -207,6 +207,12 @@
207 interrupt-parent = <&/mv64x60/pic>; 207 interrupt-parent = <&/mv64x60/pic>;
208 }; 208 };
209 209
210 wdt@b410 { /* watchdog timer */
211 compatible = "marvell,mv64x60-wdt";
212 reg = <b410 8>;
213 timeout = <a>; /* wdt timeout in seconds */
214 };
215
210 i2c@c000 { 216 i2c@c000 {
211 device_type = "i2c"; 217 device_type = "i2c";
212 compatible = "marvell,mv64x60-i2c"; 218 compatible = "marvell,mv64x60-i2c";
diff --git a/arch/powerpc/kernel/entry_64.S b/arch/powerpc/kernel/entry_64.S
index 2b66d53dcc55..9ef28da2c7fe 100644
--- a/arch/powerpc/kernel/entry_64.S
+++ b/arch/powerpc/kernel/entry_64.S
@@ -546,7 +546,6 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
546 rfid 546 rfid
547 b . /* prevent speculative execution */ 547 b . /* prevent speculative execution */
548 548
549/* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */
550do_work: 549do_work:
551#ifdef CONFIG_PREEMPT 550#ifdef CONFIG_PREEMPT
552 andi. r0,r3,MSR_PR /* Returning to user mode? */ 551 andi. r0,r3,MSR_PR /* Returning to user mode? */
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index b618fa60aef3..548a32082e4a 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -390,6 +390,61 @@ error:
390 return err; 390 return err;
391} 391}
392 392
393/*
394 * Create mv64x60_wdt platform devices
395 */
396static int __init mv64x60_wdt_device_setup(struct device_node *np, int id)
397{
398 struct resource r;
399 struct platform_device *pdev;
400 struct mv64x60_wdt_pdata pdata;
401 const unsigned int *prop;
402 int err;
403
404 err = of_address_to_resource(np, 0, &r);
405 if (err)
406 return err;
407
408 memset(&pdata, 0, sizeof(pdata));
409
410 prop = of_get_property(np, "timeout", NULL);
411 if (!prop)
412 return -ENODEV;
413 pdata.timeout = *prop;
414
415 np = of_get_parent(np);
416 if (!np)
417 return -ENODEV;
418
419 prop = of_get_property(np, "clock-frequency", NULL);
420 of_node_put(np);
421 if (!prop)
422 return -ENODEV;
423 pdata.bus_clk = *prop / 1000000; /* wdt driver wants freq in MHz */
424
425 pdev = platform_device_alloc(MV64x60_WDT_NAME, id);
426 if (!pdev)
427 return -ENOMEM;
428
429 err = platform_device_add_resources(pdev, &r, 1);
430 if (err)
431 goto error;
432
433 err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
434 if (err)
435 goto error;
436
437 err = platform_device_add(pdev);
438 if (err)
439 goto error;
440
441 return 0;
442
443error:
444 platform_device_put(pdev);
445 return err;
446}
447
393static int __init mv64x60_device_setup(void) 448static int __init mv64x60_device_setup(void)
394{ 449{
395 struct device_node *np = NULL; 450 struct device_node *np = NULL;
@@ -414,6 +469,15 @@ static int __init mv64x60_device_setup(void)
414 if ((err = mv64x60_i2c_device_setup(np, id))) 469 if ((err = mv64x60_i2c_device_setup(np, id)))
415 goto error; 470 goto error;
416 471
472 /* support up to one watchdog timer */
473 np = of_find_compatible_node(np, NULL, "marvell,mv64x60-wdt");
474 if (np) {
475 if ((err = mv64x60_wdt_device_setup(np, id)))
476 goto error;
477 of_node_put(np);
478 }
479
480
417 return 0; 481 return 0;
418 482
419error: 483error:
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index d212b1c418a9..2744b8a6f66a 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -441,6 +441,32 @@ static struct platform_device i2c_device = {
441}; 441};
442#endif 442#endif
443 443
444#ifdef CONFIG_WATCHDOG
445static struct mv64x60_wdt_pdata mv64x60_wdt_pdata = {
446 .timeout = 10, /* default watchdog expiry in seconds */
447 .bus_clk = 133, /* default bus clock in MHz */
448};
449
450static struct resource mv64x60_wdt_resources[] = {
451 [0] = {
452 .name = "mv64x60 wdt base",
453 .start = MV64x60_WDT_WDC,
454 .end = MV64x60_WDT_WDC + 8 - 1, /* two 32-bit registers */
455 .flags = IORESOURCE_MEM,
456 },
457};
458
459static struct platform_device wdt_device = {
460 .name = MV64x60_WDT_NAME,
461 .id = 0,
462 .num_resources = ARRAY_SIZE(mv64x60_wdt_resources),
463 .resource = mv64x60_wdt_resources,
464 .dev = {
465 .platform_data = &mv64x60_wdt_pdata,
466 },
467};
468#endif
469
444#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) 470#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
445static struct mv64xxx_pdata mv64xxx_pdata = { 471static struct mv64xxx_pdata mv64xxx_pdata = {
446 .hs_reg_valid = 0, 472 .hs_reg_valid = 0,
@@ -476,6 +502,9 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = {
476#ifdef CONFIG_I2C_MV64XXX 502#ifdef CONFIG_I2C_MV64XXX
477 &i2c_device, 503 &i2c_device,
478#endif 504#endif
505#ifdef CONFIG_MV64X60_WDT
506 &wdt_device,
507#endif
479#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) 508#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
480 &mv64xxx_device, 509 &mv64xxx_device,
481#endif 510#endif
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index f87f429e0b24..54878f07cf0c 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -90,6 +90,9 @@ config ARCH_HAS_ILOG2_U64
90 bool 90 bool
91 default n 91 default n
92 92
93config ARCH_NO_VIRT_TO_BUS
94 def_bool y
95
93source "init/Kconfig" 96source "init/Kconfig"
94 97
95menu "System type" 98menu "System type"
@@ -134,8 +137,8 @@ config SH_FPU_EMU
134 137
135config SH_DSP 138config SH_DSP
136 bool "DSP support" 139 bool "DSP support"
137 default y if SH4AL_DSP || !CPU_SH4 140 depends on CPU_HAS_DSP
138 default n 141 default y
139 help 142 help
140 Selecting this option will enable support for SH processors that 143 Selecting this option will enable support for SH processors that
141 have DSP units (ie, SH2-DSP, SH3-DSP, and SH4AL-DSP). 144 have DSP units (ie, SH2-DSP, SH3-DSP, and SH4AL-DSP).
@@ -172,9 +175,6 @@ config SPECULATIVE_EXECUTION
172config CPU_HAS_INTEVT 175config CPU_HAS_INTEVT
173 bool 176 bool
174 177
175config CPU_HAS_PINT_IRQ
176 bool
177
178config CPU_HAS_MASKREG_IRQ 178config CPU_HAS_MASKREG_IRQ
179 bool 179 bool
180 180
@@ -202,6 +202,9 @@ config CPU_HAS_SR_RB
202config CPU_HAS_PTEA 202config CPU_HAS_PTEA
203 bool 203 bool
204 204
205config CPU_HAS_DSP
206 bool
207
205endmenu 208endmenu
206 209
207menu "Board support" 210menu "Board support"
@@ -261,14 +264,6 @@ config SH_7780_SOLUTION_ENGINE
261 Select 7780 SolutionEngine if configuring for a Renesas SH7780 264 Select 7780 SolutionEngine if configuring for a Renesas SH7780
262 evaluation board. 265 evaluation board.
263 266
264config SH_7300_SOLUTION_ENGINE
265 bool "SolutionEngine7300"
266 select SOLUTION_ENGINE
267 depends on CPU_SUBTYPE_SH7300
268 help
269 Select 7300 SolutionEngine if configuring for a Hitachi
270 SH7300(SH-Mobile V) evaluation board.
271
272config SH_7343_SOLUTION_ENGINE 267config SH_7343_SOLUTION_ENGINE
273 bool "SolutionEngine7343" 268 bool "SolutionEngine7343"
274 select SOLUTION_ENGINE 269 select SOLUTION_ENGINE
@@ -277,14 +272,6 @@ config SH_7343_SOLUTION_ENGINE
277 Select 7343 SolutionEngine if configuring for a Hitachi 272 Select 7343 SolutionEngine if configuring for a Hitachi
278 SH7343 (SH-Mobile 3AS) evaluation board. 273 SH7343 (SH-Mobile 3AS) evaluation board.
279 274
280config SH_73180_SOLUTION_ENGINE
281 bool "SolutionEngine73180"
282 select SOLUTION_ENGINE
283 depends on CPU_SUBTYPE_SH73180
284 help
285 Select 73180 SolutionEngine if configuring for a Hitachi
286 SH73180(SH-Mobile 3) evaluation board.
287
288config SH_7751_SYSTEMH 275config SH_7751_SYSTEMH
289 bool "SystemH7751R" 276 bool "SystemH7751R"
290 depends on CPU_SUBTYPE_SH7751R 277 depends on CPU_SUBTYPE_SH7751R
@@ -448,10 +435,10 @@ config SH_TIMER_IRQ
448 435
449config SH_PCLK_FREQ 436config SH_PCLK_FREQ
450 int "Peripheral clock frequency (in Hz)" 437 int "Peripheral clock frequency (in Hz)"
451 default "27000000" if CPU_SUBTYPE_SH73180 || CPU_SUBTYPE_SH7343 438 default "27000000" if CPU_SUBTYPE_SH7343
452 default "31250000" if CPU_SUBTYPE_SH7619 439 default "31250000" if CPU_SUBTYPE_SH7619
453 default "32000000" if CPU_SUBTYPE_SH7722 440 default "32000000" if CPU_SUBTYPE_SH7722
454 default "33333333" if CPU_SUBTYPE_SH7300 || CPU_SUBTYPE_SH7770 || \ 441 default "33333333" if CPU_SUBTYPE_SH7770 || \
455 CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7705 || \ 442 CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7705 || \
456 CPU_SUBTYPE_SH7206 443 CPU_SUBTYPE_SH7206
457 default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R 444 default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index 0016609d1eba..3d211aa33cd8 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -91,9 +91,7 @@ machdir-$(CONFIG_SH_SOLUTION_ENGINE) += se/770x
91machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE) += se/7722 91machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE) += se/7722
92machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE) += se/7751 92machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE) += se/7751
93machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE) += se/7780 93machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE) += se/7780
94machdir-$(CONFIG_SH_7300_SOLUTION_ENGINE) += se/7300
95machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) += se/7343 94machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE) += se/7343
96machdir-$(CONFIG_SH_73180_SOLUTION_ENGINE) += se/73180
97machdir-$(CONFIG_SH_HP6XX) += hp6xx 95machdir-$(CONFIG_SH_HP6XX) += hp6xx
98machdir-$(CONFIG_SH_DREAMCAST) += dreamcast 96machdir-$(CONFIG_SH_DREAMCAST) += dreamcast
99machdir-$(CONFIG_SH_MPC1211) += mpc1211 97machdir-$(CONFIG_SH_MPC1211) += mpc1211
diff --git a/arch/sh/boards/se/7300/Makefile b/arch/sh/boards/se/7300/Makefile
deleted file mode 100644
index 46247368f14b..000000000000
--- a/arch/sh/boards/se/7300/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the 7300 SolutionEngine specific parts of the kernel
3#
4
5obj-y := setup.o io.o irq.o
diff --git a/arch/sh/boards/se/7300/io.c b/arch/sh/boards/se/7300/io.c
deleted file mode 100644
index 8a03d7a52a7c..000000000000
--- a/arch/sh/boards/se/7300/io.c
+++ /dev/null
@@ -1,268 +0,0 @@
1/*
2 * arch/sh/boards/se/7300/io.c
3 *
4 * Copyright (C) 2003 YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
5 * Based on arch/sh/kernel/io_shmse.c
6 *
7 * I/O routine for SH-Mobile3 73180 SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <asm/io.h>
13#include <asm/se7300.h>
14
15#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
16
17struct iop {
18 unsigned long start, end;
19 unsigned long base;
20 struct iop *(*check) (struct iop * p, unsigned long port);
21 unsigned char (*inb) (struct iop * p, unsigned long port);
22 unsigned short (*inw) (struct iop * p, unsigned long port);
23 void (*outb) (struct iop * p, unsigned char value, unsigned long port);
24 void (*outw) (struct iop * p, unsigned short value, unsigned long port);
25};
26
27struct iop *
28simple_check(struct iop *p, unsigned long port)
29{
30 if ((p->start <= port) && (port <= p->end))
31 return p;
32 else
33 badio(check, port);
34}
35
36struct iop *
37ide_check(struct iop *p, unsigned long port)
38{
39 if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
40 return p;
41 return NULL;
42}
43
44unsigned char
45simple_inb(struct iop *p, unsigned long port)
46{
47 return *(unsigned char *) (p->base + port);
48}
49
50unsigned short
51simple_inw(struct iop *p, unsigned long port)
52{
53 return *(unsigned short *) (p->base + port);
54}
55
56void
57simple_outb(struct iop *p, unsigned char value, unsigned long port)
58{
59 *(unsigned char *) (p->base + port) = value;
60}
61
62void
63simple_outw(struct iop *p, unsigned short value, unsigned long port)
64{
65 *(unsigned short *) (p->base + port) = value;
66}
67
68unsigned char
69pcc_inb(struct iop *p, unsigned long port)
70{
71 unsigned long addr = p->base + port + 0x40000;
72 unsigned long v;
73
74 if (port & 1)
75 addr += 0x00400000;
76 v = *(volatile unsigned char *) addr;
77 return v;
78}
79
80void
81pcc_outb(struct iop *p, unsigned char value, unsigned long port)
82{
83 unsigned long addr = p->base + port + 0x40000;
84
85 if (port & 1)
86 addr += 0x00400000;
87 *(volatile unsigned char *) addr = value;
88}
89
90unsigned char
91bad_inb(struct iop *p, unsigned long port)
92{
93 badio(inb, port);
94}
95
96void
97bad_outb(struct iop *p, unsigned char value, unsigned long port)
98{
99 badio(inw, port);
100}
101
102#ifdef CONFIG_SMC91X
103/* MSTLANEX01 LAN at 0xb400:0000 */
104static struct iop laniop = {
105 .start = 0x300,
106 .end = 0x30f,
107 .base = 0xb4000000,
108 .check = simple_check,
109 .inb = simple_inb,
110 .inw = simple_inw,
111 .outb = simple_outb,
112 .outw = simple_outw,
113};
114#endif
115
116/* NE2000 pc card NIC */
117static struct iop neiop = {
118 .start = 0x280,
119 .end = 0x29f,
120 .base = 0xb0600000 + 0x80, /* soft 0x280 -> hard 0x300 */
121 .check = simple_check,
122 .inb = pcc_inb,
123 .inw = simple_inw,
124 .outb = pcc_outb,
125 .outw = simple_outw,
126};
127
128#ifdef CONFIG_IDE
129/* CF in CF slot */
130static struct iop cfiop = {
131 .base = 0xb0600000,
132 .check = ide_check,
133 .inb = pcc_inb,
134 .inw = simple_inw,
135 .outb = pcc_outb,
136 .outw = simple_outw,
137};
138#endif
139
140static __inline__ struct iop *
141port2iop(unsigned long port)
142{
143 if (0) ;
144#if defined(CONFIG_SMC91X)
145 else if (laniop.check(&laniop, port))
146 return &laniop;
147#endif
148#if defined(CONFIG_NE2000)
149 else if (neiop.check(&neiop, port))
150 return &neiop;
151#endif
152#if defined(CONFIG_IDE)
153 else if (cfiop.check(&cfiop, port))
154 return &cfiop;
155#endif
156 else
157 return &neiop; /* fallback */
158}
159
160static inline void
161delay(void)
162{
163 ctrl_inw(0xac000000);
164 ctrl_inw(0xac000000);
165}
166
167unsigned char
168sh7300se_inb(unsigned long port)
169{
170 struct iop *p = port2iop(port);
171 return (p->inb) (p, port);
172}
173
174unsigned char
175sh7300se_inb_p(unsigned long port)
176{
177 unsigned char v = sh7300se_inb(port);
178 delay();
179 return v;
180}
181
182unsigned short
183sh7300se_inw(unsigned long port)
184{
185 struct iop *p = port2iop(port);
186 return (p->inw) (p, port);
187}
188
189unsigned int
190sh7300se_inl(unsigned long port)
191{
192 badio(inl, port);
193}
194
195void
196sh7300se_outb(unsigned char value, unsigned long port)
197{
198 struct iop *p = port2iop(port);
199 (p->outb) (p, value, port);
200}
201
202void
203sh7300se_outb_p(unsigned char value, unsigned long port)
204{
205 sh7300se_outb(value, port);
206 delay();
207}
208
209void
210sh7300se_outw(unsigned short value, unsigned long port)
211{
212 struct iop *p = port2iop(port);
213 (p->outw) (p, value, port);
214}
215
216void
217sh7300se_outl(unsigned int value, unsigned long port)
218{
219 badio(outl, port);
220}
221
222void
223sh7300se_insb(unsigned long port, void *addr, unsigned long count)
224{
225 unsigned char *a = addr;
226 struct iop *p = port2iop(port);
227 while (count--)
228 *a++ = (p->inb) (p, port);
229}
230
231void
232sh7300se_insw(unsigned long port, void *addr, unsigned long count)
233{
234 unsigned short *a = addr;
235 struct iop *p = port2iop(port);
236 while (count--)
237 *a++ = (p->inw) (p, port);
238}
239
240void
241sh7300se_insl(unsigned long port, void *addr, unsigned long count)
242{
243 badio(insl, port);
244}
245
246void
247sh7300se_outsb(unsigned long port, const void *addr, unsigned long count)
248{
249 unsigned char *a = (unsigned char *) addr;
250 struct iop *p = port2iop(port);
251 while (count--)
252 (p->outb) (p, *a++, port);
253}
254
255void
256sh7300se_outsw(unsigned long port, const void *addr, unsigned long count)
257{
258 unsigned short *a = (unsigned short *) addr;
259 struct iop *p = port2iop(port);
260 while (count--)
261 (p->outw) (p, *a++, port);
262}
263
264void
265sh7300se_outsl(unsigned long port, const void *addr, unsigned long count)
266{
267 badio(outsw, port);
268}
diff --git a/arch/sh/boards/se/7300/irq.c b/arch/sh/boards/se/7300/irq.c
deleted file mode 100644
index 1279d776d60f..000000000000
--- a/arch/sh/boards/se/7300/irq.c
+++ /dev/null
@@ -1,40 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7300/irq.c
3 *
4 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
5 *
6 * SH-Mobile SolutionEngine 7300 Support.
7 *
8 */
9
10#include <linux/init.h>
11#include <linux/irq.h>
12#include <asm/irq.h>
13#include <asm/io.h>
14#include <asm/se7300.h>
15
16static struct ipr_data se7300_ipr_map[] = {
17 /* PC_IRQ[0-3] -> IRQ0 (32) */
18 { IRQ0_IRQ, IRQ0_IPR_ADDR, IRQ0_IPR_POS, 0x0f - IRQ0_IRQ },
19 /* A_IRQ[0-3] -> IRQ1 (33) */
20 { IRQ1_IRQ, IRQ1_IPR_ADDR, IRQ1_IPR_POS, 0x0f - IRQ1_IRQ },
21 { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
22 { DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
23 { DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
24 { VIO_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
25};
26
27/*
28 * Initialize IRQ setting
29 */
30void __init
31init_7300se_IRQ(void)
32{
33 ctrl_outw(0x0028, PA_EPLD_MODESET); /* mode set IRQ0,1 active low. */
34 ctrl_outw(0xa000, INTC_ICR1); /* IRQ mode; IRQ0,1 enable. */
35 ctrl_outw(0x0000, PORT_PFCR); /* use F for IRQ[3:0] and SIU. */
36
37 make_ipr_irq(se7300_ipr_map, ARRAY_SIZE(se7300_ipr_map));
38
39 ctrl_outw(0x2000, PA_MRSHPC + 0x0c); /* mrshpc irq enable */
40}
diff --git a/arch/sh/boards/se/7300/setup.c b/arch/sh/boards/se/7300/setup.c
deleted file mode 100644
index eb469f5b6e97..000000000000
--- a/arch/sh/boards/se/7300/setup.c
+++ /dev/null
@@ -1,74 +0,0 @@
1/*
2 * linux/arch/sh/boards/se/7300/setup.c
3 *
4 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
5 *
6 * SH-Mobile SolutionEngine 7300 Support.
7 *
8 */
9#include <linux/init.h>
10#include <linux/platform_device.h>
11#include <asm/machvec.h>
12#include <asm/se7300.h>
13
14void init_7300se_IRQ(void);
15
16static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
17
18static struct resource heartbeat_resources[] = {
19 [0] = {
20 .start = PA_LED,
21 .end = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
22 .flags = IORESOURCE_MEM,
23 },
24};
25
26static struct platform_device heartbeat_device = {
27 .name = "heartbeat",
28 .id = -1,
29 .dev = {
30 .platform_data = heartbeat_bit_pos,
31 },
32 .num_resources = ARRAY_SIZE(heartbeat_resources),
33 .resource = heartbeat_resources,
34};
35
36static struct platform_device *se7300_devices[] __initdata = {
37 &heartbeat_device,
38};
39
40static int __init se7300_devices_setup(void)
41{
42 return platform_add_devices(se7300_devices, ARRAY_SIZE(se7300_devices));
43}
44__initcall(se7300_devices_setup);
45
46/*
47 * The Machine Vector
48 */
49static struct sh_machine_vector mv_7300se __initmv = {
50 .mv_name = "SolutionEngine 7300",
51 .mv_nr_irqs = 109,
52 .mv_inb = sh7300se_inb,
53 .mv_inw = sh7300se_inw,
54 .mv_inl = sh7300se_inl,
55 .mv_outb = sh7300se_outb,
56 .mv_outw = sh7300se_outw,
57 .mv_outl = sh7300se_outl,
58
59 .mv_inb_p = sh7300se_inb_p,
60 .mv_inw_p = sh7300se_inw,
61 .mv_inl_p = sh7300se_inl,
62 .mv_outb_p = sh7300se_outb_p,
63 .mv_outw_p = sh7300se_outw,
64 .mv_outl_p = sh7300se_outl,
65
66 .mv_insb = sh7300se_insb,
67 .mv_insw = sh7300se_insw,
68 .mv_insl = sh7300se_insl,
69 .mv_outsb = sh7300se_outsb,
70 .mv_outsw = sh7300se_outsw,
71 .mv_outsl = sh7300se_outsl,
72
73 .mv_init_irq = init_7300se_IRQ,
74};
diff --git a/arch/sh/boards/se/73180/Makefile b/arch/sh/boards/se/73180/Makefile
deleted file mode 100644
index e7c09967c529..000000000000
--- a/arch/sh/boards/se/73180/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
1#
2# Makefile for the 73180 SolutionEngine specific parts of the kernel
3#
4
5obj-y := setup.o io.o irq.o
diff --git a/arch/sh/boards/se/73180/io.c b/arch/sh/boards/se/73180/io.c
deleted file mode 100644
index 72715575458b..000000000000
--- a/arch/sh/boards/se/73180/io.c
+++ /dev/null
@@ -1,268 +0,0 @@
1/*
2 * arch/sh/boards/se/73180/io.c
3 *
4 * Copyright (C) 2003 YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
5 * Based on arch/sh/boards/se/7300/io.c
6 *
7 * I/O routine for SH-Mobile3 73180 SolutionEngine.
8 *
9 */
10
11#include <linux/kernel.h>
12#include <asm/mach/se73180.h>
13#include <asm/io.h>
14
15#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
16
17struct iop {
18 unsigned long start, end;
19 unsigned long base;
20 struct iop *(*check) (struct iop * p, unsigned long port);
21 unsigned char (*inb) (struct iop * p, unsigned long port);
22 unsigned short (*inw) (struct iop * p, unsigned long port);
23 void (*outb) (struct iop * p, unsigned char value, unsigned long port);
24 void (*outw) (struct iop * p, unsigned short value, unsigned long port);
25};
26
27struct iop *
28simple_check(struct iop *p, unsigned long port)
29{
30 if ((p->start <= port) && (port <= p->end))
31 return p;
32 else
33 badio(check, port);
34}
35
36struct iop *
37ide_check(struct iop *p, unsigned long port)
38{
39 if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
40 return p;
41 return NULL;
42}
43
44unsigned char
45simple_inb(struct iop *p, unsigned long port)
46{
47 return *(unsigned char *) (p->base + port);
48}
49
50unsigned short
51simple_inw(struct iop *p, unsigned long port)
52{
53 return *(unsigned short *) (p->base + port);
54}
55
56void
57simple_outb(struct iop *p, unsigned char value, unsigned long port)
58{
59 *(unsigned char *) (p->base + port) = value;
60}
61
62void
63simple_outw(struct iop *p, unsigned short value, unsigned long port)
64{
65 *(unsigned short *) (p->base + port) = value;
66}
67
68unsigned char
69pcc_inb(struct iop *p, unsigned long port)
70{
71 unsigned long addr = p->base + port + 0x40000;
72 unsigned long v;
73
74 if (port & 1)
75 addr += 0x00400000;
76 v = *(volatile unsigned char *) addr;
77 return v;
78}
79
80void
81pcc_outb(struct iop *p, unsigned char value, unsigned long port)
82{
83 unsigned long addr = p->base + port + 0x40000;
84
85 if (port & 1)
86 addr += 0x00400000;
87 *(volatile unsigned char *) addr = value;
88}
89
90unsigned char
91bad_inb(struct iop *p, unsigned long port)
92{
93 badio(inb, port);
94}
95
96void
97bad_outb(struct iop *p, unsigned char value, unsigned long port)
98{
99 badio(inw, port);
100}
101
102#ifdef CONFIG_SMC91X
103/* MSTLANEX01 LAN at 0xb400:0000 */
104static struct iop laniop = {
105 .start = 0x300,
106 .end = 0x30f,
107 .base = 0xb4000000,
108 .check = simple_check,
109 .inb = simple_inb,
110 .inw = simple_inw,
111 .outb = simple_outb,
112 .outw = simple_outw,
113};
114#endif
115
116/* NE2000 pc card NIC */
117static struct iop neiop = {
118 .start = 0x280,
119 .end = 0x29f,
120 .base = 0xb0600000 + 0x80, /* soft 0x280 -> hard 0x300 */
121 .check = simple_check,
122 .inb = pcc_inb,
123 .inw = simple_inw,
124 .outb = pcc_outb,
125 .outw = simple_outw,
126};
127
128#ifdef CONFIG_IDE
129/* CF in CF slot */
130static struct iop cfiop = {
131 .base = 0xb0600000,
132 .check = ide_check,
133 .inb = pcc_inb,
134 .inw = simple_inw,
135 .outb = pcc_outb,
136 .outw = simple_outw,
137};
138#endif
139
140static __inline__ struct iop *
141port2iop(unsigned long port)
142{
143 if (0) ;
144#if defined(CONFIG_SMC91X)
145 else if (laniop.check(&laniop, port))
146 return &laniop;
147#endif
148#if defined(CONFIG_NE2000)
149 else if (neiop.check(&neiop, port))
150 return &neiop;
151#endif
152#if defined(CONFIG_IDE)
153 else if (cfiop.check(&cfiop, port))
154 return &cfiop;
155#endif
156 else
157 return &neiop; /* fallback */
158}
159
160static inline void
161delay(void)
162{
163 ctrl_inw(0xac000000);
164 ctrl_inw(0xac000000);
165}
166
167unsigned char
168sh73180se_inb(unsigned long port)
169{
170 struct iop *p = port2iop(port);
171 return (p->inb) (p, port);
172}
173
174unsigned char
175sh73180se_inb_p(unsigned long port)
176{
177 unsigned char v = sh73180se_inb(port);
178 delay();
179 return v;
180}
181
182unsigned short
183sh73180se_inw(unsigned long port)
184{
185 struct iop *p = port2iop(port);
186 return (p->inw) (p, port);
187}
188
189unsigned int
190sh73180se_inl(unsigned long port)
191{
192 badio(inl, port);
193}
194
195void
196sh73180se_outb(unsigned char value, unsigned long port)
197{
198 struct iop *p = port2iop(port);
199 (p->outb) (p, value, port);
200}
201
202void
203sh73180se_outb_p(unsigned char value, unsigned long port)
204{
205 sh73180se_outb(value, port);
206 delay();
207}
208
209void
210sh73180se_outw(unsigned short value, unsigned long port)
211{
212 struct iop *p = port2iop(port);
213 (p->outw) (p, value, port);
214}
215
216void
217sh73180se_outl(unsigned int value, unsigned long port)
218{
219 badio(outl, port);
220}
221
222void
223sh73180se_insb(unsigned long port, void *addr, unsigned long count)
224{
225 unsigned char *a = addr;
226 struct iop *p = port2iop(port);
227 while (count--)
228 *a++ = (p->inb) (p, port);
229}
230
231void
232sh73180se_insw(unsigned long port, void *addr, unsigned long count)
233{
234 unsigned short *a = addr;
235 struct iop *p = port2iop(port);
236 while (count--)
237 *a++ = (p->inw) (p, port);
238}
239
240void
241sh73180se_insl(unsigned long port, void *addr, unsigned long count)
242{
243 badio(insl, port);
244}
245
246void
247sh73180se_outsb(unsigned long port, const void *addr, unsigned long count)
248{
249 unsigned char *a = (unsigned char *) addr;
250 struct iop *p = port2iop(port);
251 while (count--)
252 (p->outb) (p, *a++, port);
253}
254
255void
256sh73180se_outsw(unsigned long port, const void *addr, unsigned long count)
257{
258 unsigned short *a = (unsigned short *) addr;
259 struct iop *p = port2iop(port);
260 while (count--)
261 (p->outw) (p, *a++, port);
262}
263
264void
265sh73180se_outsl(unsigned long port, const void *addr, unsigned long count)
266{
267 badio(outsw, port);
268}
diff --git a/arch/sh/boards/se/73180/irq.c b/arch/sh/boards/se/73180/irq.c
deleted file mode 100644
index e7200c56bb45..000000000000
--- a/arch/sh/boards/se/73180/irq.c
+++ /dev/null
@@ -1,136 +0,0 @@
1/*
2 * arch/sh/boards/se/73180/irq.c
3 *
4 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
5 * Based on arch/sh/boards/se/7300/irq.c
6 *
7 * Modified for SH-Mobile SolutionEngine 73180 Support
8 * by YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
9 *
10 */
11
12#include <linux/init.h>
13#include <linux/irq.h>
14#include <asm/irq.h>
15#include <asm/io.h>
16#include <asm/mach/se73180.h>
17
18static int
19irq2intreq(int irq)
20{
21 if (irq == 10)
22 return 5;
23 return 7 - (irq - 32);
24}
25
26static void
27disable_intreq_irq(unsigned int irq)
28{
29 ctrl_outb(1 << (7 - irq2intreq(irq)), INTMSK0);
30}
31
32static void
33enable_intreq_irq(unsigned int irq)
34{
35 ctrl_outb(1 << (7 - irq2intreq(irq)), INTMSKCLR0);
36}
37
38static void
39mask_and_ack_intreq_irq(unsigned int irq)
40{
41 disable_intreq_irq(irq);
42}
43
44static unsigned int
45startup_intreq_irq(unsigned int irq)
46{
47 enable_intreq_irq(irq);
48 return 0;
49}
50
51static void
52shutdown_intreq_irq(unsigned int irq)
53{
54 disable_intreq_irq(irq);
55}
56
57static void
58end_intreq_irq(unsigned int irq)
59{
60 if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
61 enable_intreq_irq(irq);
62}
63
64static struct hw_interrupt_type intreq_irq_type = {
65 .typename = "intreq",
66 .startup = startup_intreq_irq,
67 .shutdown = shutdown_intreq_irq,
68 .enable = enable_intreq_irq,
69 .disable = disable_intreq_irq,
70 .ack = mask_and_ack_intreq_irq,
71 .end = end_intreq_irq
72};
73
74void
75make_intreq_irq(unsigned int irq)
76{
77 disable_irq_nosync(irq);
78 irq_desc[irq].chip = &intreq_irq_type;
79 disable_intreq_irq(irq);
80}
81
82int
83shmse_irq_demux(int irq)
84{
85 if (irq == IRQ5_IRQ)
86 return 10;
87 return irq;
88}
89
90static struct ipr_data se73180_siof0_ipr_map[] = {
91 { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
92};
93static struct ipr_data se73180_vpu_ipr_map[] = {
94 { VPU_IRQ, VPU_IPR_ADDR, VPU_IPR_POS, 8 },
95};
96static struct ipr_data se73180_other_ipr_map[] = {
97 { DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
98 { DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
99 { DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY },
100 { IIC0_ALI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
101 { IIC0_TACKI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
102 { IIC0_WAITI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
103 { IIC0_DTEI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
104 { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
105 { SIU_IRQ, SIU_IPR_ADDR, SIU_IPR_POS, SIU_PRIORITY },
106
107 /* VIO interrupt */
108 { CEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
109 { BEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
110 { VEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
111
112 { LCDC_IRQ, LCDC_IPR_ADDR, LCDC_IPR_POS, LCDC_PRIORITY },
113};
114
115/*
116 * Initialize IRQ setting
117 */
118void __init
119init_73180se_IRQ(void)
120{
121 make_ipr_irq(se73180_siof0_ipr_map, ARRAY_SIZE(se73180_siof0_ipr_map));
122
123 ctrl_outw(0x2000, 0xb03fffec); /* mrshpc irq enable */
124 ctrl_outw(0x2000, 0xb07fffec); /* mrshpc irq enable */
125 ctrl_outl(3 << ((7 - 5) * 4), INTC_INTPRI0); /* irq5 pri=3 */
126 ctrl_outw(2 << ((7 - 5) * 2), INTC_ICR1); /* low-level irq */
127 make_intreq_irq(10);
128
129 make_ipr_irq(se73180_vpu_ipr_map, ARRAY_SIZE(se73180_vpu_ipr_map));
130
131 ctrl_outb(0x0f, INTC_IMCR5); /* enable SCIF IRQ */
132
133 make_ipr_irq(se73180_other_ipr_map, ARRAY_SIZE(se73180_other_ipr_map));
134
135 ctrl_outw(0x2000, PA_MRSHPC + 0x0c); /* mrshpc irq enable */
136}
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c
deleted file mode 100644
index 1deee8556642..000000000000
--- a/arch/sh/boards/se/73180/setup.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 * arch/sh/boards/se/73180/setup.c
3 *
4 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
5 * Based on arch/sh/setup_shmse.c
6 *
7 * Modified for 73180 SolutionEngine
8 * by YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
9 *
10 */
11
12#include <linux/init.h>
13#include <linux/platform_device.h>
14#include <asm/machvec.h>
15#include <asm/se73180.h>
16#include <asm/irq.h>
17
18void init_73180se_IRQ(void);
19
20static struct resource heartbeat_resources[] = {
21 [0] = {
22 .start = PA_LED,
23 .end = PA_LED + 8 - 1,
24 .flags = IORESOURCE_MEM,
25 },
26};
27
28static struct platform_device heartbeat_device = {
29 .name = "heartbeat",
30 .id = -1,
31 .num_resources = ARRAY_SIZE(heartbeat_resources),
32 .resource = heartbeat_resources,
33};
34
35static struct platform_device *se73180_devices[] __initdata = {
36 &heartbeat_device,
37};
38
39static int __init se73180_devices_setup(void)
40{
41 return platform_add_devices(se73180_devices,
42 ARRAY_SIZE(se73180_devices));
43}
44__initcall(se73180_devices_setup);
45
46/*
47 * The Machine Vector
48 */
49static struct sh_machine_vector mv_73180se __initmv = {
50 .mv_name = "SolutionEngine 73180",
51 .mv_nr_irqs = 108,
52 .mv_inb = sh73180se_inb,
53 .mv_inw = sh73180se_inw,
54 .mv_inl = sh73180se_inl,
55 .mv_outb = sh73180se_outb,
56 .mv_outw = sh73180se_outw,
57 .mv_outl = sh73180se_outl,
58
59 .mv_inb_p = sh73180se_inb_p,
60 .mv_inw_p = sh73180se_inw,
61 .mv_inl_p = sh73180se_inl,
62 .mv_outb_p = sh73180se_outb_p,
63 .mv_outw_p = sh73180se_outw,
64 .mv_outl_p = sh73180se_outl,
65
66 .mv_insb = sh73180se_insb,
67 .mv_insw = sh73180se_insw,
68 .mv_insl = sh73180se_insl,
69 .mv_outsb = sh73180se_outsb,
70 .mv_outsw = sh73180se_outsw,
71 .mv_outsl = sh73180se_outsl,
72
73 .mv_init_irq = init_73180se_IRQ,
74 .mv_irq_demux = shmse_irq_demux,
75};
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index 11dc272c618e..4c5ffdcd55b6 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -32,9 +32,10 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
32$(obj)/compressed/vmlinux: FORCE 32$(obj)/compressed/vmlinux: FORCE
33 $(Q)$(MAKE) $(build)=$(obj)/compressed $@ 33 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
34 34
35KERNEL_LOAD := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET) + \ 35KERNEL_LOAD := $(shell /bin/bash -c 'printf "0x%8x" \
36 $(CONFIG_MEMORY_START) + \ 36 $$[$(CONFIG_PAGE_OFFSET) + \
37 $(CONFIG_ZERO_PAGE_OFFSET)+0x1000]) 37 $(CONFIG_MEMORY_START) + \
38 $(CONFIG_ZERO_PAGE_OFFSET)+0x1000]')
38 39
39quiet_cmd_uimage = UIMAGE $@ 40quiet_cmd_uimage = UIMAGE $@
40 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \ 41 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
diff --git a/arch/sh/boot/compressed/Makefile b/arch/sh/boot/compressed/Makefile
index d9512416f885..013504ae1122 100644
--- a/arch/sh/boot/compressed/Makefile
+++ b/arch/sh/boot/compressed/Makefile
@@ -16,9 +16,10 @@ endif
16# 16#
17# IMAGE_OFFSET is the load offset of the compression loader 17# IMAGE_OFFSET is the load offset of the compression loader
18# 18#
19IMAGE_OFFSET := $(shell printf "0x%08x" $$[$(CONFIG_PAGE_OFFSET) + \ 19IMAGE_OFFSET := $(shell /bin/bash -c 'printf "0x%08x" \
20 $(CONFIG_MEMORY_START) + \ 20 $$[$(CONFIG_PAGE_OFFSET) + \
21 $(CONFIG_BOOT_LINK_OFFSET)]) 21 $(CONFIG_MEMORY_START) + \
22 $(CONFIG_BOOT_LINK_OFFSET)]')
22 23
23LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name) 24LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
24 25
diff --git a/arch/sh/configs/se7300_defconfig b/arch/sh/configs/se7300_defconfig
deleted file mode 100644
index 8a217908b81f..000000000000
--- a/arch/sh/configs/se7300_defconfig
+++ /dev/null
@@ -1,696 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18
4# Tue Oct 3 11:43:22 2006
5#
6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_BROKEN_ON_SMP=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y
27# CONFIG_SWAP is not set
28# CONFIG_SYSVIPC is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30# CONFIG_UTS_NS is not set
31# CONFIG_IKCONFIG is not set
32# CONFIG_RELAY is not set
33CONFIG_INITRAMFS_SOURCE=""
34# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
35CONFIG_SYSCTL=y
36CONFIG_EMBEDDED=y
37CONFIG_UID16=y
38# CONFIG_SYSCTL_SYSCALL is not set
39# CONFIG_KALLSYMS is not set
40# CONFIG_HOTPLUG is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_ELF_CORE=y
44CONFIG_BASE_FULL=y
45# CONFIG_FUTEX is not set
46# CONFIG_EPOLL is not set
47CONFIG_SHMEM=y
48CONFIG_SLAB=y
49CONFIG_VM_EVENT_COUNTERS=y
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52# CONFIG_SLOB is not set
53
54#
55# Loadable module support
56#
57# CONFIG_MODULES is not set
58
59#
60# Block layer
61#
62CONFIG_BLOCK=y
63# CONFIG_LBD is not set
64# CONFIG_BLK_DEV_IO_TRACE is not set
65# CONFIG_LSF is not set
66
67#
68# IO Schedulers
69#
70CONFIG_IOSCHED_NOOP=y
71# CONFIG_IOSCHED_AS is not set
72# CONFIG_IOSCHED_DEADLINE is not set
73# CONFIG_IOSCHED_CFQ is not set
74# CONFIG_DEFAULT_AS is not set
75# CONFIG_DEFAULT_DEADLINE is not set
76# CONFIG_DEFAULT_CFQ is not set
77CONFIG_DEFAULT_NOOP=y
78CONFIG_DEFAULT_IOSCHED="noop"
79
80#
81# System type
82#
83CONFIG_SOLUTION_ENGINE=y
84# CONFIG_SH_SOLUTION_ENGINE is not set
85# CONFIG_SH_7751_SOLUTION_ENGINE is not set
86CONFIG_SH_7300_SOLUTION_ENGINE=y
87# CONFIG_SH_7343_SOLUTION_ENGINE is not set
88# CONFIG_SH_73180_SOLUTION_ENGINE is not set
89# CONFIG_SH_7751_SYSTEMH is not set
90# CONFIG_SH_HP6XX is not set
91# CONFIG_SH_EC3104 is not set
92# CONFIG_SH_SATURN is not set
93# CONFIG_SH_DREAMCAST is not set
94# CONFIG_SH_BIGSUR is not set
95# CONFIG_SH_MPC1211 is not set
96# CONFIG_SH_SH03 is not set
97# CONFIG_SH_SECUREEDGE5410 is not set
98# CONFIG_SH_HS7751RVOIP is not set
99# CONFIG_SH_7710VOIPGW is not set
100# CONFIG_SH_RTS7751R2D is not set
101# CONFIG_SH_R7780RP is not set
102# CONFIG_SH_EDOSK7705 is not set
103# CONFIG_SH_SH4202_MICRODEV is not set
104# CONFIG_SH_LANDISK is not set
105# CONFIG_SH_TITAN is not set
106# CONFIG_SH_SHMIN is not set
107# CONFIG_SH_UNKNOWN is not set
108
109#
110# Processor selection
111#
112CONFIG_CPU_SH3=y
113
114#
115# SH-2 Processor Support
116#
117# CONFIG_CPU_SUBTYPE_SH7604 is not set
118
119#
120# SH-3 Processor Support
121#
122CONFIG_CPU_SUBTYPE_SH7300=y
123# CONFIG_CPU_SUBTYPE_SH7705 is not set
124# CONFIG_CPU_SUBTYPE_SH7706 is not set
125# CONFIG_CPU_SUBTYPE_SH7707 is not set
126# CONFIG_CPU_SUBTYPE_SH7708 is not set
127# CONFIG_CPU_SUBTYPE_SH7709 is not set
128# CONFIG_CPU_SUBTYPE_SH7710 is not set
129
130#
131# SH-4 Processor Support
132#
133# CONFIG_CPU_SUBTYPE_SH7750 is not set
134# CONFIG_CPU_SUBTYPE_SH7091 is not set
135# CONFIG_CPU_SUBTYPE_SH7750R is not set
136# CONFIG_CPU_SUBTYPE_SH7750S is not set
137# CONFIG_CPU_SUBTYPE_SH7751 is not set
138# CONFIG_CPU_SUBTYPE_SH7751R is not set
139# CONFIG_CPU_SUBTYPE_SH7760 is not set
140# CONFIG_CPU_SUBTYPE_SH4_202 is not set
141
142#
143# ST40 Processor Support
144#
145# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
146# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
147
148#
149# SH-4A Processor Support
150#
151# CONFIG_CPU_SUBTYPE_SH7770 is not set
152# CONFIG_CPU_SUBTYPE_SH7780 is not set
153
154#
155# SH4AL-DSP Processor Support
156#
157# CONFIG_CPU_SUBTYPE_SH73180 is not set
158# CONFIG_CPU_SUBTYPE_SH7343 is not set
159
160#
161# Memory management options
162#
163CONFIG_MMU=y
164CONFIG_PAGE_OFFSET=0x80000000
165CONFIG_MEMORY_START=0x0c000000
166CONFIG_MEMORY_SIZE=0x04000000
167CONFIG_VSYSCALL=y
168CONFIG_SELECT_MEMORY_MODEL=y
169CONFIG_FLATMEM_MANUAL=y
170# CONFIG_DISCONTIGMEM_MANUAL is not set
171# CONFIG_SPARSEMEM_MANUAL is not set
172CONFIG_FLATMEM=y
173CONFIG_FLAT_NODE_MEM_MAP=y
174# CONFIG_SPARSEMEM_STATIC is not set
175CONFIG_SPLIT_PTLOCK_CPUS=4
176# CONFIG_RESOURCES_64BIT is not set
177
178#
179# Cache configuration
180#
181# CONFIG_SH_DIRECT_MAPPED is not set
182# CONFIG_SH_WRITETHROUGH is not set
183# CONFIG_SH_OCRAM is not set
184
185#
186# Processor features
187#
188CONFIG_CPU_LITTLE_ENDIAN=y
189# CONFIG_SH_FPU_EMU is not set
190CONFIG_SH_DSP=y
191# CONFIG_SH_ADC is not set
192CONFIG_CPU_HAS_INTEVT=y
193CONFIG_CPU_HAS_SR_RB=y
194
195#
196# Timer support
197#
198CONFIG_SH_TMU=y
199CONFIG_SH_PCLK_FREQ=33333333
200
201#
202# CPU Frequency scaling
203#
204# CONFIG_CPU_FREQ is not set
205
206#
207# DMA support
208#
209# CONFIG_SH_DMA is not set
210
211#
212# Companion Chips
213#
214# CONFIG_HD6446X_SERIES is not set
215CONFIG_HEARTBEAT=y
216
217#
218# Kernel features
219#
220# CONFIG_HZ_100 is not set
221CONFIG_HZ_250=y
222# CONFIG_HZ_1000 is not set
223CONFIG_HZ=250
224# CONFIG_KEXEC is not set
225# CONFIG_SMP is not set
226CONFIG_PREEMPT_NONE=y
227# CONFIG_PREEMPT_VOLUNTARY is not set
228# CONFIG_PREEMPT is not set
229
230#
231# Boot options
232#
233CONFIG_ZERO_PAGE_OFFSET=0x00001000
234CONFIG_BOOT_LINK_OFFSET=0x00210000
235# CONFIG_UBC_WAKEUP is not set
236CONFIG_CMDLINE_BOOL=y
237CONFIG_CMDLINE="console=ttySC0,38400 root=/dev/ram0"
238
239#
240# Bus options
241#
242# CONFIG_PCI is not set
243
244#
245# PCCARD (PCMCIA/CardBus) support
246#
247
248#
249# PCI Hotplug Support
250#
251
252#
253# Executable file formats
254#
255CONFIG_BINFMT_ELF=y
256# CONFIG_BINFMT_FLAT is not set
257# CONFIG_BINFMT_MISC is not set
258
259#
260# Power management options (EXPERIMENTAL)
261#
262# CONFIG_PM is not set
263
264#
265# Networking
266#
267# CONFIG_NET is not set
268
269#
270# Device Drivers
271#
272
273#
274# Generic Driver Options
275#
276CONFIG_STANDALONE=y
277CONFIG_PREVENT_FIRMWARE_BUILD=y
278# CONFIG_SYS_HYPERVISOR is not set
279
280#
281# Connector - unified userspace <-> kernelspace linker
282#
283
284#
285# Memory Technology Devices (MTD)
286#
287# CONFIG_MTD is not set
288
289#
290# Parallel port support
291#
292# CONFIG_PARPORT is not set
293
294#
295# Plug and Play support
296#
297
298#
299# Block devices
300#
301# CONFIG_BLK_DEV_COW_COMMON is not set
302# CONFIG_BLK_DEV_LOOP is not set
303CONFIG_BLK_DEV_RAM=y
304CONFIG_BLK_DEV_RAM_COUNT=16
305CONFIG_BLK_DEV_RAM_SIZE=4096
306CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
307CONFIG_BLK_DEV_INITRD=y
308# CONFIG_CDROM_PKTCDVD is not set
309
310#
311# ATA/ATAPI/MFM/RLL support
312#
313# CONFIG_IDE is not set
314
315#
316# SCSI device support
317#
318# CONFIG_RAID_ATTRS is not set
319# CONFIG_SCSI is not set
320# CONFIG_SCSI_NETLINK is not set
321
322#
323# Serial ATA (prod) and Parallel ATA (experimental) drivers
324#
325# CONFIG_ATA is not set
326
327#
328# Multi-device support (RAID and LVM)
329#
330# CONFIG_MD is not set
331
332#
333# Fusion MPT device support
334#
335# CONFIG_FUSION is not set
336
337#
338# IEEE 1394 (FireWire) support
339#
340
341#
342# I2O device support
343#
344
345#
346# ISDN subsystem
347#
348
349#
350# Telephony Support
351#
352# CONFIG_PHONE is not set
353
354#
355# Input device support
356#
357CONFIG_INPUT=y
358# CONFIG_INPUT_FF_MEMLESS is not set
359
360#
361# Userland interfaces
362#
363CONFIG_INPUT_MOUSEDEV=y
364CONFIG_INPUT_MOUSEDEV_PSAUX=y
365CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
366CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
367# CONFIG_INPUT_JOYDEV is not set
368# CONFIG_INPUT_TSDEV is not set
369# CONFIG_INPUT_EVDEV is not set
370# CONFIG_INPUT_EVBUG is not set
371
372#
373# Input Device Drivers
374#
375# CONFIG_INPUT_KEYBOARD is not set
376# CONFIG_INPUT_MOUSE is not set
377# CONFIG_INPUT_JOYSTICK is not set
378# CONFIG_INPUT_TOUCHSCREEN is not set
379# CONFIG_INPUT_MISC is not set
380
381#
382# Hardware I/O ports
383#
384CONFIG_SERIO=y
385# CONFIG_SERIO_I8042 is not set
386# CONFIG_SERIO_SERPORT is not set
387# CONFIG_SERIO_LIBPS2 is not set
388# CONFIG_SERIO_RAW is not set
389# CONFIG_GAMEPORT is not set
390
391#
392# Character devices
393#
394# CONFIG_VT is not set
395# CONFIG_SERIAL_NONSTANDARD is not set
396
397#
398# Serial drivers
399#
400# CONFIG_SERIAL_8250 is not set
401
402#
403# Non-8250 serial port support
404#
405CONFIG_SERIAL_SH_SCI=y
406CONFIG_SERIAL_SH_SCI_NR_UARTS=2
407CONFIG_SERIAL_SH_SCI_CONSOLE=y
408CONFIG_SERIAL_CORE=y
409CONFIG_SERIAL_CORE_CONSOLE=y
410# CONFIG_UNIX98_PTYS is not set
411# CONFIG_LEGACY_PTYS is not set
412
413#
414# IPMI
415#
416CONFIG_IPMI_HANDLER=y
417# CONFIG_IPMI_PANIC_EVENT is not set
418CONFIG_IPMI_DEVICE_INTERFACE=y
419# CONFIG_IPMI_SI is not set
420CONFIG_IPMI_WATCHDOG=y
421# CONFIG_IPMI_POWEROFF is not set
422
423#
424# Watchdog Cards
425#
426CONFIG_WATCHDOG=y
427# CONFIG_WATCHDOG_NOWAYOUT is not set
428
429#
430# Watchdog Device Drivers
431#
432CONFIG_SOFT_WATCHDOG=y
433# CONFIG_SH_WDT is not set
434CONFIG_HW_RANDOM=y
435# CONFIG_GEN_RTC is not set
436# CONFIG_DTLK is not set
437# CONFIG_R3964 is not set
438
439#
440# Ftape, the floppy tape device driver
441#
442# CONFIG_RAW_DRIVER is not set
443
444#
445# TPM devices
446#
447# CONFIG_TCG_TPM is not set
448# CONFIG_TELCLOCK is not set
449
450#
451# I2C support
452#
453# CONFIG_I2C is not set
454
455#
456# SPI support
457#
458# CONFIG_SPI is not set
459# CONFIG_SPI_MASTER is not set
460
461#
462# Dallas's 1-wire bus
463#
464
465#
466# Hardware Monitoring support
467#
468CONFIG_HWMON=y
469# CONFIG_HWMON_VID is not set
470# CONFIG_SENSORS_ABITUGURU is not set
471# CONFIG_SENSORS_F71805F is not set
472# CONFIG_SENSORS_VT1211 is not set
473# CONFIG_HWMON_DEBUG_CHIP is not set
474
475#
476# Misc devices
477#
478
479#
480# Multimedia devices
481#
482# CONFIG_VIDEO_DEV is not set
483CONFIG_VIDEO_V4L2=y
484
485#
486# Digital Video Broadcasting Devices
487#
488
489#
490# Graphics support
491#
492CONFIG_FIRMWARE_EDID=y
493# CONFIG_FB is not set
494# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
495
496#
497# Sound
498#
499# CONFIG_SOUND is not set
500
501#
502# USB support
503#
504# CONFIG_USB_ARCH_HAS_HCD is not set
505# CONFIG_USB_ARCH_HAS_OHCI is not set
506# CONFIG_USB_ARCH_HAS_EHCI is not set
507
508#
509# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
510#
511
512#
513# USB Gadget Support
514#
515# CONFIG_USB_GADGET is not set
516
517#
518# MMC/SD Card support
519#
520# CONFIG_MMC is not set
521
522#
523# LED devices
524#
525# CONFIG_NEW_LEDS is not set
526
527#
528# LED drivers
529#
530
531#
532# LED Triggers
533#
534
535#
536# InfiniBand support
537#
538
539#
540# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
541#
542
543#
544# Real Time Clock
545#
546# CONFIG_RTC_CLASS is not set
547
548#
549# DMA Engine support
550#
551# CONFIG_DMA_ENGINE is not set
552
553#
554# DMA Clients
555#
556
557#
558# DMA Devices
559#
560
561#
562# File systems
563#
564CONFIG_EXT2_FS=y
565# CONFIG_EXT2_FS_XATTR is not set
566# CONFIG_EXT2_FS_XIP is not set
567# CONFIG_EXT3_FS is not set
568# CONFIG_REISERFS_FS is not set
569# CONFIG_JFS_FS is not set
570# CONFIG_FS_POSIX_ACL is not set
571# CONFIG_XFS_FS is not set
572# CONFIG_MINIX_FS is not set
573# CONFIG_ROMFS_FS is not set
574CONFIG_INOTIFY=y
575CONFIG_INOTIFY_USER=y
576# CONFIG_QUOTA is not set
577CONFIG_DNOTIFY=y
578# CONFIG_AUTOFS_FS is not set
579# CONFIG_AUTOFS4_FS is not set
580# CONFIG_FUSE_FS is not set
581
582#
583# CD-ROM/DVD Filesystems
584#
585# CONFIG_ISO9660_FS is not set
586# CONFIG_UDF_FS is not set
587
588#
589# DOS/FAT/NT Filesystems
590#
591# CONFIG_MSDOS_FS is not set
592# CONFIG_VFAT_FS is not set
593# CONFIG_NTFS_FS is not set
594
595#
596# Pseudo filesystems
597#
598CONFIG_PROC_FS=y
599CONFIG_PROC_KCORE=y
600CONFIG_PROC_SYSCTL=y
601CONFIG_SYSFS=y
602# CONFIG_TMPFS is not set
603# CONFIG_HUGETLBFS is not set
604# CONFIG_HUGETLB_PAGE is not set
605CONFIG_RAMFS=y
606# CONFIG_CONFIGFS_FS is not set
607
608#
609# Miscellaneous filesystems
610#
611# CONFIG_ADFS_FS is not set
612# CONFIG_AFFS_FS is not set
613# CONFIG_HFS_FS is not set
614# CONFIG_HFSPLUS_FS is not set
615# CONFIG_BEFS_FS is not set
616# CONFIG_BFS_FS is not set
617# CONFIG_EFS_FS is not set
618# CONFIG_CRAMFS is not set
619# CONFIG_VXFS_FS is not set
620# CONFIG_HPFS_FS is not set
621# CONFIG_QNX4FS_FS is not set
622# CONFIG_SYSV_FS is not set
623# CONFIG_UFS_FS is not set
624
625#
626# Partition Types
627#
628# CONFIG_PARTITION_ADVANCED is not set
629CONFIG_MSDOS_PARTITION=y
630
631#
632# Native Language Support
633#
634# CONFIG_NLS is not set
635
636#
637# Profiling support
638#
639# CONFIG_PROFILING is not set
640
641#
642# Kernel hacking
643#
644# CONFIG_PRINTK_TIME is not set
645CONFIG_ENABLE_MUST_CHECK=y
646# CONFIG_MAGIC_SYSRQ is not set
647# CONFIG_UNUSED_SYMBOLS is not set
648# CONFIG_DEBUG_KERNEL is not set
649CONFIG_LOG_BUF_SHIFT=14
650# CONFIG_DEBUG_BUGVERBOSE is not set
651# CONFIG_DEBUG_FS is not set
652CONFIG_FRAME_POINTER=y
653# CONFIG_UNWIND_INFO is not set
654CONFIG_SH_STANDARD_BIOS=y
655CONFIG_EARLY_PRINTK=y
656CONFIG_KGDB=y
657
658#
659# KGDB configuration options
660#
661# CONFIG_MORE_COMPILE_OPTIONS is not set
662# CONFIG_KGDB_NMI is not set
663# CONFIG_KGDB_THREAD is not set
664# CONFIG_SH_KGDB_CONSOLE is not set
665# CONFIG_KGDB_SYSRQ is not set
666# CONFIG_KGDB_KERNEL_ASSERTS is not set
667
668#
669# Serial port setup
670#
671CONFIG_KGDB_DEFPORT=1
672CONFIG_KGDB_DEFBAUD=115200
673CONFIG_KGDB_DEFPARITY_N=y
674# CONFIG_KGDB_DEFPARITY_E is not set
675# CONFIG_KGDB_DEFPARITY_O is not set
676CONFIG_KGDB_DEFBITS_8=y
677# CONFIG_KGDB_DEFBITS_7 is not set
678
679#
680# Security options
681#
682# CONFIG_KEYS is not set
683# CONFIG_SECURITY is not set
684
685#
686# Cryptographic options
687#
688# CONFIG_CRYPTO is not set
689
690#
691# Library routines
692#
693# CONFIG_CRC_CCITT is not set
694# CONFIG_CRC16 is not set
695CONFIG_CRC32=y
696# CONFIG_LIBCRC32C is not set
diff --git a/arch/sh/configs/se73180_defconfig b/arch/sh/configs/se73180_defconfig
deleted file mode 100644
index 1a766153cbb0..000000000000
--- a/arch/sh/configs/se73180_defconfig
+++ /dev/null
@@ -1,648 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18
4# Tue Oct 3 11:44:45 2006
5#
6CONFIG_SUPERH=y
7CONFIG_RWSEM_GENERIC_SPINLOCK=y
8CONFIG_GENERIC_FIND_NEXT_BIT=y
9CONFIG_GENERIC_HWEIGHT=y
10CONFIG_GENERIC_HARDIRQS=y
11CONFIG_GENERIC_IRQ_PROBE=y
12CONFIG_GENERIC_CALIBRATE_DELAY=y
13CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
14
15#
16# Code maturity level options
17#
18CONFIG_EXPERIMENTAL=y
19CONFIG_BROKEN_ON_SMP=y
20CONFIG_INIT_ENV_ARG_LIMIT=32
21
22#
23# General setup
24#
25CONFIG_LOCALVERSION=""
26CONFIG_LOCALVERSION_AUTO=y
27CONFIG_SWAP=y
28# CONFIG_SYSVIPC is not set
29# CONFIG_BSD_PROCESS_ACCT is not set
30# CONFIG_UTS_NS is not set
31# CONFIG_IKCONFIG is not set
32# CONFIG_RELAY is not set
33CONFIG_INITRAMFS_SOURCE=""
34# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
35CONFIG_SYSCTL=y
36CONFIG_EMBEDDED=y
37CONFIG_UID16=y
38# CONFIG_SYSCTL_SYSCALL is not set
39# CONFIG_KALLSYMS is not set
40# CONFIG_HOTPLUG is not set
41CONFIG_PRINTK=y
42CONFIG_BUG=y
43CONFIG_ELF_CORE=y
44CONFIG_BASE_FULL=y
45# CONFIG_FUTEX is not set
46# CONFIG_EPOLL is not set
47CONFIG_SHMEM=y
48CONFIG_SLAB=y
49CONFIG_VM_EVENT_COUNTERS=y
50# CONFIG_TINY_SHMEM is not set
51CONFIG_BASE_SMALL=0
52# CONFIG_SLOB is not set
53
54#
55# Loadable module support
56#
57CONFIG_MODULES=y
58# CONFIG_MODULE_UNLOAD is not set
59# CONFIG_MODVERSIONS is not set
60# CONFIG_MODULE_SRCVERSION_ALL is not set
61# CONFIG_KMOD is not set
62
63#
64# Block layer
65#
66CONFIG_BLOCK=y
67# CONFIG_LBD is not set
68# CONFIG_LSF is not set
69
70#
71# IO Schedulers
72#
73CONFIG_IOSCHED_NOOP=y
74# CONFIG_IOSCHED_AS is not set
75# CONFIG_IOSCHED_DEADLINE is not set
76# CONFIG_IOSCHED_CFQ is not set
77# CONFIG_DEFAULT_AS is not set
78# CONFIG_DEFAULT_DEADLINE is not set
79# CONFIG_DEFAULT_CFQ is not set
80CONFIG_DEFAULT_NOOP=y
81CONFIG_DEFAULT_IOSCHED="noop"
82
83#
84# System type
85#
86CONFIG_SOLUTION_ENGINE=y
87# CONFIG_SH_SOLUTION_ENGINE is not set
88# CONFIG_SH_7751_SOLUTION_ENGINE is not set
89# CONFIG_SH_7300_SOLUTION_ENGINE is not set
90# CONFIG_SH_7343_SOLUTION_ENGINE is not set
91CONFIG_SH_73180_SOLUTION_ENGINE=y
92# CONFIG_SH_7751_SYSTEMH is not set
93# CONFIG_SH_HP6XX is not set
94# CONFIG_SH_EC3104 is not set
95# CONFIG_SH_SATURN is not set
96# CONFIG_SH_DREAMCAST is not set
97# CONFIG_SH_BIGSUR is not set
98# CONFIG_SH_MPC1211 is not set
99# CONFIG_SH_SH03 is not set
100# CONFIG_SH_SECUREEDGE5410 is not set
101# CONFIG_SH_HS7751RVOIP is not set
102# CONFIG_SH_7710VOIPGW is not set
103# CONFIG_SH_RTS7751R2D is not set
104# CONFIG_SH_R7780RP is not set
105# CONFIG_SH_EDOSK7705 is not set
106# CONFIG_SH_SH4202_MICRODEV is not set
107# CONFIG_SH_LANDISK is not set
108# CONFIG_SH_TITAN is not set
109# CONFIG_SH_SHMIN is not set
110# CONFIG_SH_UNKNOWN is not set
111
112#
113# Processor selection
114#
115CONFIG_CPU_SH4=y
116CONFIG_CPU_SH4A=y
117CONFIG_CPU_SH4AL_DSP=y
118
119#
120# SH-2 Processor Support
121#
122# CONFIG_CPU_SUBTYPE_SH7604 is not set
123
124#
125# SH-3 Processor Support
126#
127# CONFIG_CPU_SUBTYPE_SH7300 is not set
128# CONFIG_CPU_SUBTYPE_SH7705 is not set
129# CONFIG_CPU_SUBTYPE_SH7706 is not set
130# CONFIG_CPU_SUBTYPE_SH7707 is not set
131# CONFIG_CPU_SUBTYPE_SH7708 is not set
132# CONFIG_CPU_SUBTYPE_SH7709 is not set
133# CONFIG_CPU_SUBTYPE_SH7710 is not set
134
135#
136# SH-4 Processor Support
137#
138# CONFIG_CPU_SUBTYPE_SH7750 is not set
139# CONFIG_CPU_SUBTYPE_SH7091 is not set
140# CONFIG_CPU_SUBTYPE_SH7750R is not set
141# CONFIG_CPU_SUBTYPE_SH7750S is not set
142# CONFIG_CPU_SUBTYPE_SH7751 is not set
143# CONFIG_CPU_SUBTYPE_SH7751R is not set
144# CONFIG_CPU_SUBTYPE_SH7760 is not set
145# CONFIG_CPU_SUBTYPE_SH4_202 is not set
146
147#
148# ST40 Processor Support
149#
150# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
151# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
152
153#
154# SH-4A Processor Support
155#
156# CONFIG_CPU_SUBTYPE_SH7770 is not set
157# CONFIG_CPU_SUBTYPE_SH7780 is not set
158
159#
160# SH4AL-DSP Processor Support
161#
162CONFIG_CPU_SUBTYPE_SH73180=y
163# CONFIG_CPU_SUBTYPE_SH7343 is not set
164
165#
166# Memory management options
167#
168CONFIG_MMU=y
169CONFIG_PAGE_OFFSET=0x80000000
170CONFIG_MEMORY_START=0x0c000000
171CONFIG_MEMORY_SIZE=0x02000000
172CONFIG_32BIT=y
173CONFIG_VSYSCALL=y
174CONFIG_SELECT_MEMORY_MODEL=y
175CONFIG_FLATMEM_MANUAL=y
176# CONFIG_DISCONTIGMEM_MANUAL is not set
177# CONFIG_SPARSEMEM_MANUAL is not set
178CONFIG_FLATMEM=y
179CONFIG_FLAT_NODE_MEM_MAP=y
180# CONFIG_SPARSEMEM_STATIC is not set
181CONFIG_SPLIT_PTLOCK_CPUS=4
182# CONFIG_RESOURCES_64BIT is not set
183
184#
185# Cache configuration
186#
187# CONFIG_SH_DIRECT_MAPPED is not set
188# CONFIG_SH_WRITETHROUGH is not set
189# CONFIG_SH_OCRAM is not set
190
191#
192# Processor features
193#
194CONFIG_CPU_LITTLE_ENDIAN=y
195# CONFIG_SH_FPU is not set
196# CONFIG_SH_FPU_EMU is not set
197CONFIG_SH_DSP=y
198# CONFIG_SH_STORE_QUEUES is not set
199CONFIG_CPU_HAS_INTEVT=y
200CONFIG_CPU_HAS_SR_RB=y
201
202#
203# Timer support
204#
205CONFIG_SH_TMU=y
206CONFIG_SH_PCLK_FREQ=27000000
207
208#
209# CPU Frequency scaling
210#
211# CONFIG_CPU_FREQ is not set
212
213#
214# DMA support
215#
216# CONFIG_SH_DMA is not set
217
218#
219# Companion Chips
220#
221# CONFIG_HD6446X_SERIES is not set
222CONFIG_HEARTBEAT=y
223
224#
225# Kernel features
226#
227# CONFIG_HZ_100 is not set
228CONFIG_HZ_250=y
229# CONFIG_HZ_1000 is not set
230CONFIG_HZ=250
231# CONFIG_KEXEC is not set
232# CONFIG_SMP is not set
233CONFIG_PREEMPT_NONE=y
234# CONFIG_PREEMPT_VOLUNTARY is not set
235# CONFIG_PREEMPT is not set
236
237#
238# Boot options
239#
240CONFIG_ZERO_PAGE_OFFSET=0x00010000
241CONFIG_BOOT_LINK_OFFSET=0x00800000
242# CONFIG_UBC_WAKEUP is not set
243CONFIG_CMDLINE_BOOL=y
244CONFIG_CMDLINE="console=ttySC0,38400 root=/dev/ram"
245
246#
247# Bus options
248#
249# CONFIG_PCI is not set
250
251#
252# PCCARD (PCMCIA/CardBus) support
253#
254
255#
256# PCI Hotplug Support
257#
258
259#
260# Executable file formats
261#
262CONFIG_BINFMT_ELF=y
263# CONFIG_BINFMT_FLAT is not set
264# CONFIG_BINFMT_MISC is not set
265
266#
267# Power management options (EXPERIMENTAL)
268#
269# CONFIG_PM is not set
270
271#
272# Networking
273#
274# CONFIG_NET is not set
275
276#
277# Device Drivers
278#
279
280#
281# Generic Driver Options
282#
283CONFIG_STANDALONE=y
284CONFIG_PREVENT_FIRMWARE_BUILD=y
285# CONFIG_SYS_HYPERVISOR is not set
286
287#
288# Connector - unified userspace <-> kernelspace linker
289#
290
291#
292# Memory Technology Devices (MTD)
293#
294# CONFIG_MTD is not set
295
296#
297# Parallel port support
298#
299# CONFIG_PARPORT is not set
300
301#
302# Plug and Play support
303#
304
305#
306# Block devices
307#
308# CONFIG_BLK_DEV_COW_COMMON is not set
309CONFIG_BLK_DEV_LOOP=y
310# CONFIG_BLK_DEV_CRYPTOLOOP is not set
311CONFIG_BLK_DEV_RAM=y
312CONFIG_BLK_DEV_RAM_COUNT=16
313CONFIG_BLK_DEV_RAM_SIZE=4096
314CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
315CONFIG_BLK_DEV_INITRD=y
316# CONFIG_CDROM_PKTCDVD is not set
317
318#
319# ATA/ATAPI/MFM/RLL support
320#
321# CONFIG_IDE is not set
322
323#
324# SCSI device support
325#
326# CONFIG_RAID_ATTRS is not set
327# CONFIG_SCSI is not set
328# CONFIG_SCSI_NETLINK is not set
329
330#
331# Serial ATA (prod) and Parallel ATA (experimental) drivers
332#
333# CONFIG_ATA is not set
334
335#
336# Multi-device support (RAID and LVM)
337#
338# CONFIG_MD is not set
339
340#
341# Fusion MPT device support
342#
343# CONFIG_FUSION is not set
344
345#
346# IEEE 1394 (FireWire) support
347#
348
349#
350# I2O device support
351#
352
353#
354# ISDN subsystem
355#
356
357#
358# Telephony Support
359#
360# CONFIG_PHONE is not set
361
362#
363# Input device support
364#
365# CONFIG_INPUT is not set
366
367#
368# Hardware I/O ports
369#
370# CONFIG_SERIO is not set
371# CONFIG_GAMEPORT is not set
372
373#
374# Character devices
375#
376# CONFIG_VT is not set
377# CONFIG_SERIAL_NONSTANDARD is not set
378
379#
380# Serial drivers
381#
382# CONFIG_SERIAL_8250 is not set
383
384#
385# Non-8250 serial port support
386#
387CONFIG_SERIAL_SH_SCI=y
388CONFIG_SERIAL_SH_SCI_NR_UARTS=2
389CONFIG_SERIAL_SH_SCI_CONSOLE=y
390CONFIG_SERIAL_CORE=y
391CONFIG_SERIAL_CORE_CONSOLE=y
392# CONFIG_UNIX98_PTYS is not set
393# CONFIG_LEGACY_PTYS is not set
394
395#
396# IPMI
397#
398# CONFIG_IPMI_HANDLER is not set
399
400#
401# Watchdog Cards
402#
403CONFIG_WATCHDOG=y
404# CONFIG_WATCHDOG_NOWAYOUT is not set
405
406#
407# Watchdog Device Drivers
408#
409# CONFIG_SOFT_WATCHDOG is not set
410# CONFIG_SH_WDT is not set
411CONFIG_HW_RANDOM=y
412# CONFIG_GEN_RTC is not set
413# CONFIG_DTLK is not set
414# CONFIG_R3964 is not set
415
416#
417# Ftape, the floppy tape device driver
418#
419# CONFIG_RAW_DRIVER is not set
420
421#
422# TPM devices
423#
424# CONFIG_TCG_TPM is not set
425# CONFIG_TELCLOCK is not set
426
427#
428# I2C support
429#
430# CONFIG_I2C is not set
431
432#
433# SPI support
434#
435# CONFIG_SPI is not set
436# CONFIG_SPI_MASTER is not set
437
438#
439# Dallas's 1-wire bus
440#
441
442#
443# Hardware Monitoring support
444#
445CONFIG_HWMON=y
446# CONFIG_HWMON_VID is not set
447# CONFIG_SENSORS_ABITUGURU is not set
448# CONFIG_SENSORS_F71805F is not set
449# CONFIG_SENSORS_VT1211 is not set
450# CONFIG_HWMON_DEBUG_CHIP is not set
451
452#
453# Misc devices
454#
455
456#
457# Multimedia devices
458#
459# CONFIG_VIDEO_DEV is not set
460CONFIG_VIDEO_V4L2=y
461
462#
463# Digital Video Broadcasting Devices
464#
465
466#
467# Graphics support
468#
469CONFIG_FIRMWARE_EDID=y
470# CONFIG_FB is not set
471
472#
473# Sound
474#
475# CONFIG_SOUND is not set
476
477#
478# USB support
479#
480# CONFIG_USB_ARCH_HAS_HCD is not set
481# CONFIG_USB_ARCH_HAS_OHCI is not set
482# CONFIG_USB_ARCH_HAS_EHCI is not set
483
484#
485# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
486#
487
488#
489# USB Gadget Support
490#
491# CONFIG_USB_GADGET is not set
492
493#
494# MMC/SD Card support
495#
496# CONFIG_MMC is not set
497
498#
499# LED devices
500#
501# CONFIG_NEW_LEDS is not set
502
503#
504# LED drivers
505#
506
507#
508# LED Triggers
509#
510
511#
512# InfiniBand support
513#
514
515#
516# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
517#
518
519#
520# Real Time Clock
521#
522# CONFIG_RTC_CLASS is not set
523
524#
525# DMA Engine support
526#
527# CONFIG_DMA_ENGINE is not set
528
529#
530# DMA Clients
531#
532
533#
534# DMA Devices
535#
536
537#
538# File systems
539#
540CONFIG_EXT2_FS=y
541# CONFIG_EXT2_FS_XATTR is not set
542# CONFIG_EXT2_FS_XIP is not set
543# CONFIG_EXT3_FS is not set
544# CONFIG_REISERFS_FS is not set
545# CONFIG_JFS_FS is not set
546# CONFIG_FS_POSIX_ACL is not set
547# CONFIG_XFS_FS is not set
548# CONFIG_MINIX_FS is not set
549# CONFIG_ROMFS_FS is not set
550CONFIG_INOTIFY=y
551CONFIG_INOTIFY_USER=y
552# CONFIG_QUOTA is not set
553CONFIG_DNOTIFY=y
554# CONFIG_AUTOFS_FS is not set
555# CONFIG_AUTOFS4_FS is not set
556# CONFIG_FUSE_FS is not set
557
558#
559# CD-ROM/DVD Filesystems
560#
561# CONFIG_ISO9660_FS is not set
562# CONFIG_UDF_FS is not set
563
564#
565# DOS/FAT/NT Filesystems
566#
567# CONFIG_MSDOS_FS is not set
568# CONFIG_VFAT_FS is not set
569# CONFIG_NTFS_FS is not set
570
571#
572# Pseudo filesystems
573#
574CONFIG_PROC_FS=y
575CONFIG_PROC_KCORE=y
576CONFIG_PROC_SYSCTL=y
577# CONFIG_SYSFS is not set
578CONFIG_TMPFS=y
579# CONFIG_TMPFS_POSIX_ACL is not set
580# CONFIG_HUGETLBFS is not set
581# CONFIG_HUGETLB_PAGE is not set
582CONFIG_RAMFS=y
583
584#
585# Miscellaneous filesystems
586#
587# CONFIG_ADFS_FS is not set
588# CONFIG_AFFS_FS is not set
589# CONFIG_HFS_FS is not set
590# CONFIG_HFSPLUS_FS is not set
591# CONFIG_BEFS_FS is not set
592# CONFIG_BFS_FS is not set
593# CONFIG_EFS_FS is not set
594# CONFIG_CRAMFS is not set
595# CONFIG_VXFS_FS is not set
596# CONFIG_HPFS_FS is not set
597# CONFIG_QNX4FS_FS is not set
598# CONFIG_SYSV_FS is not set
599# CONFIG_UFS_FS is not set
600
601#
602# Partition Types
603#
604# CONFIG_PARTITION_ADVANCED is not set
605CONFIG_MSDOS_PARTITION=y
606
607#
608# Native Language Support
609#
610# CONFIG_NLS is not set
611
612#
613# Profiling support
614#
615# CONFIG_PROFILING is not set
616
617#
618# Kernel hacking
619#
620# CONFIG_PRINTK_TIME is not set
621CONFIG_ENABLE_MUST_CHECK=y
622# CONFIG_MAGIC_SYSRQ is not set
623# CONFIG_UNUSED_SYMBOLS is not set
624# CONFIG_DEBUG_KERNEL is not set
625CONFIG_LOG_BUF_SHIFT=14
626# CONFIG_DEBUG_BUGVERBOSE is not set
627CONFIG_SH_STANDARD_BIOS=y
628# CONFIG_EARLY_SCIF_CONSOLE is not set
629# CONFIG_EARLY_PRINTK is not set
630# CONFIG_KGDB is not set
631
632#
633# Security options
634#
635# CONFIG_KEYS is not set
636
637#
638# Cryptographic options
639#
640# CONFIG_CRYPTO is not set
641
642#
643# Library routines
644#
645# CONFIG_CRC_CCITT is not set
646# CONFIG_CRC16 is not set
647CONFIG_CRC32=y
648# CONFIG_LIBCRC32C is not set
diff --git a/arch/sh/drivers/dma/dma-api.c b/arch/sh/drivers/dma/dma-api.c
index cf8e11994330..76ed816d9a24 100644
--- a/arch/sh/drivers/dma/dma-api.c
+++ b/arch/sh/drivers/dma/dma-api.c
@@ -31,8 +31,8 @@ struct dma_info *get_dma_info(unsigned int chan)
31 * the channel is. 31 * the channel is.
32 */ 32 */
33 list_for_each_entry(info, &registered_dmac_list, list) { 33 list_for_each_entry(info, &registered_dmac_list, list) {
34 if ((chan < info->first_channel_nr) || 34 if ((chan < info->first_vchannel_nr) ||
35 (chan >= info->first_channel_nr + info->nr_channels)) 35 (chan >= info->first_vchannel_nr + info->nr_channels))
36 continue; 36 continue;
37 37
38 return info; 38 return info;
@@ -82,7 +82,7 @@ struct dma_channel *get_dma_channel(unsigned int chan)
82 82
83 for (i = 0; i < info->nr_channels; i++) { 83 for (i = 0; i < info->nr_channels; i++) {
84 channel = &info->channels[i]; 84 channel = &info->channels[i];
85 if (channel->chan == chan) 85 if (channel->vchan == chan)
86 return channel; 86 return channel;
87 } 87 }
88 88
@@ -369,6 +369,7 @@ int register_dmac(struct dma_info *info)
369 } 369 }
370 370
371 total_channels = get_nr_channels(); 371 total_channels = get_nr_channels();
372 info->first_vchannel_nr = total_channels;
372 for (i = 0; i < info->nr_channels; i++) { 373 for (i = 0; i < info->nr_channels; i++) {
373 struct dma_channel *chan = &info->channels[i]; 374 struct dma_channel *chan = &info->channels[i];
374 375
diff --git a/arch/sh/kernel/cpu/irq/Makefile b/arch/sh/kernel/cpu/irq/Makefile
index 9ddb446ac930..60bfc05cf354 100644
--- a/arch/sh/kernel/cpu/irq/Makefile
+++ b/arch/sh/kernel/cpu/irq/Makefile
@@ -4,7 +4,6 @@
4obj-y += imask.o 4obj-y += imask.o
5 5
6obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o 6obj-$(CONFIG_CPU_HAS_IPR_IRQ) += ipr.o
7obj-$(CONFIG_CPU_HAS_PINT_IRQ) += pint.o
8obj-$(CONFIG_CPU_HAS_MASKREG_IRQ) += maskreg.o 7obj-$(CONFIG_CPU_HAS_MASKREG_IRQ) += maskreg.o
9obj-$(CONFIG_CPU_HAS_INTC_IRQ) += intc.o 8obj-$(CONFIG_CPU_HAS_INTC_IRQ) += intc.o
10obj-$(CONFIG_CPU_HAS_INTC2_IRQ) += intc2.o 9obj-$(CONFIG_CPU_HAS_INTC2_IRQ) += intc2.o
diff --git a/arch/sh/kernel/cpu/irq/ipr.c b/arch/sh/kernel/cpu/irq/ipr.c
index 98e84f40c713..5da325414880 100644
--- a/arch/sh/kernel/cpu/irq/ipr.c
+++ b/arch/sh/kernel/cpu/irq/ipr.c
@@ -8,7 +8,7 @@
8 * 8 *
9 * Supported system: 9 * Supported system:
10 * On-chip supporting modules (TMU, RTC, etc.). 10 * On-chip supporting modules (TMU, RTC, etc.).
11 * On-chip supporting modules for SH7709/SH7709A/SH7729/SH7300. 11 * On-chip supporting modules for SH7709/SH7709A/SH7729.
12 * Hitachi SolutionEngine external I/O: 12 * Hitachi SolutionEngine external I/O:
13 * MS7709SE01, MS7709ASE01, and MS7750SE01 13 * MS7709SE01, MS7709ASE01, and MS7750SE01
14 * 14 *
diff --git a/arch/sh/kernel/cpu/irq/pint.c b/arch/sh/kernel/cpu/irq/pint.c
deleted file mode 100644
index 67602685df1a..000000000000
--- a/arch/sh/kernel/cpu/irq/pint.c
+++ /dev/null
@@ -1,220 +0,0 @@
1/*
2 * arch/sh/kernel/cpu/irq/pint.c - Interrupt handling for PINT-based IRQs.
3 *
4 * Copyright (C) 1999 Niibe Yutaka & Takeshi Yaegashi
5 * Copyright (C) 2000 Kazumoto Kojima
6 * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
7 *
8 * This file is subject to the terms and conditions of the GNU General Public
9 * License. See the file "COPYING" in the main directory of this archive
10 * for more details.
11 */
12
13#include <linux/init.h>
14#include <linux/irq.h>
15#include <linux/module.h>
16
17#include <asm/system.h>
18#include <asm/io.h>
19#include <asm/machvec.h>
20
21#if defined(CONFIG_CPU_SUBTYPE_SH7705)
22#define INTC_INTER 0xA4000014UL
23#define INTC_IPRD 0xA4000018UL
24#define INTC_ICR2 0xA4000012UL
25
26/* PFC */
27#define PORT_PACR 0xA4000100UL
28#define PORT_PBCR 0xA4000102UL
29#define PORT_PCCR 0xA4000104UL
30#define PORT_PDCR 0xA4000106UL
31#define PORT_PECR 0xA4000108UL
32#define PORT_PFCR 0xA400010AUL
33#define PORT_PGCR 0xA400010CUL
34#define PORT_PHCR 0xA400010EUL
35#define PORT_PJCR 0xA4000110UL
36#define PORT_PKCR 0xA4000112UL
37#define PORT_PLCR 0xA4000114UL
38#define PORT_PMCR 0xA4000118UL
39#define PORT_PNCR 0xA400011AUL
40#define PORT_PECR2 0xA4050148UL
41#define PORT_PFCR2 0xA405014AUL
42#define PORT_PNCR2 0xA405015AUL
43
44/* I/O port */
45#define PORT_PADR 0xA4000120UL
46#define PORT_PBDR 0xA4000122UL
47#define PORT_PCDR 0xA4000124UL
48#define PORT_PDDR 0xA4000126UL
49#define PORT_PEDR 0xA4000128UL
50#define PORT_PFDR 0xA400012AUL
51#define PORT_PGDR 0xA400012CUL
52#define PORT_PHDR 0xA400012EUL
53#define PORT_PJDR 0xA4000130UL
54#define PORT_PKDR 0xA4000132UL
55#define PORT_PLDR 0xA4000134UL
56#define PORT_PMDR 0xA4000138UL
57#define PORT_PNDR 0xA400013AUL
58
59#define PINT0_IRQ 40
60#define PINT8_IRQ 41
61#define PINT_IRQ_BASE 86
62
63#define PINT0_IPR_ADDR INTC_IPRD
64#define PINT0_IPR_POS 3
65#define PINT0_PRIORITY 2
66
67#define PINT8_IPR_ADDR INTC_IPRD
68#define PINT8_IPR_POS 2
69#define PINT8_PRIORITY 2
70
71#endif /* CONFIG_CPU_SUBTYPE_SH7705 */
72
73static unsigned char pint_map[256];
74static unsigned long portcr_mask;
75
76static void enable_pint_irq(unsigned int irq);
77static void disable_pint_irq(unsigned int irq);
78
79/* shutdown is same as "disable" */
80#define shutdown_pint_irq disable_pint_irq
81
82static void mask_and_ack_pint(unsigned int);
83static void end_pint_irq(unsigned int irq);
84
85static unsigned int startup_pint_irq(unsigned int irq)
86{
87 enable_pint_irq(irq);
88 return 0; /* never anything pending */
89}
90
91static struct hw_interrupt_type pint_irq_type = {
92 .typename = "PINT-IRQ",
93 .startup = startup_pint_irq,
94 .shutdown = shutdown_pint_irq,
95 .enable = enable_pint_irq,
96 .disable = disable_pint_irq,
97 .ack = mask_and_ack_pint,
98 .end = end_pint_irq
99};
100
101static void disable_pint_irq(unsigned int irq)
102{
103 unsigned long val;
104
105 val = ctrl_inw(INTC_INTER);
106 val &= ~(1 << (irq - PINT_IRQ_BASE));
107 ctrl_outw(val, INTC_INTER); /* disable PINTn */
108 portcr_mask &= ~(3 << (irq - PINT_IRQ_BASE)*2);
109}
110
111static void enable_pint_irq(unsigned int irq)
112{
113 unsigned long val;
114
115 val = ctrl_inw(INTC_INTER);
116 val |= 1 << (irq - PINT_IRQ_BASE);
117 ctrl_outw(val, INTC_INTER); /* enable PINTn */
118 portcr_mask |= 3 << (irq - PINT_IRQ_BASE)*2;
119}
120
121static void mask_and_ack_pint(unsigned int irq)
122{
123 disable_pint_irq(irq);
124}
125
126static void end_pint_irq(unsigned int irq)
127{
128 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
129 enable_pint_irq(irq);
130}
131
132void make_pint_irq(unsigned int irq)
133{
134 disable_irq_nosync(irq);
135 irq_desc[irq].chip = &pint_irq_type;
136 disable_pint_irq(irq);
137}
138
139static struct ipr_data pint_ipr_map[] = {
140 { PINT0_IRQ, PINT0_IPR_ADDR, PINT0_IPR_POS, PINT0_PRIORITY },
141 { PINT8_IRQ, PINT8_IPR_ADDR, PINT8_IPR_POS, PINT8_PRIORITY },
142};
143
144void __init init_IRQ_pint(void)
145{
146 int i;
147
148 make_ipr_irq(pint_ipr_map, ARRAY_SIZE(pint_ipr_map));
149
150 enable_irq(PINT0_IRQ);
151 enable_irq(PINT8_IRQ);
152
153 for(i = 0; i < 16; i++)
154 make_pint_irq(PINT_IRQ_BASE + i);
155
156 for(i = 0; i < 256; i++) {
157 if (i & 1)
158 pint_map[i] = 0;
159 else if (i & 2)
160 pint_map[i] = 1;
161 else if (i & 4)
162 pint_map[i] = 2;
163 else if (i & 8)
164 pint_map[i] = 3;
165 else if (i & 0x10)
166 pint_map[i] = 4;
167 else if (i & 0x20)
168 pint_map[i] = 5;
169 else if (i & 0x40)
170 pint_map[i] = 6;
171 else if (i & 0x80)
172 pint_map[i] = 7;
173 }
174}
175
176int ipr_irq_demux(int irq)
177{
178 unsigned long creg, dreg, d, sav;
179
180 if (irq == PINT0_IRQ) {
181#if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7707)
182 creg = PORT_PACR;
183 dreg = PORT_PADR;
184#else
185 creg = PORT_PCCR;
186 dreg = PORT_PCDR;
187#endif
188 sav = ctrl_inw(creg);
189 ctrl_outw(sav | portcr_mask, creg);
190 d = (~ctrl_inb(dreg) ^ ctrl_inw(INTC_ICR2)) &
191 ctrl_inw(INTC_INTER) & 0xff;
192 ctrl_outw(sav, creg);
193
194 if (d == 0)
195 return irq;
196
197 return PINT_IRQ_BASE + pint_map[d];
198 } else if (irq == PINT8_IRQ) {
199#if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7707)
200 creg = PORT_PBCR;
201 dreg = PORT_PBDR;
202#else
203 creg = PORT_PFCR;
204 dreg = PORT_PFDR;
205#endif
206 sav = ctrl_inw(creg);
207 ctrl_outw(sav | (portcr_mask >> 16), creg);
208 d = (~ctrl_inb(dreg) ^ (ctrl_inw(INTC_ICR2) >> 8)) &
209 (ctrl_inw(INTC_INTER) >> 8) & 0xff;
210 ctrl_outw(sav, creg);
211
212 if (d == 0)
213 return irq;
214
215 return PINT_IRQ_BASE + 8 + pint_map[d];
216 }
217
218 return irq;
219}
220
diff --git a/arch/sh/kernel/cpu/sh3/Makefile b/arch/sh/kernel/cpu/sh3/Makefile
index 09faa056cd43..55b750763f66 100644
--- a/arch/sh/kernel/cpu/sh3/Makefile
+++ b/arch/sh/kernel/cpu/sh3/Makefile
@@ -10,16 +10,14 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7706) += setup-sh7709.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh7709.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7707) += setup-sh7709.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh7708.o 11obj-$(CONFIG_CPU_SUBTYPE_SH7708) += setup-sh7708.o
12obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh7709.o 12obj-$(CONFIG_CPU_SUBTYPE_SH7709) += setup-sh7709.o
13obj-$(CONFIG_CPU_SUBTYPE_SH7300) += setup-sh7300.o
14obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o 13obj-$(CONFIG_CPU_SUBTYPE_SH7710) += setup-sh7710.o
15obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o 14obj-$(CONFIG_CPU_SUBTYPE_SH7712) += setup-sh7710.o
16 15
17# Primary on-chip clocks (common) 16# Primary on-chip clocks (common)
18clock-$(CONFIG_CPU_SH3) := clock-sh3.o 17clock-$(CONFIG_CPU_SH3) := clock-sh3.o
19clock-$(CONFIG_CPU_SUBTYPE_SH7300) := clock-sh7300.o
20clock-$(CONFIG_CPU_SUBTYPE_SH7705) := clock-sh7705.o 18clock-$(CONFIG_CPU_SUBTYPE_SH7705) := clock-sh7705.o
21clock-$(CONFIG_CPU_SUBTYPE_SH7706) := clock-sh7706.o 19clock-$(CONFIG_CPU_SUBTYPE_SH7706) := clock-sh7706.o
22clock-$(CONFIG_CPU_SUBTYPE_SH7709) := clock-sh7709.o 20clock-$(CONFIG_CPU_SUBTYPE_SH7709) := clock-sh7709.o
23clock-$(CONFIG_CPU_SUBTYPE_SH7710) := clock-sh7300.o 21clock-$(CONFIG_CPU_SUBTYPE_SH7710) := clock-sh7710.o
24 22
25obj-y += $(clock-y) 23obj-y += $(clock-y)
diff --git a/arch/sh/kernel/cpu/sh3/clock-sh7300.c b/arch/sh/kernel/cpu/sh3/clock-sh7710.c
index e804174b9625..4744c50ec449 100644
--- a/arch/sh/kernel/cpu/sh3/clock-sh7300.c
+++ b/arch/sh/kernel/cpu/sh3/clock-sh7710.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/sh/kernel/cpu/sh3/clock-sh7300.c 2 * arch/sh/kernel/cpu/sh3/clock-sh7710.c
3 * 3 *
4 * SH7300 support for the clock framework 4 * SH7710 support for the clock framework
5 * 5 *
6 * Copyright (C) 2005 Paul Mundt 6 * Copyright (C) 2005 Paul Mundt
7 * 7 *
@@ -29,7 +29,7 @@ static void master_clk_init(struct clk *clk)
29 clk->rate *= md_table[ctrl_inw(FRQCR) & 0x0007]; 29 clk->rate *= md_table[ctrl_inw(FRQCR) & 0x0007];
30} 30}
31 31
32static struct clk_ops sh7300_master_clk_ops = { 32static struct clk_ops sh7710_master_clk_ops = {
33 .init = master_clk_init, 33 .init = master_clk_init,
34}; 34};
35 35
@@ -39,7 +39,7 @@ static void module_clk_recalc(struct clk *clk)
39 clk->rate = clk->parent->rate / md_table[idx]; 39 clk->rate = clk->parent->rate / md_table[idx];
40} 40}
41 41
42static struct clk_ops sh7300_module_clk_ops = { 42static struct clk_ops sh7710_module_clk_ops = {
43 .recalc = module_clk_recalc, 43 .recalc = module_clk_recalc,
44}; 44};
45 45
@@ -49,7 +49,7 @@ static void bus_clk_recalc(struct clk *clk)
49 clk->rate = clk->parent->rate / md_table[idx]; 49 clk->rate = clk->parent->rate / md_table[idx];
50} 50}
51 51
52static struct clk_ops sh7300_bus_clk_ops = { 52static struct clk_ops sh7710_bus_clk_ops = {
53 .recalc = bus_clk_recalc, 53 .recalc = bus_clk_recalc,
54}; 54};
55 55
@@ -59,20 +59,20 @@ static void cpu_clk_recalc(struct clk *clk)
59 clk->rate = clk->parent->rate / md_table[idx]; 59 clk->rate = clk->parent->rate / md_table[idx];
60} 60}
61 61
62static struct clk_ops sh7300_cpu_clk_ops = { 62static struct clk_ops sh7710_cpu_clk_ops = {
63 .recalc = cpu_clk_recalc, 63 .recalc = cpu_clk_recalc,
64}; 64};
65 65
66static struct clk_ops *sh7300_clk_ops[] = { 66static struct clk_ops *sh7710_clk_ops[] = {
67 &sh7300_master_clk_ops, 67 &sh7710_master_clk_ops,
68 &sh7300_module_clk_ops, 68 &sh7710_module_clk_ops,
69 &sh7300_bus_clk_ops, 69 &sh7710_bus_clk_ops,
70 &sh7300_cpu_clk_ops, 70 &sh7710_cpu_clk_ops,
71}; 71};
72 72
73void __init arch_init_clk_ops(struct clk_ops **ops, int idx) 73void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
74{ 74{
75 if (idx < ARRAY_SIZE(sh7300_clk_ops)) 75 if (idx < ARRAY_SIZE(sh7710_clk_ops))
76 *ops = sh7300_clk_ops[idx]; 76 *ops = sh7710_clk_ops[idx];
77} 77}
78 78
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7300.c b/arch/sh/kernel/cpu/sh3/setup-sh7300.c
deleted file mode 100644
index ab4d204bfba5..000000000000
--- a/arch/sh/kernel/cpu/sh3/setup-sh7300.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * SH7300 Setup
3 *
4 * Copyright (C) 2006 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <asm/sci.h>
14
15static struct plat_sci_port sci_platform_data[] = {
16 {
17 .mapbase = 0xa4430000,
18 .flags = UPF_BOOT_AUTOCONF,
19 .type = PORT_SCI,
20 .irqs = { 80, 80, 80, 80 },
21 }, {
22 .flags = 0,
23 }
24};
25
26static struct platform_device sci_device = {
27 .name = "sh-sci",
28 .id = -1,
29 .dev = {
30 .platform_data = sci_platform_data,
31 },
32};
33
34static struct platform_device *sh7300_devices[] __initdata = {
35 &sci_device,
36};
37
38static int __init sh7300_devices_setup(void)
39{
40 return platform_add_devices(sh7300_devices,
41 ARRAY_SIZE(sh7300_devices));
42}
43__initcall(sh7300_devices_setup);
diff --git a/arch/sh/kernel/cpu/sh4/probe.c b/arch/sh/kernel/cpu/sh4/probe.c
index 66c3f75647b2..98d28fb1ce16 100644
--- a/arch/sh/kernel/cpu/sh4/probe.c
+++ b/arch/sh/kernel/cpu/sh4/probe.c
@@ -90,12 +90,6 @@ int __init detect_cpu_and_cache_system(void)
90 current_cpu_data.type = CPU_SH7751; 90 current_cpu_data.type = CPU_SH7751;
91 current_cpu_data.flags |= CPU_HAS_FPU; 91 current_cpu_data.flags |= CPU_HAS_FPU;
92 break; 92 break;
93 case 0x2000:
94 current_cpu_data.type = CPU_SH73180;
95 current_cpu_data.icache.ways = 4;
96 current_cpu_data.dcache.ways = 4;
97 current_cpu_data.flags |= CPU_HAS_LLSC;
98 break;
99 case 0x2001: 93 case 0x2001:
100 case 0x2004: 94 case 0x2004:
101 current_cpu_data.type = CPU_SH7770; 95 current_cpu_data.type = CPU_SH7770;
diff --git a/arch/sh/kernel/cpu/sh4/sq.c b/arch/sh/kernel/cpu/sh4/sq.c
index b98d6c3e6f36..c21512c6044e 100644
--- a/arch/sh/kernel/cpu/sh4/sq.c
+++ b/arch/sh/kernel/cpu/sh4/sq.c
@@ -208,7 +208,6 @@ EXPORT_SYMBOL(sq_remap);
208void sq_unmap(unsigned long vaddr) 208void sq_unmap(unsigned long vaddr)
209{ 209{
210 struct sq_mapping **p, *map; 210 struct sq_mapping **p, *map;
211 struct vm_struct *vma;
212 int page; 211 int page;
213 212
214 for (p = &sq_mapping_list; (map = *p); p = &map->next) 213 for (p = &sq_mapping_list; (map = *p); p = &map->next)
@@ -225,11 +224,18 @@ void sq_unmap(unsigned long vaddr)
225 bitmap_release_region(sq_bitmap, page, get_order(map->size)); 224 bitmap_release_region(sq_bitmap, page, get_order(map->size));
226 225
227#ifdef CONFIG_MMU 226#ifdef CONFIG_MMU
228 vma = remove_vm_area((void *)(map->sq_addr & PAGE_MASK)); 227 {
229 if (!vma) { 228 /*
230 printk(KERN_ERR "%s: bad address 0x%08lx\n", 229 * Tear down the VMA in the MMU case.
231 __FUNCTION__, map->sq_addr); 230 */
232 return; 231 struct vm_struct *vma;
232
233 vma = remove_vm_area((void *)(map->sq_addr & PAGE_MASK));
234 if (!vma) {
235 printk(KERN_ERR "%s: bad address 0x%08lx\n",
236 __FUNCTION__, map->sq_addr);
237 return;
238 }
233 } 239 }
234#endif 240#endif
235 241
diff --git a/arch/sh/kernel/cpu/sh4a/Makefile b/arch/sh/kernel/cpu/sh4a/Makefile
index 400623286487..e6a1fb5f8484 100644
--- a/arch/sh/kernel/cpu/sh4a/Makefile
+++ b/arch/sh/kernel/cpu/sh4a/Makefile
@@ -6,13 +6,11 @@
6obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o 6obj-$(CONFIG_CPU_SUBTYPE_SH7770) += setup-sh7770.o
7obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o 7obj-$(CONFIG_CPU_SUBTYPE_SH7780) += setup-sh7780.o
8obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o 8obj-$(CONFIG_CPU_SUBTYPE_SH7785) += setup-sh7785.o
9obj-$(CONFIG_CPU_SUBTYPE_SH73180) += setup-sh73180.o
10obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o 9obj-$(CONFIG_CPU_SUBTYPE_SH7343) += setup-sh7343.o
11obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o 10obj-$(CONFIG_CPU_SUBTYPE_SH7722) += setup-sh7722.o
12obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o 11obj-$(CONFIG_CPU_SUBTYPE_SHX3) += setup-shx3.o
13 12
14# Primary on-chip clocks (common) 13# Primary on-chip clocks (common)
15clock-$(CONFIG_CPU_SUBTYPE_SH73180) := clock-sh73180.o
16clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o 14clock-$(CONFIG_CPU_SUBTYPE_SH7770) := clock-sh7770.o
17clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o 15clock-$(CONFIG_CPU_SUBTYPE_SH7780) := clock-sh7780.o
18clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o 16clock-$(CONFIG_CPU_SUBTYPE_SH7785) := clock-sh7785.o
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh73180.c b/arch/sh/kernel/cpu/sh4a/clock-sh73180.c
deleted file mode 100644
index 6d5ba373a75e..000000000000
--- a/arch/sh/kernel/cpu/sh4a/clock-sh73180.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * arch/sh/kernel/cpu/sh4a/clock-sh73180.c
3 *
4 * SH73180 support for the clock framework
5 *
6 * Copyright (C) 2005 Paul Mundt
7 *
8 * FRQCR parsing hacked out of arch/sh/kernel/time.c
9 *
10 * Copyright (C) 1999 Tetsuya Okada & Niibe Yutaka
11 * Copyright (C) 2000 Philipp Rumpf <prumpf@tux.org>
12 * Copyright (C) 2002, 2003, 2004 Paul Mundt
13 * Copyright (C) 2002 M. R. Brown <mrbrown@linux-sh.org>
14 *
15 * This file is subject to the terms and conditions of the GNU General Public
16 * License. See the file "COPYING" in the main directory of this archive
17 * for more details.
18 */
19#include <linux/init.h>
20#include <linux/kernel.h>
21#include <asm/clock.h>
22#include <asm/freq.h>
23#include <asm/io.h>
24
25/*
26 * SH73180 uses a common set of divisors, so this is quite simple..
27 */
28static int divisors[] = { 1, 2, 3, 4, 6, 8, 12, 16 };
29
30static void master_clk_init(struct clk *clk)
31{
32 clk->rate *= divisors[ctrl_inl(FRQCR) & 0x0007];
33}
34
35static struct clk_ops sh73180_master_clk_ops = {
36 .init = master_clk_init,
37};
38
39static void module_clk_recalc(struct clk *clk)
40{
41 int idx = (ctrl_inl(FRQCR) & 0x0007);
42 clk->rate = clk->parent->rate / divisors[idx];
43}
44
45static struct clk_ops sh73180_module_clk_ops = {
46 .recalc = module_clk_recalc,
47};
48
49static void bus_clk_recalc(struct clk *clk)
50{
51 int idx = (ctrl_inl(FRQCR) >> 12) & 0x0007;
52 clk->rate = clk->parent->rate / divisors[idx];
53}
54
55static struct clk_ops sh73180_bus_clk_ops = {
56 .recalc = bus_clk_recalc,
57};
58
59static void cpu_clk_recalc(struct clk *clk)
60{
61 int idx = (ctrl_inl(FRQCR) >> 20) & 0x0007;
62 clk->rate = clk->parent->rate / divisors[idx];
63}
64
65static struct clk_ops sh73180_cpu_clk_ops = {
66 .recalc = cpu_clk_recalc,
67};
68
69static struct clk_ops *sh73180_clk_ops[] = {
70 &sh73180_master_clk_ops,
71 &sh73180_module_clk_ops,
72 &sh73180_bus_clk_ops,
73 &sh73180_cpu_clk_ops,
74};
75
76void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
77{
78 if (idx < ARRAY_SIZE(sh73180_clk_ops))
79 *ops = sh73180_clk_ops[idx];
80}
81
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh73180.c b/arch/sh/kernel/cpu/sh4a/setup-sh73180.c
deleted file mode 100644
index cc9ea1e2e5df..000000000000
--- a/arch/sh/kernel/cpu/sh4a/setup-sh73180.c
+++ /dev/null
@@ -1,43 +0,0 @@
1/*
2 * SH73180 Setup
3 *
4 * Copyright (C) 2006 Paul Mundt
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10#include <linux/platform_device.h>
11#include <linux/init.h>
12#include <linux/serial.h>
13#include <asm/sci.h>
14
15static struct plat_sci_port sci_platform_data[] = {
16 {
17 .mapbase = 0xffe80000,
18 .flags = UPF_BOOT_AUTOCONF,
19 .type = PORT_SCIF,
20 .irqs = { 80, 81, 83, 82 },
21 }, {
22 .flags = 0,
23 }
24};
25
26static struct platform_device sci_device = {
27 .name = "sh-sci",
28 .id = -1,
29 .dev = {
30 .platform_data = sci_platform_data,
31 },
32};
33
34static struct platform_device *sh73180_devices[] __initdata = {
35 &sci_device,
36};
37
38static int __init sh73180_devices_setup(void)
39{
40 return platform_add_devices(sh73180_devices,
41 ARRAY_SIZE(sh73180_devices));
42}
43__initcall(sh73180_devices_setup);
diff --git a/arch/sh/kernel/init_task.c b/arch/sh/kernel/init_task.c
index 44053ea92936..4b449c4a6bad 100644
--- a/arch/sh/kernel/init_task.c
+++ b/arch/sh/kernel/init_task.c
@@ -3,7 +3,7 @@
3#include <linux/sched.h> 3#include <linux/sched.h>
4#include <linux/init_task.h> 4#include <linux/init_task.h>
5#include <linux/mqueue.h> 5#include <linux/mqueue.h>
6 6#include <linux/fs.h>
7#include <asm/uaccess.h> 7#include <asm/uaccess.h>
8#include <asm/pgtable.h> 8#include <asm/pgtable.h>
9 9
diff --git a/arch/sh/kernel/process.c b/arch/sh/kernel/process.c
index 6334a4c54c7c..15ae322dbd74 100644
--- a/arch/sh/kernel/process.c
+++ b/arch/sh/kernel/process.c
@@ -18,6 +18,7 @@
18#include <linux/kdebug.h> 18#include <linux/kdebug.h>
19#include <linux/tick.h> 19#include <linux/tick.h>
20#include <linux/reboot.h> 20#include <linux/reboot.h>
21#include <linux/fs.h>
21#include <asm/uaccess.h> 22#include <asm/uaccess.h>
22#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
23#include <asm/pgalloc.h> 24#include <asm/pgalloc.h>
@@ -474,7 +475,6 @@ out:
474 475
475unsigned long get_wchan(struct task_struct *p) 476unsigned long get_wchan(struct task_struct *p)
476{ 477{
477 unsigned long schedule_frame;
478 unsigned long pc; 478 unsigned long pc;
479 479
480 if (!p || p == current || p->state == TASK_RUNNING) 480 if (!p || p == current || p->state == TASK_RUNNING)
@@ -484,10 +484,13 @@ unsigned long get_wchan(struct task_struct *p)
484 * The same comment as on the Alpha applies here, too ... 484 * The same comment as on the Alpha applies here, too ...
485 */ 485 */
486 pc = thread_saved_pc(p); 486 pc = thread_saved_pc(p);
487
488#ifdef CONFIG_FRAME_POINTER
487 if (in_sched_functions(pc)) { 489 if (in_sched_functions(pc)) {
488 schedule_frame = (unsigned long)p->thread.sp; 490 unsigned long schedule_frame = (unsigned long)p->thread.sp;
489 return ((unsigned long *)schedule_frame)[21]; 491 return ((unsigned long *)schedule_frame)[21];
490 } 492 }
493#endif
491 494
492 return pc; 495 return pc;
493} 496}
diff --git a/arch/sh/kernel/setup.c b/arch/sh/kernel/setup.c
index c14a3e95d0b1..2cf7dec0d690 100644
--- a/arch/sh/kernel/setup.c
+++ b/arch/sh/kernel/setup.c
@@ -276,7 +276,6 @@ void __init setup_arch(char **cmdline_p)
276 276
277static const char *cpu_name[] = { 277static const char *cpu_name[] = {
278 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619", 278 [CPU_SH7206] = "SH7206", [CPU_SH7619] = "SH7619",
279 [CPU_SH7300] = "SH7300",
280 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706", 279 [CPU_SH7705] = "SH7705", [CPU_SH7706] = "SH7706",
281 [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708", 280 [CPU_SH7707] = "SH7707", [CPU_SH7708] = "SH7708",
282 [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710", 281 [CPU_SH7709] = "SH7709", [CPU_SH7710] = "SH7710",
@@ -284,7 +283,7 @@ static const char *cpu_name[] = {
284 [CPU_SH7729] = "SH7729", [CPU_SH7750] = "SH7750", 283 [CPU_SH7729] = "SH7729", [CPU_SH7750] = "SH7750",
285 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R", 284 [CPU_SH7750S] = "SH7750S", [CPU_SH7750R] = "SH7750R",
286 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R", 285 [CPU_SH7751] = "SH7751", [CPU_SH7751R] = "SH7751R",
287 [CPU_SH7760] = "SH7760", [CPU_SH73180] = "SH73180", 286 [CPU_SH7760] = "SH7760",
288 [CPU_ST40RA] = "ST40RA", [CPU_ST40GX1] = "ST40GX1", 287 [CPU_ST40RA] = "ST40RA", [CPU_ST40GX1] = "ST40GX1",
289 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501", 288 [CPU_SH4_202] = "SH4-202", [CPU_SH4_501] = "SH4-501",
290 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780", 289 [CPU_SH7770] = "SH7770", [CPU_SH7780] = "SH7780",
diff --git a/arch/sh/kernel/sys_sh.c b/arch/sh/kernel/sys_sh.c
index 76b1bc7f7029..024ce5dedd8c 100644
--- a/arch/sh/kernel/sys_sh.c
+++ b/arch/sh/kernel/sys_sh.c
@@ -21,6 +21,7 @@
21#include <linux/file.h> 21#include <linux/file.h>
22#include <linux/utsname.h> 22#include <linux/utsname.h>
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/fs.h>
24#include <asm/cacheflush.h> 25#include <asm/cacheflush.h>
25#include <asm/uaccess.h> 26#include <asm/uaccess.h>
26#include <asm/ipc.h> 27#include <asm/ipc.h>
diff --git a/arch/sh/kernel/timers/timer-tmu.c b/arch/sh/kernel/timers/timer-tmu.c
index 7aca37d79766..8a545d54e2d3 100644
--- a/arch/sh/kernel/timers/timer-tmu.c
+++ b/arch/sh/kernel/timers/timer-tmu.c
@@ -173,8 +173,7 @@ static int tmu_timer_init(void)
173 173
174 tmu_timer_stop(); 174 tmu_timer_stop();
175 175
176#if !defined(CONFIG_CPU_SUBTYPE_SH7300) && \ 176#if !defined(CONFIG_CPU_SUBTYPE_SH7760) && \
177 !defined(CONFIG_CPU_SUBTYPE_SH7760) && \
178 !defined(CONFIG_CPU_SUBTYPE_SH7785) && \ 177 !defined(CONFIG_CPU_SUBTYPE_SH7785) && \
179 !defined(CONFIG_CPU_SUBTYPE_SHX3) 178 !defined(CONFIG_CPU_SUBTYPE_SHX3)
180 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR); 179 ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
diff --git a/arch/sh/kernel/vsyscall/vsyscall.c b/arch/sh/kernel/vsyscall/vsyscall.c
index 2aa9438361bc..95f4de0800ec 100644
--- a/arch/sh/kernel/vsyscall/vsyscall.c
+++ b/arch/sh/kernel/vsyscall/vsyscall.c
@@ -18,6 +18,7 @@
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/elf.h> 19#include <linux/elf.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/err.h>
21 22
22/* 23/*
23 * Should the kernel map a VDSO page into processes and pass its 24 * Should the kernel map a VDSO page into processes and pass its
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 70da1c8d407e..43f3972a5fb9 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -27,6 +27,7 @@ config CPU_SH4A
27config CPU_SH4AL_DSP 27config CPU_SH4AL_DSP
28 bool 28 bool
29 select CPU_SH4A 29 select CPU_SH4A
30 select CPU_HAS_DSP
30 31
31config CPU_SUBTYPE_ST40 32config CPU_SUBTYPE_ST40
32 bool 33 bool
@@ -62,15 +63,10 @@ config CPU_SUBTYPE_SH7206
62 63
63# SH-3 Processor Support 64# SH-3 Processor Support
64 65
65config CPU_SUBTYPE_SH7300
66 bool "Support SH7300 processor"
67 select CPU_SH3
68
69config CPU_SUBTYPE_SH7705 66config CPU_SUBTYPE_SH7705
70 bool "Support SH7705 processor" 67 bool "Support SH7705 processor"
71 select CPU_SH3 68 select CPU_SH3
72 select CPU_HAS_IPR_IRQ 69 select CPU_HAS_IPR_IRQ
73 select CPU_HAS_PINT_IRQ
74 70
75config CPU_SUBTYPE_SH7706 71config CPU_SUBTYPE_SH7706
76 bool "Support SH7706 processor" 72 bool "Support SH7706 processor"
@@ -82,7 +78,6 @@ config CPU_SUBTYPE_SH7706
82config CPU_SUBTYPE_SH7707 78config CPU_SUBTYPE_SH7707
83 bool "Support SH7707 processor" 79 bool "Support SH7707 processor"
84 select CPU_SH3 80 select CPU_SH3
85 select CPU_HAS_PINT_IRQ
86 help 81 help
87 Select SH7707 if you have a 60 Mhz SH-3 HD6417707 CPU. 82 Select SH7707 if you have a 60 Mhz SH-3 HD6417707 CPU.
88 83
@@ -97,7 +92,6 @@ config CPU_SUBTYPE_SH7709
97 bool "Support SH7709 processor" 92 bool "Support SH7709 processor"
98 select CPU_SH3 93 select CPU_SH3
99 select CPU_HAS_IPR_IRQ 94 select CPU_HAS_IPR_IRQ
100 select CPU_HAS_PINT_IRQ
101 help 95 help
102 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU. 96 Select SH7709 if you have a 80 Mhz SH-3 HD6417709 CPU.
103 97
@@ -105,6 +99,7 @@ config CPU_SUBTYPE_SH7710
105 bool "Support SH7710 processor" 99 bool "Support SH7710 processor"
106 select CPU_SH3 100 select CPU_SH3
107 select CPU_HAS_IPR_IRQ 101 select CPU_HAS_IPR_IRQ
102 select CPU_HAS_DSP
108 help 103 help
109 Select SH7710 if you have a SH3-DSP SH7710 CPU. 104 Select SH7710 if you have a SH3-DSP SH7710 CPU.
110 105
@@ -112,6 +107,7 @@ config CPU_SUBTYPE_SH7712
112 bool "Support SH7712 processor" 107 bool "Support SH7712 processor"
113 select CPU_SH3 108 select CPU_SH3
114 select CPU_HAS_IPR_IRQ 109 select CPU_HAS_IPR_IRQ
110 select CPU_HAS_DSP
115 help 111 help
116 Select SH7712 if you have a SH3-DSP SH7712 CPU. 112 Select SH7712 if you have a SH3-DSP SH7712 CPU.
117 113
@@ -205,10 +201,6 @@ config CPU_SUBTYPE_SHX3
205 201
206# SH4AL-DSP Processor Support 202# SH4AL-DSP Processor Support
207 203
208config CPU_SUBTYPE_SH73180
209 bool "Support SH73180 processor"
210 select CPU_SH4AL_DSP
211
212config CPU_SUBTYPE_SH7343 204config CPU_SUBTYPE_SH7343
213 bool "Support SH7343 processor" 205 bool "Support SH7343 processor"
214 select CPU_SH4AL_DSP 206 select CPU_SH4AL_DSP
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 981b04089055..86486326ef1d 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -77,16 +77,8 @@ static void __init emit_cache_params(void)
77/* 77/*
78 * SH-4 has virtually indexed and physically tagged cache. 78 * SH-4 has virtually indexed and physically tagged cache.
79 */ 79 */
80
81/* Worst case assumed to be 64k cache, direct-mapped i.e. 4 synonym bits. */
82#define MAX_P3_MUTEXES 16
83
84struct mutex p3map_mutex[MAX_P3_MUTEXES];
85
86void __init p3_cache_init(void) 80void __init p3_cache_init(void)
87{ 81{
88 int i;
89
90 compute_alias(&current_cpu_data.icache); 82 compute_alias(&current_cpu_data.icache);
91 compute_alias(&current_cpu_data.dcache); 83 compute_alias(&current_cpu_data.dcache);
92 84
@@ -106,12 +98,6 @@ void __init p3_cache_init(void)
106 } 98 }
107 99
108 emit_cache_params(); 100 emit_cache_params();
109
110 if (ioremap_page_range(P3SEG, P3SEG + (PAGE_SIZE * 4), 0, PAGE_KERNEL))
111 panic("%s failed.", __FUNCTION__);
112
113 for (i = 0; i < current_cpu_data.dcache.n_aliases; i++)
114 mutex_init(&p3map_mutex[i]);
115} 101}
116 102
117/* 103/*
diff --git a/arch/sh/mm/pg-sh4.c b/arch/sh/mm/pg-sh4.c
index df69da9ca69c..25f5c6f6821d 100644
--- a/arch/sh/mm/pg-sh4.c
+++ b/arch/sh/mm/pg-sh4.c
@@ -2,19 +2,45 @@
2 * arch/sh/mm/pg-sh4.c 2 * arch/sh/mm/pg-sh4.c
3 * 3 *
4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka 4 * Copyright (C) 1999, 2000, 2002 Niibe Yutaka
5 * Copyright (C) 2002 - 2005 Paul Mundt 5 * Copyright (C) 2002 - 2007 Paul Mundt
6 * 6 *
7 * Released under the terms of the GNU GPL v2.0. 7 * Released under the terms of the GNU GPL v2.0.
8 */ 8 */
9#include <linux/mm.h> 9#include <linux/mm.h>
10#include <linux/mutex.h> 10#include <linux/mutex.h>
11#include <linux/fs.h>
11#include <asm/mmu_context.h> 12#include <asm/mmu_context.h>
12#include <asm/cacheflush.h> 13#include <asm/cacheflush.h>
13 14
14extern struct mutex p3map_mutex[];
15
16#define CACHE_ALIAS (current_cpu_data.dcache.alias_mask) 15#define CACHE_ALIAS (current_cpu_data.dcache.alias_mask)
17 16
17static inline void *kmap_coherent(struct page *page, unsigned long addr)
18{
19 enum fixed_addresses idx;
20 unsigned long vaddr, flags;
21 pte_t pte;
22
23 inc_preempt_count();
24
25 idx = (addr & current_cpu_data.dcache.alias_mask) >> PAGE_SHIFT;
26 vaddr = __fix_to_virt(FIX_CMAP_END - idx);
27 pte = mk_pte(page, PAGE_KERNEL);
28
29 local_irq_save(flags);
30 flush_tlb_one(get_asid(), vaddr);
31 local_irq_restore(flags);
32
33 update_mmu_cache(NULL, vaddr, pte);
34
35 return (void *)vaddr;
36}
37
38static inline void kunmap_coherent(struct page *page)
39{
40 dec_preempt_count();
41 preempt_check_resched();
42}
43
18/* 44/*
19 * clear_user_page 45 * clear_user_page
20 * @to: P1 address 46 * @to: P1 address
@@ -27,25 +53,9 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
27 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 53 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
28 clear_page(to); 54 clear_page(to);
29 else { 55 else {
30 unsigned long phys_addr = PHYSADDR(to); 56 void *vto = kmap_coherent(page, address);
31 unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS); 57 __clear_user_page(vto, to);
32 pgd_t *pgd = pgd_offset_k(p3_addr); 58 kunmap_coherent(vto);
33 pud_t *pud = pud_offset(pgd, p3_addr);
34 pmd_t *pmd = pmd_offset(pud, p3_addr);
35 pte_t *pte = pte_offset_kernel(pmd, p3_addr);
36 pte_t entry;
37 unsigned long flags;
38
39 entry = pfn_pte(phys_addr >> PAGE_SHIFT, PAGE_KERNEL);
40 mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
41 set_pte(pte, entry);
42 local_irq_save(flags);
43 flush_tlb_one(get_asid(), p3_addr);
44 local_irq_restore(flags);
45 update_mmu_cache(NULL, p3_addr, entry);
46 __clear_user_page((void *)p3_addr, to);
47 pte_clear(&init_mm, p3_addr, pte);
48 mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
49 } 59 }
50} 60}
51 61
@@ -63,25 +73,9 @@ void copy_user_page(void *to, void *from, unsigned long address,
63 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0) 73 if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
64 copy_page(to, from); 74 copy_page(to, from);
65 else { 75 else {
66 unsigned long phys_addr = PHYSADDR(to); 76 void *vfrom = kmap_coherent(page, address);
67 unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS); 77 __copy_user_page(vfrom, from, to);
68 pgd_t *pgd = pgd_offset_k(p3_addr); 78 kunmap_coherent(vfrom);
69 pud_t *pud = pud_offset(pgd, p3_addr);
70 pmd_t *pmd = pmd_offset(pud, p3_addr);
71 pte_t *pte = pte_offset_kernel(pmd, p3_addr);
72 pte_t entry;
73 unsigned long flags;
74
75 entry = pfn_pte(phys_addr >> PAGE_SHIFT, PAGE_KERNEL);
76 mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
77 set_pte(pte, entry);
78 local_irq_save(flags);
79 flush_tlb_one(get_asid(), p3_addr);
80 local_irq_restore(flags);
81 update_mmu_cache(NULL, p3_addr, entry);
82 __copy_user_page((void *)p3_addr, from, to);
83 pte_clear(&init_mm, p3_addr, pte);
84 mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
85 } 79 }
86} 80}
87 81
diff --git a/arch/sh/tools/mach-types b/arch/sh/tools/mach-types
index 4b5e9305092e..439bfe3d29af 100644
--- a/arch/sh/tools/mach-types
+++ b/arch/sh/tools/mach-types
@@ -8,12 +8,10 @@
8SE SH_SOLUTION_ENGINE 8SE SH_SOLUTION_ENGINE
97751SE SH_7751_SOLUTION_ENGINE 97751SE SH_7751_SOLUTION_ENGINE
107722SE SH_7722_SOLUTION_ENGINE 107722SE SH_7722_SOLUTION_ENGINE
117300SE SH_7300_SOLUTION_ENGINE
127343SE SH_7343_SOLUTION_ENGINE 117343SE SH_7343_SOLUTION_ENGINE
137206SE SH_7206_SOLUTION_ENGINE 127206SE SH_7206_SOLUTION_ENGINE
147619SE SH_7619_SOLUTION_ENGINE 137619SE SH_7619_SOLUTION_ENGINE
157780SE SH_7780_SOLUTION_ENGINE 147780SE SH_7780_SOLUTION_ENGINE
1673180SE SH_73180_SOLUTION_ENGINE
177751SYSTEMH SH_7751_SYSTEMH 157751SYSTEMH SH_7751_SYSTEMH
18HP6XX SH_HP6XX 16HP6XX SH_HP6XX
19HD64461 HD64461 17HD64461 HD64461
diff --git a/arch/sh64/Kconfig b/arch/sh64/Kconfig
index ff654204b7d4..5664631d8ae5 100644
--- a/arch/sh64/Kconfig
+++ b/arch/sh64/Kconfig
@@ -47,6 +47,9 @@ config ARCH_HAS_ILOG2_U64
47 bool 47 bool
48 default n 48 default n
49 49
50config ARCH_NO_VIRT_TO_BUS
51 def_bool y
52
50source init/Kconfig 53source init/Kconfig
51 54
52menu "System type" 55menu "System type"
diff --git a/arch/sh64/kernel/init_task.c b/arch/sh64/kernel/init_task.c
index de2d07db1f88..deee8bfd3270 100644
--- a/arch/sh64/kernel/init_task.c
+++ b/arch/sh64/kernel/init_task.c
@@ -14,7 +14,7 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/init_task.h> 15#include <linux/init_task.h>
16#include <linux/mqueue.h> 16#include <linux/mqueue.h>
17 17#include <linux/fs.h>
18#include <asm/uaccess.h> 18#include <asm/uaccess.h>
19#include <asm/pgtable.h> 19#include <asm/pgtable.h>
20 20
diff --git a/arch/sh64/kernel/irq_intc.c b/arch/sh64/kernel/irq_intc.c
index 42c07d2e71d9..3b63a93198f2 100644
--- a/arch/sh64/kernel/irq_intc.c
+++ b/arch/sh64/kernel/irq_intc.c
@@ -16,6 +16,7 @@
16 */ 16 */
17 17
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/interrupt.h>
19#include <linux/irq.h> 20#include <linux/irq.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/stddef.h> 22#include <linux/stddef.h>
diff --git a/arch/sh64/kernel/pci-dma.c b/arch/sh64/kernel/pci-dma.c
index a36c3d71a3fe..a9328f894755 100644
--- a/arch/sh64/kernel/pci-dma.c
+++ b/arch/sh64/kernel/pci-dma.c
@@ -30,7 +30,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
30 30
31 if (vp != NULL) { 31 if (vp != NULL) {
32 memset(vp, 0, size); 32 memset(vp, 0, size);
33 *dma_handle = virt_to_bus(ret); 33 *dma_handle = virt_to_phys(ret);
34 dma_cache_wback_inv((unsigned long)ret, size); 34 dma_cache_wback_inv((unsigned long)ret, size);
35 } 35 }
36 36
@@ -42,7 +42,7 @@ void consistent_free(struct pci_dev *hwdev, size_t size,
42{ 42{
43 void *alloc; 43 void *alloc;
44 44
45 alloc = bus_to_virt((unsigned long)dma_handle); 45 alloc = phys_to_virt((unsigned long)dma_handle);
46 free_pages((unsigned long)alloc, get_order(size)); 46 free_pages((unsigned long)alloc, get_order(size));
47 47
48 iounmap(vaddr); 48 iounmap(vaddr);
diff --git a/arch/sh64/kernel/process.c b/arch/sh64/kernel/process.c
index 1b89c9dfb93d..ceb9458abda4 100644
--- a/arch/sh64/kernel/process.c
+++ b/arch/sh64/kernel/process.c
@@ -21,6 +21,7 @@
21 * This file handles the architecture-dependent parts of process handling.. 21 * This file handles the architecture-dependent parts of process handling..
22 */ 22 */
23#include <linux/mm.h> 23#include <linux/mm.h>
24#include <linux/fs.h>
24#include <linux/ptrace.h> 25#include <linux/ptrace.h>
25#include <linux/reboot.h> 26#include <linux/reboot.h>
26#include <linux/init.h> 27#include <linux/init.h>
diff --git a/arch/sh64/kernel/sys_sh64.c b/arch/sh64/kernel/sys_sh64.c
index 19126daf9f4c..b7f18e298a20 100644
--- a/arch/sh64/kernel/sys_sh64.c
+++ b/arch/sh64/kernel/sys_sh64.c
@@ -19,6 +19,7 @@
19#include <linux/rwsem.h> 19#include <linux/rwsem.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/fs.h>
22#include <linux/smp.h> 23#include <linux/smp.h>
23#include <linux/sem.h> 24#include <linux/sem.h>
24#include <linux/msg.h> 25#include <linux/msg.h>
diff --git a/arch/sh64/lib/dbg.c b/arch/sh64/lib/dbg.c
index 4310fc87444e..97816e0baf19 100644
--- a/arch/sh64/lib/dbg.c
+++ b/arch/sh64/lib/dbg.c
@@ -12,6 +12,7 @@
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/sched.h> 13#include <linux/sched.h>
14#include <linux/mm.h> 14#include <linux/mm.h>
15#include <linux/fs.h>
15#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
16 17
17typedef u64 regType_t; 18typedef u64 regType_t;
diff --git a/arch/sparc/mm/sun4c.c b/arch/sparc/mm/sun4c.c
index a57a366e339a..79d60d86f6f8 100644
--- a/arch/sparc/mm/sun4c.c
+++ b/arch/sparc/mm/sun4c.c
@@ -1999,6 +1999,9 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
1999 unsigned long flags; 1999 unsigned long flags;
2000 int pseg; 2000 int pseg;
2001 2001
2002 if (vma->vm_mm->context == NO_CONTEXT)
2003 return;
2004
2002 local_irq_save(flags); 2005 local_irq_save(flags);
2003 address &= PAGE_MASK; 2006 address &= PAGE_MASK;
2004 if ((pseg = sun4c_get_segmap(address)) == invalid_segment) { 2007 if ((pseg = sun4c_get_segmap(address)) == invalid_segment) {
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 368d3e97dfd9..629b00e3b0b0 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -157,7 +157,7 @@ static void tty_receive_char(struct tty_struct *tty, char ch)
157 157
158static int open_one_chan(struct chan *chan) 158static int open_one_chan(struct chan *chan)
159{ 159{
160 int fd; 160 int fd, err;
161 161
162 if(chan->opened) 162 if(chan->opened)
163 return 0; 163 return 0;
@@ -168,6 +168,13 @@ static int open_one_chan(struct chan *chan)
168 chan->data, &chan->dev); 168 chan->data, &chan->dev);
169 if(fd < 0) 169 if(fd < 0)
170 return fd; 170 return fd;
171
172 err = os_set_fd_block(fd, 0);
173 if (err) {
174 (*chan->ops->close)(fd, chan->data);
175 return err;
176 }
177
171 chan->fd = fd; 178 chan->fd = fd;
172 179
173 chan->opened = 1; 180 chan->opened = 1;
diff --git a/arch/x86_64/kernel/Makefile b/arch/x86_64/kernel/Makefile
index d1d18c1ea0f4..ff5d8c9b96d9 100644
--- a/arch/x86_64/kernel/Makefile
+++ b/arch/x86_64/kernel/Makefile
@@ -32,7 +32,6 @@ obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
32obj-$(CONFIG_IOMMU) += pci-gart.o aperture.o 32obj-$(CONFIG_IOMMU) += pci-gart.o aperture.o
33obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary.o tce.o 33obj-$(CONFIG_CALGARY_IOMMU) += pci-calgary.o tce.o
34obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o 34obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
35obj-$(CONFIG_SERIAL_8250) += legacy_serial.o
36obj-$(CONFIG_KPROBES) += kprobes.o 35obj-$(CONFIG_KPROBES) += kprobes.o
37obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o 36obj-$(CONFIG_X86_PM_TIMER) += pmtimer.o
38obj-$(CONFIG_X86_VSMP) += vsmp.o 37obj-$(CONFIG_X86_VSMP) += vsmp.o
@@ -51,7 +50,6 @@ CFLAGS_vsyscall.o := $(PROFILING) -g0
51 50
52therm_throt-y += ../../i386/kernel/cpu/mcheck/therm_throt.o 51therm_throt-y += ../../i386/kernel/cpu/mcheck/therm_throt.o
53bootflag-y += ../../i386/kernel/bootflag.o 52bootflag-y += ../../i386/kernel/bootflag.o
54legacy_serial-y += ../../i386/kernel/legacy_serial.o
55cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o 53cpuid-$(subst m,y,$(CONFIG_X86_CPUID)) += ../../i386/kernel/cpuid.o
56topology-y += ../../i386/kernel/topology.o 54topology-y += ../../i386/kernel/topology.o
57microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o 55microcode-$(subst m,y,$(CONFIG_MICROCODE)) += ../../i386/kernel/microcode.o
diff --git a/arch/x86_64/kernel/bugs.c b/arch/x86_64/kernel/bugs.c
index c3c6b91566ed..4e5e9d364d63 100644
--- a/arch/x86_64/kernel/bugs.c
+++ b/arch/x86_64/kernel/bugs.c
@@ -8,6 +8,7 @@
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <asm/alternative.h> 10#include <asm/alternative.h>
11#include <asm/bugs.h>
11#include <asm/processor.h> 12#include <asm/processor.h>
12#include <asm/mtrr.h> 13#include <asm/mtrr.h>
13 14
diff --git a/arch/x86_64/kernel/entry.S b/arch/x86_64/kernel/entry.S
index 830cfc6ee8cb..1d232e5f5658 100644
--- a/arch/x86_64/kernel/entry.S
+++ b/arch/x86_64/kernel/entry.S
@@ -282,7 +282,7 @@ sysret_careful:
282sysret_signal: 282sysret_signal:
283 TRACE_IRQS_ON 283 TRACE_IRQS_ON
284 sti 284 sti
285 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx 285 testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
286 jz 1f 286 jz 1f
287 287
288 /* Really a signal */ 288 /* Really a signal */
@@ -375,7 +375,7 @@ int_very_careful:
375 jmp int_restore_rest 375 jmp int_restore_rest
376 376
377int_signal: 377int_signal:
378 testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx 378 testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
379 jz 1f 379 jz 1f
380 movq %rsp,%rdi # &ptregs -> arg1 380 movq %rsp,%rdi # &ptregs -> arg1
381 xorl %esi,%esi # oldset -> arg2 381 xorl %esi,%esi # oldset -> arg2
@@ -599,7 +599,7 @@ retint_careful:
599 jmp retint_check 599 jmp retint_check
600 600
601retint_signal: 601retint_signal:
602 testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx 602 testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
603 jz retint_swapgs 603 jz retint_swapgs
604 TRACE_IRQS_ON 604 TRACE_IRQS_ON
605 sti 605 sti
diff --git a/arch/x86_64/kernel/tce.c b/arch/x86_64/kernel/tce.c
index 821527e7faa3..e3f2569b2c44 100644
--- a/arch/x86_64/kernel/tce.c
+++ b/arch/x86_64/kernel/tce.c
@@ -131,7 +131,7 @@ done:
131 return ret; 131 return ret;
132} 132}
133 133
134int build_tce_table(struct pci_dev *dev, void __iomem *bbar) 134int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar)
135{ 135{
136 struct iommu_table *tbl; 136 struct iommu_table *tbl;
137 int ret; 137 int ret;